Skip to content

Commit 01dff16

Browse files
committed
Address review feedback
1 parent 7cb03ca commit 01dff16

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

crates/ruff_server/src/server/api/requests/execute_command.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -160,14 +160,14 @@ version = {version}
160160
position_encoding = {encoding:?}
161161
workspace_root_folders = {workspace_folders:#?}
162162
indexed_configuration_files = {config_files:#?}
163-
open_documents = {open_documents}
163+
open_documents_len = {open_documents_len}
164164
client_capabilities = {client_capabilities:#?}
165165
",
166166
version = crate::version(),
167167
encoding = session.encoding(),
168168
workspace_folders = session.workspace_root_folders().collect::<Vec<_>>(),
169169
config_files = session.config_file_paths().collect::<Vec<_>>(),
170-
open_documents = session.open_documents(),
170+
open_documents_len = session.open_documents_len(),
171171
client_capabilities = session.resolved_client_capabilities(),
172172
)?;
173173

@@ -176,10 +176,11 @@ client_capabilities = {client_capabilities:#?}
176176
writeln!(buffer, "Unable to take a snapshot of the document at {uri}")?;
177177
return Ok(buffer);
178178
};
179+
let query = snapshot.query();
179180

180181
writeln!(
181182
buffer,
182-
"Document:
183+
"Open document:
183184
uri = {uri}
184185
kind = {kind}
185186
version = {version}
@@ -193,10 +194,10 @@ config_path = {config_path:?}
193194
DocumentKey::NotebookCell(_) => "NotebookCell",
194195
DocumentKey::Text(_) => "Text",
195196
},
196-
version = snapshot.query().version(),
197+
version = query.version(),
197198
client_settings = snapshot.client_settings(),
198-
config_path = snapshot.query().settings().path(),
199-
settings = snapshot.query().settings(),
199+
config_path = query.settings().path(),
200+
settings = query.settings(),
200201
)?;
201202
} else {
202203
writeln!(

crates/ruff_server/src/session.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ impl Session {
168168
}
169169

170170
/// Returns the number of open documents in the session.
171-
pub(crate) fn open_documents(&self) -> usize {
172-
self.index.open_documents()
171+
pub(crate) fn open_documents_len(&self) -> usize {
172+
self.index.open_documents_len()
173173
}
174174

175175
/// Returns an iterator over the workspace root folders in the session.

crates/ruff_server/src/session/index.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ impl Index {
396396
}
397397

398398
/// Returns the number of open documents.
399-
pub(super) fn open_documents(&self) -> usize {
399+
pub(super) fn open_documents_len(&self) -> usize {
400400
self.documents.len()
401401
}
402402

0 commit comments

Comments
 (0)