mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-30 22:01:47 +00:00
Include document specific debug info (#16215)
## Summary Related https://github.com/astral-sh/ruff-vscode/pull/692. ## Test Plan **When there's no active text document:** ``` [Info - 10:57:03 PM] Global: executable = /Users/dhruv/work/astral/ruff/target/debug/ruff version = 0.9.6 position_encoding = UTF16 workspace_root_folders = [ "/Users/dhruv/playground/ruff", ] indexed_configuration_files = [ "/Users/dhruv/playground/ruff/pyproject.toml", "/Users/dhruv/playground/ruff/formatter/ruff.toml", ] open_documents = 0 client_capabilities = ResolvedClientCapabilities { code_action_deferred_edit_resolution: true, apply_edit: true, document_changes: true, workspace_refresh: true, pull_diagnostics: true, } global_client_settings = ResolvedClientSettings { fix_all: true, organize_imports: true, lint_enable: true, disable_rule_comment_enable: true, fix_violation_enable: true, show_syntax_errors: true, editor_settings: ResolvedEditorSettings { configuration: None, lint_preview: None, format_preview: None, select: None, extend_select: None, ignore: None, exclude: None, line_length: None, configuration_preference: EditorFirst, }, } ``` **When there's an active text document that's been passed as param:** ``` [Info - 10:53:33 PM] Global: executable = /Users/dhruv/work/astral/ruff/target/debug/ruff version = 0.9.6 position_encoding = UTF16 workspace_root_folders = [ "/Users/dhruv/playground/ruff", ] indexed_configuration_files = [ "/Users/dhruv/playground/ruff/pyproject.toml", "/Users/dhruv/playground/ruff/formatter/ruff.toml", ] open_documents = 1 client_capabilities = ResolvedClientCapabilities { code_action_deferred_edit_resolution: true, apply_edit: true, document_changes: true, workspace_refresh: true, pull_diagnostics: true, } Document: uri = file:///Users/dhruv/playground/ruff/lsp/play.py kind = Text version = 1 client_settings = ResolvedClientSettings { fix_all: true, organize_imports: true, lint_enable: true, disable_rule_comment_enable: true, fix_violation_enable: true, show_syntax_errors: true, editor_settings: ResolvedEditorSettings { configuration: None, lint_preview: None, format_preview: None, select: None, extend_select: None, ignore: None, exclude: None, line_length: None, configuration_preference: EditorFirst, }, } config_path = Some("/Users/dhruv/playground/ruff/pyproject.toml") ... ``` Replace `...` at the end with the output of `ruff check --show-settings path.py`
This commit is contained in:
parent
bb2a712f6a
commit
ed9c18d9b4
4 changed files with 132 additions and 47 deletions
|
@ -1,8 +1,10 @@
|
|||
//! Data model, state management, and configuration resolution.
|
||||
|
||||
use std::path::Path;
|
||||
use std::sync::Arc;
|
||||
|
||||
use lsp_types::{ClientCapabilities, FileEvent, NotebookDocumentCellChange, Url};
|
||||
use settings::ResolvedClientSettings;
|
||||
|
||||
use crate::edit::{DocumentKey, DocumentVersion, NotebookDocument};
|
||||
use crate::server::Workspaces;
|
||||
|
@ -147,18 +149,6 @@ impl Session {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn num_documents(&self) -> usize {
|
||||
self.index.num_documents()
|
||||
}
|
||||
|
||||
pub(crate) fn num_workspaces(&self) -> usize {
|
||||
self.index.num_workspaces()
|
||||
}
|
||||
|
||||
pub(crate) fn list_config_files(&self) -> Vec<&std::path::Path> {
|
||||
self.index.list_config_files()
|
||||
}
|
||||
|
||||
pub(crate) fn resolved_client_capabilities(&self) -> &ResolvedClientCapabilities {
|
||||
&self.resolved_client_capabilities
|
||||
}
|
||||
|
@ -166,6 +156,26 @@ impl Session {
|
|||
pub(crate) fn encoding(&self) -> PositionEncoding {
|
||||
self.position_encoding
|
||||
}
|
||||
|
||||
/// Returns an iterator over the paths to the configuration files in the index.
|
||||
pub(crate) fn config_file_paths(&self) -> impl Iterator<Item = &Path> {
|
||||
self.index.config_file_paths()
|
||||
}
|
||||
|
||||
/// Returns the resolved global client settings.
|
||||
pub(crate) fn global_client_settings(&self) -> ResolvedClientSettings {
|
||||
ResolvedClientSettings::global(&self.global_settings)
|
||||
}
|
||||
|
||||
/// Returns the number of open documents in the session.
|
||||
pub(crate) fn open_documents_len(&self) -> usize {
|
||||
self.index.open_documents_len()
|
||||
}
|
||||
|
||||
/// Returns an iterator over the workspace root folders in the session.
|
||||
pub(crate) fn workspace_root_folders(&self) -> impl Iterator<Item = &Path> {
|
||||
self.index.workspace_root_folders()
|
||||
}
|
||||
}
|
||||
|
||||
impl DocumentSnapshot {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue