Skip to content

Commit 50b9626

Browse files
committed
Cursorless scope side bar
1 parent 223fc7e commit 50b9626

File tree

15 files changed

+378
-16
lines changed

15 files changed

+378
-16
lines changed

cursorless-talon/src/apps/cursorless_vscode.py

+6
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,9 @@ def private_cursorless_show_settings_in_ide():
3232
)
3333
actions.sleep("250ms")
3434
actions.insert("cursorless")
35+
36+
def private_cursorless_show_sidebar():
37+
"""Show Cursorless sidebar"""
38+
actions.user.private_cursorless_run_rpc_command_and_wait(
39+
"workbench.view.extension.cursorless"
40+
)

cursorless-talon/src/cheatsheet/sections/get_scope_visualizer.py

+10
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,14 @@ def get_scope_visualizer():
2424
],
2525
],
2626
},
27+
{
28+
"id": "show_scope_sidebar",
29+
"type": "command",
30+
"variations": [
31+
{
32+
"spokenForm": "bar cursorless",
33+
"description": "Show cursorless sidebar",
34+
},
35+
],
36+
},
2737
]

cursorless-talon/src/cursorless.py

+3
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@
1212
class Actions:
1313
def private_cursorless_show_settings_in_ide():
1414
"""Show Cursorless-specific settings in ide"""
15+
16+
def private_cursorless_show_sidebar():
17+
"""Show Cursorless-specific settings in ide"""

cursorless-talon/src/cursorless.talon

+3
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,6 @@ tag: user.cursorless
4040

4141
{user.cursorless_homophone} settings:
4242
user.private_cursorless_show_settings_in_ide()
43+
44+
bar {user.cursorless_homophone}:
45+
user.private_cursorless_show_sidebar()

docs/user/scope-sidebar.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# The Cursorless sidebar
2+
3+
You can say `"bar cursorless"` to show the Cursorless sidebar. Currently, the sidebar just contains a section showing a list of all scopes, organized by whether they are present and supported in the active text editor. As you type, the list of present scopes will update in real time. Clicking on a scope will visualize it using the [scope visualizer](scope-visualizer.md). Note that for legacy scopes, we can't tell whether they are present in the active text editor, so we list them under a separate Legacy section. Clicking on these scopes will not visualize them, as we also don't support visualizing legacy scopes.

images/logo.svg

+6
Loading

packages/common/src/cursorlessCommandIds.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ export const cursorlessCommandDescriptions: Record<
6969
"Resume test case recording",
7070
),
7171
["cursorless.showDocumentation"]: new VisibleCommand("Show documentation"),
72+
["cursorless.showScopeVisualizer"]: new VisibleCommand(
73+
"Show the scope visualizer",
74+
),
75+
["cursorless.hideScopeVisualizer"]: new VisibleCommand(
76+
"Hide the scope visualizer",
77+
),
7278

7379
["cursorless.command"]: new HiddenCommand("The core cursorless command"),
7480
["cursorless.showQuickPick"]: new HiddenCommand(
@@ -110,10 +116,4 @@ export const cursorlessCommandDescriptions: Record<
110116
["cursorless.keyboard.modal.modeToggle"]: new HiddenCommand(
111117
"Toggle the cursorless modal mode",
112118
),
113-
["cursorless.showScopeVisualizer"]: new HiddenCommand(
114-
"Show the scope visualizer",
115-
),
116-
["cursorless.hideScopeVisualizer"]: new HiddenCommand(
117-
"Hide the scope visualizer",
118-
),
119119
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const CURSORLESS_SCOPE_TREE_VIEW_ID = "cursorless.scopes";

packages/common/src/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export * from "./cursorlessCommandIds";
2+
export * from "./cursorlessSideBarIds";
23
export * from "./testUtil/extractTargetedMarks";
34
export { default as FakeIDE } from "./ide/fake/FakeIDE";
45
export type { Message } from "./ide/spy/SpyMessages";

packages/cursorless-vscode/package.json

+26-10
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
],
4747
"activationEvents": [
4848
"onLanguage",
49+
"onView:cursorless.scopes",
4950
"onCommand:cursorless.command",
5051
"onCommand:cursorless.internal.updateCheatsheetDefaults",
5152
"onCommand:cursorless.keyboard.escape",
@@ -77,6 +78,14 @@
7778
}
7879
},
7980
"contributes": {
81+
"views": {
82+
"cursorless": [
83+
{
84+
"id": "cursorless.scopes",
85+
"name": "Scopes"
86+
}
87+
]
88+
},
8089
"commands": [
8190
{
8291
"command": "cursorless.toggleDecorations",
@@ -106,6 +115,14 @@
106115
"command": "cursorless.showDocumentation",
107116
"title": "Cursorless: Show documentation"
108117
},
118+
{
119+
"command": "cursorless.showScopeVisualizer",
120+
"title": "Cursorless: Show the scope visualizer"
121+
},
122+
{
123+
"command": "cursorless.hideScopeVisualizer",
124+
"title": "Cursorless: Hide the scope visualizer"
125+
},
109126
{
110127
"command": "cursorless.command",
111128
"title": "Cursorless: The core cursorless command",
@@ -175,16 +192,6 @@
175192
"command": "cursorless.keyboard.modal.modeToggle",
176193
"title": "Cursorless: Toggle the cursorless modal mode",
177194
"enablement": "false"
178-
},
179-
{
180-
"command": "cursorless.showScopeVisualizer",
181-
"title": "Cursorless: Show the scope visualizer",
182-
"enablement": "false"
183-
},
184-
{
185-
"command": "cursorless.hideScopeVisualizer",
186-
"title": "Cursorless: Hide the scope visualizer",
187-
"enablement": "false"
188195
}
189196
],
190197
"colors": [
@@ -1032,6 +1039,15 @@
10321039
"fontCharacter": "\\E900"
10331040
}
10341041
}
1042+
},
1043+
"viewsContainers": {
1044+
"activitybar": [
1045+
{
1046+
"id": "cursorless",
1047+
"title": "Cursorless",
1048+
"icon": "images/logo.svg"
1049+
}
1050+
]
10351051
}
10361052
},
10371053
"sponsor": {

0 commit comments

Comments
 (0)