@@ -24,26 +24,32 @@ export class TreeSitterCommandParser {
2424 }
2525
2626 async extractSubCommands ( languageId : TreeSitterCommandParserLanguage , commandLine : string ) : Promise < string [ ] > {
27- const parser = await this . _parser ;
28- const language = await waitForState ( derived ( reader => {
29- return this . _treeSitterLibraryService . getLanguage ( languageId , true , reader ) ;
30- } ) ) ;
31- parser . setLanguage ( language ) ;
27+ const disableSubCommandExtraction = true ; // see https://github.com/microsoft/vscode/issues/273177
3228
33- const tree = parser . parse ( commandLine ) ;
34- if ( ! tree ) {
35- throw new BugIndicatingError ( 'Failed to parse tree' ) ;
36- }
29+ if ( disableSubCommandExtraction ) {
30+ throw new Error ( 'not supported' ) ;
31+ } else {
32+ const parser = await this . _parser ;
33+ const language = await waitForState ( derived ( reader => {
34+ return this . _treeSitterLibraryService . getLanguage ( languageId , true , reader ) ;
35+ } ) ) ;
36+ parser . setLanguage ( language ) ;
3737
38- const query = await this . _getQuery ( language ) ;
39- if ( ! query ) {
40- throw new BugIndicatingError ( 'Failed to create tree sitter query ' ) ;
41- }
38+ const tree = parser . parse ( commandLine ) ;
39+ if ( ! tree ) {
40+ throw new BugIndicatingError ( 'Failed to parse tree' ) ;
41+ }
4242
43- const captures = query . captures ( tree . rootNode ) ;
44- const subCommands = captures . map ( e => e . node . text ) ;
43+ const query = await this . _getQuery ( language ) ;
44+ if ( ! query ) {
45+ throw new BugIndicatingError ( 'Failed to create tree sitter query' ) ;
46+ }
47+
48+ const captures = query . captures ( tree . rootNode ) ;
49+ const subCommands = captures . map ( e => e . node . text ) ;
4550
46- return subCommands ;
51+ return subCommands ;
52+ }
4753 }
4854
4955 async queryTree ( languageId : TreeSitterCommandParserLanguage , commandLine : string , querySource : string ) : Promise < QueryCapture [ ] > {
0 commit comments