@@ -318,6 +318,7 @@ const TreeDataProvider: vscode.TreeDataProvider<element> = {
318
318
item . tooltip = `Time: ${ time } \nRuleCount: ${ grammar . rules . length - grammar . lines . length } \nRegexCount: ${ regexCount } ` ;
319
319
item . description = `${ timeFixed } ms${ time > 500 ? ' ⚠️' : '' } ` ;
320
320
item . id = grammar . _rootScopeName ;
321
+ item . contextValue = 'root' ;
321
322
return item ;
322
323
}
323
324
@@ -853,14 +854,16 @@ export function initCallStackView(context: vscode.ExtensionContext): void {
853
854
vscode . commands . registerTextEditorCommand ( "textmate.callstack" , CallStackView ) ,
854
855
vscode . commands . registerCommand ( "textmate.refresh" , refresh ) ,
855
856
vscode . commands . registerCommand ( "textmate.find" , find ) ,
857
+ vscode . commands . registerCommand ( "textmate.copytoclipboard.grammar" , copyToClipBoardGrammar ) ,
856
858
vscode . commands . registerCommand ( "textmate.call.details" , callDetails ) ,
857
859
vscode . commands . registerCommand ( "textmate.goto.file" , gotoFile ) ,
858
860
vscode . commands . registerCommand ( "textmate.goto.grammar" , gotoGrammar ) ,
859
- vscode . commands . registerCommand ( "textmate.tree-view" , ( element : element ) => changeView ( 'tree' , element ) ) ,
860
- vscode . commands . registerCommand ( "textmate.list-view" , ( element : element ) => changeView ( 'list' , element ) ) ,
861
+ vscode . commands . registerCommand ( "textmate.tree-view" , ( element ? : element ) => changeView ( 'tree' , element ) ) ,
862
+ vscode . commands . registerCommand ( "textmate.list-view" , ( element ? : element ) => changeView ( 'list' , element ) ) ,
861
863
// vscode.window.onDidChangeActiveColorTheme(updateWorkbench_colorCustomizations),
862
864
) ;
863
865
866
+ // vscode.window.showInformationMessage(`vscode.commands.getCommands()\n${JSON.stringify(await vscode.commands.getCommands())}`);
864
867
// await updateWorkbench_colorCustomizations();
865
868
866
869
changeView ( callView ) ;
@@ -1036,6 +1039,15 @@ async function find(element?: element) {
1036
1039
// vscode.commands.executeCommand('list.toggleFindMatchType');
1037
1040
}
1038
1041
1042
+ async function copyToClipBoardGrammar ( element ?: element ) {
1043
+ try {
1044
+ const grammarJSON = JSON . stringify ( grammar , stringify ) ;
1045
+ await vscode . env . clipboard . writeText ( grammarJSON ) ;
1046
+ } catch ( error ) {
1047
+ console . warn ( "JSON TextMate: CallStack CopyToClipBoard: Error:\n" , error ) ;
1048
+ }
1049
+ }
1050
+
1039
1051
async function callDetails ( element : element ) {
1040
1052
// vscode.window.showInformationMessage(`callDetails\n${JSON.stringify(element)}`);
1041
1053
selectedElement = element ;
0 commit comments