Skip to content

Commit 0b199bf

Browse files
committed
Tweak comments
1 parent ba9d316 commit 0b199bf

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

crates/ark/src/lsp/ark_file.rs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,7 @@ use crate::lsp::db::FileExt;
1818

1919
/// Editor-managed buffer state, paired with its `oak_db::File`.
2020
///
21-
/// This is the value stored in `WorldState::documents`. The protocol fields
22-
/// (`version`, `config`, `url`) are plain data. Everything derived from the
23-
/// buffer text (the tree-sitter tree, the line index, the contents) is reached
24-
/// through salsa queries on `file`, so it's computed once and never stored
25-
/// twice.
21+
/// This is a temporary structure during the transition to pure Oak handlers.
2622
///
2723
/// The methods take `db` as a parameter rather than holding it. `ArkFile` lives
2824
/// in `WorldState`, and the db is a sibling field there, so a stored borrow of
@@ -33,6 +29,18 @@ pub(crate) struct ArkFile {
3329
pub(crate) file: File,
3430
pub(crate) version: Option<i32>,
3531
pub(crate) config: DocumentConfig,
32+
// The editor's verbatim URL. We store it rather than recompute it from
33+
// `file`'s path so the bytes the frontend sent round-trip exactly. It lives
34+
// on `ArkFile` so it travels with owned values for callers that can't
35+
// easily access `WorldState::open_files`: the diagnostics task on a worker
36+
// thread (`RefreshDiagnosticsTask`) and `code_action/roxygen.rs`, which
37+
// builds a `WorkspaceEdit` keyed by URL.
38+
//
39+
// TODO: this is a stopgap that goes away with `ArkFile`. Once handlers are
40+
// pure Oak, they return `File`-keyed results (diagnostics, the edit targets
41+
// in a `WorkspaceEdit`) and the wire URL gets attached at the transport
42+
// boundary from a map of open editor URLs owned by the LSP layer. In that
43+
// design the verbatim URL never travels through the analysis layer.
3644
pub(crate) url: Url,
3745
pub(crate) encoding: PositionEncoding,
3846
}

0 commit comments

Comments
 (0)