mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 12:19:12 +00:00
fix(lsp): filter scheme in semantic tokens registration options (#28756)
This commit is contained in:
parent
757ef462f7
commit
37b760e3c6
1 changed files with 25 additions and 22 deletions
|
@ -39,30 +39,33 @@ fn code_action_capabilities(
|
|||
|
||||
pub fn semantic_tokens_registration_options(
|
||||
) -> SemanticTokensRegistrationOptions {
|
||||
const LANGUAGES: [&str; 4] = [
|
||||
"javascript",
|
||||
"javascriptreact",
|
||||
"typescript",
|
||||
"typescriptreact",
|
||||
];
|
||||
const SCHEMES: [&str; 5] = [
|
||||
"file",
|
||||
"untitled",
|
||||
"deno",
|
||||
"vscode-notebook-cell",
|
||||
"deno-notebook-cell",
|
||||
];
|
||||
let mut document_filters =
|
||||
Vec::with_capacity(LANGUAGES.len() * SCHEMES.len());
|
||||
for language in &LANGUAGES {
|
||||
for scheme in &SCHEMES {
|
||||
document_filters.push(DocumentFilter {
|
||||
language: Some(language.to_string()),
|
||||
scheme: Some(scheme.to_string()),
|
||||
pattern: None,
|
||||
});
|
||||
}
|
||||
}
|
||||
SemanticTokensRegistrationOptions {
|
||||
text_document_registration_options: TextDocumentRegistrationOptions {
|
||||
document_selector: Some(vec![
|
||||
DocumentFilter {
|
||||
language: Some("javascript".to_string()),
|
||||
scheme: None,
|
||||
pattern: None,
|
||||
},
|
||||
DocumentFilter {
|
||||
language: Some("javascriptreact".to_string()),
|
||||
scheme: None,
|
||||
pattern: None,
|
||||
},
|
||||
DocumentFilter {
|
||||
language: Some("typescript".to_string()),
|
||||
scheme: None,
|
||||
pattern: None,
|
||||
},
|
||||
DocumentFilter {
|
||||
language: Some("typescriptreact".to_string()),
|
||||
scheme: None,
|
||||
pattern: None,
|
||||
},
|
||||
]),
|
||||
document_selector: Some(document_filters),
|
||||
},
|
||||
semantic_tokens_options: SemanticTokensOptions {
|
||||
legend: get_legend(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue