aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-02-25 10:02:21 +0000
committerGitHub <[email protected]>2020-02-25 10:02:21 +0000
commit1fe48a0115c24240f5a3e1b329e642f18e2715d6 (patch)
tree88c3290bced7671039b4765a5f599a019aa3c6e6 /crates/ra_ide
parent5e6f4ca6905e02a5fa34ef292fa2abefcd982222 (diff)
parent17ffdf9c27a6bb5cf5d30ad6a677390609fcf861 (diff)
Merge #3159
3159: Server-side Semantic Tokens r=matklad a=kjeremy Takes the output of `syntax_highlighting` and converts it to the proposed semantic tokens API (so far only `textDocument/semanticTokens`. There's a lot of cool stuff we could do with this and the "Inspect Editor Tokens and Scopes" vscode command (pic below) is a cool way to see what has tokens and what doesn't. Incredibly hacky and could panic due to unwraps, `panic!` etc. To use: run with `code-insiders --enable-proposed-api matklad.rust-analyzer`. If you try to run this without `--enable-proposed-api` it will crash. ![image](https://user-images.githubusercontent.com/4325700/74595603-7c66cf00-5011-11ea-9593-312663f04fc1.png) @matklad I'm mostly looking for design feedback. Co-authored-by: kjeremy <[email protected]> Co-authored-by: Jeremy Kolb <[email protected]>
Diffstat (limited to 'crates/ra_ide')
-rw-r--r--crates/ra_ide/src/lib.rs2
-rw-r--r--crates/ra_ide/src/syntax_highlighting.rs52
2 files changed, 27 insertions, 27 deletions
diff --git a/crates/ra_ide/src/lib.rs b/crates/ra_ide/src/lib.rs
index f86f98be7..82e10bc7e 100644
--- a/crates/ra_ide/src/lib.rs
+++ b/crates/ra_ide/src/lib.rs
@@ -75,7 +75,7 @@ pub use crate::{
75 runnables::{Runnable, RunnableKind, TestId}, 75 runnables::{Runnable, RunnableKind, TestId},
76 source_change::{FileSystemEdit, SourceChange, SourceFileEdit}, 76 source_change::{FileSystemEdit, SourceChange, SourceFileEdit},
77 ssr::SsrError, 77 ssr::SsrError,
78 syntax_highlighting::HighlightedRange, 78 syntax_highlighting::{tags, HighlightedRange},
79}; 79};
80 80
81pub use hir::Documentation; 81pub use hir::Documentation;
diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs
index d873f153e..812229b4e 100644
--- a/crates/ra_ide/src/syntax_highlighting.rs
+++ b/crates/ra_ide/src/syntax_highlighting.rs
@@ -17,32 +17,32 @@ use crate::{
17}; 17};
18 18
19pub mod tags { 19pub mod tags {
20 pub(crate) const FIELD: &str = "field"; 20 pub const FIELD: &str = "field";
21 pub(crate) const FUNCTION: &str = "function"; 21 pub const FUNCTION: &str = "function";
22 pub(crate) const MODULE: &str = "module"; 22 pub const MODULE: &str = "module";
23 pub(crate) const CONSTANT: &str = "constant"; 23 pub const CONSTANT: &str = "constant";
24 pub(crate) const MACRO: &str = "macro"; 24 pub const MACRO: &str = "macro";
25 25
26 pub(crate) const VARIABLE: &str = "variable"; 26 pub const VARIABLE: &str = "variable";
27 pub(crate) const VARIABLE_MUT: &str = "variable.mut"; 27 pub const VARIABLE_MUT: &str = "variable.mut";
28 28
29 pub(crate) const TYPE: &str = "type"; 29 pub const TYPE: &str = "type";
30 pub(crate) const TYPE_BUILTIN: &str = "type.builtin"; 30 pub const TYPE_BUILTIN: &str = "type.builtin";
31 pub(crate) const TYPE_SELF: &str = "type.self"; 31 pub const TYPE_SELF: &str = "type.self";
32 pub(crate) const TYPE_PARAM: &str = "type.param"; 32 pub const TYPE_PARAM: &str = "type.param";
33 pub(crate) const TYPE_LIFETIME: &str = "type.lifetime"; 33 pub const TYPE_LIFETIME: &str = "type.lifetime";
34 34
35 pub(crate) const LITERAL_BYTE: &str = "literal.byte"; 35 pub const LITERAL_BYTE: &str = "literal.byte";
36 pub(crate) const LITERAL_NUMERIC: &str = "literal.numeric"; 36 pub const LITERAL_NUMERIC: &str = "literal.numeric";
37 pub(crate) const LITERAL_CHAR: &str = "literal.char"; 37 pub const LITERAL_CHAR: &str = "literal.char";
38 38
39 pub(crate) const LITERAL_COMMENT: &str = "comment"; 39 pub const LITERAL_COMMENT: &str = "comment";
40 pub(crate) const LITERAL_STRING: &str = "string"; 40 pub const LITERAL_STRING: &str = "string";
41 pub(crate) const LITERAL_ATTRIBUTE: &str = "attribute"; 41 pub const LITERAL_ATTRIBUTE: &str = "attribute";
42 42
43 pub(crate) const KEYWORD: &str = "keyword"; 43 pub const KEYWORD: &str = "keyword";
44 pub(crate) const KEYWORD_UNSAFE: &str = "keyword.unsafe"; 44 pub const KEYWORD_UNSAFE: &str = "keyword.unsafe";
45 pub(crate) const KEYWORD_CONTROL: &str = "keyword.control"; 45 pub const KEYWORD_CONTROL: &str = "keyword.control";
46} 46}
47 47
48#[derive(Debug)] 48#[derive(Debug)]