Skip to content

Commit 670c9a5

Browse files
committed
More fixes
1 parent 0479eea commit 670c9a5

File tree

4 files changed

+26
-5
lines changed

4 files changed

+26
-5
lines changed

packages/common/src/cursorlessCommandIds.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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
};

packages/cursorless-engine/src/scopeProviders/ScopeInfoProvider.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff 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,

packages/cursorless-vscode/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,7 @@
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",

packages/cursorless-vscode/src/ScopeSupportTreeProvider.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
import { CursorlessCommandId } from "@cursorless/common";
12
import {
23
ScopeProvider,
34
ScopeSupport,
45
ScopeSupportLevels,
56
ScopeTypeInfo,
67
} from "@cursorless/cursorless-engine";
78
import * as vscode from "vscode";
9+
import { VisualizationType } from "./ScopeVisualizerCommandApi";
810

911
export 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

0 commit comments

Comments
 (0)