Skip to content

Commit

Permalink
Cursorless scope side bar (#1942)
Browse files Browse the repository at this point in the history
- Depends on #1941
- Depends on #1946

## Checklist

- [-] I have added
[tests](https://www.cursorless.org/docs/contributing/test-case-recorder/)
(see comment below)
- [x] Add descriptions to section headings (eg present, not present,
etc)
- [x] File issue about using lang icons for lang-specific scopes
- [x] I have updated the
[docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and
[cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet)
- [x] I have not broken the cheatsheet
- [x] File issue for showing scopes touching, as well as equal to,
selection
- [x] Checkboxes from original #1663
  • Loading branch information
pokey authored Oct 30, 2023
1 parent 64d01e4 commit 1260235
Show file tree
Hide file tree
Showing 15 changed files with 385 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.key("right")

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",
),
};
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

0 comments on commit 1260235

Please sign in to comment.