diff --git a/.eslintrc.json b/.eslintrc.json index 26ea892256..22bc8da48f 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -20,6 +20,7 @@ "assertionStyle": "as" } ], + "@typescript-eslint/consistent-type-imports": "error", "@typescript-eslint/naming-convention": "warn", "@typescript-eslint/no-explicit-any": "off", "@typescript-eslint/no-inferrable-types": "off", diff --git a/packages/cheatsheet-local/src/app/app.tsx b/packages/cheatsheet-local/src/app/app.tsx index bf330971b3..c7d5d4a2b6 100644 --- a/packages/cheatsheet-local/src/app/app.tsx +++ b/packages/cheatsheet-local/src/app/app.tsx @@ -1,4 +1,5 @@ -import { CheatsheetPage, CheatsheetInfo } from "@cursorless/cheatsheet"; +import type { CheatsheetInfo } from "@cursorless/cheatsheet"; +import { CheatsheetPage } from "@cursorless/cheatsheet"; import "../styles.css"; declare global { diff --git a/packages/cheatsheet/src/lib/cheatsheet.tsx b/packages/cheatsheet/src/lib/cheatsheet.tsx index 23eed38083..97300a83b5 100644 --- a/packages/cheatsheet/src/lib/cheatsheet.tsx +++ b/packages/cheatsheet/src/lib/cheatsheet.tsx @@ -6,7 +6,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faCircleQuestion } from "@fortawesome/free-solid-svg-icons/faCircleQuestion"; import CheatsheetNotesComponent from "./components/CheatsheetNotesComponent"; import SmartLink from "./components/SmartLink"; -import { CheatsheetInfo } from "./CheatsheetInfo"; +import type { CheatsheetInfo } from "./CheatsheetInfo"; type CheatsheetPageProps = { cheatsheetInfo: CheatsheetInfo; diff --git a/packages/cheatsheet/src/lib/components/CheatsheetLegendComponent.tsx b/packages/cheatsheet/src/lib/components/CheatsheetLegendComponent.tsx index a9e38ad60f..2a66690c75 100644 --- a/packages/cheatsheet/src/lib/components/CheatsheetLegendComponent.tsx +++ b/packages/cheatsheet/src/lib/components/CheatsheetLegendComponent.tsx @@ -1,5 +1,5 @@ import * as React from "react"; -import { CheatsheetLegend } from "../cheatsheetLegend"; +import type { CheatsheetLegend } from "../cheatsheetLegend"; import useIsHighlighted from "../hooks/useIsHighlighted"; import { formatCaptures } from "./formatCaptures"; import SmartLink from "./SmartLink"; diff --git a/packages/cheatsheet/src/lib/components/CheatsheetListComponent.tsx b/packages/cheatsheet/src/lib/components/CheatsheetListComponent.tsx index 368d32fd8e..b3403636aa 100644 --- a/packages/cheatsheet/src/lib/components/CheatsheetListComponent.tsx +++ b/packages/cheatsheet/src/lib/components/CheatsheetListComponent.tsx @@ -1,4 +1,4 @@ -import { CheatsheetSection, Variation } from "../CheatsheetInfo"; +import type { CheatsheetSection, Variation } from "../CheatsheetInfo"; import useIsHighlighted from "../hooks/useIsHighlighted"; import { formatCaptures } from "./formatCaptures"; diff --git a/packages/common/src/getFakeCommandServerApi.ts b/packages/common/src/getFakeCommandServerApi.ts index 3a1adb23fa..8ba6b763ec 100644 --- a/packages/common/src/getFakeCommandServerApi.ts +++ b/packages/common/src/getFakeCommandServerApi.ts @@ -1,4 +1,4 @@ -import { CommandServerApi } from "./types/CommandServerApi"; +import type { CommandServerApi } from "./types/CommandServerApi"; export function getFakeCommandServerApi(): CommandServerApi { return { diff --git a/packages/common/src/ide/PassthroughIDEBase.ts b/packages/common/src/ide/PassthroughIDEBase.ts index 23dc1e034a..236d283675 100644 --- a/packages/common/src/ide/PassthroughIDEBase.ts +++ b/packages/common/src/ide/PassthroughIDEBase.ts @@ -1,19 +1,24 @@ -import { GeneralizedRange } from "../types/GeneralizedRange"; -import { TextDocument } from "../types/TextDocument"; -import { EditableTextEditor, TextEditor } from "../types/TextEditor"; -import { Capabilities } from "./types/Capabilities"; -import { Clipboard } from "./types/Clipboard"; -import { Configuration } from "./types/Configuration"; -import { TextDocumentChangeEvent } from "./types/Events"; -import { +import type { GeneralizedRange } from "../types/GeneralizedRange"; +import type { TextDocument } from "../types/TextDocument"; +import type { EditableTextEditor, TextEditor } from "../types/TextEditor"; +import type { Capabilities } from "./types/Capabilities"; +import type { Clipboard } from "./types/Clipboard"; +import type { Configuration } from "./types/Configuration"; +import type { TextDocumentChangeEvent } from "./types/Events"; +import type { TextEditorSelectionChangeEvent, TextEditorVisibleRangesChangeEvent, } from "./types/events.types"; -import { FlashDescriptor } from "./types/FlashDescriptor"; -import { Disposable, IDE, RunMode, WorkspaceFolder } from "./types/ide.types"; -import { Messages } from "./types/Messages"; -import { QuickPickOptions } from "./types/QuickPickOptions"; -import { State } from "./types/State"; +import type { FlashDescriptor } from "./types/FlashDescriptor"; +import type { + Disposable, + IDE, + RunMode, + WorkspaceFolder, +} from "./types/ide.types"; +import type { Messages } from "./types/Messages"; +import type { QuickPickOptions } from "./types/QuickPickOptions"; +import type { State } from "./types/State"; export default class PassthroughIDEBase implements IDE { configuration: Configuration; diff --git a/packages/common/src/ide/fake/FakeCapabilities.ts b/packages/common/src/ide/fake/FakeCapabilities.ts index febe2266d5..66ae5dfd0f 100644 --- a/packages/common/src/ide/fake/FakeCapabilities.ts +++ b/packages/common/src/ide/fake/FakeCapabilities.ts @@ -1,4 +1,4 @@ -import { Capabilities } from "../types/Capabilities"; +import type { Capabilities } from "../types/Capabilities"; export class FakeCapabilities implements Capabilities { commands = { diff --git a/packages/common/src/ide/fake/FakeConfiguration.ts b/packages/common/src/ide/fake/FakeConfiguration.ts index a879cfb208..75ed172434 100644 --- a/packages/common/src/ide/fake/FakeConfiguration.ts +++ b/packages/common/src/ide/fake/FakeConfiguration.ts @@ -1,13 +1,13 @@ import { get } from "lodash"; import { Notifier } from "../../util/Notifier"; -import { +import type { Configuration, ConfigurationScope, - CONFIGURATION_DEFAULTS, CursorlessConfigKey, CursorlessConfiguration, } from "../types/Configuration"; -import { GetFieldType, Paths } from "../types/Paths"; +import { CONFIGURATION_DEFAULTS } from "../types/Configuration"; +import type { GetFieldType, Paths } from "../types/Paths"; interface ConfigurationScopeValues { scope: ConfigurationScope; diff --git a/packages/common/src/ide/fake/FakeIDE.ts b/packages/common/src/ide/fake/FakeIDE.ts index 7bb1069fbe..38e610c351 100644 --- a/packages/common/src/ide/fake/FakeIDE.ts +++ b/packages/common/src/ide/fake/FakeIDE.ts @@ -1,21 +1,21 @@ import type { EditableTextEditor, TextEditor } from "../.."; import { pull } from "lodash"; -import { GeneralizedRange } from "../../types/GeneralizedRange"; -import { TextDocument } from "../../types/TextDocument"; +import type { GeneralizedRange } from "../../types/GeneralizedRange"; +import type { TextDocument } from "../../types/TextDocument"; import type { TextDocumentChangeEvent } from "../types/Events"; -import { +import type { Event, TextEditorSelectionChangeEvent, TextEditorVisibleRangesChangeEvent, } from "../types/events.types"; -import { FlashDescriptor } from "../types/FlashDescriptor"; +import type { FlashDescriptor } from "../types/FlashDescriptor"; import type { Disposable, IDE, RunMode, WorkspaceFolder, } from "../types/ide.types"; -import { QuickPickOptions } from "../types/QuickPickOptions"; +import type { QuickPickOptions } from "../types/QuickPickOptions"; import { FakeCapabilities } from "./FakeCapabilities"; import FakeClipboard from "./FakeClipboard"; import FakeConfiguration from "./FakeConfiguration"; diff --git a/packages/common/src/ide/normalized/NormalizedIDE.ts b/packages/common/src/ide/normalized/NormalizedIDE.ts index 30b1dccd58..524f9556e1 100644 --- a/packages/common/src/ide/normalized/NormalizedIDE.ts +++ b/packages/common/src/ide/normalized/NormalizedIDE.ts @@ -1,14 +1,14 @@ import { getFixturePath } from "../../index"; -import { GeneralizedRange } from "../../types/GeneralizedRange"; -import { TextEditor } from "../../types/TextEditor"; -import FakeClipboard from "../fake/FakeClipboard"; -import FakeConfiguration from "../fake/FakeConfiguration"; -import FakeGlobalState from "../fake/FakeGlobalState"; -import FakeIDE from "../fake/FakeIDE"; +import type { GeneralizedRange } from "../../types/GeneralizedRange"; +import type { TextEditor } from "../../types/TextEditor"; +import type FakeClipboard from "../fake/FakeClipboard"; +import type FakeConfiguration from "../fake/FakeConfiguration"; +import type FakeGlobalState from "../fake/FakeGlobalState"; +import type FakeIDE from "../fake/FakeIDE"; import PassthroughIDEBase from "../PassthroughIDEBase"; -import { FlashDescriptor } from "../types/FlashDescriptor"; +import type { FlashDescriptor } from "../types/FlashDescriptor"; import type { IDE } from "../types/ide.types"; -import { QuickPickOptions } from "../types/QuickPickOptions"; +import type { QuickPickOptions } from "../types/QuickPickOptions"; export class NormalizedIDE extends PassthroughIDEBase { configuration: FakeConfiguration; diff --git a/packages/common/src/ide/spy/SpyIDE.ts b/packages/common/src/ide/spy/SpyIDE.ts index 716b2113f4..6a6d2e46b9 100644 --- a/packages/common/src/ide/spy/SpyIDE.ts +++ b/packages/common/src/ide/spy/SpyIDE.ts @@ -1,10 +1,11 @@ import { pickBy, values } from "lodash"; -import { GeneralizedRange } from "../../types/GeneralizedRange"; -import { TextEditor } from "../../types/TextEditor"; +import type { GeneralizedRange } from "../../types/GeneralizedRange"; +import type { TextEditor } from "../../types/TextEditor"; import PassthroughIDEBase from "../PassthroughIDEBase"; -import { FlashDescriptor } from "../types/FlashDescriptor"; +import type { FlashDescriptor } from "../types/FlashDescriptor"; import type { HighlightId, IDE } from "../types/ide.types"; -import SpyMessages, { Message } from "./SpyMessages"; +import type { Message } from "./SpyMessages"; +import SpyMessages from "./SpyMessages"; interface Highlight { highlightId: HighlightId | undefined; diff --git a/packages/common/src/ide/types/Capabilities.ts b/packages/common/src/ide/types/Capabilities.ts index fc34a134d4..89a9d9ba85 100644 --- a/packages/common/src/ide/types/Capabilities.ts +++ b/packages/common/src/ide/types/Capabilities.ts @@ -1,4 +1,4 @@ -import { CommandId } from "./CommandId"; +import type { CommandId } from "./CommandId"; export interface Capabilities { readonly commands: CommandCapabilityMap; diff --git a/packages/common/src/ide/types/Configuration.ts b/packages/common/src/ide/types/Configuration.ts index 6ee3a7bc87..60ef078024 100644 --- a/packages/common/src/ide/types/Configuration.ts +++ b/packages/common/src/ide/types/Configuration.ts @@ -1,7 +1,7 @@ -import { Listener } from "../.."; +import type { Listener } from "../.."; import { HatStability } from "./HatStability"; -import { Disposable } from "./ide.types"; -import { GetFieldType, Paths } from "./Paths"; +import type { Disposable } from "./ide.types"; +import type { GetFieldType, Paths } from "./Paths"; export type CursorlessConfiguration = { tokenHatSplittingMode: TokenHatSplittingMode; diff --git a/packages/common/src/ide/types/FileSystem.types.ts b/packages/common/src/ide/types/FileSystem.types.ts index 15818b3633..535a9b39bb 100644 --- a/packages/common/src/ide/types/FileSystem.types.ts +++ b/packages/common/src/ide/types/FileSystem.types.ts @@ -1,4 +1,4 @@ -import { Disposable } from "./ide.types"; +import type { Disposable } from "./ide.types"; export type PathChangeListener = () => void; diff --git a/packages/common/src/ide/types/FlashDescriptor.ts b/packages/common/src/ide/types/FlashDescriptor.ts index 9694dcb907..db9613b588 100644 --- a/packages/common/src/ide/types/FlashDescriptor.ts +++ b/packages/common/src/ide/types/FlashDescriptor.ts @@ -1,5 +1,5 @@ -import { TextEditor } from "../.."; -import { GeneralizedRange } from "../../types/GeneralizedRange"; +import type { TextEditor } from "../.."; +import type { GeneralizedRange } from "../../types/GeneralizedRange"; export enum FlashStyle { pendingDelete = "pendingDelete", diff --git a/packages/common/src/ide/types/Hats.ts b/packages/common/src/ide/types/Hats.ts index ce7bf5cc4a..72cf1f7dea 100644 --- a/packages/common/src/ide/types/Hats.ts +++ b/packages/common/src/ide/types/Hats.ts @@ -1,8 +1,8 @@ -import { Range } from "../../types/Range"; -import { TextEditor } from "../../types/TextEditor"; -import { Listener } from "../../util/Notifier"; +import type { Range } from "../../types/Range"; +import type { TextEditor } from "../../types/TextEditor"; +import type { Listener } from "../../util/Notifier"; import type { HatStyleName } from "./hatStyles.types"; -import { Disposable } from "./ide.types"; +import type { Disposable } from "./ide.types"; export interface HatRange { styleName: HatStyleName; diff --git a/packages/common/src/ide/types/ide.types.ts b/packages/common/src/ide/types/ide.types.ts index c99e1e711d..c07a756156 100644 --- a/packages/common/src/ide/types/ide.types.ts +++ b/packages/common/src/ide/types/ide.types.ts @@ -4,21 +4,21 @@ import type { TextDocument, TextEditor, } from "../.."; -import { URI } from "vscode-uri"; -import { GeneralizedRange } from "../../types/GeneralizedRange"; -import { Capabilities } from "./Capabilities"; -import { Clipboard } from "./Clipboard"; -import { Configuration } from "./Configuration"; -import { TextDocumentChangeEvent } from "./Events"; -import { +import type { URI } from "vscode-uri"; +import type { GeneralizedRange } from "../../types/GeneralizedRange"; +import type { Capabilities } from "./Capabilities"; +import type { Clipboard } from "./Clipboard"; +import type { Configuration } from "./Configuration"; +import type { TextDocumentChangeEvent } from "./Events"; +import type { Event, TextEditorSelectionChangeEvent, TextEditorVisibleRangesChangeEvent, } from "./events.types"; -import { FlashDescriptor } from "./FlashDescriptor"; -import { Messages } from "./Messages"; -import { QuickPickOptions } from "./QuickPickOptions"; -import { State } from "./State"; +import type { FlashDescriptor } from "./FlashDescriptor"; +import type { Messages } from "./Messages"; +import type { QuickPickOptions } from "./QuickPickOptions"; +import type { State } from "./State"; export type RunMode = "production" | "development" | "test"; export type HighlightId = string; diff --git a/packages/common/src/ide/util/messages.ts b/packages/common/src/ide/util/messages.ts index 85ffce897d..26565eb9b8 100644 --- a/packages/common/src/ide/util/messages.ts +++ b/packages/common/src/ide/util/messages.ts @@ -1,4 +1,5 @@ -import { MessageId, Messages, MessageType } from "../types/Messages"; +import type { MessageId, Messages } from "../types/Messages"; +import { MessageType } from "../types/Messages"; /** * Displays a warning message {@link message} to the user along with possible diff --git a/packages/common/src/testUtil/TestCaseSnapshot.ts b/packages/common/src/testUtil/TestCaseSnapshot.ts index 3c7649bc6b..d756ea21bf 100644 --- a/packages/common/src/testUtil/TestCaseSnapshot.ts +++ b/packages/common/src/testUtil/TestCaseSnapshot.ts @@ -1,4 +1,4 @@ -import { +import type { RangePlainObject, SelectionPlainObject, SerializedMarks, diff --git a/packages/common/src/testUtil/extractTargetedMarks.ts b/packages/common/src/testUtil/extractTargetedMarks.ts index 1e65431260..b1ebcd8ec3 100644 --- a/packages/common/src/testUtil/extractTargetedMarks.ts +++ b/packages/common/src/testUtil/extractTargetedMarks.ts @@ -1,6 +1,6 @@ import { splitKey } from ".."; -import { ReadOnlyHatMap } from "../types/HatTokenMap"; -import { Token } from "../types/Token"; +import type { ReadOnlyHatMap } from "../types/HatTokenMap"; +import type { Token } from "../types/Token"; export function extractTargetedMarks( targetKeys: string[], diff --git a/packages/common/src/testUtil/serializeTestFixture.ts b/packages/common/src/testUtil/serializeTestFixture.ts index 4e49c08303..4fff821620 100644 --- a/packages/common/src/testUtil/serializeTestFixture.ts +++ b/packages/common/src/testUtil/serializeTestFixture.ts @@ -1,5 +1,5 @@ -import { TestCaseFixtureLegacy } from "../types/TestCaseFixture"; -import { EnforceUndefined } from "../util/typeUtils"; +import type { TestCaseFixtureLegacy } from "../types/TestCaseFixture"; +import type { EnforceUndefined } from "../util/typeUtils"; import { serialize } from "./serialize"; function reorderFields( diff --git a/packages/common/src/testUtil/toPlainObject.ts b/packages/common/src/testUtil/toPlainObject.ts index 626378603d..0d89d4c808 100644 --- a/packages/common/src/testUtil/toPlainObject.ts +++ b/packages/common/src/testUtil/toPlainObject.ts @@ -4,10 +4,11 @@ import type { LineRange, Message, SpyIDERecordedValues, + FlashStyle, } from ".."; -import { FlashStyle, isLineRange } from ".."; -import { Token } from "../types/Token"; -import { Selection } from "../types/Selection"; +import { isLineRange } from ".."; +import type { Token } from "../types/Token"; +import type { Selection } from "../types/Selection"; export type PositionPlainObject = { line: number; diff --git a/packages/common/src/types/GeneralizedRange.ts b/packages/common/src/types/GeneralizedRange.ts index 1161d7b01c..e89bd924de 100644 --- a/packages/common/src/types/GeneralizedRange.ts +++ b/packages/common/src/types/GeneralizedRange.ts @@ -1,6 +1,6 @@ -import { Position } from "./Position"; -import { Range } from "./Range"; -import { TextEditor } from "./TextEditor"; +import type { Position } from "./Position"; +import type { Range } from "./Range"; +import type { TextEditor } from "./TextEditor"; /** * A range of lines in a document, unlike the standard {@link Range}, which is diff --git a/packages/common/src/types/HatTokenMap.ts b/packages/common/src/types/HatTokenMap.ts index ee2f8dc398..ec60d1a8d6 100644 --- a/packages/common/src/types/HatTokenMap.ts +++ b/packages/common/src/types/HatTokenMap.ts @@ -1,6 +1,6 @@ -import { HatStyleName } from "../ide/types/hatStyles.types"; -import { Range } from "./Range"; -import { Token } from "./Token"; +import type { HatStyleName } from "../ide/types/hatStyles.types"; +import type { Range } from "./Range"; +import type { Token } from "./Token"; /** * Maps from (hatStyle, character) pairs to tokens diff --git a/packages/common/src/types/TestCaseFixture.ts b/packages/common/src/types/TestCaseFixture.ts index 7d991ae141..fc0758c23b 100644 --- a/packages/common/src/types/TestCaseFixture.ts +++ b/packages/common/src/types/TestCaseFixture.ts @@ -1,6 +1,6 @@ -import { Command, CommandLatest } from ".."; -import { TestCaseSnapshot } from "../testUtil/TestCaseSnapshot"; -import { PlainSpyIDERecordedValues } from "../testUtil/toPlainObject"; +import type { Command, CommandLatest } from ".."; +import type { TestCaseSnapshot } from "../testUtil/TestCaseSnapshot"; +import type { PlainSpyIDERecordedValues } from "../testUtil/toPlainObject"; export type ThrownError = { name: string; diff --git a/packages/common/src/types/Token.ts b/packages/common/src/types/Token.ts index e07d28c819..f88b0b8bf2 100644 --- a/packages/common/src/types/Token.ts +++ b/packages/common/src/types/Token.ts @@ -1,9 +1,9 @@ /** * A token within a text editor */ -import { Range } from "./Range"; -import { RangeOffsets } from "./RangeOffsets"; -import { TextEditor } from "./TextEditor"; +import type { Range } from "./Range"; +import type { RangeOffsets } from "./RangeOffsets"; +import type { TextEditor } from "./TextEditor"; /** * A token within a text editor diff --git a/packages/common/src/types/command/ActionDescriptor.ts b/packages/common/src/types/command/ActionDescriptor.ts index b465d81e67..b28b6ea115 100644 --- a/packages/common/src/types/command/ActionDescriptor.ts +++ b/packages/common/src/types/command/ActionDescriptor.ts @@ -1,8 +1,8 @@ -import { +import type { PartialTargetDescriptor, ScopeType, } from "./PartialTargetDescriptor.types"; -import { DestinationDescriptor } from "./DestinationDescriptor.types"; +import type { DestinationDescriptor } from "./DestinationDescriptor.types"; /** * A simple action takes only a single target and no other arguments. diff --git a/packages/common/src/types/command/DestinationDescriptor.types.ts b/packages/common/src/types/command/DestinationDescriptor.types.ts index 7d04a8b0a6..c1168fa06d 100644 --- a/packages/common/src/types/command/DestinationDescriptor.types.ts +++ b/packages/common/src/types/command/DestinationDescriptor.types.ts @@ -1,4 +1,4 @@ -import { +import type { PartialListTargetDescriptor, PartialPrimitiveTargetDescriptor, PartialRangeTargetDescriptor, diff --git a/packages/common/src/types/command/command.types.ts b/packages/common/src/types/command/command.types.ts index 6dc0f9cad5..d6978debe5 100644 --- a/packages/common/src/types/command/command.types.ts +++ b/packages/common/src/types/command/command.types.ts @@ -1,4 +1,4 @@ -import { CommandV6 } from "./CommandV6.types"; +import type { CommandV6 } from "./CommandV6.types"; import type { CommandV0, CommandV1 } from "./legacy/CommandV0V1.types"; import type { CommandV2 } from "./legacy/CommandV2.types"; import type { CommandV3 } from "./legacy/CommandV3.types"; diff --git a/packages/common/src/types/command/legacy/CommandV3.types.ts b/packages/common/src/types/command/legacy/CommandV3.types.ts index 72ab67fbc8..fa055cad3f 100644 --- a/packages/common/src/types/command/legacy/CommandV3.types.ts +++ b/packages/common/src/types/command/legacy/CommandV3.types.ts @@ -1,4 +1,4 @@ -import { PartialTargetDescriptorV3 } from "./PartialTargetDescriptorV3.types"; +import type { PartialTargetDescriptorV3 } from "./PartialTargetDescriptorV3.types"; type ActionType = | "callAsFunction" diff --git a/packages/common/src/types/command/legacy/CommandV4.types.ts b/packages/common/src/types/command/legacy/CommandV4.types.ts index 31d839e76e..4c999f6a6c 100644 --- a/packages/common/src/types/command/legacy/CommandV4.types.ts +++ b/packages/common/src/types/command/legacy/CommandV4.types.ts @@ -1,4 +1,4 @@ -import { PartialTargetDescriptorV4 } from "./PartialTargetDescriptorV4.types"; +import type { PartialTargetDescriptorV4 } from "./PartialTargetDescriptorV4.types"; type ActionType = | "callAsFunction" diff --git a/packages/common/src/types/generalizedRangeTouches.test.ts b/packages/common/src/types/generalizedRangeTouches.test.ts index d5d595eab0..af579135f8 100644 --- a/packages/common/src/types/generalizedRangeTouches.test.ts +++ b/packages/common/src/types/generalizedRangeTouches.test.ts @@ -1,5 +1,6 @@ import assert = require("assert"); -import { GeneralizedRange, generalizedRangeTouches, Position } from ".."; +import type { GeneralizedRange } from ".."; +import { generalizedRangeTouches, Position } from ".."; suite("generalizedRangeTouches", () => { test("character", () => { diff --git a/packages/common/src/types/location.types.ts b/packages/common/src/types/location.types.ts index 7496f47f0b..9b6a0b3b3b 100644 --- a/packages/common/src/types/location.types.ts +++ b/packages/common/src/types/location.types.ts @@ -1,5 +1,5 @@ -import { Range } from "./Range"; -import { TextEditor } from "./TextEditor"; +import type { Range } from "./Range"; +import type { TextEditor } from "./TextEditor"; export interface TextEditorRange { editor: TextEditor; diff --git a/packages/common/src/types/snippet.types.ts b/packages/common/src/types/snippet.types.ts index 9145a888db..4262e13736 100644 --- a/packages/common/src/types/snippet.types.ts +++ b/packages/common/src/types/snippet.types.ts @@ -1,5 +1,5 @@ -import { TextFormatterName } from "../util/textFormatters"; -import { SimpleScopeTypeType } from "./command/PartialTargetDescriptor.types"; +import type { TextFormatterName } from "../util/textFormatters"; +import type { SimpleScopeTypeType } from "./command/PartialTargetDescriptor.types"; export interface SnippetScope { /** diff --git a/packages/common/src/util/range.ts b/packages/common/src/util/range.ts index 8ea42b9d06..1b5bdb7a8a 100644 --- a/packages/common/src/util/range.ts +++ b/packages/common/src/util/range.ts @@ -1,6 +1,6 @@ import { range as lodashRange } from "lodash"; -import { Range } from "../types/Range"; -import { TextEditor } from "../types/TextEditor"; +import type { Range } from "../types/Range"; +import type { TextEditor } from "../types/TextEditor"; /** * @param editor The editor containing the range diff --git a/packages/cursorless-engine/src/CommandRunner.ts b/packages/cursorless-engine/src/CommandRunner.ts index 39942f1226..d92ce03b36 100644 --- a/packages/cursorless-engine/src/CommandRunner.ts +++ b/packages/cursorless-engine/src/CommandRunner.ts @@ -1,4 +1,4 @@ -import { CommandComplete } from "@cursorless/common"; +import type { CommandComplete } from "@cursorless/common"; export interface CommandRunner { run(command: CommandComplete): Promise; diff --git a/packages/cursorless-engine/src/ScopeVisualizer/ScopeRangeProvider.ts b/packages/cursorless-engine/src/ScopeVisualizer/ScopeRangeProvider.ts index 62f39039f9..76a5308f9d 100644 --- a/packages/cursorless-engine/src/ScopeVisualizer/ScopeRangeProvider.ts +++ b/packages/cursorless-engine/src/ScopeVisualizer/ScopeRangeProvider.ts @@ -1,12 +1,12 @@ -import { TextEditor } from "@cursorless/common"; -import { +import type { TextEditor } from "@cursorless/common"; +import type { IterationScopeRangeConfig, IterationScopeRanges, ScopeRangeConfig, ScopeRanges, } from ".."; -import { ModifierStageFactory } from "../processTargets/ModifierStageFactory"; -import { ScopeHandlerFactory } from "../processTargets/modifiers/scopeHandlers/ScopeHandlerFactory"; +import type { ModifierStageFactory } from "../processTargets/ModifierStageFactory"; +import type { ScopeHandlerFactory } from "../processTargets/modifiers/scopeHandlers/ScopeHandlerFactory"; import { getIterationRange } from "./getIterationRange"; import { getIterationScopeRanges } from "./getIterationScopeRanges"; import { getScopeRanges } from "./getScopeRanges"; diff --git a/packages/cursorless-engine/src/ScopeVisualizer/ScopeRangeWatcher.ts b/packages/cursorless-engine/src/ScopeVisualizer/ScopeRangeWatcher.ts index 6a4a7971b5..6034ea67df 100644 --- a/packages/cursorless-engine/src/ScopeVisualizer/ScopeRangeWatcher.ts +++ b/packages/cursorless-engine/src/ScopeVisualizer/ScopeRangeWatcher.ts @@ -1,6 +1,7 @@ -import { Disposable, showError } from "@cursorless/common"; +import type { Disposable } from "@cursorless/common"; +import { showError } from "@cursorless/common"; import { pull } from "lodash"; -import { +import type { IterationScopeChangeEventCallback, IterationScopeRangeConfig, ScopeChangeEventCallback, @@ -8,9 +9,9 @@ import { ScopeRanges, } from ".."; import { Debouncer } from "../core/Debouncer"; -import { LanguageDefinitions } from "../languages/LanguageDefinitions"; +import type { LanguageDefinitions } from "../languages/LanguageDefinitions"; import { ide } from "../singletons/ide.singleton"; -import { ScopeRangeProvider } from "./ScopeRangeProvider"; +import type { ScopeRangeProvider } from "./ScopeRangeProvider"; /** * Watches for changes to the scope ranges of visible editors and notifies diff --git a/packages/cursorless-engine/src/ScopeVisualizer/ScopeSupportChecker.ts b/packages/cursorless-engine/src/ScopeVisualizer/ScopeSupportChecker.ts index d9ee8f1664..a19b40e0c0 100644 --- a/packages/cursorless-engine/src/ScopeVisualizer/ScopeSupportChecker.ts +++ b/packages/cursorless-engine/src/ScopeVisualizer/ScopeSupportChecker.ts @@ -1,14 +1,13 @@ -import { - Position, +import type { ScopeType, SimpleScopeTypeType, TextEditor, - isEmptyIterable, } from "@cursorless/common"; -import { LegacyLanguageId } from "../languages/LegacyLanguageId"; +import { Position, isEmptyIterable } from "@cursorless/common"; +import type { LegacyLanguageId } from "../languages/LegacyLanguageId"; import { languageMatchers } from "../languages/getNodeMatcher"; -import { ScopeHandlerFactory } from "../processTargets/modifiers/scopeHandlers/ScopeHandlerFactory"; -import { ScopeHandler } from "../processTargets/modifiers/scopeHandlers/scopeHandler.types"; +import type { ScopeHandlerFactory } from "../processTargets/modifiers/scopeHandlers/ScopeHandlerFactory"; +import type { ScopeHandler } from "../processTargets/modifiers/scopeHandlers/scopeHandler.types"; import { ScopeSupport } from "../api/ScopeProvider"; /** diff --git a/packages/cursorless-engine/src/ScopeVisualizer/getIterationRange.ts b/packages/cursorless-engine/src/ScopeVisualizer/getIterationRange.ts index 38ccc0215c..6dd2c576e2 100644 --- a/packages/cursorless-engine/src/ScopeVisualizer/getIterationRange.ts +++ b/packages/cursorless-engine/src/ScopeVisualizer/getIterationRange.ts @@ -1,6 +1,6 @@ -import { Range, TextEditor } from "@cursorless/common"; +import type { Range, TextEditor } from "@cursorless/common"; import { last } from "lodash"; -import { ScopeHandler } from "../processTargets/modifiers/scopeHandlers/scopeHandler.types"; +import type { ScopeHandler } from "../processTargets/modifiers/scopeHandlers/scopeHandler.types"; /** * Get the range to iterate over for the given editor. diff --git a/packages/cursorless-engine/src/ScopeVisualizer/getIterationScopeRanges.ts b/packages/cursorless-engine/src/ScopeVisualizer/getIterationScopeRanges.ts index feb42bffe9..2c44f0dca2 100644 --- a/packages/cursorless-engine/src/ScopeVisualizer/getIterationScopeRanges.ts +++ b/packages/cursorless-engine/src/ScopeVisualizer/getIterationScopeRanges.ts @@ -1,9 +1,9 @@ -import { Range, TextEditor } from "@cursorless/common"; +import type { Range, TextEditor } from "@cursorless/common"; import { map } from "itertools"; -import { IterationScopeRanges } from ".."; -import { ModifierStage } from "../processTargets/PipelineStages.types"; -import { ScopeHandler } from "../processTargets/modifiers/scopeHandlers/scopeHandler.types"; -import { Target } from "../typings/target.types"; +import type { IterationScopeRanges } from ".."; +import type { ModifierStage } from "../processTargets/PipelineStages.types"; +import type { ScopeHandler } from "../processTargets/modifiers/scopeHandlers/scopeHandler.types"; +import type { Target } from "../typings/target.types"; import { getTargetRanges } from "./getTargetRanges"; /** diff --git a/packages/cursorless-engine/src/ScopeVisualizer/getScopeRanges.ts b/packages/cursorless-engine/src/ScopeVisualizer/getScopeRanges.ts index 56e47dde50..a04a3b5fe7 100644 --- a/packages/cursorless-engine/src/ScopeVisualizer/getScopeRanges.ts +++ b/packages/cursorless-engine/src/ScopeVisualizer/getScopeRanges.ts @@ -1,7 +1,7 @@ -import { Range, TextEditor } from "@cursorless/common"; +import type { Range, TextEditor } from "@cursorless/common"; import { map } from "itertools"; -import { ScopeRanges } from ".."; -import { ScopeHandler } from "../processTargets/modifiers/scopeHandlers/scopeHandler.types"; +import type { ScopeRanges } from ".."; +import type { ScopeHandler } from "../processTargets/modifiers/scopeHandlers/scopeHandler.types"; import { getTargetRanges } from "./getTargetRanges"; /** diff --git a/packages/cursorless-engine/src/ScopeVisualizer/getTargetRanges.ts b/packages/cursorless-engine/src/ScopeVisualizer/getTargetRanges.ts index 5fd843310c..26b9016371 100644 --- a/packages/cursorless-engine/src/ScopeVisualizer/getTargetRanges.ts +++ b/packages/cursorless-engine/src/ScopeVisualizer/getTargetRanges.ts @@ -1,6 +1,6 @@ import { toCharacterRange, toLineRange } from "@cursorless/common"; -import { Target } from "../typings/target.types"; -import { TargetRanges } from "../api/ScopeProvider"; +import type { Target } from "../typings/target.types"; +import type { TargetRanges } from "../api/ScopeProvider"; export function getTargetRanges(target: Target): TargetRanges { return { diff --git a/packages/cursorless-engine/src/actions/Actions.ts b/packages/cursorless-engine/src/actions/Actions.ts index 5b70327b0e..4b78632e07 100644 --- a/packages/cursorless-engine/src/actions/Actions.ts +++ b/packages/cursorless-engine/src/actions/Actions.ts @@ -1,6 +1,6 @@ -import { Snippets } from "../core/Snippets"; -import { RangeUpdater } from "../core/updateSelections/RangeUpdater"; -import { ModifierStageFactory } from "../processTargets/ModifierStageFactory"; +import type { Snippets } from "../core/Snippets"; +import type { RangeUpdater } from "../core/updateSelections/RangeUpdater"; +import type { ModifierStageFactory } from "../processTargets/ModifierStageFactory"; import { Bring, Move, Swap } from "./BringMoveSwap"; import Call from "./Call"; import Clear from "./Clear"; @@ -56,7 +56,7 @@ import { Random, Reverse, Sort } from "./Sort"; import ToggleBreakpoint from "./ToggleBreakpoint"; import Wrap from "./Wrap"; import WrapWithSnippet from "./WrapWithSnippet"; -import { ActionRecord } from "./actions.types"; +import type { ActionRecord } from "./actions.types"; /** * Keeps a map from action names to objects that implement the given action diff --git a/packages/cursorless-engine/src/actions/BringMoveSwap.ts b/packages/cursorless-engine/src/actions/BringMoveSwap.ts index 16fb9c939a..4ac02b609a 100644 --- a/packages/cursorless-engine/src/actions/BringMoveSwap.ts +++ b/packages/cursorless-engine/src/actions/BringMoveSwap.ts @@ -1,19 +1,14 @@ -import { - FlashStyle, - Range, - RangeExpansionBehavior, - Selection, - TextEditor, -} from "@cursorless/common"; +import type { Range, Selection, TextEditor } from "@cursorless/common"; +import { FlashStyle, RangeExpansionBehavior } from "@cursorless/common"; import { flatten } from "lodash"; -import { RangeUpdater } from "../core/updateSelections/RangeUpdater"; +import type { RangeUpdater } from "../core/updateSelections/RangeUpdater"; import { getSelectionInfo, performEditsAndUpdateFullSelectionInfos, } from "../core/updateSelections/updateSelections"; import { ide } from "../singletons/ide.singleton"; -import { EditWithRangeUpdater } from "../typings/Types"; -import { Destination, Target } from "../typings/target.types"; +import type { EditWithRangeUpdater } from "../typings/Types"; +import type { Destination, Target } from "../typings/target.types"; import { setSelectionsWithoutFocusingEditor } from "../util/setSelectionsAndFocusEditor"; import { flashTargets, @@ -21,7 +16,7 @@ import { runForEachEditor, } from "../util/targetUtils"; import { unifyRemovalTargets } from "../util/unifyRanges"; -import { ActionReturnValue } from "./actions.types"; +import type { ActionReturnValue } from "./actions.types"; type ActionType = "bring" | "move" | "swap"; diff --git a/packages/cursorless-engine/src/actions/Call.ts b/packages/cursorless-engine/src/actions/Call.ts index 501bd4dbc6..d78ef4d94d 100644 --- a/packages/cursorless-engine/src/actions/Call.ts +++ b/packages/cursorless-engine/src/actions/Call.ts @@ -1,7 +1,7 @@ -import { Target } from "../typings/target.types"; +import type { Target } from "../typings/target.types"; import { ensureSingleTarget } from "../util/targetUtils"; -import { Actions } from "./Actions"; -import { ActionReturnValue } from "./actions.types"; +import type { Actions } from "./Actions"; +import type { ActionReturnValue } from "./actions.types"; export default class Call { constructor(private actions: Actions) { diff --git a/packages/cursorless-engine/src/actions/CallbackAction.ts b/packages/cursorless-engine/src/actions/CallbackAction.ts index e3b0810292..61ff61fae0 100644 --- a/packages/cursorless-engine/src/actions/CallbackAction.ts +++ b/packages/cursorless-engine/src/actions/CallbackAction.ts @@ -1,10 +1,11 @@ -import { EditableTextEditor, FlashStyle, TextEditor } from "@cursorless/common"; +import type { EditableTextEditor, TextEditor } from "@cursorless/common"; +import { FlashStyle } from "@cursorless/common"; import { flatten } from "lodash"; import { selectionToStoredTarget } from "../core/commandRunner/selectionToStoredTarget"; -import { RangeUpdater } from "../core/updateSelections/RangeUpdater"; +import type { RangeUpdater } from "../core/updateSelections/RangeUpdater"; import { callFunctionAndUpdateSelections } from "../core/updateSelections/updateSelections"; import { ide } from "../singletons/ide.singleton"; -import { Target } from "../typings/target.types"; +import type { Target } from "../typings/target.types"; import { setSelectionsAndFocusEditor, setSelectionsWithoutFocusingEditor, @@ -16,7 +17,7 @@ import { runOnTargetsForEachEditor, runOnTargetsForEachEditorSequentially, } from "../util/targetUtils"; -import { ActionReturnValue } from "./actions.types"; +import type { ActionReturnValue } from "./actions.types"; interface CallbackOptions { callback: (editor: EditableTextEditor, targets: Target[]) => Promise; diff --git a/packages/cursorless-engine/src/actions/Clear.ts b/packages/cursorless-engine/src/actions/Clear.ts index 8540d1c533..f506e82f1e 100644 --- a/packages/cursorless-engine/src/actions/Clear.ts +++ b/packages/cursorless-engine/src/actions/Clear.ts @@ -1,10 +1,10 @@ import { PlainTarget } from "../processTargets/targets"; import { ide } from "../singletons/ide.singleton"; -import { Target } from "../typings/target.types"; +import type { Target } from "../typings/target.types"; import { setSelectionsAndFocusEditor } from "../util/setSelectionsAndFocusEditor"; import { ensureSingleEditor } from "../util/targetUtils"; -import { Actions } from "./Actions"; -import { SimpleAction, ActionReturnValue } from "./actions.types"; +import type { Actions } from "./Actions"; +import type { SimpleAction, ActionReturnValue } from "./actions.types"; export default class Clear implements SimpleAction { constructor(private actions: Actions) { diff --git a/packages/cursorless-engine/src/actions/CutToClipboard.ts b/packages/cursorless-engine/src/actions/CutToClipboard.ts index 5e92832dde..a5c93f114a 100644 --- a/packages/cursorless-engine/src/actions/CutToClipboard.ts +++ b/packages/cursorless-engine/src/actions/CutToClipboard.ts @@ -1,14 +1,14 @@ +import type { FlashDescriptor } from "@cursorless/common"; import { - FlashDescriptor, FlashStyle, Range, toCharacterRange, toLineRange, } from "@cursorless/common"; import { ide } from "../singletons/ide.singleton"; -import { Target } from "../typings/target.types"; -import { Actions } from "./Actions"; -import { SimpleAction, ActionReturnValue } from "./actions.types"; +import type { Target } from "../typings/target.types"; +import type { Actions } from "./Actions"; +import type { SimpleAction, ActionReturnValue } from "./actions.types"; export class CutToClipboard implements SimpleAction { constructor(private actions: Actions) { diff --git a/packages/cursorless-engine/src/actions/Deselect.ts b/packages/cursorless-engine/src/actions/Deselect.ts index 7534e77de0..5ad4a11ceb 100644 --- a/packages/cursorless-engine/src/actions/Deselect.ts +++ b/packages/cursorless-engine/src/actions/Deselect.ts @@ -1,8 +1,8 @@ import { ide } from "../singletons/ide.singleton"; -import { Target } from "../typings/target.types"; +import type { Target } from "../typings/target.types"; import { setSelectionsWithoutFocusingEditor } from "../util/setSelectionsAndFocusEditor"; import { runOnTargetsForEachEditor } from "../util/targetUtils"; -import { SimpleAction, ActionReturnValue } from "./actions.types"; +import type { SimpleAction, ActionReturnValue } from "./actions.types"; export default class Deselect implements SimpleAction { constructor() { diff --git a/packages/cursorless-engine/src/actions/EditNew/EditNew.ts b/packages/cursorless-engine/src/actions/EditNew/EditNew.ts index e6c2d178be..30259bc391 100644 --- a/packages/cursorless-engine/src/actions/EditNew/EditNew.ts +++ b/packages/cursorless-engine/src/actions/EditNew/EditNew.ts @@ -1,11 +1,11 @@ -import { RangeUpdater } from "../../core/updateSelections/RangeUpdater"; +import type { RangeUpdater } from "../../core/updateSelections/RangeUpdater"; import { ide } from "../../singletons/ide.singleton"; -import { Destination } from "../../typings/target.types"; +import type { Destination } from "../../typings/target.types"; import { setSelectionsAndFocusEditor } from "../../util/setSelectionsAndFocusEditor"; import { createThatMark, ensureSingleEditor } from "../../util/targetUtils"; -import { Actions } from "../Actions"; -import { ActionReturnValue } from "../actions.types"; -import { State } from "./EditNew.types"; +import type { Actions } from "../Actions"; +import type { ActionReturnValue } from "../actions.types"; +import type { State } from "./EditNew.types"; import { runEditTargets } from "./runEditTargets"; import { runInsertLineAfterTargets } from "./runInsertLineAfterTargets"; import { runEditNewNotebookCellTargets } from "./runNotebookCellTargets"; diff --git a/packages/cursorless-engine/src/actions/EditNew/runEditTargets.ts b/packages/cursorless-engine/src/actions/EditNew/runEditTargets.ts index 6eb7756924..3687ccf834 100644 --- a/packages/cursorless-engine/src/actions/EditNew/runEditTargets.ts +++ b/packages/cursorless-engine/src/actions/EditNew/runEditTargets.ts @@ -1,12 +1,9 @@ -import { - EditableTextEditor, - RangeExpansionBehavior, - Selection, -} from "@cursorless/common"; +import type { EditableTextEditor, Selection } from "@cursorless/common"; +import { RangeExpansionBehavior } from "@cursorless/common"; import { zip } from "lodash"; -import { RangeUpdater } from "../../core/updateSelections/RangeUpdater"; +import type { RangeUpdater } from "../../core/updateSelections/RangeUpdater"; import { performEditsAndUpdateSelectionsWithBehavior } from "../../core/updateSelections/updateSelections"; -import { EditDestination, State } from "./EditNew.types"; +import type { EditDestination, State } from "./EditNew.types"; /** * Handle targets that will use an edit action to insert a new target, and diff --git a/packages/cursorless-engine/src/actions/EditNew/runInsertLineAfterTargets.ts b/packages/cursorless-engine/src/actions/EditNew/runInsertLineAfterTargets.ts index b816d79df9..f7d8eaa6b9 100644 --- a/packages/cursorless-engine/src/actions/EditNew/runInsertLineAfterTargets.ts +++ b/packages/cursorless-engine/src/actions/EditNew/runInsertLineAfterTargets.ts @@ -1,7 +1,7 @@ -import { EditableTextEditor } from "@cursorless/common"; -import { RangeUpdater } from "../../core/updateSelections/RangeUpdater"; +import type { EditableTextEditor } from "@cursorless/common"; +import type { RangeUpdater } from "../../core/updateSelections/RangeUpdater"; import { callFunctionAndUpdateRanges } from "../../core/updateSelections/updateSelections"; -import { EditDestination, State } from "./EditNew.types"; +import type { EditDestination, State } from "./EditNew.types"; /** * Handle targets that will use a VSCode command to insert a new target, eg diff --git a/packages/cursorless-engine/src/actions/EditNew/runNotebookCellTargets.ts b/packages/cursorless-engine/src/actions/EditNew/runNotebookCellTargets.ts index 2cfeaf548e..4e3ab43929 100644 --- a/packages/cursorless-engine/src/actions/EditNew/runNotebookCellTargets.ts +++ b/packages/cursorless-engine/src/actions/EditNew/runNotebookCellTargets.ts @@ -1,9 +1,9 @@ -import { Selection } from "@cursorless/common"; +import type { Selection } from "@cursorless/common"; import { ide } from "../../singletons/ide.singleton"; -import { Destination } from "../../typings/target.types"; +import type { Destination } from "../../typings/target.types"; import { createThatMark, ensureSingleTarget } from "../../util/targetUtils"; -import { Actions } from "../Actions"; -import { ActionReturnValue } from "../actions.types"; +import type { Actions } from "../Actions"; +import type { ActionReturnValue } from "../actions.types"; export async function runEditNewNotebookCellTargets( actions: Actions, diff --git a/packages/cursorless-engine/src/actions/EditNewLineAction.ts b/packages/cursorless-engine/src/actions/EditNewLineAction.ts index 624bcc786e..d5c02f6f5a 100644 --- a/packages/cursorless-engine/src/actions/EditNewLineAction.ts +++ b/packages/cursorless-engine/src/actions/EditNewLineAction.ts @@ -1,8 +1,12 @@ -import { ModifierStageFactory } from "../processTargets/ModifierStageFactory"; -import { ModifierStage } from "../processTargets/PipelineStages.types"; +import type { ModifierStageFactory } from "../processTargets/ModifierStageFactory"; +import type { ModifierStage } from "../processTargets/PipelineStages.types"; import { containingLineIfUntypedModifier } from "../processTargets/modifiers/commonContainingScopeIfUntypedModifiers"; -import { Target } from "../typings/target.types"; -import { ActionRecord, ActionReturnValue, SimpleAction } from "./actions.types"; +import type { Target } from "../typings/target.types"; +import type { + ActionRecord, + ActionReturnValue, + SimpleAction, +} from "./actions.types"; abstract class EditNewLineAction implements SimpleAction { getFinalStages(): ModifierStage[] { diff --git a/packages/cursorless-engine/src/actions/ExecuteCommand.ts b/packages/cursorless-engine/src/actions/ExecuteCommand.ts index 9a64d6a0b9..e6c8a41e36 100644 --- a/packages/cursorless-engine/src/actions/ExecuteCommand.ts +++ b/packages/cursorless-engine/src/actions/ExecuteCommand.ts @@ -1,9 +1,9 @@ -import { ExecuteCommandOptions } from "@cursorless/common"; -import { RangeUpdater } from "../core/updateSelections/RangeUpdater"; +import type { ExecuteCommandOptions } from "@cursorless/common"; +import type { RangeUpdater } from "../core/updateSelections/RangeUpdater"; import { ide } from "../singletons/ide.singleton"; -import { Target } from "../typings/target.types"; +import type { Target } from "../typings/target.types"; import { CallbackAction } from "./CallbackAction"; -import { ActionReturnValue } from "./actions.types"; +import type { ActionReturnValue } from "./actions.types"; /** * This action can be used to execute a built-in ide command on one or more diff --git a/packages/cursorless-engine/src/actions/Find.ts b/packages/cursorless-engine/src/actions/Find.ts index bca407a903..fb5d0ec749 100644 --- a/packages/cursorless-engine/src/actions/Find.ts +++ b/packages/cursorless-engine/src/actions/Find.ts @@ -1,9 +1,9 @@ import { showWarning } from "@cursorless/common"; import { ide } from "../singletons/ide.singleton"; -import { Target } from "../typings/target.types"; +import type { Target } from "../typings/target.types"; import { ensureSingleTarget } from "../util/targetUtils"; -import { Actions } from "./Actions"; -import { SimpleAction, ActionReturnValue } from "./actions.types"; +import type { Actions } from "./Actions"; +import type { SimpleAction, ActionReturnValue } from "./actions.types"; export class FindInWorkspace implements SimpleAction { constructor(private actions: Actions) { diff --git a/packages/cursorless-engine/src/actions/FollowLink.ts b/packages/cursorless-engine/src/actions/FollowLink.ts index 2a3509d7c6..4b82cc28e7 100644 --- a/packages/cursorless-engine/src/actions/FollowLink.ts +++ b/packages/cursorless-engine/src/actions/FollowLink.ts @@ -1,13 +1,13 @@ import { FlashStyle } from "@cursorless/common"; import { ide } from "../singletons/ide.singleton"; -import { Target } from "../typings/target.types"; +import type { Target } from "../typings/target.types"; import { createThatMark, ensureSingleTarget, flashTargets, } from "../util/targetUtils"; -import { Actions } from "./Actions"; -import { SimpleAction, ActionReturnValue } from "./actions.types"; +import type { Actions } from "./Actions"; +import type { SimpleAction, ActionReturnValue } from "./actions.types"; export default class FollowLink implements SimpleAction { constructor(private actions: Actions) { diff --git a/packages/cursorless-engine/src/actions/GenerateSnippet/GenerateSnippet.ts b/packages/cursorless-engine/src/actions/GenerateSnippet/GenerateSnippet.ts index b9e78aa141..46ce6ee0fc 100644 --- a/packages/cursorless-engine/src/actions/GenerateSnippet/GenerateSnippet.ts +++ b/packages/cursorless-engine/src/actions/GenerateSnippet/GenerateSnippet.ts @@ -1,10 +1,10 @@ import { FlashStyle, isTesting, Range } from "@cursorless/common"; -import { Offsets } from "../../processTargets/modifiers/surroundingPair/types"; +import type { Offsets } from "../../processTargets/modifiers/surroundingPair/types"; import { ide } from "../../singletons/ide.singleton"; -import { Target } from "../../typings/target.types"; +import type { Target } from "../../typings/target.types"; import { matchAll } from "../../util/regex"; import { ensureSingleTarget, flashTargets } from "../../util/targetUtils"; -import { ActionReturnValue } from "../actions.types"; +import type { ActionReturnValue } from "../actions.types"; import { constructSnippetBody } from "./constructSnippetBody"; import { editText } from "./editText"; import { openNewSnippetFile } from "./openNewSnippetFile"; diff --git a/packages/cursorless-engine/src/actions/GenerateSnippet/editText.ts b/packages/cursorless-engine/src/actions/GenerateSnippet/editText.ts index b456031adb..a25326bbb3 100644 --- a/packages/cursorless-engine/src/actions/GenerateSnippet/editText.ts +++ b/packages/cursorless-engine/src/actions/GenerateSnippet/editText.ts @@ -1,5 +1,5 @@ import { sortBy } from "lodash"; -import { Offsets } from "../../processTargets/modifiers/surroundingPair/types"; +import type { Offsets } from "../../processTargets/modifiers/surroundingPair/types"; /** * For each edit in {@link edits} replaces the given {@link Edit.offsets} in diff --git a/packages/cursorless-engine/src/actions/GetTargets.ts b/packages/cursorless-engine/src/actions/GetTargets.ts index 5dc52bacb9..e412667010 100644 --- a/packages/cursorless-engine/src/actions/GetTargets.ts +++ b/packages/cursorless-engine/src/actions/GetTargets.ts @@ -1,5 +1,5 @@ -import { Target } from "../typings/target.types"; -import { ActionReturnValue, SimpleAction } from "./actions.types"; +import type { Target } from "../typings/target.types"; +import type { ActionReturnValue, SimpleAction } from "./actions.types"; export default class GetTargets implements SimpleAction { constructor() { diff --git a/packages/cursorless-engine/src/actions/GetText.ts b/packages/cursorless-engine/src/actions/GetText.ts index fdfb0efe29..1f7bac354b 100644 --- a/packages/cursorless-engine/src/actions/GetText.ts +++ b/packages/cursorless-engine/src/actions/GetText.ts @@ -1,8 +1,9 @@ -import { FlashStyle, GetTextActionOptions } from "@cursorless/common"; +import type { GetTextActionOptions } from "@cursorless/common"; +import { FlashStyle } from "@cursorless/common"; import { ide } from "../singletons/ide.singleton"; -import { Target } from "../typings/target.types"; +import type { Target } from "../typings/target.types"; import { ensureSingleTarget, flashTargets } from "../util/targetUtils"; -import { ActionReturnValue } from "./actions.types"; +import type { ActionReturnValue } from "./actions.types"; export default class GetText { constructor() { diff --git a/packages/cursorless-engine/src/actions/Highlight.ts b/packages/cursorless-engine/src/actions/Highlight.ts index ae418ae5bb..c6a27b2956 100644 --- a/packages/cursorless-engine/src/actions/Highlight.ts +++ b/packages/cursorless-engine/src/actions/Highlight.ts @@ -1,11 +1,11 @@ -import { HighlightId } from "@cursorless/common"; +import type { HighlightId } from "@cursorless/common"; import { ide } from "../singletons/ide.singleton"; -import { Target } from "../typings/target.types"; +import type { Target } from "../typings/target.types"; import { runOnTargetsForEachEditor, toGeneralizedRange, } from "../util/targetUtils"; -import { ActionReturnValue } from "./actions.types"; +import type { ActionReturnValue } from "./actions.types"; export default class Highlight { constructor() { diff --git a/packages/cursorless-engine/src/actions/InsertCopy.ts b/packages/cursorless-engine/src/actions/InsertCopy.ts index d9caad1366..441d1e545c 100644 --- a/packages/cursorless-engine/src/actions/InsertCopy.ts +++ b/packages/cursorless-engine/src/actions/InsertCopy.ts @@ -1,20 +1,20 @@ +import type { TextEditor } from "@cursorless/common"; import { FlashStyle, RangeExpansionBehavior, Selection, - TextEditor, toCharacterRange, } from "@cursorless/common"; import { flatten, zip } from "lodash"; -import { RangeUpdater } from "../core/updateSelections/RangeUpdater"; +import type { RangeUpdater } from "../core/updateSelections/RangeUpdater"; import { performEditsAndUpdateSelectionsWithBehavior } from "../core/updateSelections/updateSelections"; -import { ModifierStageFactory } from "../processTargets/ModifierStageFactory"; +import type { ModifierStageFactory } from "../processTargets/ModifierStageFactory"; import { containingLineIfUntypedModifier } from "../processTargets/modifiers/commonContainingScopeIfUntypedModifiers"; import { ide } from "../singletons/ide.singleton"; -import { Target } from "../typings/target.types"; +import type { Target } from "../typings/target.types"; import { setSelectionsWithoutFocusingEditor } from "../util/setSelectionsAndFocusEditor"; import { createThatMark, runOnTargetsForEachEditor } from "../util/targetUtils"; -import { SimpleAction, ActionReturnValue } from "./actions.types"; +import type { SimpleAction, ActionReturnValue } from "./actions.types"; class InsertCopy implements SimpleAction { getFinalStages = () => [ diff --git a/packages/cursorless-engine/src/actions/InsertEmptyLines.ts b/packages/cursorless-engine/src/actions/InsertEmptyLines.ts index 109673a9a4..cd37878d46 100644 --- a/packages/cursorless-engine/src/actions/InsertEmptyLines.ts +++ b/packages/cursorless-engine/src/actions/InsertEmptyLines.ts @@ -1,12 +1,12 @@ import { FlashStyle, Range, Selection, toLineRange } from "@cursorless/common"; import { flatten } from "lodash"; -import { RangeUpdater } from "../core/updateSelections/RangeUpdater"; +import type { RangeUpdater } from "../core/updateSelections/RangeUpdater"; import { performEditsAndUpdateSelections } from "../core/updateSelections/updateSelections"; import { ide } from "../singletons/ide.singleton"; -import { Target } from "../typings/target.types"; +import type { Target } from "../typings/target.types"; import { setSelectionsWithoutFocusingEditor } from "../util/setSelectionsAndFocusEditor"; import { runOnTargetsForEachEditor } from "../util/targetUtils"; -import { SimpleAction, ActionReturnValue } from "./actions.types"; +import type { SimpleAction, ActionReturnValue } from "./actions.types"; class InsertEmptyLines implements SimpleAction { constructor( diff --git a/packages/cursorless-engine/src/actions/InsertSnippet.ts b/packages/cursorless-engine/src/actions/InsertSnippet.ts index f0fb49dbc8..8be0008ab9 100644 --- a/packages/cursorless-engine/src/actions/InsertSnippet.ts +++ b/packages/cursorless-engine/src/actions/InsertSnippet.ts @@ -1,18 +1,17 @@ -import { +import type { InsertSnippetArg, - RangeExpansionBehavior, ScopeType, Snippet, SnippetDefinition, - textFormatters, } from "@cursorless/common"; -import { Snippets } from "../core/Snippets"; -import { RangeUpdater } from "../core/updateSelections/RangeUpdater"; +import { RangeExpansionBehavior, textFormatters } from "@cursorless/common"; +import type { Snippets } from "../core/Snippets"; +import type { RangeUpdater } from "../core/updateSelections/RangeUpdater"; import { callFunctionAndUpdateSelectionInfos, getSelectionInfo, } from "../core/updateSelections/updateSelections"; -import { ModifierStageFactory } from "../processTargets/ModifierStageFactory"; +import type { ModifierStageFactory } from "../processTargets/ModifierStageFactory"; import { ModifyIfUntypedExplicitStage } from "../processTargets/modifiers/ConditionalModifierStages"; import { UntypedTarget } from "../processTargets/targets"; import { ide } from "../singletons/ide.singleton"; @@ -21,10 +20,10 @@ import { transformSnippetVariables, } from "../snippets/snippet"; import { SnippetParser } from "../snippets/vendor/vscodeSnippet/snippetParser"; -import { Destination, Target } from "../typings/target.types"; +import type { Destination, Target } from "../typings/target.types"; import { ensureSingleEditor } from "../util/targetUtils"; -import { Actions } from "./Actions"; -import { ActionReturnValue } from "./actions.types"; +import type { Actions } from "./Actions"; +import type { ActionReturnValue } from "./actions.types"; export default class InsertSnippet { private snippetParser = new SnippetParser(); diff --git a/packages/cursorless-engine/src/actions/PasteFromClipboard.ts b/packages/cursorless-engine/src/actions/PasteFromClipboard.ts index d260696e9b..ec49fcde7d 100644 --- a/packages/cursorless-engine/src/actions/PasteFromClipboard.ts +++ b/packages/cursorless-engine/src/actions/PasteFromClipboard.ts @@ -3,17 +3,17 @@ import { RangeExpansionBehavior, toCharacterRange, } from "@cursorless/common"; -import { RangeUpdater } from "../core/updateSelections/RangeUpdater"; +import type { RangeUpdater } from "../core/updateSelections/RangeUpdater"; import { callFunctionAndUpdateSelections, callFunctionAndUpdateSelectionsWithBehavior, } from "../core/updateSelections/updateSelections"; import { ide } from "../singletons/ide.singleton"; -import { Destination } from "../typings/target.types"; +import type { Destination } from "../typings/target.types"; import { setSelectionsWithoutFocusingEditor } from "../util/setSelectionsAndFocusEditor"; import { ensureSingleEditor } from "../util/targetUtils"; -import { Actions } from "./Actions"; -import { ActionReturnValue } from "./actions.types"; +import type { Actions } from "./Actions"; +import type { ActionReturnValue } from "./actions.types"; export class PasteFromClipboard { constructor( diff --git a/packages/cursorless-engine/src/actions/Remove.ts b/packages/cursorless-engine/src/actions/Remove.ts index aeaf93d620..abd3aff300 100644 --- a/packages/cursorless-engine/src/actions/Remove.ts +++ b/packages/cursorless-engine/src/actions/Remove.ts @@ -1,13 +1,13 @@ import { FlashStyle } from "@cursorless/common"; import { flatten, zip } from "lodash"; -import { RangeUpdater } from "../core/updateSelections/RangeUpdater"; +import type { RangeUpdater } from "../core/updateSelections/RangeUpdater"; import { performEditsAndUpdateRanges } from "../core/updateSelections/updateSelections"; import { RawSelectionTarget } from "../processTargets/targets"; import { ide } from "../singletons/ide.singleton"; -import { Target } from "../typings/target.types"; +import type { Target } from "../typings/target.types"; import { flashTargets, runOnTargetsForEachEditor } from "../util/targetUtils"; import { unifyRemovalTargets } from "../util/unifyRanges"; -import { SimpleAction, ActionReturnValue } from "./actions.types"; +import type { SimpleAction, ActionReturnValue } from "./actions.types"; export default class Delete implements SimpleAction { constructor(private rangeUpdater: RangeUpdater) { diff --git a/packages/cursorless-engine/src/actions/Replace.ts b/packages/cursorless-engine/src/actions/Replace.ts index a4b7a9b192..f332e3cc68 100644 --- a/packages/cursorless-engine/src/actions/Replace.ts +++ b/packages/cursorless-engine/src/actions/Replace.ts @@ -1,11 +1,12 @@ -import { FlashStyle, ReplaceWith } from "@cursorless/common"; +import type { ReplaceWith } from "@cursorless/common"; +import { FlashStyle } from "@cursorless/common"; import { flatten, zip } from "lodash"; -import { RangeUpdater } from "../core/updateSelections/RangeUpdater"; +import type { RangeUpdater } from "../core/updateSelections/RangeUpdater"; import { performEditsAndUpdateSelections } from "../core/updateSelections/updateSelections"; import { ide } from "../singletons/ide.singleton"; -import { Destination } from "../typings/target.types"; +import type { Destination } from "../typings/target.types"; import { flashTargets, runForEachEditor } from "../util/targetUtils"; -import { ActionReturnValue } from "./actions.types"; +import type { ActionReturnValue } from "./actions.types"; export default class Replace { constructor(private rangeUpdater: RangeUpdater) { diff --git a/packages/cursorless-engine/src/actions/Rewrap.ts b/packages/cursorless-engine/src/actions/Rewrap.ts index 878c7f2671..ec1f309d09 100644 --- a/packages/cursorless-engine/src/actions/Rewrap.ts +++ b/packages/cursorless-engine/src/actions/Rewrap.ts @@ -1,16 +1,16 @@ import { FlashStyle } from "@cursorless/common"; -import { RangeUpdater } from "../core/updateSelections/RangeUpdater"; +import type { RangeUpdater } from "../core/updateSelections/RangeUpdater"; import { performEditsAndUpdateRanges } from "../core/updateSelections/updateSelections"; -import { ModifierStageFactory } from "../processTargets/ModifierStageFactory"; +import type { ModifierStageFactory } from "../processTargets/ModifierStageFactory"; import { containingSurroundingPairIfUntypedModifier } from "../processTargets/modifiers/commonContainingScopeIfUntypedModifiers"; import { ide } from "../singletons/ide.singleton"; -import { Target } from "../typings/target.types"; +import type { Target } from "../typings/target.types"; import { createThatMark, flashTargets, runOnTargetsForEachEditor, } from "../util/targetUtils"; -import { ActionReturnValue } from "./actions.types"; +import type { ActionReturnValue } from "./actions.types"; export default class Rewrap { getFinalStages = () => [ diff --git a/packages/cursorless-engine/src/actions/Scroll.ts b/packages/cursorless-engine/src/actions/Scroll.ts index 4be888e1b5..d079e224d7 100644 --- a/packages/cursorless-engine/src/actions/Scroll.ts +++ b/packages/cursorless-engine/src/actions/Scroll.ts @@ -5,8 +5,8 @@ import { toLineRange, } from "@cursorless/common"; import { ide } from "../singletons/ide.singleton"; -import { Target } from "../typings/target.types"; -import { SimpleAction, ActionReturnValue } from "./actions.types"; +import type { Target } from "../typings/target.types"; +import type { SimpleAction, ActionReturnValue } from "./actions.types"; class Scroll implements SimpleAction { constructor(private at: RevealLineAt) { diff --git a/packages/cursorless-engine/src/actions/SetInstanceReference.ts b/packages/cursorless-engine/src/actions/SetInstanceReference.ts index da2617b2ae..3eba596dbb 100644 --- a/packages/cursorless-engine/src/actions/SetInstanceReference.ts +++ b/packages/cursorless-engine/src/actions/SetInstanceReference.ts @@ -1,5 +1,5 @@ -import { Target } from "../typings/target.types"; -import { SimpleAction, ActionReturnValue } from "./actions.types"; +import type { Target } from "../typings/target.types"; +import type { SimpleAction, ActionReturnValue } from "./actions.types"; export class SetInstanceReference implements SimpleAction { constructor() { diff --git a/packages/cursorless-engine/src/actions/SetSelection.ts b/packages/cursorless-engine/src/actions/SetSelection.ts index 77baac9822..28612f8ebd 100644 --- a/packages/cursorless-engine/src/actions/SetSelection.ts +++ b/packages/cursorless-engine/src/actions/SetSelection.ts @@ -1,9 +1,9 @@ import { Selection } from "@cursorless/common"; import { ide } from "../singletons/ide.singleton"; -import { Target } from "../typings/target.types"; +import type { Target } from "../typings/target.types"; import { setSelectionsAndFocusEditor } from "../util/setSelectionsAndFocusEditor"; import { ensureSingleEditor } from "../util/targetUtils"; -import { SimpleAction, ActionReturnValue } from "./actions.types"; +import type { SimpleAction, ActionReturnValue } from "./actions.types"; export class SetSelection implements SimpleAction { constructor() { diff --git a/packages/cursorless-engine/src/actions/SimpleIdeCommandActions.ts b/packages/cursorless-engine/src/actions/SimpleIdeCommandActions.ts index ea9a8a494f..c7f27dddb7 100644 --- a/packages/cursorless-engine/src/actions/SimpleIdeCommandActions.ts +++ b/packages/cursorless-engine/src/actions/SimpleIdeCommandActions.ts @@ -1,9 +1,9 @@ -import { CommandId, EditableTextEditor, Range } from "@cursorless/common"; -import { RangeUpdater } from "../core/updateSelections/RangeUpdater"; +import type { CommandId, EditableTextEditor, Range } from "@cursorless/common"; +import type { RangeUpdater } from "../core/updateSelections/RangeUpdater"; import { ide } from "../singletons/ide.singleton"; -import { Target } from "../typings/target.types"; +import type { Target } from "../typings/target.types"; import { CallbackAction } from "./CallbackAction"; -import { ActionReturnValue } from "./actions.types"; +import type { ActionReturnValue } from "./actions.types"; interface Options { showDecorations?: boolean; diff --git a/packages/cursorless-engine/src/actions/Sort.ts b/packages/cursorless-engine/src/actions/Sort.ts index b5c1423a00..8c64de273b 100644 --- a/packages/cursorless-engine/src/actions/Sort.ts +++ b/packages/cursorless-engine/src/actions/Sort.ts @@ -1,9 +1,9 @@ import { showWarning } from "@cursorless/common"; import { shuffle } from "lodash"; import { ide } from "../singletons/ide.singleton"; -import { Target } from "../typings/target.types"; -import { Actions } from "./Actions"; -import { ActionReturnValue, SimpleAction } from "./actions.types"; +import type { Target } from "../typings/target.types"; +import type { Actions } from "./Actions"; +import type { ActionReturnValue, SimpleAction } from "./actions.types"; abstract class SortBase implements SimpleAction { constructor(private actions: Actions) { diff --git a/packages/cursorless-engine/src/actions/ToggleBreakpoint.ts b/packages/cursorless-engine/src/actions/ToggleBreakpoint.ts index b49988ad32..fcc65da5fb 100644 --- a/packages/cursorless-engine/src/actions/ToggleBreakpoint.ts +++ b/packages/cursorless-engine/src/actions/ToggleBreakpoint.ts @@ -1,10 +1,11 @@ -import { BreakpointDescriptor, FlashStyle } from "@cursorless/common"; -import { ModifierStageFactory } from "../processTargets/ModifierStageFactory"; +import type { BreakpointDescriptor } from "@cursorless/common"; +import { FlashStyle } from "@cursorless/common"; +import type { ModifierStageFactory } from "../processTargets/ModifierStageFactory"; import { containingLineIfUntypedModifier } from "../processTargets/modifiers/commonContainingScopeIfUntypedModifiers"; import { ide } from "../singletons/ide.singleton"; -import { Target } from "../typings/target.types"; +import type { Target } from "../typings/target.types"; import { flashTargets, runOnTargetsForEachEditor } from "../util/targetUtils"; -import { SimpleAction, ActionReturnValue } from "./actions.types"; +import type { SimpleAction, ActionReturnValue } from "./actions.types"; export default class ToggleBreakpoint implements SimpleAction { getFinalStages = () => [ diff --git a/packages/cursorless-engine/src/actions/Wrap.ts b/packages/cursorless-engine/src/actions/Wrap.ts index 53f320b436..1f3eb40365 100644 --- a/packages/cursorless-engine/src/actions/Wrap.ts +++ b/packages/cursorless-engine/src/actions/Wrap.ts @@ -4,18 +4,18 @@ import { Selection, toCharacterRange, } from "@cursorless/common"; -import { RangeUpdater } from "../core/updateSelections/RangeUpdater"; +import type { RangeUpdater } from "../core/updateSelections/RangeUpdater"; import { getSelectionInfo, performEditsAndUpdateFullSelectionInfos, } from "../core/updateSelections/updateSelections"; import { ide } from "../singletons/ide.singleton"; -import { Edit } from "../typings/Types"; -import { Target } from "../typings/target.types"; -import { FullSelectionInfo } from "../typings/updateSelections"; +import type { Edit } from "../typings/Types"; +import type { Target } from "../typings/target.types"; +import type { FullSelectionInfo } from "../typings/updateSelections"; import { setSelectionsWithoutFocusingEditor } from "../util/setSelectionsAndFocusEditor"; import { runOnTargetsForEachEditor } from "../util/targetUtils"; -import { ActionReturnValue } from "./actions.types"; +import type { ActionReturnValue } from "./actions.types"; export default class Wrap { constructor(private rangeUpdater: RangeUpdater) { diff --git a/packages/cursorless-engine/src/actions/WrapWithSnippet.ts b/packages/cursorless-engine/src/actions/WrapWithSnippet.ts index 56ca6942ae..5b53427998 100644 --- a/packages/cursorless-engine/src/actions/WrapWithSnippet.ts +++ b/packages/cursorless-engine/src/actions/WrapWithSnippet.ts @@ -1,8 +1,9 @@ -import { FlashStyle, ScopeType, WrapWithSnippetArg } from "@cursorless/common"; -import { Snippets } from "../core/Snippets"; -import { RangeUpdater } from "../core/updateSelections/RangeUpdater"; +import type { ScopeType, WrapWithSnippetArg } from "@cursorless/common"; +import { FlashStyle } from "@cursorless/common"; +import type { Snippets } from "../core/Snippets"; +import type { RangeUpdater } from "../core/updateSelections/RangeUpdater"; import { callFunctionAndUpdateSelections } from "../core/updateSelections/updateSelections"; -import { ModifierStageFactory } from "../processTargets/ModifierStageFactory"; +import type { ModifierStageFactory } from "../processTargets/ModifierStageFactory"; import { ModifyIfUntypedStage } from "../processTargets/modifiers/ConditionalModifierStages"; import { ide } from "../singletons/ide.singleton"; import { @@ -10,9 +11,9 @@ import { transformSnippetVariables, } from "../snippets/snippet"; import { SnippetParser } from "../snippets/vendor/vscodeSnippet/snippetParser"; -import { Target } from "../typings/target.types"; +import type { Target } from "../typings/target.types"; import { ensureSingleEditor, flashTargets } from "../util/targetUtils"; -import { ActionReturnValue } from "./actions.types"; +import type { ActionReturnValue } from "./actions.types"; export default class WrapWithSnippet { private snippetParser = new SnippetParser(); diff --git a/packages/cursorless-engine/src/api/CursorlessEngineApi.ts b/packages/cursorless-engine/src/api/CursorlessEngineApi.ts index 4dd323bf27..de258e0cf7 100644 --- a/packages/cursorless-engine/src/api/CursorlessEngineApi.ts +++ b/packages/cursorless-engine/src/api/CursorlessEngineApi.ts @@ -1,8 +1,8 @@ -import { Command, HatTokenMap, IDE } from "@cursorless/common"; -import { Snippets } from "../core/Snippets"; -import { StoredTargetMap } from "../core/StoredTargets"; -import { TestCaseRecorder } from "../testCaseRecorder/TestCaseRecorder"; -import { ScopeProvider } from "./ScopeProvider"; +import type { Command, HatTokenMap, IDE } from "@cursorless/common"; +import type { Snippets } from "../core/Snippets"; +import type { StoredTargetMap } from "../core/StoredTargets"; +import type { TestCaseRecorder } from "../testCaseRecorder/TestCaseRecorder"; +import type { ScopeProvider } from "./ScopeProvider"; export interface CursorlessEngine { commandApi: CommandApi; diff --git a/packages/cursorless-engine/src/api/ScopeProvider.ts b/packages/cursorless-engine/src/api/ScopeProvider.ts index 40d4bd6916..fbe524980b 100644 --- a/packages/cursorless-engine/src/api/ScopeProvider.ts +++ b/packages/cursorless-engine/src/api/ScopeProvider.ts @@ -1,4 +1,4 @@ -import { +import type { Disposable, GeneralizedRange, Range, diff --git a/packages/cursorless-engine/src/core/Debug.ts b/packages/cursorless-engine/src/core/Debug.ts index 8d9ff5c597..b4931dc21a 100644 --- a/packages/cursorless-engine/src/core/Debug.ts +++ b/packages/cursorless-engine/src/core/Debug.ts @@ -1,7 +1,10 @@ -import { Disposable, TextEditorSelectionChangeEvent } from "@cursorless/common"; +import type { + Disposable, + TextEditorSelectionChangeEvent, +} from "@cursorless/common"; import type { SyntaxNode, TreeCursor } from "web-tree-sitter"; import { ide } from "../singletons/ide.singleton"; -import { TreeSitter } from "../typings/TreeSitter"; +import type { TreeSitter } from "../typings/TreeSitter"; /** * Debug logger diff --git a/packages/cursorless-engine/src/core/HatAllocator.ts b/packages/cursorless-engine/src/core/HatAllocator.ts index b5300011df..2151d6fcd8 100644 --- a/packages/cursorless-engine/src/core/HatAllocator.ts +++ b/packages/cursorless-engine/src/core/HatAllocator.ts @@ -3,7 +3,7 @@ import { ide } from "../singletons/ide.singleton"; import tokenGraphemeSplitter from "../singletons/tokenGraphemeSplitter.singleton"; import { allocateHats } from "../util/allocateHats"; import { Debouncer } from "./Debouncer"; -import { IndividualHatMap } from "./IndividualHatMap"; +import type { IndividualHatMap } from "./IndividualHatMap"; interface Context { getActiveMap(): Promise; diff --git a/packages/cursorless-engine/src/core/HatTokenMapImpl.ts b/packages/cursorless-engine/src/core/HatTokenMapImpl.ts index 559375d93b..f19d73078f 100644 --- a/packages/cursorless-engine/src/core/HatTokenMapImpl.ts +++ b/packages/cursorless-engine/src/core/HatTokenMapImpl.ts @@ -1,4 +1,4 @@ -import { +import type { CommandServerApi, HatTokenMap, Hats, @@ -8,10 +8,10 @@ import { import { hrtime } from "process"; import { ide } from "../singletons/ide.singleton"; import { abs } from "../util/bigint"; -import { Debug } from "./Debug"; +import type { Debug } from "./Debug"; import { HatAllocator } from "./HatAllocator"; import { IndividualHatMap } from "./IndividualHatMap"; -import { RangeUpdater } from "./updateSelections/RangeUpdater"; +import type { RangeUpdater } from "./updateSelections/RangeUpdater"; /** * Maximum age for the pre-phrase snapshot before we consider it to be stale diff --git a/packages/cursorless-engine/src/core/IndividualHatMap.ts b/packages/cursorless-engine/src/core/IndividualHatMap.ts index 5b00390b4e..068b9b243a 100644 --- a/packages/cursorless-engine/src/core/IndividualHatMap.ts +++ b/packages/cursorless-engine/src/core/IndividualHatMap.ts @@ -1,15 +1,15 @@ -import { - getKey, +import type { HatStyleName, ReadOnlyHatMap, TextDocument, Token, TokenHat, } from "@cursorless/common"; +import { getKey } from "@cursorless/common"; import tokenGraphemeSplitter from "../singletons/tokenGraphemeSplitter.singleton"; import { getMatcher } from "../tokenizer"; -import { FullRangeInfo } from "../typings/updateSelections"; -import { RangeUpdater } from "./updateSelections/RangeUpdater"; +import type { FullRangeInfo } from "../typings/updateSelections"; +import type { RangeUpdater } from "./updateSelections/RangeUpdater"; /** * A token with information that the rangeUpdater can use to keep its diff --git a/packages/cursorless-engine/src/core/Snippets.ts b/packages/cursorless-engine/src/core/Snippets.ts index d93e61e83f..4990559139 100644 --- a/packages/cursorless-engine/src/core/Snippets.ts +++ b/packages/cursorless-engine/src/core/Snippets.ts @@ -1,4 +1,5 @@ -import { showError, Snippet, SnippetMap, walkFiles } from "@cursorless/common"; +import type { Snippet, SnippetMap } from "@cursorless/common"; +import { showError, walkFiles } from "@cursorless/common"; import { readFile, stat } from "fs/promises"; import { max } from "lodash"; import { join } from "path"; diff --git a/packages/cursorless-engine/src/core/StoredTargets.ts b/packages/cursorless-engine/src/core/StoredTargets.ts index bc6763c0ea..57806f1717 100644 --- a/packages/cursorless-engine/src/core/StoredTargets.ts +++ b/packages/cursorless-engine/src/core/StoredTargets.ts @@ -1,4 +1,4 @@ -import { Target } from "../typings/target.types"; +import type { Target } from "../typings/target.types"; export type StoredTargetKey = "that" | "source" | "instanceReference"; diff --git a/packages/cursorless-engine/src/core/commandRunner/CommandRunnerImpl.ts b/packages/cursorless-engine/src/core/commandRunner/CommandRunnerImpl.ts index 90a7ce9a0b..3583cad9c4 100644 --- a/packages/cursorless-engine/src/core/commandRunner/CommandRunnerImpl.ts +++ b/packages/cursorless-engine/src/core/commandRunner/CommandRunnerImpl.ts @@ -1,17 +1,20 @@ -import { +import type { CommandComplete, DestinationDescriptor, ActionDescriptor, PartialTargetDescriptor, } from "@cursorless/common"; -import { CommandRunner } from "../../CommandRunner"; -import { ActionRecord, ActionReturnValue } from "../../actions/actions.types"; -import { StoredTargetMap } from "../../index"; -import { TargetPipelineRunner } from "../../processTargets"; -import { ModifierStage } from "../../processTargets/PipelineStages.types"; -import { SelectionWithEditor } from "../../typings/Types"; -import { Destination, Target } from "../../typings/target.types"; -import { Debug } from "../Debug"; +import type { CommandRunner } from "../../CommandRunner"; +import type { + ActionRecord, + ActionReturnValue, +} from "../../actions/actions.types"; +import type { StoredTargetMap } from "../../index"; +import type { TargetPipelineRunner } from "../../processTargets"; +import type { ModifierStage } from "../../processTargets/PipelineStages.types"; +import type { SelectionWithEditor } from "../../typings/Types"; +import type { Destination, Target } from "../../typings/target.types"; +import type { Debug } from "../Debug"; import { inferFullTargetDescriptor } from "../inferFullTargetDescriptor"; import { selectionToStoredTarget } from "./selectionToStoredTarget"; diff --git a/packages/cursorless-engine/src/core/commandRunner/selectionToStoredTarget.ts b/packages/cursorless-engine/src/core/commandRunner/selectionToStoredTarget.ts index 3693d891da..b7cdcb053a 100644 --- a/packages/cursorless-engine/src/core/commandRunner/selectionToStoredTarget.ts +++ b/packages/cursorless-engine/src/core/commandRunner/selectionToStoredTarget.ts @@ -1,5 +1,5 @@ import { UntypedTarget } from "../../processTargets/targets"; -import { SelectionWithEditor } from "../../typings/Types"; +import type { SelectionWithEditor } from "../../typings/Types"; /** * Given a selection with an editor, constructs an appropriate `Target` to use diff --git a/packages/cursorless-engine/src/core/commandVersionUpgrades/canonicalizeAndValidateCommand.ts b/packages/cursorless-engine/src/core/commandVersionUpgrades/canonicalizeAndValidateCommand.ts index 5206f86b6e..83db24a80c 100644 --- a/packages/cursorless-engine/src/core/commandVersionUpgrades/canonicalizeAndValidateCommand.ts +++ b/packages/cursorless-engine/src/core/commandVersionUpgrades/canonicalizeAndValidateCommand.ts @@ -1,15 +1,14 @@ -import { +import type { ActionType, Command, CommandComplete, CommandLatest, EnforceUndefined, - LATEST_VERSION, Modifier, - OutdatedExtensionError, PartialTargetDescriptor, SimpleScopeTypeType, } from "@cursorless/common"; +import { LATEST_VERSION, OutdatedExtensionError } from "@cursorless/common"; import { getPartialTargetDescriptors } from "../../util/getPartialTargetDescriptors"; import { getPartialPrimitiveTargets } from "../../util/getPrimitiveTargets"; import canonicalizeTargetsInPlace from "./canonicalizeTargetsInPlace"; diff --git a/packages/cursorless-engine/src/core/commandVersionUpgrades/canonicalizeTargetsInPlace.ts b/packages/cursorless-engine/src/core/commandVersionUpgrades/canonicalizeTargetsInPlace.ts index 0e1446dd7d..7f6ef4f659 100644 --- a/packages/cursorless-engine/src/core/commandVersionUpgrades/canonicalizeTargetsInPlace.ts +++ b/packages/cursorless-engine/src/core/commandVersionUpgrades/canonicalizeTargetsInPlace.ts @@ -1,4 +1,4 @@ -import { +import type { HatStyleName, PartialPrimitiveTargetDescriptor, PartialTargetDescriptor, diff --git a/packages/cursorless-engine/src/core/commandVersionUpgrades/ensureCommandShape.ts b/packages/cursorless-engine/src/core/commandVersionUpgrades/ensureCommandShape.ts index 074b87bf8e..7eedb96aee 100644 --- a/packages/cursorless-engine/src/core/commandVersionUpgrades/ensureCommandShape.ts +++ b/packages/cursorless-engine/src/core/commandVersionUpgrades/ensureCommandShape.ts @@ -1,4 +1,8 @@ -import { ActionType, Command, PartialTargetV0V1 } from "@cursorless/common"; +import type { + ActionType, + Command, + PartialTargetV0V1, +} from "@cursorless/common"; import { isString } from "../../util/type"; /** diff --git a/packages/cursorless-engine/src/core/commandVersionUpgrades/upgradeV0ToV1/upgradeV0ToV1.ts b/packages/cursorless-engine/src/core/commandVersionUpgrades/upgradeV0ToV1/upgradeV0ToV1.ts index 98973361d0..a375fb8dc1 100644 --- a/packages/cursorless-engine/src/core/commandVersionUpgrades/upgradeV0ToV1/upgradeV0ToV1.ts +++ b/packages/cursorless-engine/src/core/commandVersionUpgrades/upgradeV0ToV1/upgradeV0ToV1.ts @@ -1,4 +1,4 @@ -import { CommandV0, CommandV1 } from "@cursorless/common"; +import type { CommandV0, CommandV1 } from "@cursorless/common"; export function upgradeV0ToV1(command: CommandV0): CommandV1 { return { ...command, version: 1 }; diff --git a/packages/cursorless-engine/src/core/commandVersionUpgrades/upgradeV1ToV2/upgradeStrictHere.ts b/packages/cursorless-engine/src/core/commandVersionUpgrades/upgradeV1ToV2/upgradeStrictHere.ts index 40a5e7c8c1..4ca002dd84 100644 --- a/packages/cursorless-engine/src/core/commandVersionUpgrades/upgradeV1ToV2/upgradeStrictHere.ts +++ b/packages/cursorless-engine/src/core/commandVersionUpgrades/upgradeV1ToV2/upgradeStrictHere.ts @@ -1,5 +1,5 @@ import { isDeepStrictEqual } from "util"; -import { PartialPrimitiveTargetDescriptorV2 } from "@cursorless/common"; +import type { PartialPrimitiveTargetDescriptorV2 } from "@cursorless/common"; const STRICT_HERE = { type: "primitive", diff --git a/packages/cursorless-engine/src/core/commandVersionUpgrades/upgradeV1ToV2/upgradeV1ToV2.ts b/packages/cursorless-engine/src/core/commandVersionUpgrades/upgradeV1ToV2/upgradeV1ToV2.ts index 9f0506367c..a7dfc56566 100644 --- a/packages/cursorless-engine/src/core/commandVersionUpgrades/upgradeV1ToV2/upgradeV1ToV2.ts +++ b/packages/cursorless-engine/src/core/commandVersionUpgrades/upgradeV1ToV2/upgradeV1ToV2.ts @@ -1,13 +1,13 @@ -import { ActionType, ActionTypeV2 } from "@cursorless/common"; -import { CommandV2 } from "@cursorless/common"; -import { +import type { ActionType, ActionTypeV2 } from "@cursorless/common"; +import type { CommandV2 } from "@cursorless/common"; +import type { ModifierV2, PartialPrimitiveTargetDescriptorV2, PartialRangeTargetDescriptorV2, PartialTargetDescriptorV2, SimpleScopeTypeTypeV2, } from "@cursorless/common"; -import { +import type { CommandV1, ModifierV0V1, PartialPrimitiveTargetV0V1, diff --git a/packages/cursorless-engine/src/core/commandVersionUpgrades/upgradeV2ToV3/upgradeV2ToV3.ts b/packages/cursorless-engine/src/core/commandVersionUpgrades/upgradeV2ToV3/upgradeV2ToV3.ts index d93f077e02..ce9742b990 100644 --- a/packages/cursorless-engine/src/core/commandVersionUpgrades/upgradeV2ToV3/upgradeV2ToV3.ts +++ b/packages/cursorless-engine/src/core/commandVersionUpgrades/upgradeV2ToV3/upgradeV2ToV3.ts @@ -1,4 +1,4 @@ -import { +import type { CommandV2, CommandV3, LineNumberMarkV2, diff --git a/packages/cursorless-engine/src/core/commandVersionUpgrades/upgradeV3ToV4/upgradeV3ToV4.ts b/packages/cursorless-engine/src/core/commandVersionUpgrades/upgradeV3ToV4/upgradeV3ToV4.ts index 03451092b1..d3b444fae1 100644 --- a/packages/cursorless-engine/src/core/commandVersionUpgrades/upgradeV3ToV4/upgradeV3ToV4.ts +++ b/packages/cursorless-engine/src/core/commandVersionUpgrades/upgradeV3ToV4/upgradeV3ToV4.ts @@ -1,4 +1,4 @@ -import { +import type { CommandV3, CommandV4, ImplicitTargetDescriptor, diff --git a/packages/cursorless-engine/src/core/commandVersionUpgrades/upgradeV4ToV5/upgradeV4ToV5.ts b/packages/cursorless-engine/src/core/commandVersionUpgrades/upgradeV4ToV5/upgradeV4ToV5.ts index 972e7caa53..98116d74d0 100644 --- a/packages/cursorless-engine/src/core/commandVersionUpgrades/upgradeV4ToV5/upgradeV4ToV5.ts +++ b/packages/cursorless-engine/src/core/commandVersionUpgrades/upgradeV4ToV5/upgradeV4ToV5.ts @@ -1,4 +1,4 @@ -import { +import type { ActionCommandV4, ActionCommandV5, CommandV4, diff --git a/packages/cursorless-engine/src/core/commandVersionUpgrades/upgradeV5ToV6/canonicalizeActionName.ts b/packages/cursorless-engine/src/core/commandVersionUpgrades/upgradeV5ToV6/canonicalizeActionName.ts index 810b7ffe7d..4b71f6d857 100644 --- a/packages/cursorless-engine/src/core/commandVersionUpgrades/upgradeV5ToV6/canonicalizeActionName.ts +++ b/packages/cursorless-engine/src/core/commandVersionUpgrades/upgradeV5ToV6/canonicalizeActionName.ts @@ -1,4 +1,5 @@ -import { ActionType, actionNames } from "@cursorless/common"; +import type { ActionType } from "@cursorless/common"; +import { actionNames } from "@cursorless/common"; const actionAliasToCanonicalName: Record = { bring: "replaceWithTarget", diff --git a/packages/cursorless-engine/src/core/commandVersionUpgrades/upgradeV5ToV6/upgradeV5ToV6.ts b/packages/cursorless-engine/src/core/commandVersionUpgrades/upgradeV5ToV6/upgradeV5ToV6.ts index 7d26cc9dcd..2c955c12d4 100644 --- a/packages/cursorless-engine/src/core/commandVersionUpgrades/upgradeV5ToV6/upgradeV5ToV6.ts +++ b/packages/cursorless-engine/src/core/commandVersionUpgrades/upgradeV5ToV6/upgradeV5ToV6.ts @@ -1,4 +1,4 @@ -import { +import type { ActionCommandV5, ActionDescriptor, CommandV5, diff --git a/packages/cursorless-engine/src/core/compareSnippetDefinitions.ts b/packages/cursorless-engine/src/core/compareSnippetDefinitions.ts index 794282db2f..87c7b435c5 100644 --- a/packages/cursorless-engine/src/core/compareSnippetDefinitions.ts +++ b/packages/cursorless-engine/src/core/compareSnippetDefinitions.ts @@ -1,9 +1,9 @@ -import { +import type { SimpleScopeTypeType, SnippetDefinition, SnippetScope, } from "@cursorless/common"; -import { SnippetOrigin } from "./mergeSnippets"; +import type { SnippetOrigin } from "./mergeSnippets"; /** * Compares two snippet definitions by how specific their scope, breaking diff --git a/packages/cursorless-engine/src/core/handleHoistedModifiers.ts b/packages/cursorless-engine/src/core/handleHoistedModifiers.ts index e3d0f7e1c2..c37ad98a72 100644 --- a/packages/cursorless-engine/src/core/handleHoistedModifiers.ts +++ b/packages/cursorless-engine/src/core/handleHoistedModifiers.ts @@ -1,7 +1,7 @@ -import { Modifier } from "@cursorless/common"; +import type { Modifier } from "@cursorless/common"; import produce from "immer"; import { findLastIndex } from "lodash"; -import { +import type { PrimitiveTargetDescriptor, RangeTargetDescriptor, } from "../typings/TargetDescriptor"; diff --git a/packages/cursorless-engine/src/core/inferFullTargetDescriptor.ts b/packages/cursorless-engine/src/core/inferFullTargetDescriptor.ts index 25248c4d1e..26e2870635 100644 --- a/packages/cursorless-engine/src/core/inferFullTargetDescriptor.ts +++ b/packages/cursorless-engine/src/core/inferFullTargetDescriptor.ts @@ -1,11 +1,11 @@ -import { +import type { Modifier, PartialListTargetDescriptor, PartialPrimitiveTargetDescriptor, PartialRangeTargetDescriptor, PartialTargetDescriptor, } from "@cursorless/common"; -import { +import type { ListTargetDescriptor, Mark, PrimitiveTargetDescriptor, diff --git a/packages/cursorless-engine/src/core/mergeSnippets.test.ts b/packages/cursorless-engine/src/core/mergeSnippets.test.ts index bd4e4579c7..46cb529cdb 100644 --- a/packages/cursorless-engine/src/core/mergeSnippets.test.ts +++ b/packages/cursorless-engine/src/core/mergeSnippets.test.ts @@ -1,4 +1,4 @@ -import { SnippetMap } from "@cursorless/common"; +import type { SnippetMap } from "@cursorless/common"; import { mergeSnippets } from "./mergeSnippets"; import assert = require("assert"); diff --git a/packages/cursorless-engine/src/core/mergeSnippets.ts b/packages/cursorless-engine/src/core/mergeSnippets.ts index 333a022d0a..72ccee15c3 100644 --- a/packages/cursorless-engine/src/core/mergeSnippets.ts +++ b/packages/cursorless-engine/src/core/mergeSnippets.ts @@ -1,4 +1,4 @@ -import { Snippet, SnippetMap } from "@cursorless/common"; +import type { Snippet, SnippetMap } from "@cursorless/common"; import { cloneDeep, groupBy, mapValues, merge } from "lodash"; import { compareSnippetDefinitions } from "./compareSnippetDefinitions"; diff --git a/packages/cursorless-engine/src/core/updateSelections/RangeUpdater.ts b/packages/cursorless-engine/src/core/updateSelections/RangeUpdater.ts index bed97ab337..a3f85a8d09 100644 --- a/packages/cursorless-engine/src/core/updateSelections/RangeUpdater.ts +++ b/packages/cursorless-engine/src/core/updateSelections/RangeUpdater.ts @@ -7,7 +7,7 @@ import type { import { pull } from "lodash"; import { ide } from "../../singletons/ide.singleton"; import type { Edit } from "../../typings/Types"; -import { +import type { ExtendedTextDocumentChangeEvent, FullRangeInfo, } from "../../typings/updateSelections"; diff --git a/packages/cursorless-engine/src/core/updateSelections/getOffsetsForDeleteOrReplace.ts b/packages/cursorless-engine/src/core/updateSelections/getOffsetsForDeleteOrReplace.ts index 4dcd541cbd..e52765dc73 100644 --- a/packages/cursorless-engine/src/core/updateSelections/getOffsetsForDeleteOrReplace.ts +++ b/packages/cursorless-engine/src/core/updateSelections/getOffsetsForDeleteOrReplace.ts @@ -1,6 +1,9 @@ import { invariant } from "immutability-helper"; -import { ChangeEventInfo, FullRangeInfo } from "../../typings/updateSelections"; -import { RangeOffsets } from "@cursorless/common"; +import type { + ChangeEventInfo, + FullRangeInfo, +} from "../../typings/updateSelections"; +import type { RangeOffsets } from "@cursorless/common"; /** * Gets updated offsets for the range `rangeInfo` after the change described by diff --git a/packages/cursorless-engine/src/core/updateSelections/getOffsetsForEmptyRangeInsert.ts b/packages/cursorless-engine/src/core/updateSelections/getOffsetsForEmptyRangeInsert.ts index e652e02450..491d00014c 100644 --- a/packages/cursorless-engine/src/core/updateSelections/getOffsetsForEmptyRangeInsert.ts +++ b/packages/cursorless-engine/src/core/updateSelections/getOffsetsForEmptyRangeInsert.ts @@ -1,7 +1,10 @@ import { invariant } from "immutability-helper"; import { leftAnchored, rightAnchored } from "../../util/regex"; -import { ChangeEventInfo, FullRangeInfo } from "../../typings/updateSelections"; -import { RangeOffsets } from "@cursorless/common"; +import type { + ChangeEventInfo, + FullRangeInfo, +} from "../../typings/updateSelections"; +import type { RangeOffsets } from "@cursorless/common"; /** * Gets updated offsets for the range `rangeInfo` after the change described by diff --git a/packages/cursorless-engine/src/core/updateSelections/getOffsetsForNonEmptyRangeInsert.ts b/packages/cursorless-engine/src/core/updateSelections/getOffsetsForNonEmptyRangeInsert.ts index 0aac5a5a3a..4fab8b9655 100644 --- a/packages/cursorless-engine/src/core/updateSelections/getOffsetsForNonEmptyRangeInsert.ts +++ b/packages/cursorless-engine/src/core/updateSelections/getOffsetsForNonEmptyRangeInsert.ts @@ -1,7 +1,10 @@ import { invariant } from "immutability-helper"; import { leftAnchored, rightAnchored } from "../../util/regex"; -import { ChangeEventInfo, FullRangeInfo } from "../../typings/updateSelections"; -import { RangeOffsets } from "@cursorless/common"; +import type { + ChangeEventInfo, + FullRangeInfo, +} from "../../typings/updateSelections"; +import type { RangeOffsets } from "@cursorless/common"; /** * Gets updated offsets for the range `rangeInfo` after the change described by diff --git a/packages/cursorless-engine/src/core/updateSelections/getUpdatedText.ts b/packages/cursorless-engine/src/core/updateSelections/getUpdatedText.ts index edefea71fe..6621f3d82f 100644 --- a/packages/cursorless-engine/src/core/updateSelections/getUpdatedText.ts +++ b/packages/cursorless-engine/src/core/updateSelections/getUpdatedText.ts @@ -1,5 +1,8 @@ -import { ChangeEventInfo, FullRangeInfo } from "../../typings/updateSelections"; -import { RangeOffsets } from "@cursorless/common"; +import type { + ChangeEventInfo, + FullRangeInfo, +} from "../../typings/updateSelections"; +import type { RangeOffsets } from "@cursorless/common"; /** * Updates the text of the given rangeInfo to take into account the given change. diff --git a/packages/cursorless-engine/src/core/updateSelections/updateRangeInfos.ts b/packages/cursorless-engine/src/core/updateSelections/updateRangeInfos.ts index e861ecda0a..1cb4bde625 100644 --- a/packages/cursorless-engine/src/core/updateSelections/updateRangeInfos.ts +++ b/packages/cursorless-engine/src/core/updateSelections/updateRangeInfos.ts @@ -2,12 +2,12 @@ import { sumBy } from "lodash"; import getOffsetsForDeleteOrReplace from "./getOffsetsForDeleteOrReplace"; import getOffsetsForEmptyRangeInsert from "./getOffsetsForEmptyRangeInsert"; import getOffsetsForNonEmptyRangeInsert from "./getOffsetsForNonEmptyRangeInsert"; -import { +import type { ExtendedTextDocumentChangeEvent, FullRangeInfo, ChangeEventInfo, } from "../../typings/updateSelections"; -import { RangeOffsets } from "@cursorless/common"; +import type { RangeOffsets } from "@cursorless/common"; import { getUpdatedText } from "./getUpdatedText"; /** diff --git a/packages/cursorless-engine/src/core/updateSelections/updateSelections.ts b/packages/cursorless-engine/src/core/updateSelections/updateSelections.ts index fe7e1bd9b8..7352dd237f 100644 --- a/packages/cursorless-engine/src/core/updateSelections/updateSelections.ts +++ b/packages/cursorless-engine/src/core/updateSelections/updateSelections.ts @@ -1,18 +1,17 @@ -import { - RangeExpansionBehavior, +import type { EditableTextEditor, Range, - Selection, TextDocument, } from "@cursorless/common"; +import { RangeExpansionBehavior, Selection } from "@cursorless/common"; import { flatten } from "lodash"; -import { Edit } from "../../typings/Types"; -import { +import type { Edit } from "../../typings/Types"; +import type { FullSelectionInfo, SelectionInfo, } from "../../typings/updateSelections"; import { performDocumentEdits } from "../../util/performDocumentEdits"; -import { RangeUpdater } from "./RangeUpdater"; +import type { RangeUpdater } from "./RangeUpdater"; interface SelectionsWithBehavior { selections: readonly Selection[]; diff --git a/packages/cursorless-engine/src/cursorlessEngine.ts b/packages/cursorless-engine/src/cursorlessEngine.ts index ab0c96b495..a0d626c221 100644 --- a/packages/cursorless-engine/src/cursorlessEngine.ts +++ b/packages/cursorless-engine/src/cursorlessEngine.ts @@ -1,13 +1,14 @@ -import { +import type { Command, CommandServerApi, FileSystem, Hats, IDE, } from "@cursorless/common"; -import { StoredTargetMap, TestCaseRecorder, TreeSitter } from "."; -import { CursorlessEngine } from "./api/CursorlessEngineApi"; -import { ScopeProvider } from "./api/ScopeProvider"; +import type { TreeSitter } from "."; +import { StoredTargetMap, TestCaseRecorder } from "."; +import type { CursorlessEngine } from "./api/CursorlessEngineApi"; +import type { ScopeProvider } from "./api/ScopeProvider"; import { ScopeRangeProvider } from "./ScopeVisualizer/ScopeRangeProvider"; import { ScopeSupportChecker } from "./ScopeVisualizer/ScopeSupportChecker"; import { Debug } from "./core/Debug"; diff --git a/packages/cursorless-engine/src/generateSpokenForm/defaultSpokenForms/actions.ts b/packages/cursorless-engine/src/generateSpokenForm/defaultSpokenForms/actions.ts index e1009625d0..5567173ebe 100644 --- a/packages/cursorless-engine/src/generateSpokenForm/defaultSpokenForms/actions.ts +++ b/packages/cursorless-engine/src/generateSpokenForm/defaultSpokenForms/actions.ts @@ -1,4 +1,4 @@ -import { ActionType } from "@cursorless/common"; +import type { ActionType } from "@cursorless/common"; /** * This is a mapping from action names to their default spoken forms, or `null` diff --git a/packages/cursorless-engine/src/generateSpokenForm/defaultSpokenForms/marks.ts b/packages/cursorless-engine/src/generateSpokenForm/defaultSpokenForms/marks.ts index 386933e7eb..8703b73c08 100644 --- a/packages/cursorless-engine/src/generateSpokenForm/defaultSpokenForms/marks.ts +++ b/packages/cursorless-engine/src/generateSpokenForm/defaultSpokenForms/marks.ts @@ -1,4 +1,4 @@ -import { PartialMark } from "@cursorless/common"; +import type { PartialMark } from "@cursorless/common"; const hatColors: Record = { blue: "blue", diff --git a/packages/cursorless-engine/src/generateSpokenForm/defaultSpokenForms/modifiers.ts b/packages/cursorless-engine/src/generateSpokenForm/defaultSpokenForms/modifiers.ts index 88852cc14c..851bd090c1 100644 --- a/packages/cursorless-engine/src/generateSpokenForm/defaultSpokenForms/modifiers.ts +++ b/packages/cursorless-engine/src/generateSpokenForm/defaultSpokenForms/modifiers.ts @@ -1,9 +1,9 @@ -import { +import type { ModifierType, SimpleScopeTypeType, SurroundingPairName, - CompositeKeyMap, } from "@cursorless/common"; +import { CompositeKeyMap } from "@cursorless/common"; export const modifiers = { excludeInterior: "bounds", diff --git a/packages/cursorless-engine/src/generateSpokenForm/defaultSpokenForms/snippets.ts b/packages/cursorless-engine/src/generateSpokenForm/defaultSpokenForms/snippets.ts index f62dc4a7e6..41a0c7ddaf 100644 --- a/packages/cursorless-engine/src/generateSpokenForm/defaultSpokenForms/snippets.ts +++ b/packages/cursorless-engine/src/generateSpokenForm/defaultSpokenForms/snippets.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import { InsertSnippetArg, WrapWithSnippetArg } from "@cursorless/common"; +import type { InsertSnippetArg, WrapWithSnippetArg } from "@cursorless/common"; import { NoSpokenFormError } from "../NoSpokenFormError"; const insertionSnippets: Record = { diff --git a/packages/cursorless-engine/src/generateSpokenForm/generateSpokenForm.test.ts b/packages/cursorless-engine/src/generateSpokenForm/generateSpokenForm.test.ts index 6e8e2d31f4..b6b6c53e6e 100644 --- a/packages/cursorless-engine/src/generateSpokenForm/generateSpokenForm.test.ts +++ b/packages/cursorless-engine/src/generateSpokenForm/generateSpokenForm.test.ts @@ -1,5 +1,5 @@ +import type { TestCaseFixtureLegacy } from "@cursorless/common"; import { - TestCaseFixtureLegacy, getRecordedTestPaths, serializeTestFixture, shouldUpdateFixtures, diff --git a/packages/cursorless-engine/src/generateSpokenForm/generateSpokenForm.ts b/packages/cursorless-engine/src/generateSpokenForm/generateSpokenForm.ts index 532485981e..65d4ead897 100644 --- a/packages/cursorless-engine/src/generateSpokenForm/generateSpokenForm.ts +++ b/packages/cursorless-engine/src/generateSpokenForm/generateSpokenForm.ts @@ -1,11 +1,12 @@ -import { +import type { ActionDescriptor, CommandComplete, DestinationDescriptor, InsertionMode, PartialTargetDescriptor, } from "@cursorless/common"; -import { RecursiveArray, flattenDeep } from "lodash"; +import type { RecursiveArray } from "lodash"; +import { flattenDeep } from "lodash"; import { NoSpokenFormError } from "./NoSpokenFormError"; import { actions } from "./defaultSpokenForms/actions"; import { connectives } from "./defaultSpokenForms/connectives"; diff --git a/packages/cursorless-engine/src/generateSpokenForm/getHatMapCommand.ts b/packages/cursorless-engine/src/generateSpokenForm/getHatMapCommand.ts index 0d88a7f7ea..94dfe921f8 100644 --- a/packages/cursorless-engine/src/generateSpokenForm/getHatMapCommand.ts +++ b/packages/cursorless-engine/src/generateSpokenForm/getHatMapCommand.ts @@ -1,8 +1,8 @@ -import { +import type { CommandLatest, PartialPrimitiveTargetDescriptor, - splitKey, } from "@cursorless/common"; +import { splitKey } from "@cursorless/common"; /** * Constructs the command that would have been used as the second command when diff --git a/packages/cursorless-engine/src/generateSpokenForm/getRangeConnective.ts b/packages/cursorless-engine/src/generateSpokenForm/getRangeConnective.ts index 5b0a7a5b47..17bfd6be39 100644 --- a/packages/cursorless-engine/src/generateSpokenForm/getRangeConnective.ts +++ b/packages/cursorless-engine/src/generateSpokenForm/getRangeConnective.ts @@ -1,4 +1,4 @@ -import { PartialRangeType } from "@cursorless/common"; +import type { PartialRangeType } from "@cursorless/common"; import { NoSpokenFormError } from "./NoSpokenFormError"; import { connectives } from "./defaultSpokenForms/connectives"; diff --git a/packages/cursorless-engine/src/generateSpokenForm/primitiveTargetToSpokenForm.ts b/packages/cursorless-engine/src/generateSpokenForm/primitiveTargetToSpokenForm.ts index 59452aa775..985885401c 100644 --- a/packages/cursorless-engine/src/generateSpokenForm/primitiveTargetToSpokenForm.ts +++ b/packages/cursorless-engine/src/generateSpokenForm/primitiveTargetToSpokenForm.ts @@ -1,4 +1,4 @@ -import { +import type { LineNumberMark, Modifier, PartialMark, @@ -6,7 +6,7 @@ import { RelativeScopeModifier, ScopeType, } from "@cursorless/common"; -import { RecursiveArray } from "lodash"; +import type { RecursiveArray } from "lodash"; import { NoSpokenFormError } from "./NoSpokenFormError"; import { characterToSpokenForm } from "./defaultSpokenForms/characters"; import { connectives } from "./defaultSpokenForms/connectives"; diff --git a/packages/cursorless-engine/src/languages/LanguageDefinition.ts b/packages/cursorless-engine/src/languages/LanguageDefinition.ts index 3576b94124..6ff429628f 100644 --- a/packages/cursorless-engine/src/languages/LanguageDefinition.ts +++ b/packages/cursorless-engine/src/languages/LanguageDefinition.ts @@ -1,11 +1,12 @@ -import { ScopeType, SimpleScopeType, showError } from "@cursorless/common"; +import type { ScopeType, SimpleScopeType } from "@cursorless/common"; +import { showError } from "@cursorless/common"; import { existsSync, readFileSync } from "fs"; import { dirname, join } from "path"; import { TreeSitterScopeHandler } from "../processTargets/modifiers/scopeHandlers"; import { TreeSitterTextFragmentScopeHandler } from "../processTargets/modifiers/scopeHandlers/TreeSitterScopeHandler/TreeSitterTextFragmentScopeHandler"; -import { ScopeHandler } from "../processTargets/modifiers/scopeHandlers/scopeHandler.types"; +import type { ScopeHandler } from "../processTargets/modifiers/scopeHandlers/scopeHandler.types"; import { ide } from "../singletons/ide.singleton"; -import { TreeSitter } from "../typings/TreeSitter"; +import type { TreeSitter } from "../typings/TreeSitter"; import { matchAll } from "../util/regex"; import { TreeSitterQuery } from "./TreeSitterQuery"; import { TEXT_FRAGMENT_CAPTURE_NAME } from "./captureNames"; diff --git a/packages/cursorless-engine/src/languages/LanguageDefinitions.ts b/packages/cursorless-engine/src/languages/LanguageDefinitions.ts index 4632f3473c..3ef28063c6 100644 --- a/packages/cursorless-engine/src/languages/LanguageDefinitions.ts +++ b/packages/cursorless-engine/src/languages/LanguageDefinitions.ts @@ -1,14 +1,13 @@ -import { +import type { Disposable, FileSystem, - Notifier, Range, TextDocument, - getCursorlessRepoRoot, } from "@cursorless/common"; +import { Notifier, getCursorlessRepoRoot } from "@cursorless/common"; import { join } from "path"; -import { SyntaxNode } from "web-tree-sitter"; -import { TreeSitter } from ".."; +import type { SyntaxNode } from "web-tree-sitter"; +import type { TreeSitter } from ".."; import { ide } from "../singletons/ide.singleton"; import { LanguageDefinition } from "./LanguageDefinition"; diff --git a/packages/cursorless-engine/src/languages/TreeSitterQuery/PredicateOperatorSchemaTypes.ts b/packages/cursorless-engine/src/languages/TreeSitterQuery/PredicateOperatorSchemaTypes.ts index 5d76b6bea7..c09970c1fc 100644 --- a/packages/cursorless-engine/src/languages/TreeSitterQuery/PredicateOperatorSchemaTypes.ts +++ b/packages/cursorless-engine/src/languages/TreeSitterQuery/PredicateOperatorSchemaTypes.ts @@ -1,9 +1,9 @@ -import z from "zod"; -import { +import type z from "zod"; +import type { SchemaInputType, SchemaOutputType, } from "./operatorArgumentSchemaTypes"; -import { MutableQueryCapture } from "./QueryCapture"; +import type { MutableQueryCapture } from "./QueryCapture"; /** * A schema used to validate a list of operands for a given predicate operator. diff --git a/packages/cursorless-engine/src/languages/TreeSitterQuery/QueryCapture.ts b/packages/cursorless-engine/src/languages/TreeSitterQuery/QueryCapture.ts index f92fde3098..53d68bfa5d 100644 --- a/packages/cursorless-engine/src/languages/TreeSitterQuery/QueryCapture.ts +++ b/packages/cursorless-engine/src/languages/TreeSitterQuery/QueryCapture.ts @@ -1,5 +1,5 @@ -import { Range, TextDocument } from "@cursorless/common"; -import { Point } from "web-tree-sitter"; +import type { Range, TextDocument } from "@cursorless/common"; +import type { Point } from "web-tree-sitter"; /** * Simple representation of the tree sitter syntax node. Used by diff --git a/packages/cursorless-engine/src/languages/TreeSitterQuery/QueryPredicateOperator.ts b/packages/cursorless-engine/src/languages/TreeSitterQuery/QueryPredicateOperator.ts index c7601ad259..f7ab4a2ce0 100644 --- a/packages/cursorless-engine/src/languages/TreeSitterQuery/QueryPredicateOperator.ts +++ b/packages/cursorless-engine/src/languages/TreeSitterQuery/QueryPredicateOperator.ts @@ -1,11 +1,11 @@ -import { PredicateOperand } from "web-tree-sitter"; -import z from "zod"; -import { +import type { PredicateOperand } from "web-tree-sitter"; +import type z from "zod"; +import type { AcceptFunctionArgs, HasSchema, InferSchemaType, } from "./PredicateOperatorSchemaTypes"; -import { MutableQueryMatch } from "./QueryCapture"; +import type { MutableQueryMatch } from "./QueryCapture"; import { constructZodErrorMessages } from "./constructZodErrorMessages"; /** diff --git a/packages/cursorless-engine/src/languages/TreeSitterQuery/TreeSitterQuery.ts b/packages/cursorless-engine/src/languages/TreeSitterQuery/TreeSitterQuery.ts index 3ecd56b1a5..8efc2246cf 100644 --- a/packages/cursorless-engine/src/languages/TreeSitterQuery/TreeSitterQuery.ts +++ b/packages/cursorless-engine/src/languages/TreeSitterQuery/TreeSitterQuery.ts @@ -1,9 +1,14 @@ -import { Position, TextDocument, showError } from "@cursorless/common"; -import { Point, Query } from "web-tree-sitter"; +import type { Position, TextDocument } from "@cursorless/common"; +import { showError } from "@cursorless/common"; +import type { Point, Query } from "web-tree-sitter"; import { ide } from "../../singletons/ide.singleton"; -import { TreeSitter } from "../../typings/TreeSitter"; +import type { TreeSitter } from "../../typings/TreeSitter"; import { getNodeRange } from "../../util/nodeSelectors"; -import { MutableQueryMatch, QueryCapture, QueryMatch } from "./QueryCapture"; +import type { + MutableQueryMatch, + QueryCapture, + QueryMatch, +} from "./QueryCapture"; import { parsePredicates } from "./parsePredicates"; import { predicateToString } from "./predicateToString"; import { groupBy, uniq } from "lodash"; diff --git a/packages/cursorless-engine/src/languages/TreeSitterQuery/checkCaptureStartEnd.test.ts b/packages/cursorless-engine/src/languages/TreeSitterQuery/checkCaptureStartEnd.test.ts index 8e273cb8ff..73b4989803 100644 --- a/packages/cursorless-engine/src/languages/TreeSitterQuery/checkCaptureStartEnd.test.ts +++ b/packages/cursorless-engine/src/languages/TreeSitterQuery/checkCaptureStartEnd.test.ts @@ -1,5 +1,6 @@ -import { Messages, Range } from "@cursorless/common"; -import { QueryCapture } from "./QueryCapture"; +import type { Messages } from "@cursorless/common"; +import { Range } from "@cursorless/common"; +import type { QueryCapture } from "./QueryCapture"; import { checkCaptureStartEnd } from "./checkCaptureStartEnd"; import assert = require("assert"); diff --git a/packages/cursorless-engine/src/languages/TreeSitterQuery/checkCaptureStartEnd.ts b/packages/cursorless-engine/src/languages/TreeSitterQuery/checkCaptureStartEnd.ts index e9b13d22b2..204374fffa 100644 --- a/packages/cursorless-engine/src/languages/TreeSitterQuery/checkCaptureStartEnd.ts +++ b/packages/cursorless-engine/src/languages/TreeSitterQuery/checkCaptureStartEnd.ts @@ -1,5 +1,6 @@ -import { Messages, showError } from "@cursorless/common"; -import { QueryCapture } from "./QueryCapture"; +import type { Messages } from "@cursorless/common"; +import { showError } from "@cursorless/common"; +import type { QueryCapture } from "./QueryCapture"; /** * Checks the captures for a single name to ensure that they are valid. Detects diff --git a/packages/cursorless-engine/src/languages/TreeSitterQuery/constructZodErrorMessages.ts b/packages/cursorless-engine/src/languages/TreeSitterQuery/constructZodErrorMessages.ts index 41768b74ce..16298fd699 100644 --- a/packages/cursorless-engine/src/languages/TreeSitterQuery/constructZodErrorMessages.ts +++ b/packages/cursorless-engine/src/languages/TreeSitterQuery/constructZodErrorMessages.ts @@ -1,5 +1,5 @@ -import { PredicateOperand } from "web-tree-sitter"; -import z from "zod"; +import type { PredicateOperand } from "web-tree-sitter"; +import type z from "zod"; import { operandToString } from "./predicateToString"; export function constructZodErrorMessages( diff --git a/packages/cursorless-engine/src/languages/TreeSitterQuery/operatorArgumentSchemaTypes.ts b/packages/cursorless-engine/src/languages/TreeSitterQuery/operatorArgumentSchemaTypes.ts index db6a6eadd4..1e5d6eaf85 100644 --- a/packages/cursorless-engine/src/languages/TreeSitterQuery/operatorArgumentSchemaTypes.ts +++ b/packages/cursorless-engine/src/languages/TreeSitterQuery/operatorArgumentSchemaTypes.ts @@ -1,6 +1,6 @@ import z from "zod"; import { assertTypesEqual } from "./assertTypesEqual"; -import { PredicateOperand } from "web-tree-sitter"; +import type { PredicateOperand } from "web-tree-sitter"; const string = z.object({ type: z.literal("string"), value: z.string() }); diff --git a/packages/cursorless-engine/src/languages/TreeSitterQuery/parsePredicates.test.ts b/packages/cursorless-engine/src/languages/TreeSitterQuery/parsePredicates.test.ts index 31de8e33e5..1274265921 100644 --- a/packages/cursorless-engine/src/languages/TreeSitterQuery/parsePredicates.test.ts +++ b/packages/cursorless-engine/src/languages/TreeSitterQuery/parsePredicates.test.ts @@ -1,6 +1,6 @@ import assert = require("assert"); import { parsePredicates } from "./parsePredicates"; -import { PredicateResult } from "web-tree-sitter"; +import type { PredicateResult } from "web-tree-sitter"; const predicates: PredicateResult[][] = [ [ diff --git a/packages/cursorless-engine/src/languages/TreeSitterQuery/parsePredicates.ts b/packages/cursorless-engine/src/languages/TreeSitterQuery/parsePredicates.ts index 04ddbae4d9..65494ddc47 100644 --- a/packages/cursorless-engine/src/languages/TreeSitterQuery/parsePredicates.ts +++ b/packages/cursorless-engine/src/languages/TreeSitterQuery/parsePredicates.ts @@ -1,5 +1,5 @@ -import { PredicateResult } from "web-tree-sitter"; -import { MutableQueryMatch } from "./QueryCapture"; +import type { PredicateResult } from "web-tree-sitter"; +import type { MutableQueryMatch } from "./QueryCapture"; import { queryPredicateOperators } from "./queryPredicateOperators"; /** diff --git a/packages/cursorless-engine/src/languages/TreeSitterQuery/predicateToString.ts b/packages/cursorless-engine/src/languages/TreeSitterQuery/predicateToString.ts index 6b9f0bc922..c07a2e941d 100644 --- a/packages/cursorless-engine/src/languages/TreeSitterQuery/predicateToString.ts +++ b/packages/cursorless-engine/src/languages/TreeSitterQuery/predicateToString.ts @@ -1,4 +1,4 @@ -import { PredicateOperand, PredicateResult } from "web-tree-sitter"; +import type { PredicateOperand, PredicateResult } from "web-tree-sitter"; export function predicateToString( predicateDescriptor: PredicateResult, diff --git a/packages/cursorless-engine/src/languages/TreeSitterQuery/queryPredicateOperators.ts b/packages/cursorless-engine/src/languages/TreeSitterQuery/queryPredicateOperators.ts index e1647f5f1e..af5990ddd6 100644 --- a/packages/cursorless-engine/src/languages/TreeSitterQuery/queryPredicateOperators.ts +++ b/packages/cursorless-engine/src/languages/TreeSitterQuery/queryPredicateOperators.ts @@ -1,7 +1,7 @@ import { Range } from "@cursorless/common"; import z from "zod"; import { makeRangeFromPositions } from "../../util/nodeSelectors"; -import { MutableQueryCapture } from "./QueryCapture"; +import type { MutableQueryCapture } from "./QueryCapture"; import { QueryPredicateOperator } from "./QueryPredicateOperator"; import { q } from "./operatorArgumentSchemaTypes"; diff --git a/packages/cursorless-engine/src/languages/TreeSitterQuery/rewriteStartOfEndOf.test.ts b/packages/cursorless-engine/src/languages/TreeSitterQuery/rewriteStartOfEndOf.test.ts index 57911d796c..f66a1a94e1 100644 --- a/packages/cursorless-engine/src/languages/TreeSitterQuery/rewriteStartOfEndOf.test.ts +++ b/packages/cursorless-engine/src/languages/TreeSitterQuery/rewriteStartOfEndOf.test.ts @@ -1,6 +1,7 @@ -import { Range, TextDocument } from "@cursorless/common"; -import { SyntaxNode } from "web-tree-sitter"; -import { MutableQueryCapture } from "./QueryCapture"; +import type { TextDocument } from "@cursorless/common"; +import { Range } from "@cursorless/common"; +import type { SyntaxNode } from "web-tree-sitter"; +import type { MutableQueryCapture } from "./QueryCapture"; import { rewriteStartOfEndOf } from "./rewriteStartOfEndOf"; import assert = require("assert"); diff --git a/packages/cursorless-engine/src/languages/TreeSitterQuery/rewriteStartOfEndOf.ts b/packages/cursorless-engine/src/languages/TreeSitterQuery/rewriteStartOfEndOf.ts index bdc8b65d21..463ba9a15c 100644 --- a/packages/cursorless-engine/src/languages/TreeSitterQuery/rewriteStartOfEndOf.ts +++ b/packages/cursorless-engine/src/languages/TreeSitterQuery/rewriteStartOfEndOf.ts @@ -1,4 +1,4 @@ -import { MutableQueryCapture } from "./QueryCapture"; +import type { MutableQueryCapture } from "./QueryCapture"; /** * Modifies captures by applying any `.startOf` or `.endOf` suffixes. For diff --git a/packages/cursorless-engine/src/languages/branchMatcher.ts b/packages/cursorless-engine/src/languages/branchMatcher.ts index 7293bdd577..2f49775878 100644 --- a/packages/cursorless-engine/src/languages/branchMatcher.ts +++ b/packages/cursorless-engine/src/languages/branchMatcher.ts @@ -1,4 +1,4 @@ -import { NodeMatcher } from "../typings/Types"; +import type { NodeMatcher } from "../typings/Types"; import { patternFinder } from "../util/nodeFinders"; import { cascadingMatcher, diff --git a/packages/cursorless-engine/src/languages/clojure.ts b/packages/cursorless-engine/src/languages/clojure.ts index bd00fb1d3b..e17e22c9b1 100644 --- a/packages/cursorless-engine/src/languages/clojure.ts +++ b/packages/cursorless-engine/src/languages/clojure.ts @@ -5,8 +5,8 @@ import { matcher, patternMatcher, } from "../util/nodeMatchers"; -import { NodeMatcherAlternative, NodeFinder } from "../typings/Types"; -import { SimpleScopeTypeType } from "@cursorless/common"; +import type { NodeMatcherAlternative, NodeFinder } from "../typings/Types"; +import type { SimpleScopeTypeType } from "@cursorless/common"; import type { SyntaxNode } from "web-tree-sitter"; import { delimitedSelector } from "../util/nodeSelectors"; import { identity } from "lodash"; diff --git a/packages/cursorless-engine/src/languages/cpp.ts b/packages/cursorless-engine/src/languages/cpp.ts index 21266bb82c..8e0782aec5 100644 --- a/packages/cursorless-engine/src/languages/cpp.ts +++ b/packages/cursorless-engine/src/languages/cpp.ts @@ -4,8 +4,8 @@ import { leadingMatcher, trailingMatcher, } from "../util/nodeMatchers"; -import { NodeMatcherAlternative } from "../typings/Types"; -import { SimpleScopeTypeType } from "@cursorless/common"; +import type { NodeMatcherAlternative } from "../typings/Types"; +import type { SimpleScopeTypeType } from "@cursorless/common"; // Generated by the following command: // > curl https://raw.githubusercontent.com/tree-sitter/tree-sitter-cpp/master/src/node-types.json | jq '[.[] | select(.type == "compound_statement") | .children.types[].type] + [.[] | select(.type == "_statement") | .subtypes[].type]' diff --git a/packages/cursorless-engine/src/languages/csharp.ts b/packages/cursorless-engine/src/languages/csharp.ts index ade8dc043b..e60affc5f3 100644 --- a/packages/cursorless-engine/src/languages/csharp.ts +++ b/packages/cursorless-engine/src/languages/csharp.ts @@ -10,8 +10,8 @@ import { conditionMatcher, patternMatcher, } from "../util/nodeMatchers"; -import { NodeMatcherAlternative } from "../typings/Types"; -import { SimpleScopeTypeType } from "@cursorless/common"; +import type { NodeMatcherAlternative } from "../typings/Types"; +import type { SimpleScopeTypeType } from "@cursorless/common"; import { nodeFinder, typedNodeFinder } from "../util/nodeFinders"; import { delimitedSelector, childRangeSelector } from "../util/nodeSelectors"; import { patternFinder } from "../util/nodeFinders"; diff --git a/packages/cursorless-engine/src/languages/elseIfExtractor.ts b/packages/cursorless-engine/src/languages/elseIfExtractor.ts index be80cf7f21..1fa316be34 100644 --- a/packages/cursorless-engine/src/languages/elseIfExtractor.ts +++ b/packages/cursorless-engine/src/languages/elseIfExtractor.ts @@ -1,6 +1,10 @@ -import { Selection, TextEditor } from "@cursorless/common"; +import type { TextEditor } from "@cursorless/common"; +import { Selection } from "@cursorless/common"; import type { SyntaxNode } from "web-tree-sitter"; -import { SelectionExtractor, SelectionWithContext } from "../typings/Types"; +import type { + SelectionExtractor, + SelectionWithContext, +} from "../typings/Types"; import { childRangeSelector, positionFromPoint, diff --git a/packages/cursorless-engine/src/languages/getNodeMatcher.ts b/packages/cursorless-engine/src/languages/getNodeMatcher.ts index 39e0b1b22d..7f3ae98f65 100644 --- a/packages/cursorless-engine/src/languages/getNodeMatcher.ts +++ b/packages/cursorless-engine/src/languages/getNodeMatcher.ts @@ -1,7 +1,7 @@ import { UnsupportedLanguageError } from "@cursorless/common"; import type { SyntaxNode } from "web-tree-sitter"; -import { SimpleScopeTypeType } from "@cursorless/common"; -import { +import type { SimpleScopeTypeType } from "@cursorless/common"; +import type { NodeMatcher, NodeMatcherValue, SelectionWithEditor, @@ -9,7 +9,7 @@ import { import { notSupported } from "../util/nodeMatchers"; import { selectionWithEditorFromRange } from "../util/selectionUtils"; import clojure from "./clojure"; -import { LegacyLanguageId } from "./LegacyLanguageId"; +import type { LegacyLanguageId } from "./LegacyLanguageId"; import cpp from "./cpp"; import csharp from "./csharp"; import go from "./go"; diff --git a/packages/cursorless-engine/src/languages/getTextFragmentExtractor.ts b/packages/cursorless-engine/src/languages/getTextFragmentExtractor.ts index 3ec3d17be7..ee312f3f8b 100644 --- a/packages/cursorless-engine/src/languages/getTextFragmentExtractor.ts +++ b/packages/cursorless-engine/src/languages/getTextFragmentExtractor.ts @@ -1,9 +1,10 @@ -import { Range, UnsupportedLanguageError } from "@cursorless/common"; +import type { Range } from "@cursorless/common"; +import { UnsupportedLanguageError } from "@cursorless/common"; import type { SyntaxNode } from "web-tree-sitter"; -import { SelectionWithEditor } from "../typings/Types"; +import type { SelectionWithEditor } from "../typings/Types"; import { notSupported } from "../util/nodeMatchers"; import { getNodeInternalRange, getNodeRange } from "../util/nodeSelectors"; -import { LegacyLanguageId } from "./LegacyLanguageId"; +import type { LegacyLanguageId } from "./LegacyLanguageId"; import { getNodeMatcher } from "./getNodeMatcher"; import { stringTextFragmentExtractor as htmlStringTextFragmentExtractor } from "./html"; import { stringTextFragmentExtractor as jsonStringTextFragmentExtractor } from "./json"; diff --git a/packages/cursorless-engine/src/languages/go.ts b/packages/cursorless-engine/src/languages/go.ts index 208d16e222..502dae1678 100644 --- a/packages/cursorless-engine/src/languages/go.ts +++ b/packages/cursorless-engine/src/languages/go.ts @@ -5,8 +5,8 @@ import { cascadingMatcher, patternMatcher, } from "../util/nodeMatchers"; -import { NodeMatcherAlternative } from "../typings/Types"; -import { SimpleScopeTypeType } from "@cursorless/common"; +import type { NodeMatcherAlternative } from "../typings/Types"; +import type { SimpleScopeTypeType } from "@cursorless/common"; const nodeMatchers: Partial< Record diff --git a/packages/cursorless-engine/src/languages/html.ts b/packages/cursorless-engine/src/languages/html.ts index 2ca3de39d6..1872a79d8e 100644 --- a/packages/cursorless-engine/src/languages/html.ts +++ b/packages/cursorless-engine/src/languages/html.ts @@ -1,6 +1,9 @@ import type { SyntaxNode } from "web-tree-sitter"; -import { SimpleScopeTypeType } from "@cursorless/common"; -import { NodeMatcherAlternative, SelectionWithEditor } from "../typings/Types"; +import type { SimpleScopeTypeType } from "@cursorless/common"; +import type { + NodeMatcherAlternative, + SelectionWithEditor, +} from "../typings/Types"; import { typedNodeFinder } from "../util/nodeFinders"; import { createPatternMatchers, diff --git a/packages/cursorless-engine/src/languages/java.ts b/packages/cursorless-engine/src/languages/java.ts index 240dd0d3ce..43843c69ca 100644 --- a/packages/cursorless-engine/src/languages/java.ts +++ b/packages/cursorless-engine/src/languages/java.ts @@ -10,8 +10,8 @@ import { import { childRangeSelector } from "../util/nodeSelectors"; import { patternFinder } from "../util/nodeFinders"; -import { NodeMatcherAlternative } from "../typings/Types"; -import { SimpleScopeTypeType } from "@cursorless/common"; +import type { NodeMatcherAlternative } from "../typings/Types"; +import type { SimpleScopeTypeType } from "@cursorless/common"; // Generated by the following command: // > curl https://raw.githubusercontent.com/tree-sitter/tree-sitter-java/master/src/node-types.json | jq '[.[] | select(.type == "statement" or .type == "declaration") | .subtypes[].type]' diff --git a/packages/cursorless-engine/src/languages/json.ts b/packages/cursorless-engine/src/languages/json.ts index 3436b8c708..5f368b92b1 100644 --- a/packages/cursorless-engine/src/languages/json.ts +++ b/packages/cursorless-engine/src/languages/json.ts @@ -1,6 +1,9 @@ import type { SyntaxNode } from "web-tree-sitter"; -import { SimpleScopeTypeType } from "@cursorless/common"; -import { NodeMatcherAlternative, SelectionWithEditor } from "../typings/Types"; +import type { SimpleScopeTypeType } from "@cursorless/common"; +import type { + NodeMatcherAlternative, + SelectionWithEditor, +} from "../typings/Types"; import { createPatternMatchers, leadingMatcher, diff --git a/packages/cursorless-engine/src/languages/latex.ts b/packages/cursorless-engine/src/languages/latex.ts index 65ed58b444..403e928fa4 100644 --- a/packages/cursorless-engine/src/languages/latex.ts +++ b/packages/cursorless-engine/src/languages/latex.ts @@ -1,11 +1,7 @@ -import { - Range, - Selection, - SimpleScopeTypeType, - TextEditor, -} from "@cursorless/common"; +import type { SimpleScopeTypeType, TextEditor } from "@cursorless/common"; +import { Range, Selection } from "@cursorless/common"; import type { SyntaxNode } from "web-tree-sitter"; -import { +import type { NodeMatcherAlternative, SelectionWithContext, SelectionWithEditor, diff --git a/packages/cursorless-engine/src/languages/markdown.ts b/packages/cursorless-engine/src/languages/markdown.ts index 3b4ffa56f1..fdc3dbacf5 100644 --- a/packages/cursorless-engine/src/languages/markdown.ts +++ b/packages/cursorless-engine/src/languages/markdown.ts @@ -1,8 +1,9 @@ -import { Range, Selection, TextEditor } from "@cursorless/common"; +import type { TextEditor } from "@cursorless/common"; +import { Range, Selection } from "@cursorless/common"; import type { SyntaxNode } from "web-tree-sitter"; import { getMatchesInRange } from "../util/getMatchesInRange"; -import { SimpleScopeTypeType } from "@cursorless/common"; -import { +import type { SimpleScopeTypeType } from "@cursorless/common"; +import type { NodeFinder, NodeMatcherAlternative, SelectionWithContext, diff --git a/packages/cursorless-engine/src/languages/php.ts b/packages/cursorless-engine/src/languages/php.ts index c710a9b50c..e0a847b04c 100644 --- a/packages/cursorless-engine/src/languages/php.ts +++ b/packages/cursorless-engine/src/languages/php.ts @@ -1,7 +1,8 @@ -import { Selection, TextEditor } from "@cursorless/common"; +import type { TextEditor } from "@cursorless/common"; +import { Selection } from "@cursorless/common"; import type { SyntaxNode } from "web-tree-sitter"; -import { SimpleScopeTypeType } from "@cursorless/common"; -import { +import type { SimpleScopeTypeType } from "@cursorless/common"; +import type { NodeMatcherAlternative, SelectionWithContext, SelectionWithEditor, diff --git a/packages/cursorless-engine/src/languages/python.ts b/packages/cursorless-engine/src/languages/python.ts index b29611b705..6eea55a44f 100644 --- a/packages/cursorless-engine/src/languages/python.ts +++ b/packages/cursorless-engine/src/languages/python.ts @@ -1,7 +1,7 @@ -import { Selection } from "@cursorless/common"; +import type { Selection } from "@cursorless/common"; import type { SyntaxNode } from "web-tree-sitter"; -import { SimpleScopeTypeType } from "@cursorless/common"; -import { NodeFinder, NodeMatcherAlternative } from "../typings/Types"; +import type { SimpleScopeTypeType } from "@cursorless/common"; +import type { NodeFinder, NodeMatcherAlternative } from "../typings/Types"; import { argumentNodeFinder, patternFinder } from "../util/nodeFinders"; import { argumentMatcher, diff --git a/packages/cursorless-engine/src/languages/ruby.ts b/packages/cursorless-engine/src/languages/ruby.ts index 9bf1c87158..02f0ade03a 100644 --- a/packages/cursorless-engine/src/languages/ruby.ts +++ b/packages/cursorless-engine/src/languages/ruby.ts @@ -9,8 +9,11 @@ import { patternMatcher, trailingMatcher, } from "../util/nodeMatchers"; -import { NodeMatcherAlternative, SelectionWithEditor } from "../typings/Types"; -import { SimpleScopeTypeType } from "@cursorless/common"; +import type { + NodeMatcherAlternative, + SelectionWithEditor, +} from "../typings/Types"; +import type { SimpleScopeTypeType } from "@cursorless/common"; import type { SyntaxNode } from "web-tree-sitter"; import { getNodeRange } from "../util/nodeSelectors"; import { patternFinder } from "../util/nodeFinders"; diff --git a/packages/cursorless-engine/src/languages/rust.ts b/packages/cursorless-engine/src/languages/rust.ts index 8d2140434d..b77404d33b 100644 --- a/packages/cursorless-engine/src/languages/rust.ts +++ b/packages/cursorless-engine/src/languages/rust.ts @@ -1,7 +1,10 @@ -import { TextEditor } from "@cursorless/common"; +import type { TextEditor } from "@cursorless/common"; import type { SyntaxNode } from "web-tree-sitter"; -import { SimpleScopeTypeType } from "@cursorless/common"; -import { NodeMatcherAlternative, SelectionWithContext } from "../typings/Types"; +import type { SimpleScopeTypeType } from "@cursorless/common"; +import type { + NodeMatcherAlternative, + SelectionWithContext, +} from "../typings/Types"; import { patternFinder } from "../util/nodeFinders"; import { ancestorChainNodeMatcher, diff --git a/packages/cursorless-engine/src/languages/scala.ts b/packages/cursorless-engine/src/languages/scala.ts index 81ac8efca1..b752fc3ea8 100644 --- a/packages/cursorless-engine/src/languages/scala.ts +++ b/packages/cursorless-engine/src/languages/scala.ts @@ -1,5 +1,5 @@ -import { SimpleScopeTypeType } from "@cursorless/common"; -import { NodeMatcherAlternative } from "../typings/Types"; +import type { SimpleScopeTypeType } from "@cursorless/common"; +import type { NodeMatcherAlternative } from "../typings/Types"; import { patternFinder } from "../util/nodeFinders"; import { argumentMatcher, diff --git a/packages/cursorless-engine/src/languages/scss.ts b/packages/cursorless-engine/src/languages/scss.ts index b0d0f3dfd2..49f01e4948 100644 --- a/packages/cursorless-engine/src/languages/scss.ts +++ b/packages/cursorless-engine/src/languages/scss.ts @@ -1,6 +1,6 @@ import type { SyntaxNode } from "web-tree-sitter"; -import { SimpleScopeTypeType } from "@cursorless/common"; -import { +import type { SimpleScopeTypeType } from "@cursorless/common"; +import type { NodeMatcherAlternative, NodeMatcherValue, SelectionWithEditor, diff --git a/packages/cursorless-engine/src/languages/ternaryBranchMatcher.ts b/packages/cursorless-engine/src/languages/ternaryBranchMatcher.ts index a89ccf8d94..dc62551f06 100644 --- a/packages/cursorless-engine/src/languages/ternaryBranchMatcher.ts +++ b/packages/cursorless-engine/src/languages/ternaryBranchMatcher.ts @@ -1,5 +1,5 @@ import type { SyntaxNode } from "web-tree-sitter"; -import { NodeMatcher } from "../typings/Types"; +import type { NodeMatcher } from "../typings/Types"; import { matcher } from "../util/nodeMatchers"; /** diff --git a/packages/cursorless-engine/src/languages/typescript.ts b/packages/cursorless-engine/src/languages/typescript.ts index 377f81d3ea..375d6c006b 100644 --- a/packages/cursorless-engine/src/languages/typescript.ts +++ b/packages/cursorless-engine/src/languages/typescript.ts @@ -1,6 +1,6 @@ -import { SimpleScopeTypeType } from "@cursorless/common"; +import type { SimpleScopeTypeType } from "@cursorless/common"; import type { SyntaxNode } from "web-tree-sitter"; -import { +import type { NodeMatcher, NodeMatcherAlternative, SelectionWithEditor, diff --git a/packages/cursorless-engine/src/processTargets/MarkStageFactory.ts b/packages/cursorless-engine/src/processTargets/MarkStageFactory.ts index 710ef6e72f..98245181c3 100644 --- a/packages/cursorless-engine/src/processTargets/MarkStageFactory.ts +++ b/packages/cursorless-engine/src/processTargets/MarkStageFactory.ts @@ -1,5 +1,5 @@ -import { Mark } from "../typings/TargetDescriptor"; -import { MarkStage } from "./PipelineStages.types"; +import type { Mark } from "../typings/TargetDescriptor"; +import type { MarkStage } from "./PipelineStages.types"; export interface MarkStageFactory { create(mark: Mark): MarkStage; diff --git a/packages/cursorless-engine/src/processTargets/MarkStageFactoryImpl.ts b/packages/cursorless-engine/src/processTargets/MarkStageFactoryImpl.ts index b93999cdfb..71d11cb9b9 100644 --- a/packages/cursorless-engine/src/processTargets/MarkStageFactoryImpl.ts +++ b/packages/cursorless-engine/src/processTargets/MarkStageFactoryImpl.ts @@ -1,9 +1,9 @@ -import { ReadOnlyHatMap } from "@cursorless/common"; -import { TargetPipelineRunner } from "."; -import { StoredTargetMap } from ".."; -import { Mark } from "../typings/TargetDescriptor"; -import { MarkStageFactory } from "./MarkStageFactory"; -import { MarkStage } from "./PipelineStages.types"; +import type { ReadOnlyHatMap } from "@cursorless/common"; +import type { TargetPipelineRunner } from "."; +import type { StoredTargetMap } from ".."; +import type { Mark } from "../typings/TargetDescriptor"; +import type { MarkStageFactory } from "./MarkStageFactory"; +import type { MarkStage } from "./PipelineStages.types"; import CursorStage from "./marks/CursorStage"; import DecoratedSymbolStage from "./marks/DecoratedSymbolStage"; import ExplicitMarkStage from "./marks/ExplicitMarkStage"; diff --git a/packages/cursorless-engine/src/processTargets/ModifierStageFactory.ts b/packages/cursorless-engine/src/processTargets/ModifierStageFactory.ts index 35709141b9..d02f0e8390 100644 --- a/packages/cursorless-engine/src/processTargets/ModifierStageFactory.ts +++ b/packages/cursorless-engine/src/processTargets/ModifierStageFactory.ts @@ -1,9 +1,9 @@ -import { +import type { ContainingScopeModifier, EveryScopeModifier, Modifier, } from "@cursorless/common"; -import { ModifierStage } from "./PipelineStages.types"; +import type { ModifierStage } from "./PipelineStages.types"; export interface ModifierStageFactory { create(modifier: Modifier): ModifierStage; diff --git a/packages/cursorless-engine/src/processTargets/ModifierStageFactoryImpl.ts b/packages/cursorless-engine/src/processTargets/ModifierStageFactoryImpl.ts index d3f9d73ef3..a2bd6b9068 100644 --- a/packages/cursorless-engine/src/processTargets/ModifierStageFactoryImpl.ts +++ b/packages/cursorless-engine/src/processTargets/ModifierStageFactoryImpl.ts @@ -1,13 +1,13 @@ -import { +import type { ContainingScopeModifier, EveryScopeModifier, Modifier, SurroundingPairModifier, } from "@cursorless/common"; -import { StoredTargetMap } from ".."; -import { LanguageDefinitions } from "../languages/LanguageDefinitions"; -import { ModifierStageFactory } from "./ModifierStageFactory"; -import { ModifierStage } from "./PipelineStages.types"; +import type { StoredTargetMap } from ".."; +import type { LanguageDefinitions } from "../languages/LanguageDefinitions"; +import type { ModifierStageFactory } from "./ModifierStageFactory"; +import type { ModifierStage } from "./PipelineStages.types"; import CascadingStage from "./modifiers/CascadingStage"; import { ModifyIfUntypedStage } from "./modifiers/ConditionalModifierStages"; import { ContainingScopeStage } from "./modifiers/ContainingScopeStage"; @@ -30,13 +30,13 @@ import RangeModifierStage from "./modifiers/RangeModifierStage"; import RawSelectionStage from "./modifiers/RawSelectionStage"; import RelativeScopeStage from "./modifiers/RelativeScopeStage"; import SurroundingPairStage from "./modifiers/SurroundingPairStage"; -import { ScopeHandlerFactory } from "./modifiers/scopeHandlers/ScopeHandlerFactory"; +import type { ScopeHandlerFactory } from "./modifiers/scopeHandlers/ScopeHandlerFactory"; import BoundedNonWhitespaceSequenceStage from "./modifiers/scopeTypeStages/BoundedNonWhitespaceStage"; -import { - LegacyContainingSyntaxScopeStage, +import type { SimpleContainingScopeModifier, SimpleEveryScopeModifier, } from "./modifiers/scopeTypeStages/LegacyContainingSyntaxScopeStage"; +import { LegacyContainingSyntaxScopeStage } from "./modifiers/scopeTypeStages/LegacyContainingSyntaxScopeStage"; import NotebookCellStage from "./modifiers/scopeTypeStages/NotebookCellStage"; export class ModifierStageFactoryImpl implements ModifierStageFactory { diff --git a/packages/cursorless-engine/src/processTargets/PipelineStages.types.ts b/packages/cursorless-engine/src/processTargets/PipelineStages.types.ts index 77135c24ce..a2068d38ef 100644 --- a/packages/cursorless-engine/src/processTargets/PipelineStages.types.ts +++ b/packages/cursorless-engine/src/processTargets/PipelineStages.types.ts @@ -1,4 +1,4 @@ -import { Target } from "../typings/target.types"; +import type { Target } from "../typings/target.types"; export interface MarkStage { run(): Target[]; diff --git a/packages/cursorless-engine/src/processTargets/TargetPipelineRunner.ts b/packages/cursorless-engine/src/processTargets/TargetPipelineRunner.ts index c5f147d8b0..1737c514c7 100644 --- a/packages/cursorless-engine/src/processTargets/TargetPipelineRunner.ts +++ b/packages/cursorless-engine/src/processTargets/TargetPipelineRunner.ts @@ -1,20 +1,20 @@ -import { +import type { Direction, ImplicitTargetDescriptor, Modifier, - Range, ScopeType, } from "@cursorless/common"; +import { Range } from "@cursorless/common"; import { uniqWith, zip } from "lodash"; -import { +import type { PrimitiveTargetDescriptor, RangeTargetDescriptor, TargetDescriptor, } from "../typings/TargetDescriptor"; -import { Target } from "../typings/target.types"; -import { MarkStageFactory } from "./MarkStageFactory"; -import { ModifierStageFactory } from "./ModifierStageFactory"; -import { MarkStage, ModifierStage } from "./PipelineStages.types"; +import type { Target } from "../typings/target.types"; +import type { MarkStageFactory } from "./MarkStageFactory"; +import type { ModifierStageFactory } from "./ModifierStageFactory"; +import type { MarkStage, ModifierStage } from "./PipelineStages.types"; import ImplicitStage from "./marks/ImplicitStage"; import { ContainingTokenIfUntypedEmptyStage } from "./modifiers/ConditionalModifierStages"; import { PlainTarget } from "./targets"; diff --git a/packages/cursorless-engine/src/processTargets/marks/DecoratedSymbolStage.ts b/packages/cursorless-engine/src/processTargets/marks/DecoratedSymbolStage.ts index 426cb0c622..ee3075f6a0 100644 --- a/packages/cursorless-engine/src/processTargets/marks/DecoratedSymbolStage.ts +++ b/packages/cursorless-engine/src/processTargets/marks/DecoratedSymbolStage.ts @@ -1,6 +1,6 @@ -import { DecoratedSymbolMark, ReadOnlyHatMap } from "@cursorless/common"; -import { Target } from "../../typings/target.types"; -import { MarkStage } from "../PipelineStages.types"; +import type { DecoratedSymbolMark, ReadOnlyHatMap } from "@cursorless/common"; +import type { Target } from "../../typings/target.types"; +import type { MarkStage } from "../PipelineStages.types"; import { UntypedTarget } from "../targets"; export default class implements MarkStage { diff --git a/packages/cursorless-engine/src/processTargets/marks/ExplicitMarkStage.ts b/packages/cursorless-engine/src/processTargets/marks/ExplicitMarkStage.ts index 81f6b9f918..6bfe22c481 100644 --- a/packages/cursorless-engine/src/processTargets/marks/ExplicitMarkStage.ts +++ b/packages/cursorless-engine/src/processTargets/marks/ExplicitMarkStage.ts @@ -1,6 +1,7 @@ -import { ExplicitMark, Range } from "@cursorless/common"; -import { Target } from "../../typings/target.types"; -import { MarkStage } from "../PipelineStages.types"; +import type { ExplicitMark } from "@cursorless/common"; +import { Range } from "@cursorless/common"; +import type { Target } from "../../typings/target.types"; +import type { MarkStage } from "../PipelineStages.types"; import { UntypedTarget } from "../targets"; import { ide } from "../../singletons/ide.singleton"; diff --git a/packages/cursorless-engine/src/processTargets/marks/LineNumberStage.ts b/packages/cursorless-engine/src/processTargets/marks/LineNumberStage.ts index 9d3fc971c5..47b51788d4 100644 --- a/packages/cursorless-engine/src/processTargets/marks/LineNumberStage.ts +++ b/packages/cursorless-engine/src/processTargets/marks/LineNumberStage.ts @@ -1,9 +1,9 @@ import type { LineNumberMark, LineNumberType } from "@cursorless/common"; -import { TextEditor } from "@cursorless/common"; +import type { TextEditor } from "@cursorless/common"; import { ide } from "../../singletons/ide.singleton"; import type { MarkStage } from "../PipelineStages.types"; import { createLineTarget } from "../modifiers/scopeHandlers"; -import { LineTarget } from "../targets"; +import type { LineTarget } from "../targets"; export default class implements MarkStage { constructor(private mark: LineNumberMark) {} diff --git a/packages/cursorless-engine/src/processTargets/marks/NothingStage.ts b/packages/cursorless-engine/src/processTargets/marks/NothingStage.ts index fa43106fbc..fe1cb629a1 100644 --- a/packages/cursorless-engine/src/processTargets/marks/NothingStage.ts +++ b/packages/cursorless-engine/src/processTargets/marks/NothingStage.ts @@ -1,6 +1,6 @@ -import { Target } from "../../typings/target.types"; -import { NothingMark } from "@cursorless/common"; -import { MarkStage } from "../PipelineStages.types"; +import type { Target } from "../../typings/target.types"; +import type { NothingMark } from "@cursorless/common"; +import type { MarkStage } from "../PipelineStages.types"; export default class implements MarkStage { constructor(private mark: NothingMark) {} diff --git a/packages/cursorless-engine/src/processTargets/marks/RangeMarkStage.ts b/packages/cursorless-engine/src/processTargets/marks/RangeMarkStage.ts index 1685863f15..1096d2883b 100644 --- a/packages/cursorless-engine/src/processTargets/marks/RangeMarkStage.ts +++ b/packages/cursorless-engine/src/processTargets/marks/RangeMarkStage.ts @@ -1,7 +1,7 @@ -import { RangeMark } from "@cursorless/common"; -import { Target } from "../../typings/target.types"; -import { MarkStageFactory } from "../MarkStageFactory"; -import { MarkStage } from "../PipelineStages.types"; +import type { RangeMark } from "@cursorless/common"; +import type { Target } from "../../typings/target.types"; +import type { MarkStageFactory } from "../MarkStageFactory"; +import type { MarkStage } from "../PipelineStages.types"; import { targetsToContinuousTarget } from "../TargetPipelineRunner"; export default class RangeMarkStage implements MarkStage { diff --git a/packages/cursorless-engine/src/processTargets/marks/StoredTargetStage.ts b/packages/cursorless-engine/src/processTargets/marks/StoredTargetStage.ts index 7929e97edb..446b6b6eb1 100644 --- a/packages/cursorless-engine/src/processTargets/marks/StoredTargetStage.ts +++ b/packages/cursorless-engine/src/processTargets/marks/StoredTargetStage.ts @@ -1,6 +1,9 @@ -import { StoredTargetKey, StoredTargetMap } from "../../core/StoredTargets"; -import { Target } from "../../typings/target.types"; -import { MarkStage } from "../PipelineStages.types"; +import type { + StoredTargetKey, + StoredTargetMap, +} from "../../core/StoredTargets"; +import type { Target } from "../../typings/target.types"; +import type { MarkStage } from "../PipelineStages.types"; export class StoredTargetStage implements MarkStage { constructor( diff --git a/packages/cursorless-engine/src/processTargets/marks/TargetMarkStage.ts b/packages/cursorless-engine/src/processTargets/marks/TargetMarkStage.ts index f9190b518d..a5661a6ab9 100644 --- a/packages/cursorless-engine/src/processTargets/marks/TargetMarkStage.ts +++ b/packages/cursorless-engine/src/processTargets/marks/TargetMarkStage.ts @@ -1,7 +1,7 @@ -import { TargetPipelineRunner } from ".."; -import { TargetMark } from "../../typings/TargetDescriptor"; -import { Target } from "../../typings/target.types"; -import { MarkStage } from "../PipelineStages.types"; +import type { TargetPipelineRunner } from ".."; +import type { TargetMark } from "../../typings/TargetDescriptor"; +import type { Target } from "../../typings/target.types"; +import type { MarkStage } from "../PipelineStages.types"; export class TargetMarkStage implements MarkStage { constructor( diff --git a/packages/cursorless-engine/src/processTargets/modifiers/CascadingStage.ts b/packages/cursorless-engine/src/processTargets/modifiers/CascadingStage.ts index dcb36111ff..b70f2ad842 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/CascadingStage.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/CascadingStage.ts @@ -1,7 +1,7 @@ -import { CascadingModifier } from "@cursorless/common"; -import { Target } from "../../typings/target.types"; -import { ModifierStageFactory } from "../ModifierStageFactory"; -import { ModifierStage } from "../PipelineStages.types"; +import type { CascadingModifier } from "@cursorless/common"; +import type { Target } from "../../typings/target.types"; +import type { ModifierStageFactory } from "../ModifierStageFactory"; +import type { ModifierStage } from "../PipelineStages.types"; /** * Tries each of the given modifiers in turn until one of them doesn't throw an diff --git a/packages/cursorless-engine/src/processTargets/modifiers/ConditionalModifierStages.ts b/packages/cursorless-engine/src/processTargets/modifiers/ConditionalModifierStages.ts index 496eb793cc..1221a9bebe 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/ConditionalModifierStages.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/ConditionalModifierStages.ts @@ -1,7 +1,7 @@ -import { Modifier, ModifyIfUntypedModifier } from "@cursorless/common"; -import { Target } from "../../typings/target.types"; -import { ModifierStageFactory } from "../ModifierStageFactory"; -import { ModifierStage } from "../PipelineStages.types"; +import type { Modifier, ModifyIfUntypedModifier } from "@cursorless/common"; +import type { Target } from "../../typings/target.types"; +import type { ModifierStageFactory } from "../ModifierStageFactory"; +import type { ModifierStage } from "../PipelineStages.types"; abstract class ConditionalModifierBaseStage implements ModifierStage { private nestedStage_?: ModifierStage; diff --git a/packages/cursorless-engine/src/processTargets/modifiers/ContainingScopeStage.ts b/packages/cursorless-engine/src/processTargets/modifiers/ContainingScopeStage.ts index 270008cc3c..41e12f4efe 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/ContainingScopeStage.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/ContainingScopeStage.ts @@ -1,11 +1,9 @@ -import { - ContainingScopeModifier, - NoContainingScopeError, -} from "@cursorless/common"; +import type { ContainingScopeModifier } from "@cursorless/common"; +import { NoContainingScopeError } from "@cursorless/common"; import type { Target } from "../../typings/target.types"; -import { ModifierStageFactory } from "../ModifierStageFactory"; +import type { ModifierStageFactory } from "../ModifierStageFactory"; import type { ModifierStage } from "../PipelineStages.types"; -import { ScopeHandlerFactory } from "./scopeHandlers/ScopeHandlerFactory"; +import type { ScopeHandlerFactory } from "./scopeHandlers/ScopeHandlerFactory"; import { getContainingScopeTarget } from "./getContainingScopeTarget"; /** diff --git a/packages/cursorless-engine/src/processTargets/modifiers/EveryScopeStage.ts b/packages/cursorless-engine/src/processTargets/modifiers/EveryScopeStage.ts index cb4c77d9f8..72d722276b 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/EveryScopeStage.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/EveryScopeStage.ts @@ -1,12 +1,12 @@ -import type { EveryScopeModifier, TextEditor } from "@cursorless/common"; -import { NoContainingScopeError, Range } from "@cursorless/common"; +import type { EveryScopeModifier, TextEditor, Range } from "@cursorless/common"; +import { NoContainingScopeError } from "@cursorless/common"; import type { Target } from "../../typings/target.types"; -import { ModifierStageFactory } from "../ModifierStageFactory"; +import type { ModifierStageFactory } from "../ModifierStageFactory"; import type { ModifierStage } from "../PipelineStages.types"; import { getContainingScopeTarget } from "./getContainingScopeTarget"; -import { ScopeHandlerFactory } from "./scopeHandlers/ScopeHandlerFactory"; -import { TargetScope } from "./scopeHandlers/scope.types"; -import { ScopeHandler } from "./scopeHandlers/scopeHandler.types"; +import type { ScopeHandlerFactory } from "./scopeHandlers/ScopeHandlerFactory"; +import type { TargetScope } from "./scopeHandlers/scope.types"; +import type { ScopeHandler } from "./scopeHandlers/scopeHandler.types"; /** * This modifier returns all scopes intersecting the input target if the target diff --git a/packages/cursorless-engine/src/processTargets/modifiers/HeadTailStage.ts b/packages/cursorless-engine/src/processTargets/modifiers/HeadTailStage.ts index 055eec292d..dde4ec6f30 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/HeadTailStage.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/HeadTailStage.ts @@ -1,12 +1,8 @@ -import { - HeadModifier, - Modifier, - Range, - TailModifier, -} from "@cursorless/common"; -import { Target } from "../../typings/target.types"; -import { ModifierStageFactory } from "../ModifierStageFactory"; -import { ModifierStage } from "../PipelineStages.types"; +import type { HeadModifier, Modifier, TailModifier } from "@cursorless/common"; +import { Range } from "@cursorless/common"; +import type { Target } from "../../typings/target.types"; +import type { ModifierStageFactory } from "../ModifierStageFactory"; +import type { ModifierStage } from "../PipelineStages.types"; import { getModifierStagesFromTargetModifiers, processModifierStages, diff --git a/packages/cursorless-engine/src/processTargets/modifiers/InstanceStage.ts b/packages/cursorless-engine/src/processTargets/modifiers/InstanceStage.ts index 279645e2be..29f21f4ee2 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/InstanceStage.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/InstanceStage.ts @@ -1,22 +1,22 @@ -import { +import type { Direction, Modifier, OrdinalScopeModifier, - Range, RelativeScopeModifier, ScopeType, TextEditor, } from "@cursorless/common"; +import { Range } from "@cursorless/common"; import { flatmap, ifilter, imap, itake } from "itertools"; import { escapeRegExp } from "lodash"; import type { Target } from "../../typings/target.types"; import { generateMatchesInRange } from "../../util/getMatchesInRange"; -import { ModifierStageFactory } from "../ModifierStageFactory"; +import type { ModifierStageFactory } from "../ModifierStageFactory"; import type { ModifierStage } from "../PipelineStages.types"; import { PlainTarget } from "../targets"; import { ContainingTokenIfUntypedEmptyStage } from "./ConditionalModifierStages"; import { OutOfRangeError } from "./targetSequenceUtils"; -import { StoredTargetMap } from "../.."; +import type { StoredTargetMap } from "../.."; export default class InstanceStage implements ModifierStage { constructor( diff --git a/packages/cursorless-engine/src/processTargets/modifiers/InteriorStage.ts b/packages/cursorless-engine/src/processTargets/modifiers/InteriorStage.ts index ffd39a78fb..db778ef4b6 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/InteriorStage.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/InteriorStage.ts @@ -1,10 +1,10 @@ -import { +import type { ExcludeInteriorModifier, InteriorOnlyModifier, } from "@cursorless/common"; -import { Target } from "../../typings/target.types"; -import { ModifierStageFactory } from "../ModifierStageFactory"; -import { ModifierStage } from "../PipelineStages.types"; +import type { Target } from "../../typings/target.types"; +import type { ModifierStageFactory } from "../ModifierStageFactory"; +import type { ModifierStage } from "../PipelineStages.types"; import { containingSurroundingPairIfUntypedModifier } from "./commonContainingScopeIfUntypedModifiers"; export class InteriorOnlyStage implements ModifierStage { diff --git a/packages/cursorless-engine/src/processTargets/modifiers/ItemStage/ItemStage.ts b/packages/cursorless-engine/src/processTargets/modifiers/ItemStage/ItemStage.ts index 0efb3d4538..2bb4388295 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/ItemStage/ItemStage.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/ItemStage/ItemStage.ts @@ -1,21 +1,18 @@ -import { +import type { ContainingScopeModifier, EveryScopeModifier, - NoContainingScopeError, - Range, SimpleScopeTypeType, TextEditor, } from "@cursorless/common"; -import { LanguageDefinitions } from "../../../languages/LanguageDefinitions"; -import { Target } from "../../../typings/target.types"; +import { NoContainingScopeError, Range } from "@cursorless/common"; +import type { LanguageDefinitions } from "../../../languages/LanguageDefinitions"; +import type { Target } from "../../../typings/target.types"; import { getInsertionDelimiter } from "../../../util/nodeSelectors"; import { getRangeLength } from "../../../util/rangeUtils"; -import { ModifierStage } from "../../PipelineStages.types"; +import type { ModifierStage } from "../../PipelineStages.types"; import { ScopeTypeTarget } from "../../targets"; -import { - LegacyContainingSyntaxScopeStage, - SimpleContainingScopeModifier, -} from "../scopeTypeStages/LegacyContainingSyntaxScopeStage"; +import type { SimpleContainingScopeModifier } from "../scopeTypeStages/LegacyContainingSyntaxScopeStage"; +import { LegacyContainingSyntaxScopeStage } from "../scopeTypeStages/LegacyContainingSyntaxScopeStage"; import { getIterationScope } from "./getIterationScope"; import { tokenizeRange } from "./tokenizeRange"; diff --git a/packages/cursorless-engine/src/processTargets/modifiers/ItemStage/getIterationScope.ts b/packages/cursorless-engine/src/processTargets/modifiers/ItemStage/getIterationScope.ts index 28a1b4e7af..217f6ed1f9 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/ItemStage/getIterationScope.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/ItemStage/getIterationScope.ts @@ -1,7 +1,9 @@ -import { Range, TextEditor, TextLine } from "@cursorless/common"; -import { LanguageDefinitions } from "../../../languages/LanguageDefinitions"; -import { Target } from "../../../typings/target.types"; -import { PlainTarget, SurroundingPairTarget } from "../../targets"; +import type { TextEditor, TextLine } from "@cursorless/common"; +import { Range } from "@cursorless/common"; +import type { LanguageDefinitions } from "../../../languages/LanguageDefinitions"; +import type { Target } from "../../../typings/target.types"; +import type { SurroundingPairTarget } from "../../targets"; +import { PlainTarget } from "../../targets"; import { fitRangeToLineContent } from "../scopeHandlers"; import { processSurroundingPair } from "../surroundingPair"; diff --git a/packages/cursorless-engine/src/processTargets/modifiers/ItemStage/tokenizeRange.ts b/packages/cursorless-engine/src/processTargets/modifiers/ItemStage/tokenizeRange.ts index d1003986c9..43269862b5 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/ItemStage/tokenizeRange.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/ItemStage/tokenizeRange.ts @@ -1,4 +1,5 @@ -import { Range, TextEditor } from "@cursorless/common"; +import type { TextEditor } from "@cursorless/common"; +import { Range } from "@cursorless/common"; /** * Given the iteration scope, returns a list of "tokens" within that collection diff --git a/packages/cursorless-engine/src/processTargets/modifiers/LeadingTrailingStages.ts b/packages/cursorless-engine/src/processTargets/modifiers/LeadingTrailingStages.ts index f519e77d8a..2bd92a3cce 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/LeadingTrailingStages.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/LeadingTrailingStages.ts @@ -1,7 +1,7 @@ -import { LeadingModifier, TrailingModifier } from "@cursorless/common"; -import { Target } from "../../typings/target.types"; -import { ModifierStageFactory } from "../ModifierStageFactory"; -import { ModifierStage } from "../PipelineStages.types"; +import type { LeadingModifier, TrailingModifier } from "@cursorless/common"; +import type { Target } from "../../typings/target.types"; +import type { ModifierStageFactory } from "../ModifierStageFactory"; +import type { ModifierStage } from "../PipelineStages.types"; import { containingTokenIfUntypedModifier } from "./commonContainingScopeIfUntypedModifiers"; /** diff --git a/packages/cursorless-engine/src/processTargets/modifiers/OrdinalScopeStage.ts b/packages/cursorless-engine/src/processTargets/modifiers/OrdinalScopeStage.ts index db6d863e4e..781bf4a26a 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/OrdinalScopeStage.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/OrdinalScopeStage.ts @@ -1,7 +1,7 @@ -import { OrdinalScopeModifier } from "@cursorless/common"; -import { Target } from "../../typings/target.types"; -import { ModifierStageFactory } from "../ModifierStageFactory"; -import { ModifierStage } from "../PipelineStages.types"; +import type { OrdinalScopeModifier } from "@cursorless/common"; +import type { Target } from "../../typings/target.types"; +import type { ModifierStageFactory } from "../ModifierStageFactory"; +import type { ModifierStage } from "../PipelineStages.types"; import { createRangeTargetFromIndices, getEveryScopeTargets, diff --git a/packages/cursorless-engine/src/processTargets/modifiers/PositionStage.ts b/packages/cursorless-engine/src/processTargets/modifiers/PositionStage.ts index a76dc163f8..875c2fc037 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/PositionStage.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/PositionStage.ts @@ -1,11 +1,8 @@ -import { Range } from "@cursorless/common"; -import { Target } from "../../typings/target.types"; -import { ModifierStage } from "../PipelineStages.types"; -import { - CommonTargetParameters, - PlainTarget, - RawSelectionTarget, -} from "../targets"; +import type { Range } from "@cursorless/common"; +import type { Target } from "../../typings/target.types"; +import type { ModifierStage } from "../PipelineStages.types"; +import type { CommonTargetParameters } from "../targets"; +import { PlainTarget, RawSelectionTarget } from "../targets"; abstract class PositionStage implements ModifierStage { run(target: Target): Target[] { diff --git a/packages/cursorless-engine/src/processTargets/modifiers/RangeModifierStage.ts b/packages/cursorless-engine/src/processTargets/modifiers/RangeModifierStage.ts index 721b810399..101a744b75 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/RangeModifierStage.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/RangeModifierStage.ts @@ -1,7 +1,7 @@ -import { RangeModifier } from "@cursorless/common"; -import { Target } from "../../typings/target.types"; -import { ModifierStageFactory } from "../ModifierStageFactory"; -import { ModifierStage } from "../PipelineStages.types"; +import type { RangeModifier } from "@cursorless/common"; +import type { Target } from "../../typings/target.types"; +import type { ModifierStageFactory } from "../ModifierStageFactory"; +import type { ModifierStage } from "../PipelineStages.types"; import { targetsToContinuousTarget } from "../TargetPipelineRunner"; export default class RangeModifierStage implements ModifierStage { diff --git a/packages/cursorless-engine/src/processTargets/modifiers/RelativeExclusiveScopeStage.ts b/packages/cursorless-engine/src/processTargets/modifiers/RelativeExclusiveScopeStage.ts index ab2c7573bf..7c2aade5ab 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/RelativeExclusiveScopeStage.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/RelativeExclusiveScopeStage.ts @@ -1,11 +1,11 @@ import type { RelativeScopeModifier } from "@cursorless/common"; import type { Target } from "../../typings/target.types"; -import { ModifierStageFactory } from "../ModifierStageFactory"; +import type { ModifierStageFactory } from "../ModifierStageFactory"; import type { ModifierStage } from "../PipelineStages.types"; import { constructScopeRangeTarget } from "./constructScopeRangeTarget"; import { runLegacy } from "./relativeScopeLegacy"; -import { ScopeHandlerFactory } from "./scopeHandlers/ScopeHandlerFactory"; -import { TargetScope } from "./scopeHandlers/scope.types"; +import type { ScopeHandlerFactory } from "./scopeHandlers/ScopeHandlerFactory"; +import type { TargetScope } from "./scopeHandlers/scope.types"; import type { ContainmentPolicy } from "./scopeHandlers/scopeHandler.types"; import { OutOfRangeError } from "./targetSequenceUtils"; diff --git a/packages/cursorless-engine/src/processTargets/modifiers/RelativeInclusiveScopeStage.ts b/packages/cursorless-engine/src/processTargets/modifiers/RelativeInclusiveScopeStage.ts index 73528db44c..b77cfa0802 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/RelativeInclusiveScopeStage.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/RelativeInclusiveScopeStage.ts @@ -1,14 +1,12 @@ -import { - NoContainingScopeError, - RelativeScopeModifier, -} from "@cursorless/common"; +import type { RelativeScopeModifier } from "@cursorless/common"; +import { NoContainingScopeError } from "@cursorless/common"; import type { Target } from "../../typings/target.types"; -import { ModifierStageFactory } from "../ModifierStageFactory"; +import type { ModifierStageFactory } from "../ModifierStageFactory"; import type { ModifierStage } from "../PipelineStages.types"; import { constructScopeRangeTarget } from "./constructScopeRangeTarget"; import { getPreferredScopeTouchingPosition } from "./getPreferredScopeTouchingPosition"; import { runLegacy } from "./relativeScopeLegacy"; -import { ScopeHandlerFactory } from "./scopeHandlers/ScopeHandlerFactory"; +import type { ScopeHandlerFactory } from "./scopeHandlers/ScopeHandlerFactory"; import { itake } from "itertools"; import { OutOfRangeError } from "./targetSequenceUtils"; /** diff --git a/packages/cursorless-engine/src/processTargets/modifiers/RelativeScopeStage.ts b/packages/cursorless-engine/src/processTargets/modifiers/RelativeScopeStage.ts index 8068af5e35..9727ccb0c9 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/RelativeScopeStage.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/RelativeScopeStage.ts @@ -1,10 +1,10 @@ import type { RelativeScopeModifier } from "@cursorless/common"; import type { Target } from "../../typings/target.types"; -import { ModifierStageFactory } from "../ModifierStageFactory"; +import type { ModifierStageFactory } from "../ModifierStageFactory"; import type { ModifierStage } from "../PipelineStages.types"; import RelativeExclusiveScopeStage from "./RelativeExclusiveScopeStage"; import { RelativeInclusiveScopeStage } from "./RelativeInclusiveScopeStage"; -import { ScopeHandlerFactory } from "./scopeHandlers/ScopeHandlerFactory"; +import type { ScopeHandlerFactory } from "./scopeHandlers/ScopeHandlerFactory"; /** * Implements relative scope modifiers like "next funk", "two tokens", etc. diff --git a/packages/cursorless-engine/src/processTargets/modifiers/SurroundingPairStage.ts b/packages/cursorless-engine/src/processTargets/modifiers/SurroundingPairStage.ts index 153ca5d448..93d6c1670f 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/SurroundingPairStage.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/SurroundingPairStage.ts @@ -2,10 +2,10 @@ import type { ContainingSurroundingPairModifier, SurroundingPairModifier, } from "@cursorless/common"; -import { LanguageDefinitions } from "../../languages/LanguageDefinitions"; +import type { LanguageDefinitions } from "../../languages/LanguageDefinitions"; import type { Target } from "../../typings/target.types"; import type { ModifierStage } from "../PipelineStages.types"; -import { SurroundingPairTarget } from "../targets"; +import type { SurroundingPairTarget } from "../targets"; import { processSurroundingPair } from "./surroundingPair"; /** diff --git a/packages/cursorless-engine/src/processTargets/modifiers/commonContainingScopeIfUntypedModifiers.ts b/packages/cursorless-engine/src/processTargets/modifiers/commonContainingScopeIfUntypedModifiers.ts index 01eb757f6a..213bd87053 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/commonContainingScopeIfUntypedModifiers.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/commonContainingScopeIfUntypedModifiers.ts @@ -1,4 +1,4 @@ -import { Modifier } from "@cursorless/common"; +import type { Modifier } from "@cursorless/common"; // NB: We import `Target` below just so that @link below resolves. Once one of // the following issues are fixed, we can either remove the above line or // switch to `{import("foo")}` syntax in the `{@link}` tag. diff --git a/packages/cursorless-engine/src/processTargets/modifiers/constructScopeRangeTarget.ts b/packages/cursorless-engine/src/processTargets/modifiers/constructScopeRangeTarget.ts index 170b8c157d..0240d35069 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/constructScopeRangeTarget.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/constructScopeRangeTarget.ts @@ -1,5 +1,5 @@ -import { Target } from "../../typings/target.types"; -import { TargetScope } from "./scopeHandlers/scope.types"; +import type { Target } from "../../typings/target.types"; +import type { TargetScope } from "./scopeHandlers/scope.types"; /** * Constructs a target consisting of a range between {@link scope1} and diff --git a/packages/cursorless-engine/src/processTargets/modifiers/getContainingScopeTarget.ts b/packages/cursorless-engine/src/processTargets/modifiers/getContainingScopeTarget.ts index 24aa3f6c6a..9448cc6f4a 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/getContainingScopeTarget.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/getContainingScopeTarget.ts @@ -1,8 +1,8 @@ -import { Direction, Position, TextEditor } from "@cursorless/common"; +import type { Direction, Position, TextEditor } from "@cursorless/common"; import type { Target } from "../../typings/target.types"; import { constructScopeRangeTarget } from "./constructScopeRangeTarget"; -import { TargetScope } from "./scopeHandlers/scope.types"; -import { ScopeHandler } from "./scopeHandlers/scopeHandler.types"; +import type { TargetScope } from "./scopeHandlers/scope.types"; +import type { ScopeHandler } from "./scopeHandlers/scopeHandler.types"; import { getPreferredScopeTouchingPosition } from "./getPreferredScopeTouchingPosition"; /** diff --git a/packages/cursorless-engine/src/processTargets/modifiers/getPreferredScopeTouchingPosition.ts b/packages/cursorless-engine/src/processTargets/modifiers/getPreferredScopeTouchingPosition.ts index db0a3b432b..40871e41ca 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/getPreferredScopeTouchingPosition.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/getPreferredScopeTouchingPosition.ts @@ -1,6 +1,6 @@ -import { Direction, Position, TextEditor } from "@cursorless/common"; -import { TargetScope } from "./scopeHandlers/scope.types"; -import { ScopeHandler } from "./scopeHandlers/scopeHandler.types"; +import type { Direction, Position, TextEditor } from "@cursorless/common"; +import type { TargetScope } from "./scopeHandlers/scope.types"; +import type { ScopeHandler } from "./scopeHandlers/scopeHandler.types"; /** * Returns the preferred scope touching the input position, or undefined if no diff --git a/packages/cursorless-engine/src/processTargets/modifiers/relativeScopeLegacy.ts b/packages/cursorless-engine/src/processTargets/modifiers/relativeScopeLegacy.ts index 5c952a7270..f9275471d5 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/relativeScopeLegacy.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/relativeScopeLegacy.ts @@ -1,7 +1,7 @@ -import { Range, RelativeScopeModifier } from "@cursorless/common"; +import type { Range, RelativeScopeModifier } from "@cursorless/common"; import { findLastIndex } from "lodash"; -import { Target } from "../../typings/target.types"; -import { ModifierStageFactory } from "../ModifierStageFactory"; +import type { Target } from "../../typings/target.types"; +import type { ModifierStageFactory } from "../ModifierStageFactory"; import { UntypedTarget } from "../targets"; import { createRangeTargetFromIndices, diff --git a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/BaseScopeHandler.test.ts b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/BaseScopeHandler.test.ts index 28d9fb4636..16552ffe2f 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/BaseScopeHandler.test.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/BaseScopeHandler.test.ts @@ -1,7 +1,8 @@ -import { TextEditor, Position, Direction, Range } from "@cursorless/common"; +import type { TextEditor, Direction } from "@cursorless/common"; +import { Position, Range } from "@cursorless/common"; import BaseScopeHandler from "./BaseScopeHandler"; -import { TargetScope } from "./scope.types"; -import { +import type { TargetScope } from "./scope.types"; +import type { CustomScopeType, ScopeIteratorRequirements, } from "./scopeHandler.types"; diff --git a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/BaseScopeHandler.ts b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/BaseScopeHandler.ts index a8d71ff9ec..714ba91a42 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/BaseScopeHandler.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/BaseScopeHandler.ts @@ -1,6 +1,6 @@ // eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-imports import type { Direction, ScopeType } from "@cursorless/common"; -import { Position, TextEditor } from "@cursorless/common"; +import type { Position, TextEditor } from "@cursorless/common"; import type { TargetScope } from "./scope.types"; import type { CustomScopeType, diff --git a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/CharacterScopeHandler.ts b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/CharacterScopeHandler.ts index c6deb9a3e5..a503fc1813 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/CharacterScopeHandler.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/CharacterScopeHandler.ts @@ -1,7 +1,7 @@ import { imap } from "itertools"; import { NestedScopeHandler } from "."; import { generateMatchesInRange } from "../../../util/getMatchesInRange"; -import { Direction, ScopeType } from "@cursorless/common"; +import type { Direction, ScopeType } from "@cursorless/common"; import { getMatcher } from "../../../tokenizer"; import { testRegex } from "../../../util/regex"; import { PlainTarget } from "../../targets"; diff --git a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/DocumentScopeHandler.ts b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/DocumentScopeHandler.ts index 6df7da3907..760c2b4785 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/DocumentScopeHandler.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/DocumentScopeHandler.ts @@ -1,8 +1,8 @@ -import { TextEditor, Position } from "@cursorless/common"; -import { Direction, ScopeType } from "@cursorless/common"; +import type { TextEditor, Position } from "@cursorless/common"; +import type { Direction, ScopeType } from "@cursorless/common"; import { DocumentTarget } from "../../targets"; import BaseScopeHandler from "./BaseScopeHandler"; -import { TargetScope } from "./scope.types"; +import type { TargetScope } from "./scope.types"; export default class DocumentScopeHandler extends BaseScopeHandler { public readonly scopeType = { type: "document" } as const; diff --git a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/IdentifierScopeHandler.ts b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/IdentifierScopeHandler.ts index feebab7551..5e451fb19e 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/IdentifierScopeHandler.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/IdentifierScopeHandler.ts @@ -1,7 +1,7 @@ import { imap } from "itertools"; import { NestedScopeHandler } from "."; import { getMatcher } from "../../../tokenizer"; -import { Direction } from "@cursorless/common"; +import type { Direction } from "@cursorless/common"; import { generateMatchesInRange } from "../../../util/getMatchesInRange"; import { TokenTarget } from "../../targets"; import type { TargetScope } from "./scope.types"; diff --git a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/LineScopeHandler.ts b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/LineScopeHandler.ts index 2324171397..71d9871c32 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/LineScopeHandler.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/LineScopeHandler.ts @@ -1,5 +1,6 @@ -import { Position, Range, TextEditor } from "@cursorless/common"; -import { Direction, ScopeType } from "@cursorless/common"; +import type { Position, TextEditor } from "@cursorless/common"; +import { Range } from "@cursorless/common"; +import type { Direction, ScopeType } from "@cursorless/common"; import { LineTarget } from "../../targets"; import BaseScopeHandler from "./BaseScopeHandler"; import type { TargetScope } from "./scope.types"; diff --git a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/NestedScopeHandler.ts b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/NestedScopeHandler.ts index d6a718c34b..372a139d3e 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/NestedScopeHandler.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/NestedScopeHandler.ts @@ -1,8 +1,8 @@ import type { Direction, ScopeType } from "@cursorless/common"; -import { Position, TextEditor } from "@cursorless/common"; +import type { Position, TextEditor } from "@cursorless/common"; import { flatmap } from "itertools"; import BaseScopeHandler from "./BaseScopeHandler"; -import { ScopeHandlerFactory } from "./ScopeHandlerFactory"; +import type { ScopeHandlerFactory } from "./ScopeHandlerFactory"; import type { TargetScope } from "./scope.types"; import type { ScopeHandler, diff --git a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/NotHierarchicalScopeError.ts b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/NotHierarchicalScopeError.ts index a32d192245..98cacbdfbe 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/NotHierarchicalScopeError.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/NotHierarchicalScopeError.ts @@ -1,4 +1,4 @@ -import { ScopeType } from "@cursorless/common"; +import type { ScopeType } from "@cursorless/common"; import { scopeTypeToString } from "./scopeTypeUtil"; /** diff --git a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/OneOfScopeHandler.ts b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/OneOfScopeHandler.ts index 75be46d094..700d5a5681 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/OneOfScopeHandler.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/OneOfScopeHandler.ts @@ -1,4 +1,4 @@ -import { +import type { Direction, OneOfScopeType, Position, @@ -6,10 +6,10 @@ import { } from "@cursorless/common"; import BaseScopeHandler from "./BaseScopeHandler"; import { advanceIteratorsUntil, getInitialIteratorInfos } from "./IteratorInfo"; -import { ScopeHandlerFactory } from "./ScopeHandlerFactory"; +import type { ScopeHandlerFactory } from "./ScopeHandlerFactory"; import { compareTargetScopes } from "./compareTargetScopes"; import type { TargetScope } from "./scope.types"; -import { +import type { CustomScopeType, ScopeHandler, ScopeIteratorRequirements, diff --git a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/ParagraphScopeHandler.ts b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/ParagraphScopeHandler.ts index cfb62dcc48..77d7e24e0d 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/ParagraphScopeHandler.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/ParagraphScopeHandler.ts @@ -1,15 +1,15 @@ -import { +import type { Position, Range, TextDocument, TextEditor, TextLine, } from "@cursorless/common"; -import { Direction, ScopeType } from "@cursorless/common"; +import type { Direction, ScopeType } from "@cursorless/common"; import { ParagraphTarget } from "../../targets"; import BaseScopeHandler from "./BaseScopeHandler"; import { fitRangeToLineContent } from "./LineScopeHandler"; -import { TargetScope } from "./scope.types"; +import type { TargetScope } from "./scope.types"; export default class TokenScopeHandler extends BaseScopeHandler { public readonly scopeType: ScopeType = { type: "paragraph" }; diff --git a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/RegexScopeHandler.ts b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/RegexScopeHandler.ts index 209ede051c..48189ced66 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/RegexScopeHandler.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/RegexScopeHandler.ts @@ -1,9 +1,14 @@ -import { CustomRegexScopeType, Direction, ScopeType } from "@cursorless/common"; +import type { + CustomRegexScopeType, + Direction, + ScopeType, +} from "@cursorless/common"; import { imap } from "itertools"; -import { NestedScopeHandler, ScopeHandlerFactory } from "."; +import type { ScopeHandlerFactory } from "."; +import { NestedScopeHandler } from "."; import { generateMatchesInRange } from "../../../util/getMatchesInRange"; import { TokenTarget } from "../../targets"; -import { TargetScope } from "./scope.types"; +import type { TargetScope } from "./scope.types"; abstract class RegexStageBase extends NestedScopeHandler { public readonly iterationScopeType: ScopeType = { type: "line" }; diff --git a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/ScopeHandlerFactoryImpl.ts b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/ScopeHandlerFactoryImpl.ts index 3efd7f8770..b533cb1d95 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/ScopeHandlerFactoryImpl.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/ScopeHandlerFactoryImpl.ts @@ -1,4 +1,5 @@ import type { ScopeType } from "@cursorless/common"; +import type { ScopeHandlerFactory } from "."; import { CharacterScopeHandler, CustomRegexScopeHandler, @@ -8,13 +9,12 @@ import { NonWhitespaceSequenceScopeHandler, OneOfScopeHandler, ParagraphScopeHandler, - ScopeHandlerFactory, SentenceScopeHandler, TokenScopeHandler, UrlScopeHandler, WordScopeHandler, } from "."; -import { LanguageDefinitions } from "../../../languages/LanguageDefinitions"; +import type { LanguageDefinitions } from "../../../languages/LanguageDefinitions"; import type { CustomScopeType, ScopeHandler } from "./scopeHandler.types"; /** diff --git a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/SentenceScopeHandler/SentenceScopeHandler.ts b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/SentenceScopeHandler/SentenceScopeHandler.ts index d07f0270b4..b099bb38a7 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/SentenceScopeHandler/SentenceScopeHandler.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/SentenceScopeHandler/SentenceScopeHandler.ts @@ -1,10 +1,11 @@ -import { Direction, Range } from "@cursorless/common"; +import type { Direction } from "@cursorless/common"; +import { Range } from "@cursorless/common"; import { imap } from "itertools"; import { NestedScopeHandler } from ".."; import { TokenTarget } from "../../../targets"; import type { TargetScope } from "../scope.types"; import SentenceSegmenter from "./SentenceSegmenter"; -import { MatchedText } from "../../../../util/regex"; +import type { MatchedText } from "../../../../util/regex"; export default class SentenceScopeHandler extends NestedScopeHandler { public readonly scopeType = { type: "sentence" } as const; diff --git a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/SentenceScopeHandler/SentenceSegmenter.ts b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/SentenceScopeHandler/SentenceSegmenter.ts index db5982b8bd..cf41ec7d05 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/SentenceScopeHandler/SentenceSegmenter.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/SentenceScopeHandler/SentenceSegmenter.ts @@ -1,5 +1,6 @@ import * as sbd from "sbd"; -import { MatchedText, matchRegex, testRegex } from "../../../../util/regex"; +import type { MatchedText } from "../../../../util/regex"; +import { matchRegex, testRegex } from "../../../../util/regex"; // A sentence starts with a letter with adjacent leading symbols. Whitespace excluded. const leadingOffsetRegex = /\S*\p{L}/u; diff --git a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/SurroundingPairScopeHandler.ts b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/SurroundingPairScopeHandler.ts index cfa2e5d594..182020bd88 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/SurroundingPairScopeHandler.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/SurroundingPairScopeHandler.ts @@ -1,8 +1,8 @@ -import { Position, TextEditor } from "@cursorless/common"; -import { Direction, SurroundingPairScopeType } from "@cursorless/common"; +import type { Position, TextEditor } from "@cursorless/common"; +import type { Direction, SurroundingPairScopeType } from "@cursorless/common"; import BaseScopeHandler from "./BaseScopeHandler"; -import { TargetScope } from "./scope.types"; -import { ScopeIteratorRequirements } from "./scopeHandler.types"; +import type { TargetScope } from "./scope.types"; +import type { ScopeIteratorRequirements } from "./scopeHandler.types"; export default class SurroundingPairScopeHandler extends BaseScopeHandler { public readonly iterationScopeType; diff --git a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/TokenScopeHandler.ts b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/TokenScopeHandler.ts index eb7f8d5411..33dcac2a4c 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/TokenScopeHandler.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/TokenScopeHandler.ts @@ -1,7 +1,7 @@ import { imap } from "itertools"; import { NestedScopeHandler } from "."; import { generateMatchesInRange } from "../../../util/getMatchesInRange"; -import { Direction } from "@cursorless/common"; +import type { Direction } from "@cursorless/common"; import { getMatcher } from "../../../tokenizer"; import { testRegex } from "../../../util/regex"; import { TokenTarget } from "../../targets"; diff --git a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/TreeSitterScopeHandler/BaseTreeSitterScopeHandler.ts b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/TreeSitterScopeHandler/BaseTreeSitterScopeHandler.ts index 3011807a4e..2c42e88b43 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/TreeSitterScopeHandler/BaseTreeSitterScopeHandler.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/TreeSitterScopeHandler/BaseTreeSitterScopeHandler.ts @@ -1,17 +1,17 @@ -import { +import type { Direction, Position, TextDocument, TextEditor, - showError, } from "@cursorless/common"; +import { showError } from "@cursorless/common"; import { uniqWith } from "lodash"; -import { TreeSitterQuery } from "../../../../languages/TreeSitterQuery"; -import { QueryMatch } from "../../../../languages/TreeSitterQuery/QueryCapture"; +import type { TreeSitterQuery } from "../../../../languages/TreeSitterQuery"; +import type { QueryMatch } from "../../../../languages/TreeSitterQuery/QueryCapture"; import BaseScopeHandler from "../BaseScopeHandler"; import { compareTargetScopes } from "../compareTargetScopes"; -import { TargetScope } from "../scope.types"; -import { +import type { TargetScope } from "../scope.types"; +import type { ContainmentPolicy, ScopeIteratorRequirements, } from "../scopeHandler.types"; diff --git a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/TreeSitterScopeHandler/TreeSitterIterationScopeHandler.ts b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/TreeSitterScopeHandler/TreeSitterIterationScopeHandler.ts index 7b0a044103..9f5acd1ebc 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/TreeSitterScopeHandler/TreeSitterIterationScopeHandler.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/TreeSitterScopeHandler/TreeSitterIterationScopeHandler.ts @@ -1,11 +1,13 @@ -import { ScopeType, SimpleScopeType, TextEditor } from "@cursorless/common"; -import { TreeSitterQuery } from "../../../../languages/TreeSitterQuery"; -import { QueryMatch } from "../../../../languages/TreeSitterQuery/QueryCapture"; +import type { + ScopeType, + SimpleScopeType, + TextEditor, +} from "@cursorless/common"; +import type { TreeSitterQuery } from "../../../../languages/TreeSitterQuery"; +import type { QueryMatch } from "../../../../languages/TreeSitterQuery/QueryCapture"; import { PlainTarget } from "../../../targets"; -import { - BaseTreeSitterScopeHandler, - ExtendedTargetScope, -} from "./BaseTreeSitterScopeHandler"; +import type { ExtendedTargetScope } from "./BaseTreeSitterScopeHandler"; +import { BaseTreeSitterScopeHandler } from "./BaseTreeSitterScopeHandler"; import { getRelatedCapture, getRelatedRange } from "./captureUtils"; /** Scope handler to be used for iteration scopes of tree-sitter scope types */ diff --git a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/TreeSitterScopeHandler/TreeSitterScopeHandler.ts b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/TreeSitterScopeHandler/TreeSitterScopeHandler.ts index e78a8c32c5..16f0905365 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/TreeSitterScopeHandler/TreeSitterScopeHandler.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/TreeSitterScopeHandler/TreeSitterScopeHandler.ts @@ -1,12 +1,10 @@ -import { Range, SimpleScopeType, TextEditor } from "@cursorless/common"; -import { TreeSitterQuery } from "../../../../languages/TreeSitterQuery"; -import { QueryMatch } from "../../../../languages/TreeSitterQuery/QueryCapture"; +import type { Range, SimpleScopeType, TextEditor } from "@cursorless/common"; +import type { TreeSitterQuery } from "../../../../languages/TreeSitterQuery"; +import type { QueryMatch } from "../../../../languages/TreeSitterQuery/QueryCapture"; import ScopeTypeTarget from "../../../targets/ScopeTypeTarget"; -import { CustomScopeType } from "../scopeHandler.types"; -import { - BaseTreeSitterScopeHandler, - ExtendedTargetScope, -} from "./BaseTreeSitterScopeHandler"; +import type { CustomScopeType } from "../scopeHandler.types"; +import type { ExtendedTargetScope } from "./BaseTreeSitterScopeHandler"; +import { BaseTreeSitterScopeHandler } from "./BaseTreeSitterScopeHandler"; import { TreeSitterIterationScopeHandler } from "./TreeSitterIterationScopeHandler"; import { findCaptureByName, getRelatedRange } from "./captureUtils"; diff --git a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/TreeSitterScopeHandler/TreeSitterTextFragmentScopeHandler.ts b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/TreeSitterScopeHandler/TreeSitterTextFragmentScopeHandler.ts index a7fb8609dd..55884bd784 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/TreeSitterScopeHandler/TreeSitterTextFragmentScopeHandler.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/TreeSitterScopeHandler/TreeSitterTextFragmentScopeHandler.ts @@ -1,12 +1,10 @@ -import { ScopeType, TextEditor } from "@cursorless/common"; -import { TreeSitterQuery } from "../../../../languages/TreeSitterQuery"; -import { QueryMatch } from "../../../../languages/TreeSitterQuery/QueryCapture"; +import type { ScopeType, TextEditor } from "@cursorless/common"; +import type { TreeSitterQuery } from "../../../../languages/TreeSitterQuery"; +import type { QueryMatch } from "../../../../languages/TreeSitterQuery/QueryCapture"; import { TEXT_FRAGMENT_CAPTURE_NAME } from "../../../../languages/captureNames"; import { PlainTarget } from "../../../targets"; -import { - BaseTreeSitterScopeHandler, - ExtendedTargetScope, -} from "./BaseTreeSitterScopeHandler"; +import type { ExtendedTargetScope } from "./BaseTreeSitterScopeHandler"; +import { BaseTreeSitterScopeHandler } from "./BaseTreeSitterScopeHandler"; import { findCaptureByName } from "./captureUtils"; /** Scope handler to be used for extracting text fragments from the perspective diff --git a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/TreeSitterScopeHandler/captureUtils.ts b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/TreeSitterScopeHandler/captureUtils.ts index 552e671993..998e9e761b 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/TreeSitterScopeHandler/captureUtils.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/TreeSitterScopeHandler/captureUtils.ts @@ -1,5 +1,5 @@ -import { Range } from "@cursorless/common"; -import { QueryMatch } from "../../../../languages/TreeSitterQuery/QueryCapture"; +import type { Range } from "@cursorless/common"; +import type { QueryMatch } from "../../../../languages/TreeSitterQuery/QueryCapture"; /** * Gets a capture that is related to the scope. For example, if the scope is diff --git a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/WordScopeHandler/WordScopeHandler.ts b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/WordScopeHandler/WordScopeHandler.ts index 085a9e87ef..f10e21ffad 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/WordScopeHandler/WordScopeHandler.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/WordScopeHandler/WordScopeHandler.ts @@ -1,7 +1,8 @@ -import { Range, TextEditor } from "@cursorless/common"; +import type { TextEditor } from "@cursorless/common"; +import { Range } from "@cursorless/common"; import { NestedScopeHandler } from ".."; import WordTokenizer from "./WordTokenizer"; -import { Direction } from "@cursorless/common"; +import type { Direction } from "@cursorless/common"; import { SubTokenWordTarget } from "../../../targets"; import type { TargetScope } from "../scope.types"; diff --git a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/compareTargetScopes.ts b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/compareTargetScopes.ts index 099d7d7ce9..11fbb1f0ac 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/compareTargetScopes.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/compareTargetScopes.ts @@ -1,6 +1,6 @@ -import { Position, Range } from "@cursorless/common"; -import { Direction } from "@cursorless/common"; -import { TargetScope } from "./scope.types"; +import type { Position, Range } from "@cursorless/common"; +import type { Direction } from "@cursorless/common"; +import type { TargetScope } from "./scope.types"; /** * Defines the canonical scope ordering. diff --git a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/scope.types.ts b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/scope.types.ts index 73ce68be3d..e4f2bba0a9 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/scope.types.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/scope.types.ts @@ -1,4 +1,4 @@ -import { Range, TextEditor } from "@cursorless/common"; +import type { Range, TextEditor } from "@cursorless/common"; import type { Target } from "../../../typings/target.types"; /** diff --git a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/scopeTypeUtil.ts b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/scopeTypeUtil.ts index 95f6ad3c60..bdf7f8da42 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/scopeTypeUtil.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/scopeTypeUtil.ts @@ -1,4 +1,4 @@ -import { ScopeType } from "@cursorless/common"; +import type { ScopeType } from "@cursorless/common"; export function scopeTypeToString(scopeType: ScopeType) { return scopeType.type; diff --git a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/shouldYieldScope.ts b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/shouldYieldScope.ts index 81c6dcac1a..3035692255 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/shouldYieldScope.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/shouldYieldScope.ts @@ -1,9 +1,10 @@ -import { Position, Range } from "@cursorless/common"; -import { Direction } from "@cursorless/common"; +import type { Position } from "@cursorless/common"; +import { Range } from "@cursorless/common"; +import type { Direction } from "@cursorless/common"; import { strictlyContains } from "../../../util/rangeUtils"; import { compareTargetScopes } from "./compareTargetScopes"; -import { TargetScope } from "./scope.types"; -import { ScopeIteratorRequirements } from "./scopeHandler.types"; +import type { TargetScope } from "./scope.types"; +import type { ScopeIteratorRequirements } from "./scopeHandler.types"; /** * Returns `true` if the scope should be yielded. Checks that the scope meets diff --git a/packages/cursorless-engine/src/processTargets/modifiers/scopeTypeStages/BoundedNonWhitespaceStage.ts b/packages/cursorless-engine/src/processTargets/modifiers/scopeTypeStages/BoundedNonWhitespaceStage.ts index 2cd9d3947d..a130e77992 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/scopeTypeStages/BoundedNonWhitespaceStage.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/scopeTypeStages/BoundedNonWhitespaceStage.ts @@ -1,12 +1,12 @@ -import { +import type { ContainingScopeModifier, EveryScopeModifier, - NoContainingScopeError, } from "@cursorless/common"; -import { LanguageDefinitions } from "../../../languages/LanguageDefinitions"; -import { Target } from "../../../typings/target.types"; -import { ModifierStageFactory } from "../../ModifierStageFactory"; -import { ModifierStage } from "../../PipelineStages.types"; +import { NoContainingScopeError } from "@cursorless/common"; +import type { LanguageDefinitions } from "../../../languages/LanguageDefinitions"; +import type { Target } from "../../../typings/target.types"; +import type { ModifierStageFactory } from "../../ModifierStageFactory"; +import type { ModifierStage } from "../../PipelineStages.types"; import { TokenTarget } from "../../targets"; import { processSurroundingPair } from "../surroundingPair"; diff --git a/packages/cursorless-engine/src/processTargets/modifiers/scopeTypeStages/LegacyContainingSyntaxScopeStage.ts b/packages/cursorless-engine/src/processTargets/modifiers/scopeTypeStages/LegacyContainingSyntaxScopeStage.ts index baed206ed3..a33172702b 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/scopeTypeStages/LegacyContainingSyntaxScopeStage.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/scopeTypeStages/LegacyContainingSyntaxScopeStage.ts @@ -5,7 +5,7 @@ import type { } from "@cursorless/common"; import { NoContainingScopeError, Selection } from "@cursorless/common"; import type { SyntaxNode } from "web-tree-sitter"; -import { LanguageDefinitions } from "../../../languages/LanguageDefinitions"; +import type { LanguageDefinitions } from "../../../languages/LanguageDefinitions"; import { getNodeMatcher } from "../../../languages/getNodeMatcher"; import type { NodeMatcher, diff --git a/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/delimiterMaps.ts b/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/delimiterMaps.ts index b8e54be1fe..33d43282c0 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/delimiterMaps.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/delimiterMaps.ts @@ -1,4 +1,4 @@ -import { +import type { ComplexSurroundingPairName, SimpleSurroundingPairName, } from "@cursorless/common"; diff --git a/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/extractSelectionFromSurroundingPairOffsets.ts b/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/extractSelectionFromSurroundingPairOffsets.ts index a25fbf334c..2ea44f8687 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/extractSelectionFromSurroundingPairOffsets.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/extractSelectionFromSurroundingPairOffsets.ts @@ -1,5 +1,6 @@ -import { Range, Selection, TextDocument } from "@cursorless/common"; -import { SurroundingPairOffsets } from "./types"; +import type { TextDocument } from "@cursorless/common"; +import { Range, Selection } from "@cursorless/common"; +import type { SurroundingPairOffsets } from "./types"; export interface SurroundingPairInfo { contentRange: Selection; diff --git a/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/findDelimiterPairAdjacentToSelection.ts b/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/findDelimiterPairAdjacentToSelection.ts index 47194f2bdc..1e4c4b4e32 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/findDelimiterPairAdjacentToSelection.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/findDelimiterPairAdjacentToSelection.ts @@ -1,7 +1,7 @@ -import { SurroundingPairScopeType } from "@cursorless/common"; +import type { SurroundingPairScopeType } from "@cursorless/common"; import { findOppositeDelimiter } from "./findOppositeDelimiter"; import { getSurroundingPairOffsets } from "./getSurroundingPairOffsets"; -import { +import type { DelimiterOccurrence, Offsets, PossibleDelimiterOccurrence, diff --git a/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/findDelimiterPairContainingSelection.ts b/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/findDelimiterPairContainingSelection.ts index b3a1e0220d..4563d67edc 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/findDelimiterPairContainingSelection.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/findDelimiterPairContainingSelection.ts @@ -1,10 +1,10 @@ -import { +import type { SimpleSurroundingPairName, SurroundingPairScopeType, } from "@cursorless/common"; import { generateUnmatchedDelimiters } from "./generateUnmatchedDelimiters"; import { getSurroundingPairOffsets } from "./getSurroundingPairOffsets"; -import { +import type { Offsets, PossibleDelimiterOccurrence, SurroundingPairOffsets, diff --git a/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/findOppositeDelimiter.ts b/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/findOppositeDelimiter.ts index 6a0e8c3bb4..b3134280f8 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/findOppositeDelimiter.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/findOppositeDelimiter.ts @@ -1,6 +1,6 @@ -import { SurroundingPairDirection } from "@cursorless/common"; +import type { SurroundingPairDirection } from "@cursorless/common"; import { findUnmatchedDelimiter } from "./generateUnmatchedDelimiters"; -import { +import type { DelimiterOccurrence, DelimiterSide, IndividualDelimiter, diff --git a/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/findSurroundingPairCore.ts b/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/findSurroundingPairCore.ts index 95a57c7c2a..01bff0761a 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/findSurroundingPairCore.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/findSurroundingPairCore.ts @@ -1,11 +1,11 @@ import { sortedIndexBy } from "lodash"; -import { +import type { SimpleSurroundingPairName, SurroundingPairScopeType, } from "@cursorless/common"; import { findDelimiterPairAdjacentToSelection } from "./findDelimiterPairAdjacentToSelection"; import { findDelimiterPairContainingSelection } from "./findDelimiterPairContainingSelection"; -import { +import type { SurroundingPairOffsets, Offsets, PossibleDelimiterOccurrence, diff --git a/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/findSurroundingPairParseTreeBased.ts b/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/findSurroundingPairParseTreeBased.ts index ccc756ea06..6d331e1830 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/findSurroundingPairParseTreeBased.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/findSurroundingPairParseTreeBased.ts @@ -1,6 +1,6 @@ -import { Range, TextDocument, TextEditor } from "@cursorless/common"; +import type { Range, TextDocument, TextEditor } from "@cursorless/common"; import type { SyntaxNode } from "web-tree-sitter"; -import { +import type { SimpleSurroundingPairName, SurroundingPairScopeType, } from "@cursorless/common"; @@ -9,7 +9,7 @@ import { isContainedInErrorNode } from "../../../util/treeSitterUtils"; import { extractSelectionFromSurroundingPairOffsets } from "./extractSelectionFromSurroundingPairOffsets"; import { findSurroundingPairCore } from "./findSurroundingPairCore"; import { getIndividualDelimiters } from "./getIndividualDelimiters"; -import { +import type { IndividualDelimiter, Offsets, PossibleDelimiterOccurrence, diff --git a/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/findSurroundingPairTextBased.ts b/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/findSurroundingPairTextBased.ts index d0be1d0398..cb5e905349 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/findSurroundingPairTextBased.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/findSurroundingPairTextBased.ts @@ -1,7 +1,8 @@ -import { Range, TextDocument, TextEditor } from "@cursorless/common"; +import type { TextDocument, TextEditor } from "@cursorless/common"; +import { Range } from "@cursorless/common"; import { escapeRegExp, findLast, uniq } from "lodash"; import { matchAll } from "../../../util/regex"; -import { +import type { SimpleSurroundingPairName, SurroundingPairName, SurroundingPairScopeType, @@ -9,7 +10,7 @@ import { import { extractSelectionFromSurroundingPairOffsets } from "./extractSelectionFromSurroundingPairOffsets"; import { findSurroundingPairCore } from "./findSurroundingPairCore"; import { getIndividualDelimiters } from "./getIndividualDelimiters"; -import { +import type { IndividualDelimiter, Offsets, PossibleDelimiterOccurrence, diff --git a/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/generateUnmatchedDelimiters.ts b/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/generateUnmatchedDelimiters.ts index f823684e0a..e3f4afe89f 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/generateUnmatchedDelimiters.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/generateUnmatchedDelimiters.ts @@ -1,6 +1,6 @@ import { range } from "lodash"; -import { SimpleSurroundingPairName } from "@cursorless/common"; -import { +import type { SimpleSurroundingPairName } from "@cursorless/common"; +import type { DelimiterOccurrence, DelimiterSide, PossibleDelimiterOccurrence, diff --git a/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/getIndividualDelimiters.ts b/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/getIndividualDelimiters.ts index 16420cbf7a..85f329a378 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/getIndividualDelimiters.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/getIndividualDelimiters.ts @@ -1,5 +1,5 @@ -import { SimpleSurroundingPairName } from "@cursorless/common"; -import { IndividualDelimiter } from "./types"; +import type { SimpleSurroundingPairName } from "@cursorless/common"; +import type { IndividualDelimiter } from "./types"; import { delimiterToText } from "./delimiterMaps"; import { concat, uniq } from "lodash"; import { isString } from "../../../util/type"; diff --git a/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/getSurroundingPairOffsets.ts b/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/getSurroundingPairOffsets.ts index 5a9f1a668d..4ff49165d9 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/getSurroundingPairOffsets.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/getSurroundingPairOffsets.ts @@ -1,4 +1,4 @@ -import { SurroundingPairOffsets, DelimiterOccurrence } from "./types"; +import type { SurroundingPairOffsets, DelimiterOccurrence } from "./types"; /** * Given a pair of delimiters, returns a pair of start and end offsets diff --git a/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/index.ts b/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/index.ts index 9b9337fbb3..746e4d1cbd 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/index.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/index.ts @@ -1,18 +1,17 @@ -import { +import type { ComplexSurroundingPairName, - Selection, SurroundingPairScopeType, } from "@cursorless/common"; +import { Selection } from "@cursorless/common"; import type { SyntaxNode } from "web-tree-sitter"; -import { LanguageDefinitions } from "../../../languages/LanguageDefinitions"; -import getTextFragmentExtractor, { - TextFragmentExtractor, -} from "../../../languages/getTextFragmentExtractor"; -import { Target } from "../../../typings/target.types"; +import type { LanguageDefinitions } from "../../../languages/LanguageDefinitions"; +import type { TextFragmentExtractor } from "../../../languages/getTextFragmentExtractor"; +import getTextFragmentExtractor from "../../../languages/getTextFragmentExtractor"; +import type { Target } from "../../../typings/target.types"; import { SurroundingPairTarget } from "../../targets"; import { getContainingScopeTarget } from "../getContainingScopeTarget"; import { complexDelimiterMap } from "./delimiterMaps"; -import { SurroundingPairInfo } from "./extractSelectionFromSurroundingPairOffsets"; +import type { SurroundingPairInfo } from "./extractSelectionFromSurroundingPairOffsets"; import { findSurroundingPairParseTreeBased } from "./findSurroundingPairParseTreeBased"; import { findSurroundingPairTextBased } from "./findSurroundingPairTextBased"; diff --git a/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/types.ts b/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/types.ts index c72e6accb0..25b8382e85 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/types.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/types.ts @@ -1,4 +1,4 @@ -import { SimpleSurroundingPairName } from "@cursorless/common"; +import type { SimpleSurroundingPairName } from "@cursorless/common"; /** * Used to indicate whether a particular side of the delimiter is left or right diff --git a/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/weaklyContains.ts b/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/weaklyContains.ts index bf727be34e..5581c6e684 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/weaklyContains.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/weaklyContains.ts @@ -1,4 +1,4 @@ -import { Offsets } from "./types"; +import type { Offsets } from "./types"; /** * Determines whether {@link offsets1} weakly contains {@link offsets2}, which diff --git a/packages/cursorless-engine/src/processTargets/modifiers/targetSequenceUtils.ts b/packages/cursorless-engine/src/processTargets/modifiers/targetSequenceUtils.ts index 547029eb02..e8b5473a11 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/targetSequenceUtils.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/targetSequenceUtils.ts @@ -1,6 +1,6 @@ -import { ScopeType } from "@cursorless/common"; -import { Target } from "../../typings/target.types"; -import { ModifierStageFactory } from "../ModifierStageFactory"; +import type { ScopeType } from "@cursorless/common"; +import type { Target } from "../../typings/target.types"; +import type { ModifierStageFactory } from "../ModifierStageFactory"; export class OutOfRangeError extends Error { constructor() { diff --git a/packages/cursorless-engine/src/processTargets/targetUtil/insertionRemovalBehaviors/DelimitedSequenceInsertionRemovalBehavior.ts b/packages/cursorless-engine/src/processTargets/targetUtil/insertionRemovalBehaviors/DelimitedSequenceInsertionRemovalBehavior.ts index a6f3cb7b40..40494f1c35 100644 --- a/packages/cursorless-engine/src/processTargets/targetUtil/insertionRemovalBehaviors/DelimitedSequenceInsertionRemovalBehavior.ts +++ b/packages/cursorless-engine/src/processTargets/targetUtil/insertionRemovalBehaviors/DelimitedSequenceInsertionRemovalBehavior.ts @@ -1,5 +1,5 @@ -import { Range } from "@cursorless/common"; -import { Target } from "../../../typings/target.types"; +import type { Range } from "@cursorless/common"; +import type { Target } from "../../../typings/target.types"; /** * Constructs a removal range for the given target that includes either the diff --git a/packages/cursorless-engine/src/processTargets/targetUtil/insertionRemovalBehaviors/TokenInsertionRemovalBehavior.ts b/packages/cursorless-engine/src/processTargets/targetUtil/insertionRemovalBehaviors/TokenInsertionRemovalBehavior.ts index 004f8fe1da..f55a329e17 100644 --- a/packages/cursorless-engine/src/processTargets/targetUtil/insertionRemovalBehaviors/TokenInsertionRemovalBehavior.ts +++ b/packages/cursorless-engine/src/processTargets/targetUtil/insertionRemovalBehaviors/TokenInsertionRemovalBehavior.ts @@ -1,4 +1,5 @@ -import { Range, TextEditor } from "@cursorless/common"; +import type { TextEditor } from "@cursorless/common"; +import { Range } from "@cursorless/common"; import type { Target } from "../../../typings/target.types"; import { expandToFullLine } from "../../../util/rangeUtils"; import { PlainTarget } from "../../targets"; diff --git a/packages/cursorless-engine/src/processTargets/targets/BaseTarget.ts b/packages/cursorless-engine/src/processTargets/targets/BaseTarget.ts index da49eb96b2..1df12dac35 100644 --- a/packages/cursorless-engine/src/processTargets/targets/BaseTarget.ts +++ b/packages/cursorless-engine/src/processTargets/targets/BaseTarget.ts @@ -1,11 +1,11 @@ -import type { InsertionMode, TargetPlainObject } from "@cursorless/common"; -import { - NoContainingScopeError, +import type { + InsertionMode, + TargetPlainObject, Range, Selection, TextEditor, - rangeToPlainObject, } from "@cursorless/common"; +import { NoContainingScopeError, rangeToPlainObject } from "@cursorless/common"; import { isEqual } from "lodash"; import type { EditWithRangeUpdater } from "../../typings/Types"; import type { Destination, Target } from "../../typings/target.types"; diff --git a/packages/cursorless-engine/src/processTargets/targets/DestinationImpl.ts b/packages/cursorless-engine/src/processTargets/targets/DestinationImpl.ts index 1b5d787f03..b052d04203 100644 --- a/packages/cursorless-engine/src/processTargets/targets/DestinationImpl.ts +++ b/packages/cursorless-engine/src/processTargets/targets/DestinationImpl.ts @@ -1,11 +1,7 @@ -import { - InsertionMode, - Range, - Selection, - TextEditor, -} from "@cursorless/common"; -import { EditWithRangeUpdater } from "../../typings/Types"; -import { +import type { InsertionMode, Selection, TextEditor } from "@cursorless/common"; +import { Range } from "@cursorless/common"; +import type { EditWithRangeUpdater } from "../../typings/Types"; +import type { Destination, EditNewActionType, Target, diff --git a/packages/cursorless-engine/src/processTargets/targets/DocumentTarget.ts b/packages/cursorless-engine/src/processTargets/targets/DocumentTarget.ts index 3f81b571fc..8ef6646f6f 100644 --- a/packages/cursorless-engine/src/processTargets/targets/DocumentTarget.ts +++ b/packages/cursorless-engine/src/processTargets/targets/DocumentTarget.ts @@ -1,6 +1,7 @@ -import { Range } from "@cursorless/common"; +import type { Range } from "@cursorless/common"; import { shrinkRangeToFitContent } from "../../util/selectionUtils"; -import { BaseTarget, CommonTargetParameters, PlainTarget } from "./"; +import type { CommonTargetParameters } from "./"; +import { BaseTarget, PlainTarget } from "./"; export default class DocumentTarget extends BaseTarget { type = "DocumentTarget"; diff --git a/packages/cursorless-engine/src/processTargets/targets/ImplicitTarget.ts b/packages/cursorless-engine/src/processTargets/targets/ImplicitTarget.ts index 25f0033852..71db952c50 100644 --- a/packages/cursorless-engine/src/processTargets/targets/ImplicitTarget.ts +++ b/packages/cursorless-engine/src/processTargets/targets/ImplicitTarget.ts @@ -1,4 +1,5 @@ -import { BaseTarget, CommonTargetParameters } from "."; +import type { CommonTargetParameters } from "."; +import { BaseTarget } from "."; /** * A target that was not explicitly spoken by the user. For example: diff --git a/packages/cursorless-engine/src/processTargets/targets/InteriorTarget.ts b/packages/cursorless-engine/src/processTargets/targets/InteriorTarget.ts index df6d46068f..66bb4a8c95 100644 --- a/packages/cursorless-engine/src/processTargets/targets/InteriorTarget.ts +++ b/packages/cursorless-engine/src/processTargets/targets/InteriorTarget.ts @@ -1,6 +1,7 @@ -import { Range } from "@cursorless/common"; -import { BaseTarget, MinimumTargetParameters } from "."; -import { Target } from "../../typings/target.types"; +import type { Range } from "@cursorless/common"; +import type { MinimumTargetParameters } from "."; +import { BaseTarget } from "."; +import type { Target } from "../../typings/target.types"; import { shrinkRangeToFitContent } from "../../util/selectionUtils"; import { isSameType } from "../../util/typeUtils"; import { diff --git a/packages/cursorless-engine/src/processTargets/targets/LineTarget.ts b/packages/cursorless-engine/src/processTargets/targets/LineTarget.ts index 52d2159ba8..b27b58ad35 100644 --- a/packages/cursorless-engine/src/processTargets/targets/LineTarget.ts +++ b/packages/cursorless-engine/src/processTargets/targets/LineTarget.ts @@ -1,6 +1,8 @@ -import { Position, Range, TextEditor } from "@cursorless/common"; -import { BaseTarget, CommonTargetParameters } from "."; -import { Target } from "../../typings/target.types"; +import type { TextEditor } from "@cursorless/common"; +import { Position, Range } from "@cursorless/common"; +import type { CommonTargetParameters } from "."; +import { BaseTarget } from "."; +import type { Target } from "../../typings/target.types"; import { expandToFullLine } from "../../util/rangeUtils"; import { tryConstructPlainTarget } from "../../util/tryConstructTarget"; import { createContinuousLineRange } from "../targetUtil/createContinuousRange"; diff --git a/packages/cursorless-engine/src/processTargets/targets/NotebookCellDestination.ts b/packages/cursorless-engine/src/processTargets/targets/NotebookCellDestination.ts index 9f28d148bb..0227b8f8e1 100644 --- a/packages/cursorless-engine/src/processTargets/targets/NotebookCellDestination.ts +++ b/packages/cursorless-engine/src/processTargets/targets/NotebookCellDestination.ts @@ -1,12 +1,15 @@ -import { +import type { InsertionMode, Range, Selection, TextEditor, } from "@cursorless/common"; -import { EditWithRangeUpdater } from "../../typings/Types"; -import { Destination, EditNewActionType } from "../../typings/target.types"; -import NotebookCellTarget from "./NotebookCellTarget"; +import type { EditWithRangeUpdater } from "../../typings/Types"; +import type { + Destination, + EditNewActionType, +} from "../../typings/target.types"; +import type NotebookCellTarget from "./NotebookCellTarget"; export class NotebookCellDestination implements Destination { constructor( diff --git a/packages/cursorless-engine/src/processTargets/targets/NotebookCellTarget.ts b/packages/cursorless-engine/src/processTargets/targets/NotebookCellTarget.ts index cd71744ee8..6cf1a24ff2 100644 --- a/packages/cursorless-engine/src/processTargets/targets/NotebookCellTarget.ts +++ b/packages/cursorless-engine/src/processTargets/targets/NotebookCellTarget.ts @@ -1,6 +1,7 @@ -import { InsertionMode } from "@cursorless/common"; -import { BaseTarget, CommonTargetParameters } from "."; -import { Destination } from "../../typings/target.types"; +import type { InsertionMode } from "@cursorless/common"; +import type { CommonTargetParameters } from "."; +import { BaseTarget } from "."; +import type { Destination } from "../../typings/target.types"; import { NotebookCellDestination } from "./NotebookCellDestination"; export default class NotebookCellTarget extends BaseTarget { diff --git a/packages/cursorless-engine/src/processTargets/targets/ParagraphTarget.ts b/packages/cursorless-engine/src/processTargets/targets/ParagraphTarget.ts index 9d7f59da49..483dbf705f 100644 --- a/packages/cursorless-engine/src/processTargets/targets/ParagraphTarget.ts +++ b/packages/cursorless-engine/src/processTargets/targets/ParagraphTarget.ts @@ -1,12 +1,8 @@ -import { - Position, - Range, - TextDocument, - TextEditor, - TextLine, -} from "@cursorless/common"; -import { BaseTarget, CommonTargetParameters, LineTarget } from "."; -import { Target } from "../../typings/target.types"; +import type { TextDocument, TextEditor, TextLine } from "@cursorless/common"; +import { Position, Range } from "@cursorless/common"; +import type { CommonTargetParameters } from "."; +import { BaseTarget, LineTarget } from "."; +import type { Target } from "../../typings/target.types"; import { expandToFullLine } from "../../util/rangeUtils"; import { constructLineTarget } from "../../util/tryConstructTarget"; import { isSameType } from "../../util/typeUtils"; diff --git a/packages/cursorless-engine/src/processTargets/targets/PlainTarget.ts b/packages/cursorless-engine/src/processTargets/targets/PlainTarget.ts index 06d993270b..0b5862bfc1 100644 --- a/packages/cursorless-engine/src/processTargets/targets/PlainTarget.ts +++ b/packages/cursorless-engine/src/processTargets/targets/PlainTarget.ts @@ -1,4 +1,5 @@ -import { BaseTarget, CommonTargetParameters } from "."; +import type { CommonTargetParameters } from "."; +import { BaseTarget } from "."; interface PlainTargetParameters extends CommonTargetParameters { readonly isToken?: boolean; diff --git a/packages/cursorless-engine/src/processTargets/targets/RawSelectionTarget.ts b/packages/cursorless-engine/src/processTargets/targets/RawSelectionTarget.ts index 678f5d8b10..63a2687a06 100644 --- a/packages/cursorless-engine/src/processTargets/targets/RawSelectionTarget.ts +++ b/packages/cursorless-engine/src/processTargets/targets/RawSelectionTarget.ts @@ -1,4 +1,5 @@ -import { BaseTarget, CommonTargetParameters } from "."; +import type { CommonTargetParameters } from "."; +import { BaseTarget } from "."; /** * A target that has no leading or trailing delimiters so it's removal range diff --git a/packages/cursorless-engine/src/processTargets/targets/ScopeTypeTarget.ts b/packages/cursorless-engine/src/processTargets/targets/ScopeTypeTarget.ts index 7950fca1ce..748945752c 100644 --- a/packages/cursorless-engine/src/processTargets/targets/ScopeTypeTarget.ts +++ b/packages/cursorless-engine/src/processTargets/targets/ScopeTypeTarget.ts @@ -1,11 +1,7 @@ -import { Range, SimpleScopeTypeType } from "@cursorless/common"; -import { - BaseTarget, - CommonTargetParameters, - InteriorTarget, - PlainTarget, -} from "."; -import { Target } from "../../typings/target.types"; +import type { Range, SimpleScopeTypeType } from "@cursorless/common"; +import type { CommonTargetParameters } from "."; +import { BaseTarget, InteriorTarget, PlainTarget } from "."; +import type { Target } from "../../typings/target.types"; import { isSameType } from "../../util/typeUtils"; import { createContinuousRange, diff --git a/packages/cursorless-engine/src/processTargets/targets/SubTokenWordTarget.ts b/packages/cursorless-engine/src/processTargets/targets/SubTokenWordTarget.ts index 0b3e6b0ccb..98feb4fb41 100644 --- a/packages/cursorless-engine/src/processTargets/targets/SubTokenWordTarget.ts +++ b/packages/cursorless-engine/src/processTargets/targets/SubTokenWordTarget.ts @@ -1,6 +1,7 @@ -import { Range } from "@cursorless/common"; -import { BaseTarget, CommonTargetParameters } from "."; -import { Target } from "../../typings/target.types"; +import type { Range } from "@cursorless/common"; +import type { CommonTargetParameters } from "."; +import { BaseTarget } from "."; +import type { Target } from "../../typings/target.types"; import { tryConstructPlainTarget } from "../../util/tryConstructTarget"; import { isSameType } from "../../util/typeUtils"; import { createContinuousRange } from "../targetUtil/createContinuousRange"; diff --git a/packages/cursorless-engine/src/processTargets/targets/SurroundingPairTarget.ts b/packages/cursorless-engine/src/processTargets/targets/SurroundingPairTarget.ts index 9a6459ab3c..30c3f4f3c6 100644 --- a/packages/cursorless-engine/src/processTargets/targets/SurroundingPairTarget.ts +++ b/packages/cursorless-engine/src/processTargets/targets/SurroundingPairTarget.ts @@ -1,11 +1,7 @@ -import { Range } from "@cursorless/common"; -import { - BaseTarget, - CommonTargetParameters, - InteriorTarget, - TokenTarget, -} from "."; -import { Target } from "../../typings/target.types"; +import type { Range } from "@cursorless/common"; +import type { CommonTargetParameters } from "."; +import { BaseTarget, InteriorTarget, TokenTarget } from "."; +import type { Target } from "../../typings/target.types"; import { getTokenLeadingDelimiterTarget, getTokenRemovalRange, diff --git a/packages/cursorless-engine/src/processTargets/targets/TokenTarget.ts b/packages/cursorless-engine/src/processTargets/targets/TokenTarget.ts index bf37f0d743..f3974bd5d3 100644 --- a/packages/cursorless-engine/src/processTargets/targets/TokenTarget.ts +++ b/packages/cursorless-engine/src/processTargets/targets/TokenTarget.ts @@ -1,6 +1,7 @@ -import { Range } from "@cursorless/common"; -import { BaseTarget, CommonTargetParameters } from "."; -import { Target } from "../../typings/target.types"; +import type { Range } from "@cursorless/common"; +import type { CommonTargetParameters } from "."; +import { BaseTarget } from "."; +import type { Target } from "../../typings/target.types"; import { getTokenLeadingDelimiterTarget, getTokenRemovalRange, diff --git a/packages/cursorless-engine/src/processTargets/targets/UntypedTarget.ts b/packages/cursorless-engine/src/processTargets/targets/UntypedTarget.ts index 48db3ba504..32c11487e4 100644 --- a/packages/cursorless-engine/src/processTargets/targets/UntypedTarget.ts +++ b/packages/cursorless-engine/src/processTargets/targets/UntypedTarget.ts @@ -1,5 +1,6 @@ -import { Range } from "@cursorless/common"; -import { BaseTarget, CommonTargetParameters } from "."; +import type { Range } from "@cursorless/common"; +import type { CommonTargetParameters } from "."; +import { BaseTarget } from "."; import type { Target } from "../../typings/target.types"; import { createContinuousRangeUntypedTarget } from "../targetUtil/createContinuousRange"; import { diff --git a/packages/cursorless-engine/src/runCommand.ts b/packages/cursorless-engine/src/runCommand.ts index d6d0a02a14..3310bc57b9 100644 --- a/packages/cursorless-engine/src/runCommand.ts +++ b/packages/cursorless-engine/src/runCommand.ts @@ -1,13 +1,13 @@ -import { Command, HatTokenMap, ReadOnlyHatMap } from "@cursorless/common"; -import { CommandRunner } from "./CommandRunner"; +import type { Command, HatTokenMap, ReadOnlyHatMap } from "@cursorless/common"; +import type { CommandRunner } from "./CommandRunner"; import { Actions } from "./actions/Actions"; -import { Debug } from "./core/Debug"; -import { Snippets } from "./core/Snippets"; +import type { Debug } from "./core/Debug"; +import type { Snippets } from "./core/Snippets"; import { CommandRunnerImpl } from "./core/commandRunner/CommandRunnerImpl"; import { canonicalizeAndValidateCommand } from "./core/commandVersionUpgrades/canonicalizeAndValidateCommand"; -import { RangeUpdater } from "./core/updateSelections/RangeUpdater"; -import { StoredTargetMap, TestCaseRecorder } from "./index"; -import { LanguageDefinitions } from "./languages/LanguageDefinitions"; +import type { RangeUpdater } from "./core/updateSelections/RangeUpdater"; +import type { StoredTargetMap, TestCaseRecorder } from "./index"; +import type { LanguageDefinitions } from "./languages/LanguageDefinitions"; import { TargetPipelineRunner } from "./processTargets"; import { MarkStageFactoryImpl } from "./processTargets/MarkStageFactoryImpl"; import { ModifierStageFactoryImpl } from "./processTargets/ModifierStageFactoryImpl"; diff --git a/packages/cursorless-engine/src/runIntegrationTests.ts b/packages/cursorless-engine/src/runIntegrationTests.ts index 5b5c541a85..ba6d9939e2 100644 --- a/packages/cursorless-engine/src/runIntegrationTests.ts +++ b/packages/cursorless-engine/src/runIntegrationTests.ts @@ -1,8 +1,8 @@ import assert = require("assert"); import { languageMatchers } from "./languages/getNodeMatcher"; -import { TreeSitter } from "./typings/TreeSitter"; +import type { TreeSitter } from "./typings/TreeSitter"; import { legacyLanguageIds } from "./languages/LegacyLanguageId"; -import { LanguageDefinitions } from "./languages/LanguageDefinitions"; +import type { LanguageDefinitions } from "./languages/LanguageDefinitions"; /** * Run tests that require multiple components to be instantiated, as well as a diff --git a/packages/cursorless-engine/src/scripts/transformRecordedTests/checkMarks.ts b/packages/cursorless-engine/src/scripts/transformRecordedTests/checkMarks.ts index e0e5dc0196..ab5691f537 100644 --- a/packages/cursorless-engine/src/scripts/transformRecordedTests/checkMarks.ts +++ b/packages/cursorless-engine/src/scripts/transformRecordedTests/checkMarks.ts @@ -1,4 +1,5 @@ -import { FakeIDE, TestCaseFixtureLegacy } from "@cursorless/common"; +import type { TestCaseFixtureLegacy } from "@cursorless/common"; +import { FakeIDE } from "@cursorless/common"; import { uniq } from "lodash"; import { injectIde } from "../../singletons/ide.singleton"; import tokenGraphemeSplitter from "../../singletons/tokenGraphemeSplitter.singleton"; diff --git a/packages/cursorless-engine/src/scripts/transformRecordedTests/index.ts b/packages/cursorless-engine/src/scripts/transformRecordedTests/index.ts index 9581deff31..45f685acee 100644 --- a/packages/cursorless-engine/src/scripts/transformRecordedTests/index.ts +++ b/packages/cursorless-engine/src/scripts/transformRecordedTests/index.ts @@ -2,7 +2,7 @@ import { getRecordedTestPaths } from "@cursorless/common"; import { identity } from "./transformations/identity"; import { upgrade } from "./transformations/upgrade"; import { transformFile } from "./transformFile"; -import { FixtureTransformation } from "./types"; +import type { FixtureTransformation } from "./types"; import { upgradeDecorations } from "./upgradeDecorations"; import { checkMarks } from "./checkMarks"; diff --git a/packages/cursorless-engine/src/scripts/transformRecordedTests/moveFile.ts b/packages/cursorless-engine/src/scripts/transformRecordedTests/moveFile.ts index a5b4802642..b526ae4c23 100644 --- a/packages/cursorless-engine/src/scripts/transformRecordedTests/moveFile.ts +++ b/packages/cursorless-engine/src/scripts/transformRecordedTests/moveFile.ts @@ -2,7 +2,7 @@ import { promises as fsp } from "fs"; import * as path from "path"; import * as yaml from "js-yaml"; import { mkdir, rename } from "fs/promises"; -import { TestCaseFixture } from "@cursorless/common"; +import type { TestCaseFixture } from "@cursorless/common"; /** * Can be used to organize files into directories based on eg language id diff --git a/packages/cursorless-engine/src/scripts/transformRecordedTests/transformFile.ts b/packages/cursorless-engine/src/scripts/transformRecordedTests/transformFile.ts index 690966052a..56eb23f04d 100644 --- a/packages/cursorless-engine/src/scripts/transformRecordedTests/transformFile.ts +++ b/packages/cursorless-engine/src/scripts/transformRecordedTests/transformFile.ts @@ -1,7 +1,8 @@ import { promises as fsp } from "fs"; import * as yaml from "js-yaml"; -import { TestCaseFixture, serializeTestFixture } from "@cursorless/common"; -import { FixtureTransformation } from "./types"; +import type { TestCaseFixture } from "@cursorless/common"; +import { serializeTestFixture } from "@cursorless/common"; +import type { FixtureTransformation } from "./types"; export async function transformFile( transformation: FixtureTransformation, diff --git a/packages/cursorless-engine/src/scripts/transformRecordedTests/transformations/identity.ts b/packages/cursorless-engine/src/scripts/transformRecordedTests/transformations/identity.ts index 6f2bd4cc99..ac777c5b23 100644 --- a/packages/cursorless-engine/src/scripts/transformRecordedTests/transformations/identity.ts +++ b/packages/cursorless-engine/src/scripts/transformRecordedTests/transformations/identity.ts @@ -1,4 +1,4 @@ -import { TestCaseFixtureLegacy } from "@cursorless/common"; +import type { TestCaseFixtureLegacy } from "@cursorless/common"; export function identity(fixture: TestCaseFixtureLegacy) { return fixture; diff --git a/packages/cursorless-engine/src/scripts/transformRecordedTests/transformations/upgrade.ts b/packages/cursorless-engine/src/scripts/transformRecordedTests/transformations/upgrade.ts index e745686759..4c9bb906dd 100644 --- a/packages/cursorless-engine/src/scripts/transformRecordedTests/transformations/upgrade.ts +++ b/packages/cursorless-engine/src/scripts/transformRecordedTests/transformations/upgrade.ts @@ -1,4 +1,7 @@ -import { TestCaseFixture, TestCaseFixtureLegacy } from "@cursorless/common"; +import type { + TestCaseFixture, + TestCaseFixtureLegacy, +} from "@cursorless/common"; import { canonicalizeAndValidateCommand } from "../../../core/commandVersionUpgrades/canonicalizeAndValidateCommand"; export function upgrade(fixture: TestCaseFixtureLegacy): TestCaseFixture { diff --git a/packages/cursorless-engine/src/scripts/transformRecordedTests/transformations/upgradeFromVersion0.ts b/packages/cursorless-engine/src/scripts/transformRecordedTests/transformations/upgradeFromVersion0.ts index 88450b67a9..2ae9d9d1d3 100644 --- a/packages/cursorless-engine/src/scripts/transformRecordedTests/transformations/upgradeFromVersion0.ts +++ b/packages/cursorless-engine/src/scripts/transformRecordedTests/transformations/upgradeFromVersion0.ts @@ -1,5 +1,5 @@ -import { PartialPrimitiveTargetDescriptor } from "@cursorless/common"; -import { TestCaseFixture } from "@cursorless/common"; +import type { PartialPrimitiveTargetDescriptor } from "@cursorless/common"; +import type { TestCaseFixture } from "@cursorless/common"; import { transformPartialPrimitiveTargets } from "../../../util/getPrimitiveTargets"; export function upgradeFromVersion0(fixture: TestCaseFixture) { diff --git a/packages/cursorless-engine/src/scripts/transformRecordedTests/types.ts b/packages/cursorless-engine/src/scripts/transformRecordedTests/types.ts index c1d6bd3e23..a3f35478c9 100644 --- a/packages/cursorless-engine/src/scripts/transformRecordedTests/types.ts +++ b/packages/cursorless-engine/src/scripts/transformRecordedTests/types.ts @@ -1,4 +1,4 @@ -import { TestCaseFixtureLegacy } from "@cursorless/common"; +import type { TestCaseFixtureLegacy } from "@cursorless/common"; export type FixtureTransformation = ( originalFixture: TestCaseFixtureLegacy, diff --git a/packages/cursorless-engine/src/scripts/transformRecordedTests/upgradeDecorations.ts b/packages/cursorless-engine/src/scripts/transformRecordedTests/upgradeDecorations.ts index 6fd4fcf1c8..7fc604635e 100644 --- a/packages/cursorless-engine/src/scripts/transformRecordedTests/upgradeDecorations.ts +++ b/packages/cursorless-engine/src/scripts/transformRecordedTests/upgradeDecorations.ts @@ -1,11 +1,11 @@ -import { +import type { FlashStyle, GeneralizedRangePlainObject, PositionPlainObject, TestCaseFixtureLegacy, } from "@cursorless/common"; import { groupBy, partition } from "lodash"; -import { FixtureTransformation } from "./types"; +import type { FixtureTransformation } from "./types"; interface PlainTestDecoration { name: string; diff --git a/packages/cursorless-engine/src/singletons/ide.singleton.ts b/packages/cursorless-engine/src/singletons/ide.singleton.ts index 5531b7215c..acfe529f65 100644 --- a/packages/cursorless-engine/src/singletons/ide.singleton.ts +++ b/packages/cursorless-engine/src/singletons/ide.singleton.ts @@ -1,4 +1,4 @@ -import { IDE } from "@cursorless/common"; +import type { IDE } from "@cursorless/common"; /** * This is the `ide` singleton diff --git a/packages/cursorless-engine/src/snippets/snippet.ts b/packages/cursorless-engine/src/snippets/snippet.ts index 9f2480b264..6c3156e380 100644 --- a/packages/cursorless-engine/src/snippets/snippet.ts +++ b/packages/cursorless-engine/src/snippets/snippet.ts @@ -1,13 +1,16 @@ -import { SimpleScopeTypeType, SnippetDefinition } from "@cursorless/common"; -import { Target } from "../typings/target.types"; +import type { + SimpleScopeTypeType, + SnippetDefinition, +} from "@cursorless/common"; +import type { Target } from "../typings/target.types"; +import type { TextmateSnippet } from "./vendor/vscodeSnippet/snippetParser"; import { Placeholder, Text, - TextmateSnippet, Variable, } from "./vendor/vscodeSnippet/snippetParser"; import { KnownSnippetVariableNames } from "./vendor/vscodeSnippet/snippetVariables"; -import { ModifierStageFactory } from "../processTargets/ModifierStageFactory"; +import type { ModifierStageFactory } from "../processTargets/ModifierStageFactory"; /** * Replaces the snippet variable with name `placeholderName` with diff --git a/packages/cursorless-engine/src/test/fixtures/multiAction.fixture.ts b/packages/cursorless-engine/src/test/fixtures/multiAction.fixture.ts index b2809b9852..fb6471214f 100644 --- a/packages/cursorless-engine/src/test/fixtures/multiAction.fixture.ts +++ b/packages/cursorless-engine/src/test/fixtures/multiAction.fixture.ts @@ -1,4 +1,4 @@ -import { ActionDescriptor } from "@cursorless/common"; +import type { ActionDescriptor } from "@cursorless/common"; import { multiActionSpokenFormTest } from "./spokenFormTest"; const getTextAction: ActionDescriptor = { diff --git a/packages/cursorless-engine/src/test/fixtures/spokenFormTest.ts b/packages/cursorless-engine/src/test/fixtures/spokenFormTest.ts index ac048ed91e..560674fafe 100644 --- a/packages/cursorless-engine/src/test/fixtures/spokenFormTest.ts +++ b/packages/cursorless-engine/src/test/fixtures/spokenFormTest.ts @@ -1,4 +1,4 @@ -import { ActionDescriptor, CommandV6 } from "@cursorless/common"; +import type { ActionDescriptor, CommandV6 } from "@cursorless/common"; export interface SpokenFormTest { /** diff --git a/packages/cursorless-engine/src/test/fixtures/synonymousSpokenForms.fixture.ts b/packages/cursorless-engine/src/test/fixtures/synonymousSpokenForms.fixture.ts index 87f91d7ee5..130efaed8a 100644 --- a/packages/cursorless-engine/src/test/fixtures/synonymousSpokenForms.fixture.ts +++ b/packages/cursorless-engine/src/test/fixtures/synonymousSpokenForms.fixture.ts @@ -1,4 +1,4 @@ -import { ActionDescriptor } from "@cursorless/common"; +import type { ActionDescriptor } from "@cursorless/common"; import { spokenFormTest } from "./spokenFormTest"; const verticalRangeAction: ActionDescriptor = { diff --git a/packages/cursorless-engine/src/test/fixtures/talonApi.fixture.ts b/packages/cursorless-engine/src/test/fixtures/talonApi.fixture.ts index 7e8f093fbb..37b1c4cdb0 100644 --- a/packages/cursorless-engine/src/test/fixtures/talonApi.fixture.ts +++ b/packages/cursorless-engine/src/test/fixtures/talonApi.fixture.ts @@ -1,4 +1,4 @@ -import { ActionDescriptor } from "@cursorless/common"; +import type { ActionDescriptor } from "@cursorless/common"; import { spokenFormTest } from "./spokenFormTest"; // See cursorless-talon-dev/src/cursorless_test.talon diff --git a/packages/cursorless-engine/src/test/spokenForms.talon.test.ts b/packages/cursorless-engine/src/test/spokenForms.talon.test.ts index 206b02694c..a219e09386 100644 --- a/packages/cursorless-engine/src/test/spokenForms.talon.test.ts +++ b/packages/cursorless-engine/src/test/spokenForms.talon.test.ts @@ -1,10 +1,9 @@ -import { +import type { Command, CommandLatest, TestCaseFixtureLegacy, - asyncSafety, - getRecordedTestPaths, } from "@cursorless/common"; +import { asyncSafety, getRecordedTestPaths } from "@cursorless/common"; import * as assert from "assert"; import * as yaml from "js-yaml"; import { promises as fsp } from "node:fs"; diff --git a/packages/cursorless-engine/src/testCaseRecorder/RecordTestCaseCommandOptions.ts b/packages/cursorless-engine/src/testCaseRecorder/RecordTestCaseCommandOptions.ts index 69efb0f37c..f93079fae0 100644 --- a/packages/cursorless-engine/src/testCaseRecorder/RecordTestCaseCommandOptions.ts +++ b/packages/cursorless-engine/src/testCaseRecorder/RecordTestCaseCommandOptions.ts @@ -1,4 +1,4 @@ -import { ExtraSnapshotField } from "@cursorless/common"; +import type { ExtraSnapshotField } from "@cursorless/common"; /** * This is the type of the `recordTestCase` command's argument. It is used to diff --git a/packages/cursorless-engine/src/testCaseRecorder/TestCase.ts b/packages/cursorless-engine/src/testCaseRecorder/TestCase.ts index d1802db55e..71fa2925dd 100644 --- a/packages/cursorless-engine/src/testCaseRecorder/TestCase.ts +++ b/packages/cursorless-engine/src/testCaseRecorder/TestCase.ts @@ -1,24 +1,26 @@ -import { +import type { ActionType, CommandLatest, EnforceUndefined, - extractTargetedMarks, ExtraSnapshotField, - marksToPlainObject, PartialTargetDescriptor, PlainSpyIDERecordedValues, ReadOnlyHatMap, SerializedMarks, - serializeTestFixture, SpyIDE, - spyIDERecordedValuesToPlainObject, TestCaseFixture, TestCaseSnapshot, ThrownError, Token, } from "@cursorless/common"; +import { + extractTargetedMarks, + marksToPlainObject, + serializeTestFixture, + spyIDERecordedValuesToPlainObject, +} from "@cursorless/common"; import { pick } from "lodash"; -import { StoredTargetMap } from ".."; +import type { StoredTargetMap } from ".."; import { ide } from "../singletons/ide.singleton"; import { extractTargetKeys } from "../testUtil/extractTargetKeys"; import { takeSnapshot } from "../testUtil/takeSnapshot"; diff --git a/packages/cursorless-engine/src/testCaseRecorder/TestCaseRecorder.ts b/packages/cursorless-engine/src/testCaseRecorder/TestCaseRecorder.ts index 6cf7d22ecc..a9be1af043 100644 --- a/packages/cursorless-engine/src/testCaseRecorder/TestCaseRecorder.ts +++ b/packages/cursorless-engine/src/testCaseRecorder/TestCaseRecorder.ts @@ -1,23 +1,25 @@ -import { +import type { CommandComplete, CommandLatest, DecoratedSymbolMark, + ExtraSnapshotField, + HatTokenMap, + IDE, + ReadOnlyHatMap, + SerializedMarks, + TextEditorOptions, +} from "@cursorless/common"; +import { DEFAULT_TEXT_EDITOR_OPTIONS_FOR_TEST, extractTargetedMarks, - ExtraSnapshotField, getKey, getRecordedTestsDirPath, - HatTokenMap, - IDE, marksToPlainObject, - ReadOnlyHatMap, serialize, - SerializedMarks, showError, showInfo, sleep, SpyIDE, - TextEditorOptions, toLineRange, walkDirsSync, } from "@cursorless/common"; @@ -29,10 +31,10 @@ import * as path from "path"; import { ide, injectIde } from "../singletons/ide.singleton"; import { takeSnapshot } from "../testUtil/takeSnapshot"; import { TestCase } from "./TestCase"; -import { StoredTargetMap } from "../core/StoredTargets"; -import { CommandRunner } from "../CommandRunner"; +import type { StoredTargetMap } from "../core/StoredTargets"; +import type { CommandRunner } from "../CommandRunner"; import { generateSpokenForm } from "../generateSpokenForm"; -import { RecordTestCaseCommandOptions } from "./RecordTestCaseCommandOptions"; +import type { RecordTestCaseCommandOptions } from "./RecordTestCaseCommandOptions"; const CALIBRATION_DISPLAY_DURATION_MS = 50; diff --git a/packages/cursorless-engine/src/testUtil/extractTargetKeys.ts b/packages/cursorless-engine/src/testUtil/extractTargetKeys.ts index 4f33e98be4..ebe5eb8aad 100644 --- a/packages/cursorless-engine/src/testUtil/extractTargetKeys.ts +++ b/packages/cursorless-engine/src/testUtil/extractTargetKeys.ts @@ -1,9 +1,9 @@ -import { +import type { PartialPrimitiveTargetDescriptor, PartialTargetDescriptor, - getKey, } from "@cursorless/common"; -import { PrimitiveTargetDescriptor } from "../typings/TargetDescriptor"; +import { getKey } from "@cursorless/common"; +import type { PrimitiveTargetDescriptor } from "../typings/TargetDescriptor"; export function extractTargetKeys(target: PartialTargetDescriptor): string[] { switch (target.type) { diff --git a/packages/cursorless-engine/src/testUtil/plainObjectToTarget.ts b/packages/cursorless-engine/src/testUtil/plainObjectToTarget.ts index ace22ca759..7cc5ae3165 100644 --- a/packages/cursorless-engine/src/testUtil/plainObjectToTarget.ts +++ b/packages/cursorless-engine/src/testUtil/plainObjectToTarget.ts @@ -1,10 +1,7 @@ -import { - plainObjectToRange, - TargetPlainObject, - TextEditor, -} from "@cursorless/common"; +import type { TargetPlainObject, TextEditor } from "@cursorless/common"; +import { plainObjectToRange } from "@cursorless/common"; import { LineTarget, UntypedTarget } from "../processTargets/targets"; -import { Target } from "../typings/target.types"; +import type { Target } from "../typings/target.types"; /** * Given a plain object describing a target, constructs a `Target` object. diff --git a/packages/cursorless-engine/src/testUtil/takeSnapshot.ts b/packages/cursorless-engine/src/testUtil/takeSnapshot.ts index d4b6286ceb..5ef8425fd9 100644 --- a/packages/cursorless-engine/src/testUtil/takeSnapshot.ts +++ b/packages/cursorless-engine/src/testUtil/takeSnapshot.ts @@ -1,16 +1,18 @@ -import { +import type { Clipboard, ExcludableSnapshotField, ExtraContext, ExtraSnapshotField, - hrtimeBigintToSeconds, IDE, - rangeToPlainObject, - selectionToPlainObject, SerializedMarks, TestCaseSnapshot, TextEditor, } from "@cursorless/common"; +import { + hrtimeBigintToSeconds, + rangeToPlainObject, + selectionToPlainObject, +} from "@cursorless/common"; import type { StoredTargetMap } from "../core/StoredTargets"; export async function takeSnapshot( diff --git a/packages/cursorless-engine/src/tokenGraphemeSplitter/tokenGraphemeSplitter.test.ts b/packages/cursorless-engine/src/tokenGraphemeSplitter/tokenGraphemeSplitter.test.ts index 7e4950b222..d69e278b65 100644 --- a/packages/cursorless-engine/src/tokenGraphemeSplitter/tokenGraphemeSplitter.test.ts +++ b/packages/cursorless-engine/src/tokenGraphemeSplitter/tokenGraphemeSplitter.test.ts @@ -1,4 +1,4 @@ -import { TokenHatSplittingMode } from "@cursorless/common"; +import type { TokenHatSplittingMode } from "@cursorless/common"; import * as assert from "assert"; import { unitTestSetup } from "../test/unitTestSetup"; import { TokenGraphemeSplitter, UNKNOWN } from "./tokenGraphemeSplitter"; diff --git a/packages/cursorless-engine/src/tokenGraphemeSplitter/tokenGraphemeSplitter.ts b/packages/cursorless-engine/src/tokenGraphemeSplitter/tokenGraphemeSplitter.ts index 116bcd75e5..da50ae484f 100644 --- a/packages/cursorless-engine/src/tokenGraphemeSplitter/tokenGraphemeSplitter.ts +++ b/packages/cursorless-engine/src/tokenGraphemeSplitter/tokenGraphemeSplitter.ts @@ -1,10 +1,7 @@ import { deburr, escapeRegExp } from "lodash"; import { ide } from "../singletons/ide.singleton"; -import { - TokenHatSplittingMode, - Disposable, - Notifier, -} from "@cursorless/common"; +import type { TokenHatSplittingMode, Disposable } from "@cursorless/common"; +import { Notifier } from "@cursorless/common"; import { matchAll } from "../util/regex"; /** diff --git a/packages/cursorless-engine/src/tokenizer/tokenizer.ts b/packages/cursorless-engine/src/tokenizer/tokenizer.ts index 2f9b25287a..69a902c41e 100644 --- a/packages/cursorless-engine/src/tokenizer/tokenizer.ts +++ b/packages/cursorless-engine/src/tokenizer/tokenizer.ts @@ -1,7 +1,7 @@ import { escapeRegExp } from "lodash"; import { ide } from "../singletons/ide.singleton"; import { matchAll } from "../util/regex"; -import { LanguageTokenizerComponents } from "./tokenizer.types"; +import type { LanguageTokenizerComponents } from "./tokenizer.types"; const REPEATABLE_SYMBOLS = [ "-", diff --git a/packages/cursorless-engine/src/typings/TargetDescriptor.ts b/packages/cursorless-engine/src/typings/TargetDescriptor.ts index bcf96035fa..2559adf0c3 100644 --- a/packages/cursorless-engine/src/typings/TargetDescriptor.ts +++ b/packages/cursorless-engine/src/typings/TargetDescriptor.ts @@ -1,4 +1,4 @@ -import { +import type { ImplicitTargetDescriptor, Modifier, PartialMark, diff --git a/packages/cursorless-engine/src/typings/TreeSitter.ts b/packages/cursorless-engine/src/typings/TreeSitter.ts index 17d89c5b40..db50589e43 100644 --- a/packages/cursorless-engine/src/typings/TreeSitter.ts +++ b/packages/cursorless-engine/src/typings/TreeSitter.ts @@ -1,5 +1,5 @@ -import { Range, TextDocument } from "@cursorless/common"; -import { Language, SyntaxNode, Tree } from "web-tree-sitter"; +import type { Range, TextDocument } from "@cursorless/common"; +import type { Language, SyntaxNode, Tree } from "web-tree-sitter"; export interface TreeSitter { /** diff --git a/packages/cursorless-engine/src/util/allocateHats/HatMetrics.ts b/packages/cursorless-engine/src/util/allocateHats/HatMetrics.ts index 3aae820a47..5a1960cdc0 100644 --- a/packages/cursorless-engine/src/util/allocateHats/HatMetrics.ts +++ b/packages/cursorless-engine/src/util/allocateHats/HatMetrics.ts @@ -1,6 +1,7 @@ -import { CompositeKeyMap, HatStability, TokenHat } from "@cursorless/common"; +import type { CompositeKeyMap, TokenHat } from "@cursorless/common"; +import { HatStability } from "@cursorless/common"; import { min } from "lodash"; -import { HatCandidate } from "./allocateHats"; +import type { HatCandidate } from "./allocateHats"; /** * A function that takes a hat candidate and returns a number representing its diff --git a/packages/cursorless-engine/src/util/allocateHats/allocateHats.ts b/packages/cursorless-engine/src/util/allocateHats/allocateHats.ts index 5c22ffab46..fb279921fa 100644 --- a/packages/cursorless-engine/src/util/allocateHats/allocateHats.ts +++ b/packages/cursorless-engine/src/util/allocateHats/allocateHats.ts @@ -1,16 +1,17 @@ -import { - CompositeKeyMap, - DefaultMap, +import type { HatStability, HatStyleMap, HatStyleName, - Range, TextEditor, Token, TokenHat, } from "@cursorless/common"; +import { CompositeKeyMap, DefaultMap, Range } from "@cursorless/common"; import { clone } from "lodash"; -import { Grapheme, TokenGraphemeSplitter } from "../../tokenGraphemeSplitter"; +import type { + Grapheme, + TokenGraphemeSplitter, +} from "../../tokenGraphemeSplitter"; import { chooseTokenHat } from "./chooseTokenHat"; import { getHatRankingContext } from "./getHatRankingContext"; import { getRankedTokens } from "./getRankedTokens"; diff --git a/packages/cursorless-engine/src/util/allocateHats/chooseTokenHat.ts b/packages/cursorless-engine/src/util/allocateHats/chooseTokenHat.ts index c1e583677c..83e7b38db6 100644 --- a/packages/cursorless-engine/src/util/allocateHats/chooseTokenHat.ts +++ b/packages/cursorless-engine/src/util/allocateHats/chooseTokenHat.ts @@ -1,6 +1,6 @@ -import { HatStability, TokenHat } from "@cursorless/common"; -import { HatCandidate } from "./allocateHats"; -import { RankingContext } from "./getHatRankingContext"; +import type { HatStability, TokenHat } from "@cursorless/common"; +import type { HatCandidate } from "./allocateHats"; +import type { RankingContext } from "./getHatRankingContext"; import { hatOldTokenRank, isOldTokenHat, diff --git a/packages/cursorless-engine/src/util/allocateHats/getDisplayLineMap.ts b/packages/cursorless-engine/src/util/allocateHats/getDisplayLineMap.ts index 9c0b657e9c..68dfc31e01 100644 --- a/packages/cursorless-engine/src/util/allocateHats/getDisplayLineMap.ts +++ b/packages/cursorless-engine/src/util/allocateHats/getDisplayLineMap.ts @@ -1,4 +1,4 @@ -import { TextEditor } from "@cursorless/common"; +import type { TextEditor } from "@cursorless/common"; import { concat, flatten, flow, range, uniq } from "lodash"; /** diff --git a/packages/cursorless-engine/src/util/allocateHats/getHatRankingContext.ts b/packages/cursorless-engine/src/util/allocateHats/getHatRankingContext.ts index 8a5aa42d4c..2e9f9b5308 100644 --- a/packages/cursorless-engine/src/util/allocateHats/getHatRankingContext.ts +++ b/packages/cursorless-engine/src/util/allocateHats/getHatRankingContext.ts @@ -1,11 +1,7 @@ -import { - CompositeKeyMap, - HatStyleName, - Token, - TokenHat, -} from "@cursorless/common"; -import { TokenGraphemeSplitter } from "../../tokenGraphemeSplitter"; -import { RankedToken } from "./getRankedTokens"; +import type { HatStyleName, Token, TokenHat } from "@cursorless/common"; +import { CompositeKeyMap } from "@cursorless/common"; +import type { TokenGraphemeSplitter } from "../../tokenGraphemeSplitter"; +import type { RankedToken } from "./getRankedTokens"; export interface RankingContext { /** diff --git a/packages/cursorless-engine/src/util/allocateHats/getRankedTokens.ts b/packages/cursorless-engine/src/util/allocateHats/getRankedTokens.ts index 3649502aa6..7163d27605 100644 --- a/packages/cursorless-engine/src/util/allocateHats/getRankedTokens.ts +++ b/packages/cursorless-engine/src/util/allocateHats/getRankedTokens.ts @@ -1,6 +1,6 @@ -import { TextEditor } from "@cursorless/common"; +import type { TextEditor } from "@cursorless/common"; import { flatten } from "lodash"; -import { Token } from "@cursorless/common"; +import type { Token } from "@cursorless/common"; import { getDisplayLineMap } from "./getDisplayLineMap"; import { getTokenComparator } from "./getTokenComparator"; import { getTokensInRange } from "./getTokensInRange"; diff --git a/packages/cursorless-engine/src/util/allocateHats/getTokenComparator.ts b/packages/cursorless-engine/src/util/allocateHats/getTokenComparator.ts index c309f058fe..0ffe1be63c 100644 --- a/packages/cursorless-engine/src/util/allocateHats/getTokenComparator.ts +++ b/packages/cursorless-engine/src/util/allocateHats/getTokenComparator.ts @@ -1,4 +1,4 @@ -import { Token } from "@cursorless/common"; +import type { Token } from "@cursorless/common"; interface TokenWithDisplayLine extends Token { displayLine: number; diff --git a/packages/cursorless-engine/src/util/allocateHats/getTokensInRange.ts b/packages/cursorless-engine/src/util/allocateHats/getTokensInRange.ts index b3f2760877..efa8372100 100644 --- a/packages/cursorless-engine/src/util/allocateHats/getTokensInRange.ts +++ b/packages/cursorless-engine/src/util/allocateHats/getTokensInRange.ts @@ -1,6 +1,7 @@ -import { Range, TextEditor } from "@cursorless/common"; +import type { TextEditor } from "@cursorless/common"; +import { Range } from "@cursorless/common"; import { tokenize } from "../../tokenizer"; -import { Token } from "@cursorless/common"; +import type { Token } from "@cursorless/common"; export function getTokensInRange(editor: TextEditor, range: Range): Token[] { const languageId = editor.document.languageId; diff --git a/packages/cursorless-engine/src/util/getMatchesInRange.ts b/packages/cursorless-engine/src/util/getMatchesInRange.ts index e7064e3e5d..77198cb44d 100644 --- a/packages/cursorless-engine/src/util/getMatchesInRange.ts +++ b/packages/cursorless-engine/src/util/getMatchesInRange.ts @@ -1,7 +1,7 @@ -import { Range, TextEditor } from "@cursorless/common"; +import { Range } from "@cursorless/common"; import { imap } from "itertools"; import { matchAll } from "./regex"; -import type { Direction } from "@cursorless/common"; +import type { Direction, TextEditor } from "@cursorless/common"; export function getMatchesInRange( regex: RegExp, diff --git a/packages/cursorless-engine/src/util/getPartialTargetDescriptors.ts b/packages/cursorless-engine/src/util/getPartialTargetDescriptors.ts index 0b088c3aa5..56774335fd 100644 --- a/packages/cursorless-engine/src/util/getPartialTargetDescriptors.ts +++ b/packages/cursorless-engine/src/util/getPartialTargetDescriptors.ts @@ -1,4 +1,4 @@ -import { +import type { ActionDescriptor, DestinationDescriptor, PartialTargetDescriptor, diff --git a/packages/cursorless-engine/src/util/getPrimitiveTargets.ts b/packages/cursorless-engine/src/util/getPrimitiveTargets.ts index 6a59b71ccc..61ff3ff1f1 100644 --- a/packages/cursorless-engine/src/util/getPrimitiveTargets.ts +++ b/packages/cursorless-engine/src/util/getPrimitiveTargets.ts @@ -1,4 +1,4 @@ -import { +import type { ImplicitTargetDescriptor, PartialPrimitiveTargetDescriptor, PartialRangeTargetDescriptor, diff --git a/packages/cursorless-engine/src/util/nodeFinders.ts b/packages/cursorless-engine/src/util/nodeFinders.ts index 60113c9a5a..12553bf75b 100644 --- a/packages/cursorless-engine/src/util/nodeFinders.ts +++ b/packages/cursorless-engine/src/util/nodeFinders.ts @@ -1,6 +1,7 @@ -import { Position, Selection } from "@cursorless/common"; +import type { Selection } from "@cursorless/common"; +import { Position } from "@cursorless/common"; import type { Point, SyntaxNode } from "web-tree-sitter"; -import { NodeFinder } from "../typings/Types"; +import type { NodeFinder } from "../typings/Types"; export const nodeFinder = ( isTargetNode: (node: SyntaxNode) => boolean, diff --git a/packages/cursorless-engine/src/util/nodeMatchers.ts b/packages/cursorless-engine/src/util/nodeMatchers.ts index 550fd9b01c..04fa755bad 100644 --- a/packages/cursorless-engine/src/util/nodeMatchers.ts +++ b/packages/cursorless-engine/src/util/nodeMatchers.ts @@ -1,6 +1,6 @@ import type { SyntaxNode } from "web-tree-sitter"; -import { SimpleScopeTypeType } from "@cursorless/common"; -import { +import type { SimpleScopeTypeType } from "@cursorless/common"; +import type { NodeFinder, NodeMatcher, NodeMatcherAlternative, diff --git a/packages/cursorless-engine/src/util/nodeSelectors.ts b/packages/cursorless-engine/src/util/nodeSelectors.ts index 23e5f77244..e7f5348050 100644 --- a/packages/cursorless-engine/src/util/nodeSelectors.ts +++ b/packages/cursorless-engine/src/util/nodeSelectors.ts @@ -1,7 +1,8 @@ -import { Position, Range, Selection, TextEditor } from "@cursorless/common"; +import type { TextEditor } from "@cursorless/common"; +import { Position, Range, Selection } from "@cursorless/common"; import { identity, maxBy } from "lodash"; import type { Point, SyntaxNode } from "web-tree-sitter"; -import { +import type { NodeFinder, SelectionExtractor, SelectionWithContext, diff --git a/packages/cursorless-engine/src/util/performDocumentEdits.ts b/packages/cursorless-engine/src/util/performDocumentEdits.ts index de573b87f8..535298cfce 100644 --- a/packages/cursorless-engine/src/util/performDocumentEdits.ts +++ b/packages/cursorless-engine/src/util/performDocumentEdits.ts @@ -1,6 +1,6 @@ -import { EditableTextEditor } from "@cursorless/common"; -import { RangeUpdater } from "../core/updateSelections/RangeUpdater"; -import { Edit } from "../typings/Types"; +import type { EditableTextEditor } from "@cursorless/common"; +import type { RangeUpdater } from "../core/updateSelections/RangeUpdater"; +import type { Edit } from "../typings/Types"; export async function performDocumentEdits( rangeUpdater: RangeUpdater, diff --git a/packages/cursorless-engine/src/util/rangeUtils.ts b/packages/cursorless-engine/src/util/rangeUtils.ts index 33d5def915..f5e1b786ae 100644 --- a/packages/cursorless-engine/src/util/rangeUtils.ts +++ b/packages/cursorless-engine/src/util/rangeUtils.ts @@ -1,4 +1,5 @@ -import { Position, Range, TextEditor } from "@cursorless/common"; +import type { TextEditor } from "@cursorless/common"; +import { Position, Range } from "@cursorless/common"; import { getLeadingWhitespace, getTrailingWhitespace } from "./regex"; export function isAtEndOfLine(editor: TextEditor, position: Position) { diff --git a/packages/cursorless-engine/src/util/selectionUtils.ts b/packages/cursorless-engine/src/util/selectionUtils.ts index e664f67c6b..207bc9781d 100644 --- a/packages/cursorless-engine/src/util/selectionUtils.ts +++ b/packages/cursorless-engine/src/util/selectionUtils.ts @@ -1,5 +1,6 @@ -import { Position, Range, Selection, TextEditor } from "@cursorless/common"; -import { SelectionWithEditor } from "../typings/Types"; +import type { Position, TextEditor } from "@cursorless/common"; +import { Range, Selection } from "@cursorless/common"; +import type { SelectionWithEditor } from "../typings/Types"; export function selectionWithEditorFromRange( selection: SelectionWithEditor, diff --git a/packages/cursorless-engine/src/util/setSelectionsAndFocusEditor.ts b/packages/cursorless-engine/src/util/setSelectionsAndFocusEditor.ts index 2b8b318a22..506c197f00 100644 --- a/packages/cursorless-engine/src/util/setSelectionsAndFocusEditor.ts +++ b/packages/cursorless-engine/src/util/setSelectionsAndFocusEditor.ts @@ -1,4 +1,4 @@ -import { EditableTextEditor, Selection } from "@cursorless/common"; +import type { EditableTextEditor, Selection } from "@cursorless/common"; import uniqDeep from "./uniqDeep"; diff --git a/packages/cursorless-engine/src/util/targetUtils.ts b/packages/cursorless-engine/src/util/targetUtils.ts index fc08a1bd4f..369f79cc03 100644 --- a/packages/cursorless-engine/src/util/targetUtils.ts +++ b/packages/cursorless-engine/src/util/targetUtils.ts @@ -1,18 +1,20 @@ -import { +import type { FlashDescriptor, FlashStyle, GeneralizedRange, - groupBy, IDE, Range, - Selection, TextEditor, +} from "@cursorless/common"; +import { + groupBy, + Selection, toCharacterRange, toLineRange, } from "@cursorless/common"; import { zip } from "lodash"; -import { Destination, Target } from "../typings/target.types"; -import { SelectionWithEditor } from "../typings/Types"; +import type { Destination, Target } from "../typings/target.types"; +import type { SelectionWithEditor } from "../typings/Types"; export function ensureSingleEditor( targets: Target[] | Destination[], diff --git a/packages/cursorless-engine/src/util/tryConstructTarget.ts b/packages/cursorless-engine/src/util/tryConstructTarget.ts index c9ca286450..9c3beab6ed 100644 --- a/packages/cursorless-engine/src/util/tryConstructTarget.ts +++ b/packages/cursorless-engine/src/util/tryConstructTarget.ts @@ -1,10 +1,7 @@ -import { Range, TextEditor } from "@cursorless/common"; -import { - CommonTargetParameters, - LineTarget, - PlainTarget, -} from "../processTargets/targets"; -import { Target } from "../typings/target.types"; +import type { Range, TextEditor } from "@cursorless/common"; +import type { CommonTargetParameters } from "../processTargets/targets"; +import { LineTarget, PlainTarget } from "../processTargets/targets"; +import type { Target } from "../typings/target.types"; type TargetConstructor = new ( parameters: CommonTargetParameters, diff --git a/packages/cursorless-engine/src/util/unifyRanges.ts b/packages/cursorless-engine/src/util/unifyRanges.ts index c4f3eef627..7ee7be2ded 100644 --- a/packages/cursorless-engine/src/util/unifyRanges.ts +++ b/packages/cursorless-engine/src/util/unifyRanges.ts @@ -1,5 +1,5 @@ import { targetsToContinuousTarget } from "../processTargets/TargetPipelineRunner"; -import { Target } from "../typings/target.types"; +import type { Target } from "../typings/target.types"; import { groupTargetsForEachEditor } from "./targetUtils"; /** Unifies overlapping/intersecting targets */ diff --git a/packages/cursorless-vscode-e2e/src/endToEndTestSetup.ts b/packages/cursorless-vscode-e2e/src/endToEndTestSetup.ts index a6fab13c66..43c43a3983 100644 --- a/packages/cursorless-vscode-e2e/src/endToEndTestSetup.ts +++ b/packages/cursorless-vscode-e2e/src/endToEndTestSetup.ts @@ -1,6 +1,7 @@ -import { IDE, shouldUpdateFixtures, sleep, SpyIDE } from "@cursorless/common"; +import type { IDE } from "@cursorless/common"; +import { shouldUpdateFixtures, sleep, SpyIDE } from "@cursorless/common"; import { getCursorlessApi } from "@cursorless/vscode-common"; -import { Context } from "mocha"; +import type { Context } from "mocha"; import * as sinon from "sinon"; /** diff --git a/packages/cursorless-vscode-e2e/src/mockPrePhraseGetVersion.ts b/packages/cursorless-vscode-e2e/src/mockPrePhraseGetVersion.ts index 9441d8b27b..0b91c3f048 100644 --- a/packages/cursorless-vscode-e2e/src/mockPrePhraseGetVersion.ts +++ b/packages/cursorless-vscode-e2e/src/mockPrePhraseGetVersion.ts @@ -1,4 +1,4 @@ -import { CommandServerApi } from "@cursorless/common"; +import type { CommandServerApi } from "@cursorless/common"; import * as sinon from "sinon"; export function mockPrePhraseGetVersion( diff --git a/packages/cursorless-vscode-e2e/src/notebook.ts b/packages/cursorless-vscode-e2e/src/notebook.ts index 695ad6ed88..6a52b567ad 100644 --- a/packages/cursorless-vscode-e2e/src/notebook.ts +++ b/packages/cursorless-vscode-e2e/src/notebook.ts @@ -1,4 +1,4 @@ -import * as vscode from "vscode"; +import type * as vscode from "vscode"; export function getPlainNotebookContents(notebook: vscode.NotebookDocument) { return notebook.getCells().map((cell) => cell.document.getText()); diff --git a/packages/cursorless-vscode-e2e/src/suite/recorded.vscode.test.ts b/packages/cursorless-vscode-e2e/src/suite/recorded.vscode.test.ts index db2f0658e3..5a42bb1315 100644 --- a/packages/cursorless-vscode-e2e/src/suite/recorded.vscode.test.ts +++ b/packages/cursorless-vscode-e2e/src/suite/recorded.vscode.test.ts @@ -1,26 +1,28 @@ +import type { + ExcludableSnapshotField, + PositionPlainObject, + ReadOnlyHatMap, + SelectionPlainObject, + SerializedMarks, + SpyIDE, + TestCaseFixtureLegacy, + TextEditor, + TokenHat, +} from "@cursorless/common"; import { asyncSafety, DEFAULT_TEXT_EDITOR_OPTIONS_FOR_TEST, - ExcludableSnapshotField, extractTargetedMarks, getRecordedTestPaths, HatStability, marksToPlainObject, omitByDeep, plainObjectToRange, - PositionPlainObject, rangeToPlainObject, - ReadOnlyHatMap, - SelectionPlainObject, - SerializedMarks, serializeTestFixture, shouldUpdateFixtures, splitKey, - SpyIDE, spyIDERecordedValuesToPlainObject, - TestCaseFixtureLegacy, - TextEditor, - TokenHat, } from "@cursorless/common"; import { getCursorlessApi, diff --git a/packages/cursorless-vscode-e2e/src/suite/scopeVisualizer/checkAndResetFakes.ts b/packages/cursorless-vscode-e2e/src/suite/scopeVisualizer/checkAndResetFakes.ts index 662cd1bb87..ba584724a0 100644 --- a/packages/cursorless-vscode-e2e/src/suite/scopeVisualizer/checkAndResetFakes.ts +++ b/packages/cursorless-vscode-e2e/src/suite/scopeVisualizer/checkAndResetFakes.ts @@ -1,10 +1,10 @@ import { assert } from "chai"; -import * as sinon from "sinon"; +import type * as sinon from "sinon"; import { createDecorationTypeCallToPlainObject, setDecorationsCallToPlainObject, } from "./spyCallsToPlainObject"; -import { Fakes, ExpectedArgs } from "./scopeVisualizerTest.types"; +import type { Fakes, ExpectedArgs } from "./scopeVisualizerTest.types"; export function checkAndResetFakes(fakes: Fakes, expected: ExpectedArgs) { const actual = getSpyCallsAndResetFakes(fakes); diff --git a/packages/cursorless-vscode-e2e/src/suite/scopeVisualizer/colorConfig.ts b/packages/cursorless-vscode-e2e/src/suite/scopeVisualizer/colorConfig.ts index 93467cafe8..cb504f729d 100644 --- a/packages/cursorless-vscode-e2e/src/suite/scopeVisualizer/colorConfig.ts +++ b/packages/cursorless-vscode-e2e/src/suite/scopeVisualizer/colorConfig.ts @@ -1,4 +1,4 @@ -import { ScopeVisualizerColorConfig } from "@cursorless/vscode-common"; +import type { ScopeVisualizerColorConfig } from "@cursorless/vscode-common"; /** * Fake color config to use for testing. We use an alpha of 50% and try to use diff --git a/packages/cursorless-vscode-e2e/src/suite/scopeVisualizer/injectFakes.ts b/packages/cursorless-vscode-e2e/src/suite/scopeVisualizer/injectFakes.ts index d444a8377a..eb7386bf2f 100644 --- a/packages/cursorless-vscode-e2e/src/suite/scopeVisualizer/injectFakes.ts +++ b/packages/cursorless-vscode-e2e/src/suite/scopeVisualizer/injectFakes.ts @@ -1,8 +1,9 @@ -import { VscodeApi, getCursorlessApi } from "@cursorless/vscode-common"; +import type { VscodeApi } from "@cursorless/vscode-common"; +import { getCursorlessApi } from "@cursorless/vscode-common"; import * as sinon from "sinon"; -import { DecorationRenderOptions, WorkspaceConfiguration } from "vscode"; +import type { DecorationRenderOptions, WorkspaceConfiguration } from "vscode"; import { COLOR_CONFIG } from "./colorConfig"; -import { +import type { Fakes, MockDecorationType, SetDecorationsParameters, diff --git a/packages/cursorless-vscode-e2e/src/suite/scopeVisualizer/runBasicMultilineContentTest.ts b/packages/cursorless-vscode-e2e/src/suite/scopeVisualizer/runBasicMultilineContentTest.ts index 5e7a7993a3..da6f577a8f 100644 --- a/packages/cursorless-vscode-e2e/src/suite/scopeVisualizer/runBasicMultilineContentTest.ts +++ b/packages/cursorless-vscode-e2e/src/suite/scopeVisualizer/runBasicMultilineContentTest.ts @@ -2,7 +2,7 @@ import { openNewEditor } from "@cursorless/vscode-common"; import * as vscode from "vscode"; import { checkAndResetFakes } from "./checkAndResetFakes"; import { injectFakes } from "./injectFakes"; -import { ExpectedArgs } from "./scopeVisualizerTest.types"; +import type { ExpectedArgs } from "./scopeVisualizerTest.types"; /** * Tests that the scope visualizer works with multiline content, by diff --git a/packages/cursorless-vscode-e2e/src/suite/scopeVisualizer/runBasicRemovalTest.ts b/packages/cursorless-vscode-e2e/src/suite/scopeVisualizer/runBasicRemovalTest.ts index 54b701883f..1c0350ff3f 100644 --- a/packages/cursorless-vscode-e2e/src/suite/scopeVisualizer/runBasicRemovalTest.ts +++ b/packages/cursorless-vscode-e2e/src/suite/scopeVisualizer/runBasicRemovalTest.ts @@ -2,7 +2,7 @@ import { openNewEditor } from "@cursorless/vscode-common"; import * as vscode from "vscode"; import { checkAndResetFakes } from "./checkAndResetFakes"; import { injectFakes } from "./injectFakes"; -import { ExpectedArgs } from "./scopeVisualizerTest.types"; +import type { ExpectedArgs } from "./scopeVisualizerTest.types"; /** * Tests that the scope visualizer works with removal ranges, by ensuring that diff --git a/packages/cursorless-vscode-e2e/src/suite/scopeVisualizer/runNestedMultilineContentTest.ts b/packages/cursorless-vscode-e2e/src/suite/scopeVisualizer/runNestedMultilineContentTest.ts index 29570fa63d..e5ebb54a72 100644 --- a/packages/cursorless-vscode-e2e/src/suite/scopeVisualizer/runNestedMultilineContentTest.ts +++ b/packages/cursorless-vscode-e2e/src/suite/scopeVisualizer/runNestedMultilineContentTest.ts @@ -2,7 +2,7 @@ import { openNewEditor } from "@cursorless/vscode-common"; import * as vscode from "vscode"; import { injectFakes } from "./injectFakes"; import { checkAndResetFakes } from "./checkAndResetFakes"; -import { ExpectedArgs } from "./scopeVisualizerTest.types"; +import type { ExpectedArgs } from "./scopeVisualizerTest.types"; /** * Tests that the scope visualizer works with nested multiline content, by diff --git a/packages/cursorless-vscode-e2e/src/suite/scopeVisualizer/runUpdateTest.ts b/packages/cursorless-vscode-e2e/src/suite/scopeVisualizer/runUpdateTest.ts index d9f7e19fad..68532ae712 100644 --- a/packages/cursorless-vscode-e2e/src/suite/scopeVisualizer/runUpdateTest.ts +++ b/packages/cursorless-vscode-e2e/src/suite/scopeVisualizer/runUpdateTest.ts @@ -3,7 +3,7 @@ import * as vscode from "vscode"; import { sleepWithBackoff } from "../../endToEndTestSetup"; import { injectFakes } from "./injectFakes"; import { checkAndResetFakes } from "./checkAndResetFakes"; -import { ExpectedArgs } from "./scopeVisualizerTest.types"; +import type { ExpectedArgs } from "./scopeVisualizerTest.types"; /** * Tests that the scope visualizer updates correctly when the document is diff --git a/packages/cursorless-vscode-e2e/src/suite/scopeVisualizer/scopeVisualizerTest.types.ts b/packages/cursorless-vscode-e2e/src/suite/scopeVisualizer/scopeVisualizerTest.types.ts index 71a9359546..a77d9b426f 100644 --- a/packages/cursorless-vscode-e2e/src/suite/scopeVisualizer/scopeVisualizerTest.types.ts +++ b/packages/cursorless-vscode-e2e/src/suite/scopeVisualizer/scopeVisualizerTest.types.ts @@ -1,7 +1,7 @@ -import { RangePlainObject } from "@cursorless/common"; -import { VscodeApi } from "@cursorless/vscode-common"; -import * as sinon from "sinon"; -import * as vscode from "vscode"; +import type { RangePlainObject } from "@cursorless/common"; +import type { VscodeApi } from "@cursorless/vscode-common"; +import type * as sinon from "sinon"; +import type * as vscode from "vscode"; export interface MockDecorationType { dispose(): void; diff --git a/packages/cursorless-vscode-e2e/src/suite/scopeVisualizer/spyCallsToPlainObject.ts b/packages/cursorless-vscode-e2e/src/suite/scopeVisualizer/spyCallsToPlainObject.ts index e4b865c129..c77dc8a1b6 100644 --- a/packages/cursorless-vscode-e2e/src/suite/scopeVisualizer/spyCallsToPlainObject.ts +++ b/packages/cursorless-vscode-e2e/src/suite/scopeVisualizer/spyCallsToPlainObject.ts @@ -1,12 +1,12 @@ import { rangeToPlainObject } from "@cursorless/common"; -import { DecorationRenderOptions } from "vscode"; -import { +import type { DecorationRenderOptions } from "vscode"; +import type { SetDecorationsParameters, DecorationRangesPlainObject, DecorationRenderOptionsPlainObject, MockDecorationType, } from "./scopeVisualizerTest.types"; -import { SinonSpyCall } from "sinon"; +import type { SinonSpyCall } from "sinon"; export function setDecorationsCallToPlainObject({ args: [_editor, decorationType, ranges], diff --git a/packages/cursorless-vscode-e2e/src/suite/setupFake.ts b/packages/cursorless-vscode-e2e/src/suite/setupFake.ts index 7e90a3838e..e1f1617004 100644 --- a/packages/cursorless-vscode-e2e/src/suite/setupFake.ts +++ b/packages/cursorless-vscode-e2e/src/suite/setupFake.ts @@ -1,4 +1,4 @@ -import { HatStability, NormalizedIDE } from "@cursorless/common"; +import type { HatStability, NormalizedIDE } from "@cursorless/common"; export function setupFake(ide: NormalizedIDE, hatStability: HatStability) { ide.configuration.mockConfiguration("experimental", { diff --git a/packages/cursorless-vscode-e2e/src/suite/testCaseRecorder.vscode.test.ts b/packages/cursorless-vscode-e2e/src/suite/testCaseRecorder.vscode.test.ts index b88d9f5c84..b0eaa0680f 100644 --- a/packages/cursorless-vscode-e2e/src/suite/testCaseRecorder.vscode.test.ts +++ b/packages/cursorless-vscode-e2e/src/suite/testCaseRecorder.vscode.test.ts @@ -1,9 +1,8 @@ +import type { HatTokenMap, SimpleActionName } from "@cursorless/common"; import { getFixturePath, getRecordedTestsDirPath, - HatTokenMap, LATEST_VERSION, - SimpleActionName, } from "@cursorless/common"; import { getCursorlessApi, diff --git a/packages/cursorless-vscode/src/ReleaseNotes.test.ts b/packages/cursorless-vscode/src/ReleaseNotes.test.ts index 0efaa1f75b..caf781cfe8 100644 --- a/packages/cursorless-vscode/src/ReleaseNotes.test.ts +++ b/packages/cursorless-vscode/src/ReleaseNotes.test.ts @@ -1,8 +1,9 @@ import * as sinon from "sinon"; -import { MessageType, Messages, asyncSafety } from "@cursorless/common"; +import type { MessageType, Messages } from "@cursorless/common"; +import { asyncSafety } from "@cursorless/common"; import type { ExtensionContext, Uri } from "vscode"; import { ReleaseNotes, VERSION_KEY, WHATS_NEW } from "./ReleaseNotes"; -import { VscodeApi } from "@cursorless/vscode-common"; +import type { VscodeApi } from "@cursorless/vscode-common"; interface Input { /** Whether the VSCode window is focused */ diff --git a/packages/cursorless-vscode/src/ReleaseNotes.ts b/packages/cursorless-vscode/src/ReleaseNotes.ts index b8f989d717..dc16ca23b1 100644 --- a/packages/cursorless-vscode/src/ReleaseNotes.ts +++ b/packages/cursorless-vscode/src/ReleaseNotes.ts @@ -1,7 +1,8 @@ import type { ExtensionContext } from "vscode"; -import { Messages, showInfo } from "@cursorless/common"; +import type { Messages } from "@cursorless/common"; +import { showInfo } from "@cursorless/common"; import * as semver from "semver"; -import { VscodeApi } from "@cursorless/vscode-common"; +import type { VscodeApi } from "@cursorless/vscode-common"; import { URI } from "vscode-uri"; /** diff --git a/packages/cursorless-vscode/src/ScopeVisualizerCommandApi.ts b/packages/cursorless-vscode/src/ScopeVisualizerCommandApi.ts index 77dcc80c6a..ed9afae62c 100644 --- a/packages/cursorless-vscode/src/ScopeVisualizerCommandApi.ts +++ b/packages/cursorless-vscode/src/ScopeVisualizerCommandApi.ts @@ -1,4 +1,4 @@ -import { ScopeType } from "@cursorless/common"; +import type { ScopeType } from "@cursorless/common"; export interface ScopeVisualizerCommandApi { start(scopeType: ScopeType, visualizationType: VisualizationType): void; diff --git a/packages/cursorless-vscode/src/constructTestHelpers.ts b/packages/cursorless-vscode/src/constructTestHelpers.ts index a68539edb0..faa4cee47f 100644 --- a/packages/cursorless-vscode/src/constructTestHelpers.ts +++ b/packages/cursorless-vscode/src/constructTestHelpers.ts @@ -1,4 +1,4 @@ -import { +import type { CommandServerApi, ExcludableSnapshotField, ExtraSnapshotField, @@ -10,15 +10,17 @@ import { TestCaseSnapshot, TextEditor, } from "@cursorless/common"; -import { +import type { StoredTargetKey, StoredTargetMap, +} from "@cursorless/cursorless-engine"; +import { plainObjectToTarget, takeSnapshot, } from "@cursorless/cursorless-engine"; -import { TestHelpers } from "@cursorless/vscode-common"; -import * as vscode from "vscode"; -import { VscodeIDE } from "./ide/vscode/VscodeIDE"; +import type { TestHelpers } from "@cursorless/vscode-common"; +import type * as vscode from "vscode"; +import type { VscodeIDE } from "./ide/vscode/VscodeIDE"; import { toVscodeEditor } from "./ide/vscode/toVscodeEditor"; import { vscodeApi } from "./vscodeApi"; diff --git a/packages/cursorless-vscode/src/extension.ts b/packages/cursorless-vscode/src/extension.ts index 941817b47d..a891040681 100644 --- a/packages/cursorless-vscode/src/extension.ts +++ b/packages/cursorless-vscode/src/extension.ts @@ -1,23 +1,16 @@ +import type { IDE, Range, ScopeType, TextDocument } from "@cursorless/common"; import { FakeIDE, getFakeCommandServerApi, - IDE, isTesting, NormalizedIDE, - Range, - ScopeType, - TextDocument, } from "@cursorless/common"; +import type { ScopeProvider, TreeSitter } from "@cursorless/cursorless-engine"; +import { createCursorlessEngine } from "@cursorless/cursorless-engine"; +import type { CursorlessApi, ParseTreeApi } from "@cursorless/vscode-common"; import { - createCursorlessEngine, - ScopeProvider, - TreeSitter, -} from "@cursorless/cursorless-engine"; -import { - CursorlessApi, getCommandServerApi, getParseTreeApi, - ParseTreeApi, toVscodeRange, } from "@cursorless/vscode-common"; import * as vscode from "vscode"; @@ -27,14 +20,12 @@ import { FontMeasurementsImpl } from "./ide/vscode/hats/FontMeasurementsImpl"; import { VscodeHats } from "./ide/vscode/hats/VscodeHats"; import { VscodeFileSystem } from "./ide/vscode/VscodeFileSystem"; import { VscodeIDE } from "./ide/vscode/VscodeIDE"; -import { - createVscodeScopeVisualizer, - VscodeScopeVisualizer, -} from "./ide/vscode/VSCodeScopeVisualizer"; +import type { VscodeScopeVisualizer } from "./ide/vscode/VSCodeScopeVisualizer"; +import { createVscodeScopeVisualizer } from "./ide/vscode/VSCodeScopeVisualizer"; import { KeyboardCommands } from "./keyboard/KeyboardCommands"; import { registerCommands } from "./registerCommands"; import { ReleaseNotes } from "./ReleaseNotes"; -import { +import type { ScopeVisualizerCommandApi, VisualizationType, } from "./ScopeVisualizerCommandApi"; diff --git a/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeFancyRangeHighlighter/VscodeFancyRangeHighlighter.ts b/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeFancyRangeHighlighter/VscodeFancyRangeHighlighter.ts index ca4c7a9928..80f1b60524 100644 --- a/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeFancyRangeHighlighter/VscodeFancyRangeHighlighter.ts +++ b/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeFancyRangeHighlighter/VscodeFancyRangeHighlighter.ts @@ -1,12 +1,13 @@ -import { GeneralizedRange, Range } from "@cursorless/common"; +import type { GeneralizedRange } from "@cursorless/common"; +import { Range } from "@cursorless/common"; import { flatmap } from "itertools"; -import { VscodeTextEditorImpl } from "../../VscodeTextEditorImpl"; -import { RangeTypeColors } from "../RangeTypeColors"; +import type { VscodeTextEditorImpl } from "../../VscodeTextEditorImpl"; +import type { RangeTypeColors } from "../RangeTypeColors"; import { VscodeFancyRangeHighlighterRenderer } from "./VscodeFancyRangeHighlighterRenderer"; import { generateDecorationsForCharacterRange } from "./generateDecorationsForCharacterRange"; import { generateDecorationsForLineRange } from "./generateDecorationsForLineRange"; import { generateDifferentiatedRanges } from "./generateDifferentiatedRanges"; -import { DifferentiatedStyledRange } from "./decorationStyle.types"; +import type { DifferentiatedStyledRange } from "./decorationStyle.types"; import { groupDifferentiatedStyledRanges } from "./groupDifferentiatedStyledRanges"; /** diff --git a/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeFancyRangeHighlighter/VscodeFancyRangeHighlighterRenderer.ts b/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeFancyRangeHighlighter/VscodeFancyRangeHighlighterRenderer.ts index a466d41556..f79e4455ec 100644 --- a/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeFancyRangeHighlighter/VscodeFancyRangeHighlighterRenderer.ts +++ b/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeFancyRangeHighlighter/VscodeFancyRangeHighlighterRenderer.ts @@ -1,19 +1,16 @@ import { CompositeKeyDefaultMap } from "@cursorless/common"; import { toVscodeRange } from "@cursorless/vscode-common"; -import { - DecorationRangeBehavior, - DecorationRenderOptions, - TextEditorDecorationType, -} from "vscode"; +import type { DecorationRenderOptions, TextEditorDecorationType } from "vscode"; +import { DecorationRangeBehavior } from "vscode"; import { vscodeApi } from "../../../../vscodeApi"; -import { VscodeTextEditorImpl } from "../../VscodeTextEditorImpl"; -import { RangeTypeColors } from "../RangeTypeColors"; -import { - BorderStyle, +import type { VscodeTextEditorImpl } from "../../VscodeTextEditorImpl"; +import type { RangeTypeColors } from "../RangeTypeColors"; +import type { DecorationStyle, DifferentiatedStyle, DifferentiatedStyledRangeList, } from "./decorationStyle.types"; +import { BorderStyle } from "./decorationStyle.types"; import { getDifferentiatedStyleMapKey } from "./getDifferentiatedStyleMapKey"; const BORDER_WIDTH = "1px"; diff --git a/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeFancyRangeHighlighter/decorationStyle.types.ts b/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeFancyRangeHighlighter/decorationStyle.types.ts index f20c439cde..832e995ce8 100644 --- a/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeFancyRangeHighlighter/decorationStyle.types.ts +++ b/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeFancyRangeHighlighter/decorationStyle.types.ts @@ -1,4 +1,4 @@ -import { GeneralizedRange, Range } from "@cursorless/common"; +import type { GeneralizedRange, Range } from "@cursorless/common"; export enum BorderStyle { porous = "dashed", diff --git a/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeFancyRangeHighlighter/generateDecorationsForCharacterRange/generateDecorationsForCharacterRange.ts b/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeFancyRangeHighlighter/generateDecorationsForCharacterRange/generateDecorationsForCharacterRange.ts index 0cebef7d09..b09c537d41 100644 --- a/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeFancyRangeHighlighter/generateDecorationsForCharacterRange/generateDecorationsForCharacterRange.ts +++ b/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeFancyRangeHighlighter/generateDecorationsForCharacterRange/generateDecorationsForCharacterRange.ts @@ -1,5 +1,7 @@ -import { Range, TextEditor, getLineRanges } from "@cursorless/common"; -import { BorderStyle, StyledRange } from "../decorationStyle.types"; +import type { Range, TextEditor } from "@cursorless/common"; +import { getLineRanges } from "@cursorless/common"; +import type { StyledRange } from "../decorationStyle.types"; +import { BorderStyle } from "../decorationStyle.types"; import { handleMultipleLines } from "./handleMultipleLines"; /** diff --git a/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeFancyRangeHighlighter/generateDecorationsForCharacterRange/generateLineInfos.ts b/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeFancyRangeHighlighter/generateDecorationsForCharacterRange/generateLineInfos.ts index 9202923d0c..b8ea3b4998 100644 --- a/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeFancyRangeHighlighter/generateDecorationsForCharacterRange/generateLineInfos.ts +++ b/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeFancyRangeHighlighter/generateDecorationsForCharacterRange/generateLineInfos.ts @@ -1,4 +1,4 @@ -import { Range } from "@cursorless/common"; +import type { Range } from "@cursorless/common"; /** * Generates a line info for each line in the given range, which includes diff --git a/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeFancyRangeHighlighter/generateDecorationsForCharacterRange/handleMultipleLines.ts b/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeFancyRangeHighlighter/generateDecorationsForCharacterRange/handleMultipleLines.ts index 95c8365022..d1c537a68f 100644 --- a/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeFancyRangeHighlighter/generateDecorationsForCharacterRange/handleMultipleLines.ts +++ b/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeFancyRangeHighlighter/generateDecorationsForCharacterRange/handleMultipleLines.ts @@ -1,11 +1,9 @@ import { Range } from "@cursorless/common"; -import { - BorderStyle, - DecorationStyle, - StyledRange, -} from "../decorationStyle.types"; +import type { DecorationStyle, StyledRange } from "../decorationStyle.types"; +import { BorderStyle } from "../decorationStyle.types"; import { flatmap } from "itertools"; -import { generateLineInfos, LineInfo } from "./generateLineInfos"; +import type { LineInfo } from "./generateLineInfos"; +import { generateLineInfos } from "./generateLineInfos"; /** * Generates decorations for a range, which has already been split up into line diff --git a/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeFancyRangeHighlighter/generateDecorationsForLineRange.ts b/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeFancyRangeHighlighter/generateDecorationsForLineRange.ts index 23ac9a6d33..c1b79c2f40 100644 --- a/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeFancyRangeHighlighter/generateDecorationsForLineRange.ts +++ b/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeFancyRangeHighlighter/generateDecorationsForLineRange.ts @@ -1,5 +1,6 @@ import { Range } from "@cursorless/common"; -import { BorderStyle, StyledRange } from "./decorationStyle.types"; +import type { StyledRange } from "./decorationStyle.types"; +import { BorderStyle } from "./decorationStyle.types"; export function* generateDecorationsForLineRange( startLine: number, diff --git a/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeFancyRangeHighlighter/generateDifferentiatedRanges.ts b/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeFancyRangeHighlighter/generateDifferentiatedRanges.ts index 08ae9488a0..e541a9f839 100644 --- a/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeFancyRangeHighlighter/generateDifferentiatedRanges.ts +++ b/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeFancyRangeHighlighter/generateDifferentiatedRanges.ts @@ -1,11 +1,11 @@ +import type { GeneralizedRange } from "@cursorless/common"; import { - GeneralizedRange, generalizedRangeContains, generalizedRangeTouches, } from "@cursorless/common"; import { max } from "lodash"; -import { DifferentiatedGeneralizedRange } from "./decorationStyle.types"; +import type { DifferentiatedGeneralizedRange } from "./decorationStyle.types"; /** * Given a list of generalized ranges, returns a list of differentiated ranges, diff --git a/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeFancyRangeHighlighter/getDifferentiatedStyleMapKey.ts b/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeFancyRangeHighlighter/getDifferentiatedStyleMapKey.ts index 4bda9d4585..5a0cee93cc 100644 --- a/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeFancyRangeHighlighter/getDifferentiatedStyleMapKey.ts +++ b/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeFancyRangeHighlighter/getDifferentiatedStyleMapKey.ts @@ -1,4 +1,4 @@ -import { DifferentiatedStyle } from "./decorationStyle.types"; +import type { DifferentiatedStyle } from "./decorationStyle.types"; /** * Returns a list of values that uniquely definees a differentiated style, for diff --git a/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeFancyRangeHighlighter/groupDifferentiatedStyledRanges.ts b/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeFancyRangeHighlighter/groupDifferentiatedStyledRanges.ts index 22f692f04d..c72f2dc35b 100644 --- a/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeFancyRangeHighlighter/groupDifferentiatedStyledRanges.ts +++ b/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeFancyRangeHighlighter/groupDifferentiatedStyledRanges.ts @@ -1,5 +1,5 @@ import { CompositeKeyDefaultMap } from "@cursorless/common"; -import { +import type { DifferentiatedStyle, DifferentiatedStyledRange, DifferentiatedStyledRangeList, diff --git a/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeIterationScopeVisualizer.ts b/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeIterationScopeVisualizer.ts index b160f8631c..49015a5aaa 100644 --- a/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeIterationScopeVisualizer.ts +++ b/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeIterationScopeVisualizer.ts @@ -1,7 +1,8 @@ -import { Disposable, TextEditor, toCharacterRange } from "@cursorless/common"; -import { VscodeTextEditorImpl } from "../VscodeTextEditorImpl"; +import type { Disposable, TextEditor } from "@cursorless/common"; +import { toCharacterRange } from "@cursorless/common"; +import type { VscodeTextEditorImpl } from "../VscodeTextEditorImpl"; import { VscodeScopeVisualizer } from "./VscodeScopeVisualizer"; -import { ScopeSupport } from "@cursorless/cursorless-engine"; +import type { ScopeSupport } from "@cursorless/cursorless-engine"; export class VscodeIterationScopeVisualizer extends VscodeScopeVisualizer { protected getScopeSupport(editor: TextEditor): ScopeSupport { diff --git a/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeScopeRenderer.ts b/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeScopeRenderer.ts index c9004dab50..fbba4bfc96 100644 --- a/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeScopeRenderer.ts +++ b/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeScopeRenderer.ts @@ -1,10 +1,7 @@ -import { - Disposable, - GeneralizedRange, - isGeneralizedRangeEqual, -} from "@cursorless/common"; -import { VscodeTextEditorImpl } from "../VscodeTextEditorImpl"; -import { RangeTypeColors } from "./RangeTypeColors"; +import type { Disposable, GeneralizedRange } from "@cursorless/common"; +import { isGeneralizedRangeEqual } from "@cursorless/common"; +import type { VscodeTextEditorImpl } from "../VscodeTextEditorImpl"; +import type { RangeTypeColors } from "./RangeTypeColors"; import { VscodeFancyRangeHighlighter } from "./VscodeFancyRangeHighlighter"; import { blendRangeTypeColors } from "./blendRangeTypeColors"; diff --git a/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeScopeTargetVisualizer.ts b/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeScopeTargetVisualizer.ts index 6303d6ee3c..7523b1d92f 100644 --- a/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeScopeTargetVisualizer.ts +++ b/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeScopeTargetVisualizer.ts @@ -1,12 +1,12 @@ -import { +import type { Disposable, GeneralizedRange, TextEditor, - toCharacterRange, } from "@cursorless/common"; -import { ScopeSupport, TargetRanges } from "@cursorless/cursorless-engine"; +import { toCharacterRange } from "@cursorless/common"; +import type { ScopeSupport, TargetRanges } from "@cursorless/cursorless-engine"; import { VscodeScopeVisualizer } from "."; -import { VscodeTextEditorImpl } from "../VscodeTextEditorImpl"; +import type { VscodeTextEditorImpl } from "../VscodeTextEditorImpl"; abstract class VscodeScopeTargetVisualizer extends VscodeScopeVisualizer { protected abstract getTargetRange( diff --git a/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeScopeVisualizer.ts b/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeScopeVisualizer.ts index 862a75e41b..91a86711b0 100644 --- a/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeScopeVisualizer.ts +++ b/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/VscodeScopeVisualizer.ts @@ -1,12 +1,13 @@ -import { +import type { Disposable, IDE, ScopeType, TextEditor, - showError, } from "@cursorless/common"; -import { ScopeProvider, ScopeSupport } from "@cursorless/cursorless-engine"; -import { +import { showError } from "@cursorless/common"; +import type { ScopeProvider } from "@cursorless/cursorless-engine"; +import { ScopeSupport } from "@cursorless/cursorless-engine"; +import type { ScopeRangeType, ScopeVisualizerColorConfig, } from "@cursorless/vscode-common"; diff --git a/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/blendRangeTypeColors.ts b/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/blendRangeTypeColors.ts index c884a49d36..3a85817ac2 100644 --- a/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/blendRangeTypeColors.ts +++ b/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/blendRangeTypeColors.ts @@ -1,5 +1,5 @@ import tinycolor = require("tinycolor2"); -import { RangeTypeColors } from "./RangeTypeColors"; +import type { RangeTypeColors } from "./RangeTypeColors"; /** * Blends two {@link RangeTypeColors} color configurations together according to diff --git a/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/createVscodeScopeVisualizer.ts b/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/createVscodeScopeVisualizer.ts index 4abd4b6515..b1e00a4777 100644 --- a/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/createVscodeScopeVisualizer.ts +++ b/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/createVscodeScopeVisualizer.ts @@ -1,6 +1,6 @@ -import { IDE, ScopeType } from "@cursorless/common"; -import { ScopeProvider } from "@cursorless/cursorless-engine"; -import { VisualizationType } from "../../../ScopeVisualizerCommandApi"; +import type { IDE, ScopeType } from "@cursorless/common"; +import type { ScopeProvider } from "@cursorless/cursorless-engine"; +import type { VisualizationType } from "../../../ScopeVisualizerCommandApi"; import { VscodeIterationScopeVisualizer } from "./VscodeIterationScopeVisualizer"; import { VscodeScopeContentVisualizer, diff --git a/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/getColorsFromConfig.ts b/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/getColorsFromConfig.ts index 862767b313..8c6d48fbfa 100644 --- a/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/getColorsFromConfig.ts +++ b/packages/cursorless-vscode/src/ide/vscode/VSCodeScopeVisualizer/getColorsFromConfig.ts @@ -1,8 +1,8 @@ -import { +import type { ScopeRangeType, ScopeVisualizerColorConfig, } from "@cursorless/vscode-common"; -import { RangeTypeColors } from "./RangeTypeColors"; +import type { RangeTypeColors } from "./RangeTypeColors"; export function getColorsFromConfig( config: ScopeVisualizerColorConfig, diff --git a/packages/cursorless-vscode/src/ide/vscode/VscodeCapabilities.ts b/packages/cursorless-vscode/src/ide/vscode/VscodeCapabilities.ts index 8230b233a3..a2b31e7469 100644 --- a/packages/cursorless-vscode/src/ide/vscode/VscodeCapabilities.ts +++ b/packages/cursorless-vscode/src/ide/vscode/VscodeCapabilities.ts @@ -1,4 +1,4 @@ -import { Capabilities, CommandCapabilityMap } from "@cursorless/common"; +import type { Capabilities, CommandCapabilityMap } from "@cursorless/common"; const COMMAND_CAPABILITIES: CommandCapabilityMap = { clipboardCopy: { acceptsLocation: false }, diff --git a/packages/cursorless-vscode/src/ide/vscode/VscodeClipboard.ts b/packages/cursorless-vscode/src/ide/vscode/VscodeClipboard.ts index 95556fedc6..4c0531e1ad 100644 --- a/packages/cursorless-vscode/src/ide/vscode/VscodeClipboard.ts +++ b/packages/cursorless-vscode/src/ide/vscode/VscodeClipboard.ts @@ -1,5 +1,5 @@ import * as vscode from "vscode"; -import { Clipboard } from "@cursorless/common"; +import type { Clipboard } from "@cursorless/common"; export default class VscodeClipboard implements Clipboard { async readText(): Promise { diff --git a/packages/cursorless-vscode/src/ide/vscode/VscodeConfiguration.ts b/packages/cursorless-vscode/src/ide/vscode/VscodeConfiguration.ts index 9a00993e5e..1e29cd1834 100644 --- a/packages/cursorless-vscode/src/ide/vscode/VscodeConfiguration.ts +++ b/packages/cursorless-vscode/src/ide/vscode/VscodeConfiguration.ts @@ -1,12 +1,12 @@ import { HatStability } from "@cursorless/common"; import { get } from "lodash"; import * as vscode from "vscode"; -import { +import type { Configuration, ConfigurationScope, CursorlessConfiguration, } from "@cursorless/common"; -import { GetFieldType, Paths } from "@cursorless/common"; +import type { GetFieldType, Paths } from "@cursorless/common"; import { Notifier } from "@cursorless/common"; import type { VscodeIDE } from "./VscodeIDE"; diff --git a/packages/cursorless-vscode/src/ide/vscode/VscodeEdit.ts b/packages/cursorless-vscode/src/ide/vscode/VscodeEdit.ts index b738394255..89b2c3aa03 100644 --- a/packages/cursorless-vscode/src/ide/vscode/VscodeEdit.ts +++ b/packages/cursorless-vscode/src/ide/vscode/VscodeEdit.ts @@ -1,4 +1,4 @@ -import { TextEditorEdit } from "@cursorless/common"; +import type { TextEditorEdit } from "@cursorless/common"; import { toVscodeEndOfLine, toVscodePosition, diff --git a/packages/cursorless-vscode/src/ide/vscode/VscodeEnabledHatStyleManager.ts b/packages/cursorless-vscode/src/ide/vscode/VscodeEnabledHatStyleManager.ts index 2f73a4e8e3..bcc8af4b5e 100644 --- a/packages/cursorless-vscode/src/ide/vscode/VscodeEnabledHatStyleManager.ts +++ b/packages/cursorless-vscode/src/ide/vscode/VscodeEnabledHatStyleManager.ts @@ -1,15 +1,11 @@ import { isTesting } from "@cursorless/common"; import { pickBy } from "lodash"; import * as vscode from "vscode"; -import { HatStyleInfo, HatStyleMap } from "@cursorless/common"; -import { Listener, Notifier } from "@cursorless/common"; -import { - HatColor, - HatShape, - HAT_COLORS, - HAT_NON_DEFAULT_SHAPES, - VscodeHatStyleName, -} from "./hatStyles.types"; +import type { HatStyleInfo, HatStyleMap } from "@cursorless/common"; +import type { Listener } from "@cursorless/common"; +import { Notifier } from "@cursorless/common"; +import type { HatColor, HatShape, VscodeHatStyleName } from "./hatStyles.types"; +import { HAT_COLORS, HAT_NON_DEFAULT_SHAPES } from "./hatStyles.types"; export interface ExtendedHatStyleInfo extends HatStyleInfo { color: HatColor; diff --git a/packages/cursorless-vscode/src/ide/vscode/VscodeEvents.ts b/packages/cursorless-vscode/src/ide/vscode/VscodeEvents.ts index 395527e3c2..7afd189f49 100644 --- a/packages/cursorless-vscode/src/ide/vscode/VscodeEvents.ts +++ b/packages/cursorless-vscode/src/ide/vscode/VscodeEvents.ts @@ -5,7 +5,7 @@ import type { TextDocumentChangeReason, TextDocumentContentChangeEvent, } from "@cursorless/common"; -import { Event } from "@cursorless/common"; +import type { Event } from "@cursorless/common"; import type { Disposable } from "@cursorless/common"; import { VscodeTextDocumentImpl } from "./VscodeTextDocumentImpl"; diff --git a/packages/cursorless-vscode/src/ide/vscode/VscodeFileSystem.ts b/packages/cursorless-vscode/src/ide/vscode/VscodeFileSystem.ts index 49da4f0017..0f97bb661a 100644 --- a/packages/cursorless-vscode/src/ide/vscode/VscodeFileSystem.ts +++ b/packages/cursorless-vscode/src/ide/vscode/VscodeFileSystem.ts @@ -1,9 +1,9 @@ -import { +import type { Disposable, FileSystem, PathChangeListener, - walkFiles, } from "@cursorless/common"; +import { walkFiles } from "@cursorless/common"; import { stat } from "fs/promises"; import { max } from "lodash"; diff --git a/packages/cursorless-vscode/src/ide/vscode/VscodeFlashHandler.ts b/packages/cursorless-vscode/src/ide/vscode/VscodeFlashHandler.ts index 2a579a5b13..bfac283c69 100644 --- a/packages/cursorless-vscode/src/ide/vscode/VscodeFlashHandler.ts +++ b/packages/cursorless-vscode/src/ide/vscode/VscodeFlashHandler.ts @@ -1,13 +1,12 @@ -import { +import type { EditorGeneralizedRange, FlashDescriptor, FlashStyle, - groupBy, - sleep, } from "@cursorless/common"; +import { groupBy, sleep } from "@cursorless/common"; import { workspace } from "vscode"; -import VscodeHighlights from "./VscodeHighlights"; -import { VscodeIDE } from "./VscodeIDE"; +import type VscodeHighlights from "./VscodeHighlights"; +import type { VscodeIDE } from "./VscodeIDE"; export default class VscodeFlashHandler { constructor( diff --git a/packages/cursorless-vscode/src/ide/vscode/VscodeFocusEditor.ts b/packages/cursorless-vscode/src/ide/vscode/VscodeFocusEditor.ts index e336a0fbde..a035a75113 100644 --- a/packages/cursorless-vscode/src/ide/vscode/VscodeFocusEditor.ts +++ b/packages/cursorless-vscode/src/ide/vscode/VscodeFocusEditor.ts @@ -1,12 +1,6 @@ import * as semver from "semver"; -import { - commands, - NotebookDocument, - TextEditor, - version, - ViewColumn, - window, -} from "vscode"; +import type { NotebookDocument, TextEditor } from "vscode"; +import { commands, version, ViewColumn, window } from "vscode"; import { getCellIndex } from "@cursorless/vscode-common"; import { getNotebookFromCellDocument } from "./notebook/notebook"; import { @@ -14,7 +8,7 @@ import { isVscodeLegacyNotebookVersion, } from "./notebook/notebookLegacy"; import type { VscodeIDE } from "./VscodeIDE"; -import { VscodeTextEditorImpl } from "./VscodeTextEditorImpl"; +import type { VscodeTextEditorImpl } from "./VscodeTextEditorImpl"; const columnFocusCommands = { [ViewColumn.One]: "workbench.action.focusFirstEditorGroup", diff --git a/packages/cursorless-vscode/src/ide/vscode/VscodeFold.ts b/packages/cursorless-vscode/src/ide/vscode/VscodeFold.ts index d8041ed8c4..d2a0a93546 100644 --- a/packages/cursorless-vscode/src/ide/vscode/VscodeFold.ts +++ b/packages/cursorless-vscode/src/ide/vscode/VscodeFold.ts @@ -1,7 +1,7 @@ -import { Range } from "@cursorless/common"; +import type { Range } from "@cursorless/common"; import * as vscode from "vscode"; -import { VscodeIDE } from "./VscodeIDE"; -import { VscodeTextEditorImpl } from "./VscodeTextEditorImpl"; +import type { VscodeIDE } from "./VscodeIDE"; +import type { VscodeTextEditorImpl } from "./VscodeTextEditorImpl"; export async function vscodeFold( ide: VscodeIDE, diff --git a/packages/cursorless-vscode/src/ide/vscode/VscodeHighlightDecorationTypes.ts b/packages/cursorless-vscode/src/ide/vscode/VscodeHighlightDecorationTypes.ts index da8665a589..a7cb2e3438 100644 --- a/packages/cursorless-vscode/src/ide/vscode/VscodeHighlightDecorationTypes.ts +++ b/packages/cursorless-vscode/src/ide/vscode/VscodeHighlightDecorationTypes.ts @@ -1,10 +1,5 @@ -import { - DecorationRangeBehavior, - DecorationRenderOptions, - TextEditorDecorationType, - ThemeColor, - window, -} from "vscode"; +import type { DecorationRenderOptions, TextEditorDecorationType } from "vscode"; +import { DecorationRangeBehavior, ThemeColor, window } from "vscode"; import type { VscodeStyle } from "./VscodeHighlights"; /** diff --git a/packages/cursorless-vscode/src/ide/vscode/VscodeHighlights.ts b/packages/cursorless-vscode/src/ide/vscode/VscodeHighlights.ts index 6f7388c051..54a9390ffb 100644 --- a/packages/cursorless-vscode/src/ide/vscode/VscodeHighlights.ts +++ b/packages/cursorless-vscode/src/ide/vscode/VscodeHighlights.ts @@ -1,14 +1,14 @@ import * as vscode from "vscode"; -import { ExtensionContext } from "vscode"; +import type { ExtensionContext } from "vscode"; import { FlashStyle, partition } from "@cursorless/common"; -import { +import type { CharacterRange, GeneralizedRange, - isLineRange, LineRange, } from "@cursorless/common"; +import { isLineRange } from "@cursorless/common"; import { VscodeHighlightDecorationTypes } from "./VscodeHighlightDecorationTypes"; -import { VscodeTextEditorImpl } from "./VscodeTextEditorImpl"; +import type { VscodeTextEditorImpl } from "./VscodeTextEditorImpl"; export enum HighlightStyle { highlight0 = "highlight0", diff --git a/packages/cursorless-vscode/src/ide/vscode/VscodeIDE.ts b/packages/cursorless-vscode/src/ide/vscode/VscodeIDE.ts index 761bfb5fd9..35c78bcd95 100644 --- a/packages/cursorless-vscode/src/ide/vscode/VscodeIDE.ts +++ b/packages/cursorless-vscode/src/ide/vscode/VscodeIDE.ts @@ -1,4 +1,4 @@ -import { +import type { Disposable, EditableTextEditor, FlashDescriptor, @@ -6,12 +6,12 @@ import { HighlightId, IDE, InputBoxOptions, - OutdatedExtensionError, QuickPickOptions, RunMode, TextDocumentChangeEvent, TextEditor, } from "@cursorless/common"; +import { OutdatedExtensionError } from "@cursorless/common"; import { fromVscodeRange, fromVscodeSelection, @@ -19,7 +19,8 @@ import { import { pull } from "lodash"; import { v4 as uuid } from "uuid"; import * as vscode from "vscode"; -import { ExtensionContext, window, workspace, WorkspaceFolder } from "vscode"; +import type { ExtensionContext, WorkspaceFolder } from "vscode"; +import { window, workspace } from "vscode"; import { VscodeCapabilities } from "./VscodeCapabilities"; import VscodeClipboard from "./VscodeClipboard"; import VscodeConfiguration from "./VscodeConfiguration"; diff --git a/packages/cursorless-vscode/src/ide/vscode/VscodeInsertSnippets.ts b/packages/cursorless-vscode/src/ide/vscode/VscodeInsertSnippets.ts index c58994f9d6..c68e18e549 100644 --- a/packages/cursorless-vscode/src/ide/vscode/VscodeInsertSnippets.ts +++ b/packages/cursorless-vscode/src/ide/vscode/VscodeInsertSnippets.ts @@ -1,6 +1,6 @@ import * as vscode from "vscode"; -import { Range } from "@cursorless/common"; -import { VscodeTextEditorImpl } from "./VscodeTextEditorImpl"; +import type { Range } from "@cursorless/common"; +import type { VscodeTextEditorImpl } from "./VscodeTextEditorImpl"; export async function vscodeInsertSnippet( editor: VscodeTextEditorImpl, diff --git a/packages/cursorless-vscode/src/ide/vscode/VscodeMessages.ts b/packages/cursorless-vscode/src/ide/vscode/VscodeMessages.ts index 1bcd35d305..07dd5e7adb 100644 --- a/packages/cursorless-vscode/src/ide/vscode/VscodeMessages.ts +++ b/packages/cursorless-vscode/src/ide/vscode/VscodeMessages.ts @@ -1,5 +1,6 @@ import { window } from "vscode"; -import { MessageId, Messages, MessageType } from "@cursorless/common"; +import type { MessageId, Messages } from "@cursorless/common"; +import { MessageType } from "@cursorless/common"; export default class VscodeMessages implements Messages { async showMessage( diff --git a/packages/cursorless-vscode/src/ide/vscode/VscodeNotebooks.ts b/packages/cursorless-vscode/src/ide/vscode/VscodeNotebooks.ts index b4c8d0fcf9..e89a1da006 100644 --- a/packages/cursorless-vscode/src/ide/vscode/VscodeNotebooks.ts +++ b/packages/cursorless-vscode/src/ide/vscode/VscodeNotebooks.ts @@ -1,7 +1,7 @@ import { Selection } from "@cursorless/common"; import * as vscode from "vscode"; import { getNotebookFromCellDocument } from "./notebook/notebook"; -import { VscodeTextEditorImpl } from "./VscodeTextEditorImpl"; +import type { VscodeTextEditorImpl } from "./VscodeTextEditorImpl"; export async function vscodeEditNewNotebookCellAbove( editor: VscodeTextEditorImpl, diff --git a/packages/cursorless-vscode/src/ide/vscode/VscodeOpenLink.ts b/packages/cursorless-vscode/src/ide/vscode/VscodeOpenLink.ts index c419e741c6..b592536ec8 100644 --- a/packages/cursorless-vscode/src/ide/vscode/VscodeOpenLink.ts +++ b/packages/cursorless-vscode/src/ide/vscode/VscodeOpenLink.ts @@ -1,5 +1,5 @@ import * as vscode from "vscode"; -import { VscodeTextEditorImpl } from "./VscodeTextEditorImpl"; +import type { VscodeTextEditorImpl } from "./VscodeTextEditorImpl"; export default async function vscodeOpenLink( editor: VscodeTextEditorImpl, diff --git a/packages/cursorless-vscode/src/ide/vscode/VscodeRevealLine.ts b/packages/cursorless-vscode/src/ide/vscode/VscodeRevealLine.ts index 09dded1796..4b4db38681 100644 --- a/packages/cursorless-vscode/src/ide/vscode/VscodeRevealLine.ts +++ b/packages/cursorless-vscode/src/ide/vscode/VscodeRevealLine.ts @@ -1,6 +1,6 @@ import * as vscode from "vscode"; import { RevealLineAt } from "@cursorless/common"; -import { VscodeTextEditorImpl } from "./VscodeTextEditorImpl"; +import type { VscodeTextEditorImpl } from "./VscodeTextEditorImpl"; export async function vscodeRevealLine( editor: VscodeTextEditorImpl, diff --git a/packages/cursorless-vscode/src/ide/vscode/VscodeRunMode.ts b/packages/cursorless-vscode/src/ide/vscode/VscodeRunMode.ts index c11428d124..93d8889736 100644 --- a/packages/cursorless-vscode/src/ide/vscode/VscodeRunMode.ts +++ b/packages/cursorless-vscode/src/ide/vscode/VscodeRunMode.ts @@ -1,4 +1,5 @@ -import { ExtensionContext, ExtensionMode } from "vscode"; +import type { ExtensionContext } from "vscode"; +import { ExtensionMode } from "vscode"; import type { RunMode } from "@cursorless/common"; const EXTENSION_MODE_MAP: Record = { diff --git a/packages/cursorless-vscode/src/ide/vscode/VscodeTextDocumentImpl.ts b/packages/cursorless-vscode/src/ide/vscode/VscodeTextDocumentImpl.ts index 382e5100dd..3e8721ceac 100644 --- a/packages/cursorless-vscode/src/ide/vscode/VscodeTextDocumentImpl.ts +++ b/packages/cursorless-vscode/src/ide/vscode/VscodeTextDocumentImpl.ts @@ -1,17 +1,17 @@ -import { +import type { EndOfLine, Position, - Range, TextDocument, TextLine, } from "@cursorless/common"; +import { Range } from "@cursorless/common"; import { fromVscodeEndOfLine, fromVscodePosition, toVscodePosition, toVscodeRange, } from "@cursorless/vscode-common"; -import * as vscode from "vscode"; +import type * as vscode from "vscode"; import type { URI } from "vscode-uri"; import VscodeTextLineImpl from "./VscodeTextLineImpl"; diff --git a/packages/cursorless-vscode/src/ide/vscode/VscodeTextEditorImpl.ts b/packages/cursorless-vscode/src/ide/vscode/VscodeTextEditorImpl.ts index 15733f6969..de7898430d 100644 --- a/packages/cursorless-vscode/src/ide/vscode/VscodeTextEditorImpl.ts +++ b/packages/cursorless-vscode/src/ide/vscode/VscodeTextEditorImpl.ts @@ -1,16 +1,16 @@ -import { +import type { BreakpointDescriptor, EditableTextEditor, Position, Range, RevealLineAt, Selection, - sleep, TextDocument, TextEditor, TextEditorEdit, TextEditorOptions, } from "@cursorless/common"; +import { sleep } from "@cursorless/common"; import { fromVscodeRange, fromVscodeSelection, @@ -22,7 +22,7 @@ import * as vscode from "vscode"; import vscodeEdit from "./VscodeEdit"; import vscodeFocusEditor from "./VscodeFocusEditor"; import { vscodeFold, vscodeUnfold } from "./VscodeFold"; -import { VscodeIDE } from "./VscodeIDE"; +import type { VscodeIDE } from "./VscodeIDE"; import { vscodeInsertSnippet } from "./VscodeInsertSnippets"; import { vscodeEditNewNotebookCellAbove, diff --git a/packages/cursorless-vscode/src/ide/vscode/VscodeTextLineImpl.ts b/packages/cursorless-vscode/src/ide/vscode/VscodeTextLineImpl.ts index 2f19862870..5e8e217c3f 100644 --- a/packages/cursorless-vscode/src/ide/vscode/VscodeTextLineImpl.ts +++ b/packages/cursorless-vscode/src/ide/vscode/VscodeTextLineImpl.ts @@ -1,6 +1,6 @@ -import { Range, TextLine } from "@cursorless/common"; +import type { Range, TextLine } from "@cursorless/common"; import { fromVscodeRange } from "@cursorless/vscode-common"; -import * as vscode from "vscode"; +import type * as vscode from "vscode"; export default class VscodeTextLineImpl implements TextLine { constructor(private line: vscode.TextLine) {} diff --git a/packages/cursorless-vscode/src/ide/vscode/VscodeToggleBreakpoint.ts b/packages/cursorless-vscode/src/ide/vscode/VscodeToggleBreakpoint.ts index 5d50a039d6..33248fde85 100644 --- a/packages/cursorless-vscode/src/ide/vscode/VscodeToggleBreakpoint.ts +++ b/packages/cursorless-vscode/src/ide/vscode/VscodeToggleBreakpoint.ts @@ -1,7 +1,7 @@ -import { BreakpointDescriptor } from "@cursorless/common"; +import type { BreakpointDescriptor } from "@cursorless/common"; import { toVscodeRange } from "@cursorless/vscode-common"; import * as vscode from "vscode"; -import { VscodeTextEditorImpl } from "./VscodeTextEditorImpl"; +import type { VscodeTextEditorImpl } from "./VscodeTextEditorImpl"; export async function vscodeToggleBreakpoint( editor: VscodeTextEditorImpl, diff --git a/packages/cursorless-vscode/src/ide/vscode/hats/FakeFontMeasurements.ts b/packages/cursorless-vscode/src/ide/vscode/hats/FakeFontMeasurements.ts index 45479951aa..6e8aac4af5 100644 --- a/packages/cursorless-vscode/src/ide/vscode/hats/FakeFontMeasurements.ts +++ b/packages/cursorless-vscode/src/ide/vscode/hats/FakeFontMeasurements.ts @@ -1,4 +1,4 @@ -import { FontMeasurements } from "./FontMeasurements"; +import type { FontMeasurements } from "./FontMeasurements"; export class FakeFontMeasurements implements FontMeasurements { fontSize = 12; diff --git a/packages/cursorless-vscode/src/ide/vscode/hats/FontMeasurementsImpl.ts b/packages/cursorless-vscode/src/ide/vscode/hats/FontMeasurementsImpl.ts index 66f4329fd6..ab97b949bf 100644 --- a/packages/cursorless-vscode/src/ide/vscode/hats/FontMeasurementsImpl.ts +++ b/packages/cursorless-vscode/src/ide/vscode/hats/FontMeasurementsImpl.ts @@ -1,5 +1,5 @@ import * as vscode from "vscode"; -import { FontMeasurements } from "./FontMeasurements"; +import type { FontMeasurements } from "./FontMeasurements"; /** * Contains measurements for the user's font diff --git a/packages/cursorless-vscode/src/ide/vscode/hats/VscodeHatRenderer.ts b/packages/cursorless-vscode/src/ide/vscode/hats/VscodeHatRenderer.ts index 315f5ee6c9..9633d57ca4 100644 --- a/packages/cursorless-vscode/src/ide/vscode/hats/VscodeHatRenderer.ts +++ b/packages/cursorless-vscode/src/ide/vscode/hats/VscodeHatRenderer.ts @@ -3,18 +3,19 @@ import { cloneDeep, isEqual } from "lodash"; import { join } from "path"; import * as vscode from "vscode"; import getHatThemeColors from "./getHatThemeColors"; +import type { IndividualHatAdjustmentMap } from "./shapeAdjustments"; import { defaultShapeAdjustments, DEFAULT_HAT_HEIGHT_EM, DEFAULT_VERTICAL_OFFSET_EM, - IndividualHatAdjustmentMap, } from "./shapeAdjustments"; -import { Listener, Notifier } from "@cursorless/common"; -import { FontMeasurements } from "./FontMeasurements"; -import { HatShape, HAT_SHAPES, VscodeHatStyleName } from "../hatStyles.types"; -import VscodeEnabledHatStyleManager, { - ExtendedHatStyleMap, -} from "../VscodeEnabledHatStyleManager"; +import type { Listener } from "@cursorless/common"; +import { Notifier } from "@cursorless/common"; +import type { FontMeasurements } from "./FontMeasurements"; +import type { HatShape, VscodeHatStyleName } from "../hatStyles.types"; +import { HAT_SHAPES } from "../hatStyles.types"; +import type { ExtendedHatStyleMap } from "../VscodeEnabledHatStyleManager"; +import type VscodeEnabledHatStyleManager from "../VscodeEnabledHatStyleManager"; type HatDecorationMap = Partial< Record diff --git a/packages/cursorless-vscode/src/ide/vscode/hats/VscodeHats.ts b/packages/cursorless-vscode/src/ide/vscode/hats/VscodeHats.ts index df1a0b136b..c98b3e6a22 100644 --- a/packages/cursorless-vscode/src/ide/vscode/hats/VscodeHats.ts +++ b/packages/cursorless-vscode/src/ide/vscode/hats/VscodeHats.ts @@ -1,22 +1,22 @@ -import { +import type { HatRange, Hats, HatStyleMap, HatStyleName, Listener, - Notifier, Range, TextEditor, } from "@cursorless/common"; +import { Notifier } from "@cursorless/common"; import { toVscodeRange } from "@cursorless/vscode-common"; import * as vscode from "vscode"; -import { Disposable } from "vscode"; -import { VscodeHatStyleName } from "../hatStyles.types"; +import type { Disposable } from "vscode"; +import type { VscodeHatStyleName } from "../hatStyles.types"; import VscodeEnabledHatStyleManager from "../VscodeEnabledHatStyleManager"; import type { VscodeIDE } from "../VscodeIDE"; -import { VscodeTextEditorImpl } from "../VscodeTextEditorImpl"; +import type { VscodeTextEditorImpl } from "../VscodeTextEditorImpl"; import VscodeHatRenderer from "./VscodeHatRenderer"; -import { FontMeasurements } from "./FontMeasurements"; +import type { FontMeasurements } from "./FontMeasurements"; export class VscodeHats implements Hats { private enabledHatStyleManager: VscodeEnabledHatStyleManager; diff --git a/packages/cursorless-vscode/src/ide/vscode/hats/getHatThemeColors.ts b/packages/cursorless-vscode/src/ide/vscode/hats/getHatThemeColors.ts index 4f00003241..aae1262558 100644 --- a/packages/cursorless-vscode/src/ide/vscode/hats/getHatThemeColors.ts +++ b/packages/cursorless-vscode/src/ide/vscode/hats/getHatThemeColors.ts @@ -1,5 +1,5 @@ import * as vscode from "vscode"; -import { HatColor } from "../hatStyles.types"; +import type { HatColor } from "../hatStyles.types"; interface OldDecorationColorSetting { dark: string; diff --git a/packages/cursorless-vscode/src/ide/vscode/hats/getStyleName.ts b/packages/cursorless-vscode/src/ide/vscode/hats/getStyleName.ts index 80a8f2bde9..13e164d5f8 100644 --- a/packages/cursorless-vscode/src/ide/vscode/hats/getStyleName.ts +++ b/packages/cursorless-vscode/src/ide/vscode/hats/getStyleName.ts @@ -1,4 +1,8 @@ -import { HatColor, HatShape, VscodeHatStyleName } from "../hatStyles.types"; +import type { + HatColor, + HatShape, + VscodeHatStyleName, +} from "../hatStyles.types"; export function getStyleName( color: HatColor, diff --git a/packages/cursorless-vscode/src/ide/vscode/hats/shapeAdjustments.ts b/packages/cursorless-vscode/src/ide/vscode/hats/shapeAdjustments.ts index 8d0e28bfa3..8437452b4d 100644 --- a/packages/cursorless-vscode/src/ide/vscode/hats/shapeAdjustments.ts +++ b/packages/cursorless-vscode/src/ide/vscode/hats/shapeAdjustments.ts @@ -1,4 +1,4 @@ -import { HatShape } from "../hatStyles.types"; +import type { HatShape } from "../hatStyles.types"; export interface HatAdjustments { sizeAdjustment?: number; diff --git a/packages/cursorless-vscode/src/ide/vscode/notebook/notebook.ts b/packages/cursorless-vscode/src/ide/vscode/notebook/notebook.ts index ddb0563682..5921e7c77b 100644 --- a/packages/cursorless-vscode/src/ide/vscode/notebook/notebook.ts +++ b/packages/cursorless-vscode/src/ide/vscode/notebook/notebook.ts @@ -1,4 +1,5 @@ -import { NotebookCell, TextDocument, window } from "vscode"; +import type { NotebookCell, TextDocument } from "vscode"; +import { window } from "vscode"; import { getNotebookFromCellDocumentLegacy, isVscodeLegacyNotebookVersion, diff --git a/packages/cursorless-vscode/src/ide/vscode/notebook/notebookLegacy.ts b/packages/cursorless-vscode/src/ide/vscode/notebook/notebookLegacy.ts index 610c13b269..eff9d59969 100644 --- a/packages/cursorless-vscode/src/ide/vscode/notebook/notebookLegacy.ts +++ b/packages/cursorless-vscode/src/ide/vscode/notebook/notebookLegacy.ts @@ -1,7 +1,8 @@ import { getCellIndex } from "@cursorless/vscode-common"; import { range } from "lodash"; import * as semver from "semver"; -import { commands, NotebookDocument, TextDocument, version } from "vscode"; +import type { NotebookDocument, TextDocument } from "vscode"; +import { commands, version } from "vscode"; import { toVscodeEditor } from "../toVscodeEditor"; import type { VscodeIDE } from "../VscodeIDE"; import type { VscodeTextEditorImpl } from "../VscodeTextEditorImpl"; diff --git a/packages/cursorless-vscode/src/ide/vscode/toVscodeEditor.ts b/packages/cursorless-vscode/src/ide/vscode/toVscodeEditor.ts index bc01d4efda..ef8fdf79d5 100644 --- a/packages/cursorless-vscode/src/ide/vscode/toVscodeEditor.ts +++ b/packages/cursorless-vscode/src/ide/vscode/toVscodeEditor.ts @@ -1,6 +1,6 @@ -import { TextEditor } from "@cursorless/common"; -import * as vscode from "vscode"; -import { VscodeTextEditorImpl } from "./VscodeTextEditorImpl"; +import type { TextEditor } from "@cursorless/common"; +import type * as vscode from "vscode"; +import type { VscodeTextEditorImpl } from "./VscodeTextEditorImpl"; export function toVscodeEditor(editor: TextEditor): vscode.TextEditor { if ("vscodeEditor" in editor) { diff --git a/packages/cursorless-vscode/src/ide/vscode/vscodeShowQuickPick.ts b/packages/cursorless-vscode/src/ide/vscode/vscodeShowQuickPick.ts index d17b1d6993..eec26dd236 100644 --- a/packages/cursorless-vscode/src/ide/vscode/vscodeShowQuickPick.ts +++ b/packages/cursorless-vscode/src/ide/vscode/vscodeShowQuickPick.ts @@ -1,5 +1,8 @@ import * as vscode from "vscode"; -import { QuickPickOptions, UnknownValuesOptions } from "@cursorless/common"; +import type { + QuickPickOptions, + UnknownValuesOptions, +} from "@cursorless/common"; export async function vscodeShowQuickPick( items: readonly string[], diff --git a/packages/cursorless-vscode/src/keyboard/KeyboardCommands.ts b/packages/cursorless-vscode/src/keyboard/KeyboardCommands.ts index 445e5be4e2..5721c4d53a 100644 --- a/packages/cursorless-vscode/src/keyboard/KeyboardCommands.ts +++ b/packages/cursorless-vscode/src/keyboard/KeyboardCommands.ts @@ -1,8 +1,8 @@ -import { ExtensionContext } from "vscode"; +import type { ExtensionContext } from "vscode"; import KeyboardCommandsModal from "./KeyboardCommandsModal"; import KeyboardCommandsTargeted from "./KeyboardCommandsTargeted"; import KeyboardHandler from "./KeyboardHandler"; -import { StatusBarItem } from "../StatusBarItem"; +import type { StatusBarItem } from "../StatusBarItem"; export class KeyboardCommands { targeted: KeyboardCommandsTargeted; diff --git a/packages/cursorless-vscode/src/keyboard/KeyboardCommandsModal.ts b/packages/cursorless-vscode/src/keyboard/KeyboardCommandsModal.ts index 820a19c111..d2640f54a7 100644 --- a/packages/cursorless-vscode/src/keyboard/KeyboardCommandsModal.ts +++ b/packages/cursorless-vscode/src/keyboard/KeyboardCommandsModal.ts @@ -1,14 +1,14 @@ import { keys, merge, toPairs } from "lodash"; import * as vscode from "vscode"; +import type { Keymap } from "./defaultKeymaps"; import { DEFAULT_ACTION_KEYMAP, DEFAULT_COLOR_KEYMAP, - Keymap, DEFAULT_SCOPE_KEYMAP, DEFAULT_SHAPE_KEYMAP, } from "./defaultKeymaps"; -import KeyboardCommandsTargeted from "./KeyboardCommandsTargeted"; -import KeyboardHandler from "./KeyboardHandler"; +import type KeyboardCommandsTargeted from "./KeyboardCommandsTargeted"; +import type KeyboardHandler from "./KeyboardHandler"; type SectionName = "actions" | "scopes" | "colors" | "shapes"; diff --git a/packages/cursorless-vscode/src/keyboard/KeyboardCommandsTargeted.ts b/packages/cursorless-vscode/src/keyboard/KeyboardCommandsTargeted.ts index 80d44036c2..310342f9ed 100644 --- a/packages/cursorless-vscode/src/keyboard/KeyboardCommandsTargeted.ts +++ b/packages/cursorless-vscode/src/keyboard/KeyboardCommandsTargeted.ts @@ -1,17 +1,17 @@ -import { +import type { ActionDescriptor, ActionType, - LATEST_VERSION, PartialPrimitiveTargetDescriptor, PartialTargetDescriptor, SimpleScopeTypeType, } from "@cursorless/common"; +import { LATEST_VERSION } from "@cursorless/common"; import { runCursorlessCommand } from "@cursorless/vscode-common"; import * as vscode from "vscode"; import type { HatColor, HatShape } from "../ide/vscode/hatStyles.types"; import { getStyleName } from "../ide/vscode/hats/getStyleName"; -import KeyboardCommandsModal from "./KeyboardCommandsModal"; -import KeyboardHandler from "./KeyboardHandler"; +import type KeyboardCommandsModal from "./KeyboardCommandsModal"; +import type KeyboardHandler from "./KeyboardHandler"; type TargetingMode = "replace" | "extend" | "append"; diff --git a/packages/cursorless-vscode/src/keyboard/KeyboardHandler.ts b/packages/cursorless-vscode/src/keyboard/KeyboardHandler.ts index 80e161fd9c..181a1e7d62 100644 --- a/packages/cursorless-vscode/src/keyboard/KeyboardHandler.ts +++ b/packages/cursorless-vscode/src/keyboard/KeyboardHandler.ts @@ -1,7 +1,7 @@ import { pull } from "lodash"; import * as vscode from "vscode"; -import { Disposable } from "vscode"; -import { StatusBarItem } from "../StatusBarItem"; +import type { Disposable } from "vscode"; +import type { StatusBarItem } from "../StatusBarItem"; /** * This when clause context is active if any Cursorless listener is in control diff --git a/packages/cursorless-vscode/src/keyboard/defaultKeymaps.ts b/packages/cursorless-vscode/src/keyboard/defaultKeymaps.ts index a35daad0e7..d4d032e863 100644 --- a/packages/cursorless-vscode/src/keyboard/defaultKeymaps.ts +++ b/packages/cursorless-vscode/src/keyboard/defaultKeymaps.ts @@ -1,6 +1,6 @@ -import { ActionType } from "@cursorless/common"; -import { SimpleScopeTypeType } from "@cursorless/common"; -import { HatColor, HatShape } from "../ide/vscode/hatStyles.types"; +import type { ActionType } from "@cursorless/common"; +import type { SimpleScopeTypeType } from "@cursorless/common"; +import type { HatColor, HatShape } from "../ide/vscode/hatStyles.types"; import { isTesting } from "@cursorless/common"; export type Keymap = Record; diff --git a/packages/cursorless-vscode/src/registerCommands.ts b/packages/cursorless-vscode/src/registerCommands.ts index 55c076ea8c..69256a71b1 100644 --- a/packages/cursorless-vscode/src/registerCommands.ts +++ b/packages/cursorless-vscode/src/registerCommands.ts @@ -1,20 +1,16 @@ -import { - CURSORLESS_COMMAND_ID, - CursorlessCommandId, - isTesting, -} from "@cursorless/common"; -import { +import type { CursorlessCommandId } from "@cursorless/common"; +import { CURSORLESS_COMMAND_ID, isTesting } from "@cursorless/common"; +import type { CommandApi, TestCaseRecorder, - showCheatsheet, - updateDefaults, } from "@cursorless/cursorless-engine"; +import { showCheatsheet, updateDefaults } from "@cursorless/cursorless-engine"; import * as vscode from "vscode"; import { showDocumentation, showQuickPick } from "./commands"; -import { VscodeIDE } from "./ide/vscode/VscodeIDE"; -import { VscodeHats } from "./ide/vscode/hats/VscodeHats"; -import { KeyboardCommands } from "./keyboard/KeyboardCommands"; -import { ScopeVisualizerCommandApi } from "./ScopeVisualizerCommandApi"; +import type { VscodeIDE } from "./ide/vscode/VscodeIDE"; +import type { VscodeHats } from "./ide/vscode/hats/VscodeHats"; +import type { KeyboardCommands } from "./keyboard/KeyboardCommands"; +import type { ScopeVisualizerCommandApi } from "./ScopeVisualizerCommandApi"; export function registerCommands( extensionContext: vscode.ExtensionContext, diff --git a/packages/cursorless-vscode/src/scripts/hatAdjustments/add.ts b/packages/cursorless-vscode/src/scripts/hatAdjustments/add.ts index c2e9105183..7da3ea4776 100644 --- a/packages/cursorless-vscode/src/scripts/hatAdjustments/add.ts +++ b/packages/cursorless-vscode/src/scripts/hatAdjustments/add.ts @@ -2,11 +2,11 @@ * This script can be used to add hat tweaks to the currently shipping ones */ import { sum } from "lodash"; -import { - defaultShapeAdjustments, +import type { HatAdjustments, IndividualHatAdjustmentMap, } from "../../ide/vscode/hats/shapeAdjustments"; +import { defaultShapeAdjustments } from "../../ide/vscode/hats/shapeAdjustments"; import { HAT_SHAPES } from "../../ide/vscode/hatStyles.types"; import { postProcessValue } from "./lib"; diff --git a/packages/cursorless-vscode/src/scripts/hatAdjustments/average.ts b/packages/cursorless-vscode/src/scripts/hatAdjustments/average.ts index 8159d1506c..e58452c2a7 100644 --- a/packages/cursorless-vscode/src/scripts/hatAdjustments/average.ts +++ b/packages/cursorless-vscode/src/scripts/hatAdjustments/average.ts @@ -1,11 +1,11 @@ /** * This script can be used to add hat tweaks to the currently shipping ones */ -import { - defaultShapeAdjustments, +import type { HatAdjustments, IndividualHatAdjustmentMap, } from "../../ide/vscode/hats/shapeAdjustments"; +import { defaultShapeAdjustments } from "../../ide/vscode/hats/shapeAdjustments"; import { HAT_SHAPES } from "../../ide/vscode/hatStyles.types"; import { postProcessValue } from "./lib"; diff --git a/packages/cursorless-vscode/src/scripts/populateDist/Asset.ts b/packages/cursorless-vscode/src/scripts/populateDist/Asset.ts index 5052f74de1..32fc04241e 100644 --- a/packages/cursorless-vscode/src/scripts/populateDist/Asset.ts +++ b/packages/cursorless-vscode/src/scripts/populateDist/Asset.ts @@ -1,4 +1,4 @@ -import { Context } from "./context"; +import type { Context } from "./context"; export interface Asset { source?: string; diff --git a/packages/cursorless-vscode/src/scripts/populateDist/assets.ts b/packages/cursorless-vscode/src/scripts/populateDist/assets.ts index b628120496..42cd308d66 100644 --- a/packages/cursorless-vscode/src/scripts/populateDist/assets.ts +++ b/packages/cursorless-vscode/src/scripts/populateDist/assets.ts @@ -1,6 +1,6 @@ import { transformPackageJson } from "./transformPackageJson"; import { generateBuildInfo } from "./generateBuildInfo"; -import { Asset } from "./Asset"; +import type { Asset } from "./Asset"; export const assets: Asset[] = [ { source: "../../CHANGELOG.md", destination: "CHANGELOG.md" }, diff --git a/packages/cursorless-vscode/src/scripts/populateDist/generateBuildInfo.ts b/packages/cursorless-vscode/src/scripts/populateDist/generateBuildInfo.ts index 7e933d798b..d512501557 100644 --- a/packages/cursorless-vscode/src/scripts/populateDist/generateBuildInfo.ts +++ b/packages/cursorless-vscode/src/scripts/populateDist/generateBuildInfo.ts @@ -1,6 +1,6 @@ import { getEnvironmentVariableStrict } from "@cursorless/common"; import { runCommand } from "./runCommand"; -import { Context } from "./context"; +import type { Context } from "./context"; export async function generateBuildInfo({ isCi }: Context) { // In CI, we generate a file called `build-info.json` that contains diff --git a/packages/cursorless-vscode/src/scripts/populateDist/populateDist.ts b/packages/cursorless-vscode/src/scripts/populateDist/populateDist.ts index 88fc488ce7..d73fbd93b0 100644 --- a/packages/cursorless-vscode/src/scripts/populateDist/populateDist.ts +++ b/packages/cursorless-vscode/src/scripts/populateDist/populateDist.ts @@ -3,7 +3,7 @@ import { copy, exists } from "fs-extra"; import { lstat, mkdir, readFile, writeFile } from "fs/promises"; import * as path from "path"; import { assets } from "./assets"; -import { Context } from "./context"; +import type { Context } from "./context"; // Iterate over assets, copying each file to the destination. Any parent // directories will be created as necessary, and source directories will be diff --git a/packages/cursorless-vscode/src/scripts/populateDist/transformPackageJson.ts b/packages/cursorless-vscode/src/scripts/populateDist/transformPackageJson.ts index d33c31dbdc..39f751ad07 100644 --- a/packages/cursorless-vscode/src/scripts/populateDist/transformPackageJson.ts +++ b/packages/cursorless-vscode/src/scripts/populateDist/transformPackageJson.ts @@ -1,5 +1,5 @@ import * as semver from "semver"; -import { Context } from "./context"; +import type { Context } from "./context"; import { runCommand } from "./runCommand"; export async function transformPackageJson( diff --git a/packages/cursorless-vscode/src/vscodeApi.ts b/packages/cursorless-vscode/src/vscodeApi.ts index e1f8f7b65c..b617ea1376 100644 --- a/packages/cursorless-vscode/src/vscodeApi.ts +++ b/packages/cursorless-vscode/src/vscodeApi.ts @@ -1,4 +1,4 @@ -import { VscodeApi } from "@cursorless/vscode-common"; +import type { VscodeApi } from "@cursorless/vscode-common"; import { env, window, workspace } from "vscode"; /** diff --git a/packages/meta-updater/src/Context.ts b/packages/meta-updater/src/Context.ts index 8a0196cc52..3d45d804a9 100644 --- a/packages/meta-updater/src/Context.ts +++ b/packages/meta-updater/src/Context.ts @@ -1,4 +1,4 @@ -import { Lockfile } from "@pnpm/lockfile-file"; +import type { Lockfile } from "@pnpm/lockfile-file"; /** Contains context to be used by all updaters */ export interface Context { diff --git a/packages/meta-updater/src/getCursorlessVscodeFields.ts b/packages/meta-updater/src/getCursorlessVscodeFields.ts index 2abf53d185..c8a0a553ca 100644 --- a/packages/meta-updater/src/getCursorlessVscodeFields.ts +++ b/packages/meta-updater/src/getCursorlessVscodeFields.ts @@ -2,7 +2,7 @@ import { cursorlessCommandDescriptions, cursorlessCommandIds, } from "@cursorless/common"; -import { PackageJson } from "type-fest"; +import type { PackageJson } from "type-fest"; export function getCursorlessVscodeFields(input: PackageJson) { return { diff --git a/packages/meta-updater/src/metaUpdater.ts b/packages/meta-updater/src/metaUpdater.ts index 0b4acae115..1f83031d49 100644 --- a/packages/meta-updater/src/metaUpdater.ts +++ b/packages/meta-updater/src/metaUpdater.ts @@ -4,7 +4,7 @@ // https://github.com/pnpm/pnpm/blob/d583fbb2ad7e6b986d133a4eaf60824713f13c06/LICENSE import { readWantedLockfile } from "@pnpm/lockfile-file"; import { createUpdateOptions } from "@pnpm/meta-updater"; -import { Context } from "./Context"; +import type { Context } from "./Context"; import { updatePackageJson } from "./updatePackageJson"; import { updateTSConfig } from "./updateTSConfig"; diff --git a/packages/meta-updater/src/updatePackageJson.ts b/packages/meta-updater/src/updatePackageJson.ts index 84e16dbf80..53385b8dac 100644 --- a/packages/meta-updater/src/updatePackageJson.ts +++ b/packages/meta-updater/src/updatePackageJson.ts @@ -1,7 +1,7 @@ import * as yaml from "js-yaml"; import type { FormatPluginFnOptions } from "@pnpm/meta-updater"; -import { PackageJson } from "type-fest"; -import { Context } from "./Context"; +import type { PackageJson } from "type-fest"; +import type { Context } from "./Context"; import { getCursorlessVscodeFields } from "./getCursorlessVscodeFields"; import { readFile } from "fs/promises"; import { join } from "path"; diff --git a/packages/meta-updater/src/updateTSConfig.ts b/packages/meta-updater/src/updateTSConfig.ts index 8790b63626..951df76560 100644 --- a/packages/meta-updater/src/updateTSConfig.ts +++ b/packages/meta-updater/src/updateTSConfig.ts @@ -2,9 +2,9 @@ import type { FormatPluginFnOptions } from "@pnpm/meta-updater"; import normalizePath from "normalize-path"; import path from "path"; import exists from "path-exists"; -import { TsConfigJson } from "type-fest"; +import type { TsConfigJson } from "type-fest"; import { toPosixPath } from "./toPosixPath"; -import { Context } from "./Context"; +import type { Context } from "./Context"; import { uniq } from "lodash"; /** diff --git a/packages/vscode-common/src/VscodeApi.ts b/packages/vscode-common/src/VscodeApi.ts index 2d17206d72..96664855b8 100644 --- a/packages/vscode-common/src/VscodeApi.ts +++ b/packages/vscode-common/src/VscodeApi.ts @@ -1,4 +1,4 @@ -import { workspace, window, TextEditor, env } from "vscode"; +import type { workspace, window, TextEditor, env } from "vscode"; /** * Subset of VSCode api that we need to be able to mock for testing diff --git a/packages/vscode-common/src/getExtensionApi.ts b/packages/vscode-common/src/getExtensionApi.ts index 079f85b704..ad72362c13 100644 --- a/packages/vscode-common/src/getExtensionApi.ts +++ b/packages/vscode-common/src/getExtensionApi.ts @@ -13,7 +13,7 @@ import type { } from "@cursorless/common"; import * as vscode from "vscode"; import type { Language, SyntaxNode, Tree } from "web-tree-sitter"; -import { VscodeApi } from "./VscodeApi"; +import type { VscodeApi } from "./VscodeApi"; export interface TestHelpers { ide: NormalizedIDE; diff --git a/packages/vscode-common/src/runCommand.ts b/packages/vscode-common/src/runCommand.ts index 4ed553b8b7..1a615be8c3 100644 --- a/packages/vscode-common/src/runCommand.ts +++ b/packages/vscode-common/src/runCommand.ts @@ -1,4 +1,5 @@ -import { Command, CURSORLESS_COMMAND_ID } from "@cursorless/common"; +import type { Command } from "@cursorless/common"; +import { CURSORLESS_COMMAND_ID } from "@cursorless/common"; import * as vscode from "vscode"; export function runCursorlessCommand(command: Command) { diff --git a/packages/vscode-common/src/vscodeUtil.ts b/packages/vscode-common/src/vscodeUtil.ts index 6ab9f4d4f9..6152097f67 100644 --- a/packages/vscode-common/src/vscodeUtil.ts +++ b/packages/vscode-common/src/vscodeUtil.ts @@ -1,4 +1,5 @@ -import { EndOfLine, Position, Range, Selection } from "@cursorless/common"; +import type { EndOfLine } from "@cursorless/common"; +import { Position, Range, Selection } from "@cursorless/common"; import * as vscode from "vscode"; export function toVscodeRange(range: Range): vscode.Range {