Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cursorless scope side bar #1942

Merged
merged 2 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions cursorless-talon/src/apps/cursorless_vscode.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,9 @@ def private_cursorless_show_settings_in_ide():
)
actions.sleep("250ms")
actions.key("right")

def private_cursorless_show_sidebar():
"""Show Cursorless sidebar"""
actions.user.private_cursorless_run_rpc_command_and_wait(
"workbench.view.extension.cursorless"
)
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,14 @@ def get_scope_visualizer():
],
],
},
{
"id": "show_scope_sidebar",
"type": "command",
"variations": [
{
"spokenForm": "bar cursorless",
"description": "Show cursorless sidebar",
},
],
},
]
3 changes: 3 additions & 0 deletions cursorless-talon/src/cursorless.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@
class Actions:
def private_cursorless_show_settings_in_ide():
"""Show Cursorless-specific settings in ide"""

def private_cursorless_show_sidebar():
"""Show Cursorless-specific settings in ide"""
3 changes: 3 additions & 0 deletions cursorless-talon/src/cursorless.talon
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,6 @@ tag: user.cursorless

{user.cursorless_homophone} settings:
user.private_cursorless_show_settings_in_ide()

bar {user.cursorless_homophone}:
user.private_cursorless_show_sidebar()
3 changes: 3 additions & 0 deletions docs/user/scope-sidebar.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# The Cursorless sidebar

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.
6 changes: 6 additions & 0 deletions images/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions packages/common/src/cursorlessCommandIds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ export const cursorlessCommandDescriptions: Record<
"Resume test case recording",
),
["cursorless.showDocumentation"]: new VisibleCommand("Show documentation"),
["cursorless.showScopeVisualizer"]: new VisibleCommand(
"Show the scope visualizer",
),
pokey marked this conversation as resolved.
Show resolved Hide resolved
["cursorless.hideScopeVisualizer"]: new VisibleCommand(
"Hide the scope visualizer",
),

["cursorless.command"]: new HiddenCommand("The core cursorless command"),
["cursorless.showQuickPick"]: new HiddenCommand(
Expand Down Expand Up @@ -110,10 +116,4 @@ export const cursorlessCommandDescriptions: Record<
["cursorless.keyboard.modal.modeToggle"]: new HiddenCommand(
"Toggle the cursorless modal mode",
),
["cursorless.showScopeVisualizer"]: new HiddenCommand(
"Show the scope visualizer",
),
["cursorless.hideScopeVisualizer"]: new HiddenCommand(
"Hide the scope visualizer",
),
};
1 change: 1 addition & 0 deletions packages/common/src/cursorlessSideBarIds.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const CURSORLESS_SCOPE_TREE_VIEW_ID = "cursorless.scopes";
1 change: 1 addition & 0 deletions packages/common/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export * from "./cursorlessCommandIds";
export * from "./cursorlessSideBarIds";
export * from "./testUtil/extractTargetedMarks";
export { default as FakeIDE } from "./ide/fake/FakeIDE";
export type { Message } from "./ide/spy/SpyMessages";
Expand Down
36 changes: 26 additions & 10 deletions packages/cursorless-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
],
"activationEvents": [
"onLanguage",
"onView:cursorless.scopes",
"onCommand:cursorless.command",
"onCommand:cursorless.internal.updateCheatsheetDefaults",
"onCommand:cursorless.keyboard.escape",
Expand Down Expand Up @@ -77,6 +78,14 @@
}
},
"contributes": {
"views": {
"cursorless": [
{
"id": "cursorless.scopes",
"name": "Scopes"
}
]
},
"commands": [
{
"command": "cursorless.toggleDecorations",
Expand Down Expand Up @@ -106,6 +115,14 @@
"command": "cursorless.showDocumentation",
"title": "Cursorless: Show documentation"
},
{
"command": "cursorless.showScopeVisualizer",
"title": "Cursorless: Show the scope visualizer"
},
{
"command": "cursorless.hideScopeVisualizer",
"title": "Cursorless: Hide the scope visualizer"
},
{
"command": "cursorless.command",
"title": "Cursorless: The core cursorless command",
Expand Down Expand Up @@ -175,16 +192,6 @@
"command": "cursorless.keyboard.modal.modeToggle",
"title": "Cursorless: Toggle the cursorless modal mode",
"enablement": "false"
},
{
"command": "cursorless.showScopeVisualizer",
"title": "Cursorless: Show the scope visualizer",
"enablement": "false"
},
{
"command": "cursorless.hideScopeVisualizer",
"title": "Cursorless: Hide the scope visualizer",
"enablement": "false"
}
],
"colors": [
Expand Down Expand Up @@ -1032,6 +1039,15 @@
"fontCharacter": "\\E900"
}
}
},
"viewsContainers": {
"activitybar": [
{
"id": "cursorless",
"title": "Cursorless",
"icon": "images/logo.svg"
}
]
}
},
"sponsor": {
Expand Down
Loading