refactor(lsp): store language sections in WorkspaceSettings (#20593)

When sending configuration requests to the client, reads `javascript`
and `typescript` sections in addition to `deno`.

The LSP's initialization options now accepts `javascript` and
`typescript` namespaces.
This commit is contained in:
Nayeem Rahman 2023-09-21 06:46:39 +01:00 committed by GitHub
parent 0981aefbdc
commit a4ac6a3f5f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 501 additions and 185 deletions

View file

@ -33,7 +33,9 @@ use tower_lsp::LanguageServer;
use super::client::Client;
use super::config::CompletionSettings;
use super::config::DenoCompletionSettings;
use super::config::ImportCompletionSettings;
use super::config::LanguageWorkspaceSettings;
use super::config::TestingSettings;
use super::config::WorkspaceSettings;
@ -292,23 +294,36 @@ pub fn get_repl_workspace_settings() -> WorkspaceSettings {
cache: None,
import_map: None,
code_lens: Default::default(),
inlay_hints: Default::default(),
internal_debug: false,
lint: false,
document_preload_limit: 0, // don't pre-load any modules as it's expensive and not useful for the repl
tls_certificate: None,
unsafely_ignore_certificate_errors: None,
unstable: false,
suggest: CompletionSettings {
complete_function_calls: false,
names: false,
paths: false,
auto_imports: false,
suggest: DenoCompletionSettings {
imports: ImportCompletionSettings {
auto_discover: false,
hosts: HashMap::from([("https://deno.land".to_string(), true)]),
},
},
testing: TestingSettings { args: vec![] },
javascript: LanguageWorkspaceSettings {
inlay_hints: Default::default(),
suggest: CompletionSettings {
complete_function_calls: false,
names: false,
paths: false,
auto_imports: false,
},
},
typescript: LanguageWorkspaceSettings {
inlay_hints: Default::default(),
suggest: CompletionSettings {
complete_function_calls: false,
names: false,
paths: false,
auto_imports: false,
},
},
}
}