File tree Expand file tree Collapse file tree 4 files changed +26
-5
lines changed
cursorless-engine/src/scopeProviders Expand file tree Collapse file tree 4 files changed +26
-5
lines changed Original file line number Diff line number Diff line change @@ -110,10 +110,10 @@ export const cursorlessCommandDescriptions: Record<
110110 [ "cursorless.keyboard.modal.modeToggle" ] : new HiddenCommand (
111111 "Toggle the cursorless modal mode" ,
112112 ) ,
113- [ "cursorless.showScopeVisualizer" ] : new HiddenCommand (
113+ [ "cursorless.showScopeVisualizer" ] : new VisibleCommand (
114114 "Show the scope visualizer" ,
115115 ) ,
116- [ "cursorless.hideScopeVisualizer" ] : new HiddenCommand (
116+ [ "cursorless.hideScopeVisualizer" ] : new VisibleCommand (
117117 "Hide the scope visualizer" ,
118118 ) ,
119119} ;
Original file line number Diff line number Diff line change @@ -73,7 +73,9 @@ export class ScopeInfoProvider {
7373 // Skip "string" because we use surrounding pair for that
7474 . filter (
7575 ( scopeTypeType ) =>
76- scopeTypeType !== "instance" && scopeTypeType !== "string" ,
76+ scopeTypeType !== "instance" &&
77+ scopeTypeType !== "string" &&
78+ scopeTypeType !== "switchStatementSubject" ,
7779 )
7880 . map ( ( scopeTypeType ) => ( {
7981 type : scopeTypeType ,
Original file line number Diff line number Diff line change 187187 },
188188 {
189189 "command" : " cursorless.showScopeVisualizer" ,
190- "title" : " Cursorless: Show the scope visualizer" ,
191- "enablement" : " false"
190+ "title" : " Cursorless: Show the scope visualizer"
192191 },
193192 {
194193 "command" : " cursorless.hideScopeVisualizer" ,
Original file line number Diff line number Diff line change 1+ import { CursorlessCommandId } from "@cursorless/common" ;
12import {
23 ScopeProvider ,
34 ScopeSupport ,
45 ScopeSupportLevels ,
56 ScopeTypeInfo ,
67} from "@cursorless/cursorless-engine" ;
78import * as vscode from "vscode" ;
9+ import { VisualizationType } from "./ScopeVisualizerCommandApi" ;
810
911export class ScopeSupportTreeProvider
1012 implements vscode . TreeDataProvider < MyTreeItem >
@@ -138,6 +140,24 @@ class ScopeSupportTreeItem extends vscode.TreeItem {
138140 super ( label , vscode . TreeItemCollapsibleState . None ) ;
139141
140142 this . description = description ;
143+
144+ if (
145+ scopeTypeInfo . spokenForm . type === "success" &&
146+ scopeTypeInfo . spokenForm . alternatives . length > 0
147+ ) {
148+ this . tooltip = scopeTypeInfo . spokenForm . alternatives
149+ . map ( ( spokenForm ) => `"${ spokenForm } "` )
150+ . join ( "\n" ) ;
151+ }
152+
153+ this . command = {
154+ command : "cursorless.showScopeVisualizer" satisfies CursorlessCommandId ,
155+ arguments : [
156+ scopeTypeInfo . scopeType ,
157+ "content" satisfies VisualizationType ,
158+ ] ,
159+ title : `Visualize ${ scopeTypeInfo . humanReadableName } ` ,
160+ } ;
141161 }
142162}
143163
You can’t perform that action at this time.
0 commit comments