Skip to content

Commit

Permalink
Cursorless scope side bar
Browse files Browse the repository at this point in the history
  • Loading branch information
pokey committed Oct 27, 2023
1 parent 223fc7e commit df4bb3e
Show file tree
Hide file tree
Showing 14 changed files with 376 additions and 16 deletions.
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.insert("cursorless")

def private_cursorless_show_sidebar():
"""Show Cursorless sidebar"""
actions.user.private_cursorless_run_rpc_command_and_wait(
"workbench.view.extension.cursorless"
)
10 changes: 10 additions & 0 deletions cursorless-talon/src/cheatsheet/sections/get_scope_visualizer.py
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",
),
["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",
),
};
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

0 comments on commit df4bb3e

Please sign in to comment.