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<
110
110
[ "cursorless.keyboard.modal.modeToggle" ] : new HiddenCommand (
111
111
"Toggle the cursorless modal mode" ,
112
112
) ,
113
- [ "cursorless.showScopeVisualizer" ] : new HiddenCommand (
113
+ [ "cursorless.showScopeVisualizer" ] : new VisibleCommand (
114
114
"Show the scope visualizer" ,
115
115
) ,
116
- [ "cursorless.hideScopeVisualizer" ] : new HiddenCommand (
116
+ [ "cursorless.hideScopeVisualizer" ] : new VisibleCommand (
117
117
"Hide the scope visualizer" ,
118
118
) ,
119
119
} ;
Original file line number Diff line number Diff line change @@ -73,7 +73,9 @@ export class ScopeInfoProvider {
73
73
// Skip "string" because we use surrounding pair for that
74
74
. filter (
75
75
( scopeTypeType ) =>
76
- scopeTypeType !== "instance" && scopeTypeType !== "string" ,
76
+ scopeTypeType !== "instance" &&
77
+ scopeTypeType !== "string" &&
78
+ scopeTypeType !== "switchStatementSubject" ,
77
79
)
78
80
. map ( ( scopeTypeType ) => ( {
79
81
type : scopeTypeType ,
Original file line number Diff line number Diff line change 187
187
},
188
188
{
189
189
"command" : " cursorless.showScopeVisualizer" ,
190
- "title" : " Cursorless: Show the scope visualizer" ,
191
- "enablement" : " false"
190
+ "title" : " Cursorless: Show the scope visualizer"
192
191
},
193
192
{
194
193
"command" : " cursorless.hideScopeVisualizer" ,
Original file line number Diff line number Diff line change
1
+ import { CursorlessCommandId } from "@cursorless/common" ;
1
2
import {
2
3
ScopeProvider ,
3
4
ScopeSupport ,
4
5
ScopeSupportLevels ,
5
6
ScopeTypeInfo ,
6
7
} from "@cursorless/cursorless-engine" ;
7
8
import * as vscode from "vscode" ;
9
+ import { VisualizationType } from "./ScopeVisualizerCommandApi" ;
8
10
9
11
export class ScopeSupportTreeProvider
10
12
implements vscode . TreeDataProvider < MyTreeItem >
@@ -138,6 +140,24 @@ class ScopeSupportTreeItem extends vscode.TreeItem {
138
140
super ( label , vscode . TreeItemCollapsibleState . None ) ;
139
141
140
142
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
+ } ;
141
161
}
142
162
}
143
163
You can’t perform that action at this time.
0 commit comments