Skip to content

Finish migrating off Document to ArkFile#1267

Merged
lionel- merged 6 commits into
mainfrom
oak/salsa-26-remove-document
Jun 19, 2026
Merged

Finish migrating off Document to ArkFile#1267
lionel- merged 6 commits into
mainfrom
oak/salsa-26-remove-document

Conversation

@lionel-

@lionel- lionel- commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Branched from #1266
Progress towards #1212

With this PR everything now goes through Oak's DB.

  • Remove Ark's Document structure, along with its copy of the tree-sitter tree, source code, and line index. These are now all accessed via Oak queries on File.

  • WorldState's documents field becomes open_files: HashMap<FilePath, ArkFile>. (Maybe we should rename to ArkOpenFile?)

@DavisVaughan DavisVaughan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

woooooooo

Comment thread crates/ark/src/lsp/tests/diagnostics.rs Outdated
Comment on lines +39 to +43
// TODO: this is a stopgap that goes away with `ArkFile`. Once handlers are
// pure Oak, they return `File`-keyed results (diagnostics, the edit targets
// in a `WorkspaceEdit`) and the wire URL gets attached at the transport
// boundary from a map of open editor URLs owned by the LSP layer. In that
// design the verbatim URL never travels through the analysis layer.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment thread crates/ark/src/lsp/main_loop.rs Outdated
pub(crate) fn get_document_mut(&mut self, path: &FilePath) -> anyhow::Result<&mut Document> {
if let Some(doc) = self.documents.get_mut(path) {
Ok(doc)
pub(crate) fn ark_file_mut(&mut self, uri: &Url) -> anyhow::Result<&mut ArkFile> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we only still need this for updating DocumentConfig. I wonder what that will end up being a part of

Comment thread crates/ark/src/lsp/state.rs
Comment thread crates/ark/src/lsp/state.rs Outdated
Comment on lines +142 to +144
pub(crate) fn workspace_uris(state: &WorldState) -> Vec<Url> {
state
.documents
.open_files

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub(crate) fn workspace_uris(state: &WorldState) -> Vec<Url> {
state
.documents
.open_files
pub(crate) fn open_file_uris(state: &WorldState) -> Vec<Url> {
state
.open_files

?

Seems nicer

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I imagine this helper may go away eventually too. I guess it depends on how we end up handling config in update_config(), which is currently the only consumer of this

Comment thread crates/ark/src/lsp/state_handlers.rs Outdated
// origin = "https://github.com/rust-lang/rust-analyzer/blob/master/crates/rust-analyzer/src/lsp/utils.rs"
// ---
/// Apply a batch of LSP content changes to `contents`, returning the new text.
fn apply_content_changes(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feeeel like maybe this and its newly added tests at the bottom should just go in its own standalone file. Maybe content.rs or changes.rs or something?

@lionel- lionel- force-pushed the oak/salsa-25-rewire-indexer branch from 0ec831d to 4cb3904 Compare June 16, 2026 16:42
@lionel- lionel- force-pushed the oak/salsa-26-remove-document branch from 0b199bf to 0d8ba4e Compare June 16, 2026 17:18
@lionel- lionel- force-pushed the oak/salsa-25-rewire-indexer branch from 8a00f75 to 26f55c8 Compare June 19, 2026 14:01
Base automatically changed from oak/salsa-25-rewire-indexer to main June 19, 2026 14:02
@lionel- lionel- force-pushed the oak/salsa-26-remove-document branch from bdb651b to bcaec36 Compare June 19, 2026 14:02
@lionel- lionel- merged commit 59d0f7d into main Jun 19, 2026
17 checks passed
@lionel- lionel- deleted the oak/salsa-26-remove-document branch June 19, 2026 14:03
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 19, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants