feat(lsp): add workspace symbol provider (#12787)

This commit is contained in:
Kitson Kelly 2021-11-23 11:08:56 +11:00 committed by GitHub
parent 3abe31252e
commit bf5657cd59
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 303 additions and 24 deletions

View file

@ -12,6 +12,9 @@ use lspower::lsp::SemanticTokens;
use lspower::lsp::SemanticTokensLegend;
use std::ops::{Index, IndexMut};
pub(crate) const MODIFIER_MASK: u32 = 255;
pub(crate) const TYPE_OFFSET: u32 = 8;
enum TokenType {
Class = 0,
Enum = 1,
@ -78,12 +81,12 @@ pub fn get_legend() -> SemanticTokensLegend {
token_types[TokenType::Method] = "method".into();
let mut token_modifiers = vec![SemanticTokenModifier::from(""); 6];
token_modifiers[TokenModifier::Declaration] = "declaration".into();
token_modifiers[TokenModifier::Static] = "static".into();
token_modifiers[TokenModifier::Async] = "async".into();
token_modifiers[TokenModifier::Declaration] = "declaration".into();
token_modifiers[TokenModifier::Readonly] = "readonly".into();
token_modifiers[TokenModifier::DefaultLibrary] = "defaultLibrary".into();
token_modifiers[TokenModifier::Static] = "static".into();
token_modifiers[TokenModifier::Local] = "local".into();
token_modifiers[TokenModifier::DefaultLibrary] = "defaultLibrary".into();
SemanticTokensLegend {
token_types,
@ -91,11 +94,6 @@ pub fn get_legend() -> SemanticTokensLegend {
}
}
pub enum TsTokenEncodingConsts {
TypeOffset = 8,
ModifierMask = 255,
}
pub struct SemanticTokensBuilder {
prev_line: u32,
prev_char: u32,