Skip to content
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
3 changes: 3 additions & 0 deletions packages/common/src/cursorlessCommandIds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ export const cursorlessCommandDescriptions: Record<
["cursorless.showInstallationDependencies"]: new VisibleCommand(
"Show installation dependencies",
),
// showScopeVisualizer can't be called from the command palatte because it
// requires an argument, but it still needs to be visible or the scope buttons
// will be disabled in the sidebar
["cursorless.showScopeVisualizer"]: new VisibleCommand(
"Show the scope visualizer",
),
Expand Down
4 changes: 2 additions & 2 deletions packages/common/src/util/disposableFrom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import type { Disposable } from "../ide/types/ide.types";
export function disposableFrom(...disposables: Disposable[]): Disposable {
return {
dispose(): void {
disposables.forEach(({ dispose }) => {
disposables.forEach((disposable) => {
try {
dispose();
disposable.dispose();
} catch (e) {
// just log, but don't throw; some of the VSCode disposables misbehave,
// and we don't want that to prevent us from disposing the rest of the
Expand Down
16 changes: 14 additions & 2 deletions packages/cursorless-vscode/src/registerCommands.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type {
CommandHistoryStorage,
CursorlessCommandId,
ScopeType,
} from "@cursorless/common";
import { CURSORLESS_COMMAND_ID } from "@cursorless/common";
import {
Expand All @@ -18,7 +19,10 @@ import type {
} from "@cursorless/test-case-recorder";
import * as vscode from "vscode";
import type { InstallationDependencies } from "./InstallationDependencies";
import type { ScopeVisualizer } from "./ScopeVisualizerCommandApi";
import type {
ScopeVisualizer,
VisualizationType,
} from "./ScopeVisualizerCommandApi";
import type { VscodeSnippets } from "./VscodeSnippets";
import type { VscodeTutorial } from "./VscodeTutorial";
import {
Expand Down Expand Up @@ -102,7 +106,15 @@ export function registerCommands(
["cursorless.recomputeDecorationStyles"]: hats.recomputeDecorationStyles,

// Scope visualizer
["cursorless.showScopeVisualizer"]: scopeVisualizer.start,
["cursorless.showScopeVisualizer"]: (
scopeType?: ScopeType,
visualizationType?: VisualizationType,
) => {
if (scopeType == null || visualizationType == null) {
throw new Error("Missing arguments. Only for internal use.");
}
scopeVisualizer.start(scopeType, visualizationType);
},
["cursorless.hideScopeVisualizer"]: scopeVisualizer.stop,
["cursorless.scopeVisualizer.openUrl"]:
showScopeVisualizerItemDocumentation,
Expand Down
Loading