mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-02 06:41:23 +00:00
[ty] Add python.ty.disableLanguageServices
config (#18230)
## Summary PR adding support for it in the VS Code extension: https://github.com/astral-sh/ty-vscode/pull/36 This PR adds support for `python.ty.disableLanguageServices` to the ty language server by accepting this as server setting. This has the same issue as https://github.com/astral-sh/ty/issues/282 in that it only works when configured globally. Fixing that requires support for multiple workspaces in the server itself. I also went ahead and did a similar refactor as the Ruff server to use "Options" and "Settings" to keep the code consistent although the combine functionality doesn't exists yet because workspace settings isn't supported in the ty server. ## Test Plan Refer to https://github.com/astral-sh/ty-vscode/pull/36 for the test demo.
This commit is contained in:
parent
a1c69ca460
commit
390918e790
10 changed files with 239 additions and 136 deletions
|
@ -3,16 +3,15 @@ use std::sync::Arc;
|
|||
use lsp_types::Url;
|
||||
use rustc_hash::FxHashMap;
|
||||
|
||||
use crate::session::settings::ClientSettings;
|
||||
use crate::{
|
||||
PositionEncoding, TextDocument,
|
||||
document::{DocumentKey, DocumentVersion, NotebookDocument},
|
||||
system::AnySystemPath,
|
||||
};
|
||||
|
||||
use super::ClientSettings;
|
||||
|
||||
/// Stores and tracks all open documents in a session, along with their associated settings.
|
||||
#[derive(Default, Debug)]
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct Index {
|
||||
/// Maps all document file paths to the associated document controller
|
||||
documents: FxHashMap<AnySystemPath, DocumentController>,
|
||||
|
@ -21,8 +20,7 @@ pub(crate) struct Index {
|
|||
notebook_cells: FxHashMap<Url, AnySystemPath>,
|
||||
|
||||
/// Global settings provided by the client.
|
||||
#[expect(dead_code)]
|
||||
global_settings: ClientSettings,
|
||||
global_settings: Arc<ClientSettings>,
|
||||
}
|
||||
|
||||
impl Index {
|
||||
|
@ -30,7 +28,7 @@ impl Index {
|
|||
Self {
|
||||
documents: FxHashMap::default(),
|
||||
notebook_cells: FxHashMap::default(),
|
||||
global_settings,
|
||||
global_settings: Arc::new(global_settings),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -177,6 +175,10 @@ impl Index {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn global_settings(&self) -> Arc<ClientSettings> {
|
||||
self.global_settings.clone()
|
||||
}
|
||||
|
||||
fn document_controller_for_key(
|
||||
&mut self,
|
||||
key: &DocumentKey,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue