File tree Expand file tree Collapse file tree 3 files changed +50
-1
lines changed Expand file tree Collapse file tree 3 files changed +50
-1
lines changed Original file line number Diff line number Diff line change 411411 ]
412412 }
413413 ],
414+ "languages" : [
415+ {
416+ "id" : " ra_syntax_tree" ,
417+ "extensions" : [
418+ " .rast"
419+ ]
420+ }
421+ ],
422+ "grammars" : [
423+ {
424+ "language" : " ra_syntax_tree" ,
425+ "scopeName" : " source.ra_syntax_tree" ,
426+ "path" : " ra_syntax_tree.tmGrammar.json"
427+ }
428+ ],
414429 "problemMatchers" : [
415430 {
416431 "name" : " rustc" ,
Original file line number Diff line number Diff line change 1+ {
2+ "$schema" : " https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json" ,
3+
4+ "scopeName" : " source.ra_syntax_tree" ,
5+ "patterns" : [
6+ { "include" : " #node_type" },
7+ { "include" : " #node_range_index" },
8+ { "include" : " #token_text" }
9+ ],
10+ "repository" : {
11+ "node_type" : {
12+ "match" : " ^\\ s*([A-Z_]+?)@" ,
13+ "captures" : {
14+ "1" : {
15+ "name" : " entity.name.class"
16+ }
17+ }
18+ },
19+ "node_range_index" : {
20+ "match" : " \\ d+" ,
21+ "name" : " constant.numeric"
22+ },
23+ "token_text" : {
24+ "match" : " \" .+\" " ,
25+ "name" : " string"
26+ }
27+ },
28+ "fileTypes" : [
29+ " rast"
30+ ]
31+ }
Original file line number Diff line number Diff line change @@ -15,6 +15,9 @@ export function syntaxTree(ctx: Ctx): Cmd {
1515 void new AstInspector ( ctx ) ;
1616
1717 ctx . pushCleanup ( vscode . workspace . registerTextDocumentContentProvider ( AST_FILE_SCHEME , tdcp ) ) ;
18+ ctx . pushCleanup ( vscode . languages . setLanguageConfiguration ( "ra_syntax_tree" , {
19+ brackets : [ [ "[" , ")" ] ] ,
20+ } ) ) ;
1821
1922 return async ( ) => {
2023 const editor = vscode . window . activeTextEditor ;
@@ -36,7 +39,7 @@ export function syntaxTree(ctx: Ctx): Cmd {
3639}
3740
3841class TextDocumentContentProvider implements vscode . TextDocumentContentProvider {
39- readonly uri = vscode . Uri . parse ( 'rust-analyzer://syntaxtree' ) ;
42+ readonly uri = vscode . Uri . parse ( 'rust-analyzer://syntaxtree/tree.rast ' ) ;
4043 readonly eventEmitter = new vscode . EventEmitter < vscode . Uri > ( ) ;
4144
4245
You can’t perform that action at this time.
0 commit comments