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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 6 additions & 0 deletions .oxfmtrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"$schema": "./node_modules/oxfmt/configuration_schema.json",
"sortPackageJson": false,
"sortImports": {
"newlinesBetween": false,
"partitionByNewline": true,
"internalPattern": ["@cursorless/"]
},

"ignorePatterns": [
"/packages/app-vscode/src/keyboard/grammar/generated/",
"/packages/lib-engine/src/customCommandGrammar/generated/",
Expand Down
2 changes: 1 addition & 1 deletion packages/app-neovim/src/NeovimCommandServerApi.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { NeovimClient } from "neovim/lib/api/client";
import type {
CommandServerApi,
FocusedElementType,
InboundSignal,
} from "@cursorless/lib-common";
import type { NeovimClient } from "neovim/lib/api/client";

export class NeovimCommandServerApi implements CommandServerApi {
signals: { prePhrase: InboundSignal };
Expand Down
6 changes: 3 additions & 3 deletions packages/app-neovim/src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { NeovimClient } from "neovim/lib/api/client";
import type { NvimPlugin } from "neovim/lib/host/NvimPlugin";
import {
FakeCommandServerApi,
FakeIDE,
Expand All @@ -6,10 +8,8 @@ import {
import { createCursorlessEngine } from "@cursorless/lib-engine";
import { EXTENSION_ID, NeovimIDE } from "@cursorless/lib-neovim-common";
import { getNeovimRegistry } from "@cursorless/lib-neovim-registry";
import type { NeovimClient } from "neovim/lib/api/client";
import type { NvimPlugin } from "neovim/lib/host/NvimPlugin";
import { NeovimCommandServerApi } from "./NeovimCommandServerApi";
import { constructTestHelpers } from "./constructTestHelpers";
import { NeovimCommandServerApi } from "./NeovimCommandServerApi";
import { registerCommands } from "./registerCommands";

/**
Expand Down
3 changes: 1 addition & 2 deletions packages/app-neovim/src/registerCommands.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { NeovimClient } from "neovim";
import type {
CommandResponse,
CommandServerApi,
Expand All @@ -8,15 +9,13 @@ import {
clientSupportsFallback,
ensureCommandShape,
} from "@cursorless/lib-common";

import type { CommandApi } from "@cursorless/lib-engine";
import type { NeovimIDE } from "@cursorless/lib-neovim-common";
import {
modeSwitchNormalTerminal,
modeSwitchTerminal,
} from "@cursorless/lib-neovim-common";
import { getNeovimRegistry } from "@cursorless/lib-neovim-registry";
import type { NeovimClient } from "neovim";

export async function registerCommands(
client: NeovimClient,
Expand Down
2 changes: 1 addition & 1 deletion packages/app-talonjs/src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as talon from "talon";
import type { RunMode } from "@cursorless/lib-common";
import { activate as activateCore } from "@cursorless/lib-talonjs-core";
import * as talon from "talon";

export async function activate(runMode: RunMode): Promise<void> {
await activateCore(talon, runMode);
Expand Down
6 changes: 3 additions & 3 deletions packages/app-vscode/src/InstallationDependencies.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { isWindows } from "@cursorless/lib-node-common";
import { COMMAND_SERVER_EXTENSION_ID } from "@cursorless/lib-vscode-common";
import glob from "fast-glob";
import * as fs from "node:fs";
import * as os from "node:os";
import * as path from "node:path";
import glob from "fast-glob";
import * as vscode from "vscode";
import { isWindows } from "@cursorless/lib-node-common";
import { COMMAND_SERVER_EXTENSION_ID } from "@cursorless/lib-vscode-common";

const STATE_KEY = "dontShowInstallationDependencies";

Expand Down
4 changes: 2 additions & 2 deletions packages/app-vscode/src/ReleaseNotes.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as sinon from "sinon";
import type { ExtensionContext, Uri } from "vscode";
import type { MessageType, Messages } from "@cursorless/lib-common";
import { asyncSafety } from "@cursorless/lib-common";
import type { ExtensionContext, Uri } from "vscode";
import { ReleaseNotes, VERSION_KEY, WHATS_NEW } from "./ReleaseNotes";
import type { VscodeApi } from "@cursorless/lib-vscode-common";
import { ReleaseNotes, VERSION_KEY, WHATS_NEW } from "./ReleaseNotes";

interface Input {
/** Whether the VSCode window is focused */
Expand Down
4 changes: 2 additions & 2 deletions packages/app-vscode/src/ReleaseNotes.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as semver from "semver";
import type { ExtensionContext } from "vscode";
import { URI } from "vscode-uri";
import type { Messages } from "@cursorless/lib-common";
import { showInfo } from "@cursorless/lib-common";
import * as semver from "semver";
import type { VscodeApi } from "@cursorless/lib-vscode-common";
import { URI } from "vscode-uri";

/**
* The key to use in global storage to detect when Cursorless version number has
Expand Down
40 changes: 20 additions & 20 deletions packages/app-vscode/src/ScopeTreeProvider.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,3 @@
import type {
CursorlessCommandId,
IDE,
ScopeProvider,
ScopeSupportInfo,
ScopeType,
ScopeTypeInfo,
Selection,
TextEditor,
} from "@cursorless/lib-common";
import {
CURSORLESS_SCOPE_TREE_VIEW_ID,
DOCS_URL,
ScopeSupport,
disposableFrom,
serializeScopeType,
uriEncodeHashId,
} from "@cursorless/lib-common";
import { type CustomSpokenFormGenerator } from "@cursorless/lib-engine";
import { type VscodeApi } from "@cursorless/lib-vscode-common";
import { isEqual } from "lodash-es";
import type {
Disposable,
Expand All @@ -38,6 +18,26 @@ import {
window,
} from "vscode";
import { URI } from "vscode-uri";
import type {
CursorlessCommandId,
IDE,
ScopeProvider,
ScopeSupportInfo,
ScopeType,
ScopeTypeInfo,
Selection,
TextEditor,
} from "@cursorless/lib-common";
import {
CURSORLESS_SCOPE_TREE_VIEW_ID,
DOCS_URL,
ScopeSupport,
disposableFrom,
serializeScopeType,
uriEncodeHashId,
} from "@cursorless/lib-common";
import { type CustomSpokenFormGenerator } from "@cursorless/lib-engine";
import { type VscodeApi } from "@cursorless/lib-vscode-common";
import type {
ScopeVisualizer,
VisualizationType,
Expand Down
2 changes: 1 addition & 1 deletion packages/app-vscode/src/SpyWebviewView.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Disposable } from "@cursorless/lib-common";
import { cloneDeep } from "lodash-es";
import type { Uri, Webview, WebviewView } from "vscode";
import type { Disposable } from "@cursorless/lib-common";
import type { SpyWebViewEvent } from "@cursorless/lib-vscode-common";

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/app-vscode/src/VscodeSnippets.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { IDE, TextEditor } from "@cursorless/lib-common";
import { type Snippets } from "@cursorless/lib-engine";
import { open } from "node:fs/promises";
import { join } from "node:path";
import type { IDE, TextEditor } from "@cursorless/lib-common";
import { type Snippets } from "@cursorless/lib-engine";

export class VscodeSnippets implements Snippets {
constructor(private ide: IDE) {}
Expand Down
16 changes: 8 additions & 8 deletions packages/app-vscode/src/VscodeTutorial.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
import type {
FileSystem,
TutorialId,
TutorialState,
} from "@cursorless/lib-common";
import { getCursorlessRepoRoot } from "@cursorless/lib-node-common";
import type { SpyWebViewEvent, VscodeApi } from "@cursorless/lib-vscode-common";
import path from "node:path";
import type {
CancellationToken,
Expand All @@ -14,9 +7,16 @@ import type {
WebviewViewResolveContext,
} from "vscode";
import { ExtensionMode, Uri } from "vscode";
import type {
FileSystem,
TutorialId,
TutorialState,
} from "@cursorless/lib-common";
import { getCursorlessRepoRoot } from "@cursorless/lib-node-common";
import type { Tutorial } from "@cursorless/lib-tutorial";
import type { SpyWebViewEvent, VscodeApi } from "@cursorless/lib-vscode-common";
import type { ScopeVisualizer } from "./ScopeVisualizerCommandApi";
import { SpyWebviewView } from "./SpyWebviewView";
import type { Tutorial } from "@cursorless/lib-tutorial";

const VSCODE_TUTORIAL_WEBVIEW_ID = "cursorless.tutorial";

Expand Down
2 changes: 1 addition & 1 deletion packages/app-vscode/src/commands.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CURSORLESS_ORG_URL, DOCS_URL } from "@cursorless/lib-common";
import * as vscode from "vscode";
import { CURSORLESS_ORG_URL, DOCS_URL } from "@cursorless/lib-common";

export const showDocumentation = () => {
return vscode.env.openExternal(vscode.Uri.parse(DOCS_URL));
Expand Down
2 changes: 1 addition & 1 deletion packages/app-vscode/src/constructTestHelpers.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type * as vscode from "vscode";
import type {
ExcludableSnapshotField,
ExtraSnapshotField,
Expand All @@ -20,7 +21,6 @@ import {
} from "@cursorless/lib-engine";
import { takeSnapshot } from "@cursorless/lib-test-case-recorder";
import type { VscodeTestHelpers } from "@cursorless/lib-vscode-common";
import type * as vscode from "vscode";
import { toVscodeEditor } from "./ide/vscode/toVscodeEditor";
import type { VscodeFileSystem } from "./ide/vscode/VscodeFileSystem";
import type { VscodeIDE } from "./ide/vscode/VscodeIDE";
Expand Down
2 changes: 1 addition & 1 deletion packages/app-vscode/src/createScopeVisualizer.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { pull } from "lodash-es";
import type {
Disposable,
IDE,
ScopeProvider,
ScopeType,
} from "@cursorless/lib-common";
import { pull } from "lodash-es";
import {
type VscodeScopeVisualizer,
createVscodeScopeVisualizer,
Expand Down
8 changes: 4 additions & 4 deletions packages/app-vscode/src/createTutorial.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import type * as vscode from "vscode";
import type { Hats, HatTokenMap, IDE } from "@cursorless/lib-common";
import type {
CommandRunnerDecorator,
CustomSpokenFormGenerator,
} from "@cursorless/lib-engine";
import { TutorialImpl } from "@cursorless/lib-tutorial";
import { FileSystemTutorialContentProvider } from "@cursorless/lib-node-common";
import type * as vscode from "vscode";
import type { ScopeVisualizer } from "./ScopeVisualizerCommandApi";
import { VscodeTutorial } from "./VscodeTutorial";
import { TutorialImpl } from "@cursorless/lib-tutorial";
import type { VscodeFileSystem } from "./ide/vscode/VscodeFileSystem";
import type { ScopeVisualizer } from "./ScopeVisualizerCommandApi";
import { vscodeApi } from "./vscodeApi";
import { VscodeTutorial } from "./VscodeTutorial";

export function createTutorial(
context: vscode.ExtensionContext,
Expand Down
12 changes: 6 additions & 6 deletions packages/app-vscode/src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { ExtensionContext } from "vscode";
import type { EnforceUndefined } from "@cursorless/lib-common";
import {
FakeCommandServerApi,
Expand All @@ -20,22 +21,21 @@ import {
getCommandServerApi,
getParseTreeApi,
} from "@cursorless/lib-vscode-common";
import type { ExtensionContext } from "vscode";
import { InstallationDependencies } from "./InstallationDependencies";
import { ReleaseNotes } from "./ReleaseNotes";
import { ScopeTreeProvider } from "./ScopeTreeProvider";
import { StatusBarItem } from "./StatusBarItem";
import { VscodeSnippets } from "./VscodeSnippets";
import { constructTestHelpers } from "./constructTestHelpers";
import { createScopeVisualizer } from "./createScopeVisualizer";
import { createTreeSitter } from "./createTreeSitter";
import { createTutorial } from "./createTutorial";
import { createVscodeIde } from "./createVscodeIde";
import { InstallationDependencies } from "./InstallationDependencies";
import { KeyboardCommands } from "./keyboard/KeyboardCommands";
import { registerCommands } from "./registerCommands";
import { ReleaseNotes } from "./ReleaseNotes";
import { revisualizeOnCustomRegexChange } from "./revisualizeOnCustomRegexChange";
import { ScopeTreeProvider } from "./ScopeTreeProvider";
import { StatusBarItem } from "./StatusBarItem";
import { storedTargetHighlighter } from "./storedTargetHighlighter";
import { vscodeApi } from "./vscodeApi";
import { VscodeSnippets } from "./VscodeSnippets";

/**
* Extension entrypoint called by VSCode on Cursorless startup.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { flatmap } from "itertools";
import { range as lodashRange } from "lodash-es";
import type { GeneralizedRange, TextEditor } from "@cursorless/lib-common";
import {
generateDecorationsForCharacterRange,
generateDecorationsForLineRange,
Range,
} from "@cursorless/lib-common";
import { flatmap } from "itertools";
import { range as lodashRange } from "lodash-es";
import type { VscodeTextEditor } from "../../VscodeTextEditor";
import type { RangeTypeColors } from "../RangeTypeColors";
import { VscodeFancyRangeHighlighterRenderer } from "./VscodeFancyRangeHighlighterRenderer";
import type { DifferentiatedStyledRange } from "./decorationStyle.types";
import { generateDifferentiatedRanges } from "./generateDifferentiatedRanges";
import { groupDifferentiatedStyledRanges } from "./groupDifferentiatedStyledRanges";
import { VscodeFancyRangeHighlighterRenderer } from "./VscodeFancyRangeHighlighterRenderer";

/**
* A class for highlighting ranges in a VSCode editor, which does the following:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { DecorationRenderOptions, TextEditorDecorationType } from "vscode";
import { DecorationRangeBehavior } from "vscode";
import type { DecorationStyle } from "@cursorless/lib-common";
import {
BORDER_WIDTH,
Expand All @@ -7,8 +9,6 @@ import {
getBorderStyle,
} from "@cursorless/lib-common";
import { toVscodeRange } from "@cursorless/lib-vscode-common";
import type { DecorationRenderOptions, TextEditorDecorationType } from "vscode";
import { DecorationRangeBehavior } from "vscode";
import { vscodeApi } from "../../../../vscodeApi";
import type { VscodeTextEditor } from "../../VscodeTextEditor";
import type { RangeTypeColors } from "../RangeTypeColors";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { max } from "lodash-es";
import type { GeneralizedRange } from "@cursorless/lib-common";
import {
generalizedRangeContains,
generalizedRangeTouches,
} from "@cursorless/lib-common";

import { max } from "lodash-es";
import type { DifferentiatedGeneralizedRange } from "./decorationStyle.types";

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { Disposable, GeneralizedRange } from "@cursorless/lib-common";
import { isGeneralizedRangeEqual } from "@cursorless/lib-common";
import type { VscodeTextEditor } from "../VscodeTextEditor";
import { blendRangeTypeColors } from "./blendRangeTypeColors";
import type { RangeTypeColors } from "./RangeTypeColors";
import { VscodeFancyRangeHighlighter } from "./VscodeFancyRangeHighlighter";
import { blendRangeTypeColors } from "./blendRangeTypeColors";

export interface RendererScope {
domain: GeneralizedRange;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import type {
TextEditor,
} from "@cursorless/lib-common";
import { toCharacterRange } from "@cursorless/lib-common";
import { VscodeScopeVisualizer } from "./VscodeScopeVisualizer";
import type { VscodeTextEditor } from "../VscodeTextEditor";
import { VscodeScopeVisualizer } from "./VscodeScopeVisualizer";

abstract class VscodeScopeTargetVisualizer extends VscodeScopeVisualizer {
protected abstract getTargetRange(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import type {
ScopeVisualizerColorConfig,
} from "@cursorless/lib-vscode-common";
import { vscodeApi } from "../../../vscodeApi";
import { VscodeScopeRenderer } from "./VscodeScopeRenderer";
import { getColorsFromConfig } from "./getColorsFromConfig";
import { VscodeScopeRenderer } from "./VscodeScopeRenderer";

/**
* Base class for the different kinds of scope visualizer, eg content, removal,
Expand Down
4 changes: 2 additions & 2 deletions packages/app-vscode/src/ide/vscode/VscodeCapabilities.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as semver from "semver";
import * as vscode from "vscode";
import type {
Capabilities,
CommandCapabilityMap,
} from "@cursorless/lib-common";
import { nodeGetRunMode } from "@cursorless/lib-node-common";
import * as semver from "semver";
import * as vscode from "vscode";

// FIXME: In newer versions of vscode the `editor.action.clipboardCopyAction`
// command appears to be disabled / sandboxed in test mode.
Expand Down
4 changes: 2 additions & 2 deletions packages/app-vscode/src/ide/vscode/VscodeConfiguration.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as os from "node:os";
import * as vscode from "vscode";
import type {
Configuration,
ConfigurationScope,
Expand All @@ -6,8 +8,6 @@ import type {
Paths,
} from "@cursorless/lib-common";
import { HatStability, Notifier } from "@cursorless/lib-common";
import * as os from "node:os";
import * as vscode from "vscode";
import type { VscodeIDE } from "./VscodeIDE";

type TranslatorMap = {
Expand Down
Loading
Loading