@@ -318,6 +318,7 @@ const TreeDataProvider: vscode.TreeDataProvider<element> = {
318318 item . tooltip = `Time: ${ time } \nRuleCount: ${ grammar . rules . length - grammar . lines . length } \nRegexCount: ${ regexCount } ` ;
319319 item . description = `${ timeFixed } ms${ time > 500 ? ' ⚠️' : '' } ` ;
320320 item . id = grammar . _rootScopeName ;
321+ item . contextValue = 'root' ;
321322 return item ;
322323 }
323324
@@ -853,14 +854,16 @@ export function initCallStackView(context: vscode.ExtensionContext): void {
853854 vscode . commands . registerTextEditorCommand ( "textmate.callstack" , CallStackView ) ,
854855 vscode . commands . registerCommand ( "textmate.refresh" , refresh ) ,
855856 vscode . commands . registerCommand ( "textmate.find" , find ) ,
857+ vscode . commands . registerCommand ( "textmate.copytoclipboard.grammar" , copyToClipBoardGrammar ) ,
856858 vscode . commands . registerCommand ( "textmate.call.details" , callDetails ) ,
857859 vscode . commands . registerCommand ( "textmate.goto.file" , gotoFile ) ,
858860 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 ) ) ,
861863 // vscode.window.onDidChangeActiveColorTheme(updateWorkbench_colorCustomizations),
862864 ) ;
863865
866+ // vscode.window.showInformationMessage(`vscode.commands.getCommands()\n${JSON.stringify(await vscode.commands.getCommands())}`);
864867 // await updateWorkbench_colorCustomizations();
865868
866869 changeView ( callView ) ;
@@ -1036,6 +1039,15 @@ async function find(element?: element) {
10361039 // vscode.commands.executeCommand('list.toggleFindMatchType');
10371040}
10381041
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+
10391051async function callDetails ( element : element ) {
10401052 // vscode.window.showInformationMessage(`callDetails\n${JSON.stringify(element)}`);
10411053 selectedElement = element ;
0 commit comments