consistent-type-imports rule (#2619)

related #2618
revives https://github.com/cursorless-dev/cursorless/pull/1832

vscode quick fix import and auto import appears to be doing the right
thing in regards to type only or runtime imports. Imports organize or
imports fix unfortunately do not convert a runtime import to a type
import if it's only used as a type. We probably need to rely on the
linter to do that part for us.

## Checklist

- [/] I have added
[tests](https://www.cursorless.org/docs/contributing/test-case-recorder/)
- [/] I have updated the
[docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and
[cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet)
- [/] I have not broken the cheatsheet

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
This commit is contained in:
Andreas Arvidsson 2024-08-02 08:34:35 +02:00 committed by GitHub
parent 6022ac2cdb
commit 6b87f2f4d0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
532 changed files with 1521 additions and 1529 deletions

View File

@ -23,6 +23,7 @@
],
"rules": {
"import/no-relative-packages": "error",
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/consistent-type-assertions": [
"error",
{

View File

@ -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 {

View File

@ -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;

View File

@ -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";

View File

@ -1,4 +1,4 @@
import { CheatsheetSection, Variation } from "../CheatsheetInfo";
import type { CheatsheetSection, Variation } from "../CheatsheetInfo";
import useIsHighlighted from "../hooks/useIsHighlighted";
import { formatCaptures } from "./formatCaptures";

View File

@ -1,4 +1,4 @@
import {
import type {
CommandServerApi,
FocusedElementType,
InboundSignal,

View File

@ -1,4 +1,4 @@
import { Capabilities } from "../types/Capabilities";
import type { Capabilities } from "../types/Capabilities";
export class FakeCapabilities implements Capabilities {
commands = {

View File

@ -1,13 +1,13 @@
import { get } from "lodash-es";
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;

View File

@ -1,11 +1,11 @@
import { pull } from "lodash-es";
import type { EditableTextEditor, TextEditor } from "../..";
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 { FlashDescriptor } from "../types/FlashDescriptor";
import { QuickPickOptions } from "../types/QuickPickOptions";
import {
import type { FlashDescriptor } from "../types/FlashDescriptor";
import type { QuickPickOptions } from "../types/QuickPickOptions";
import type {
Event,
TextEditorSelectionChangeEvent,
TextEditorVisibleRangesChangeEvent,

View File

@ -1,12 +1,12 @@
import { GeneralizedRange } from "../../types/GeneralizedRange";
import { TextEditor } from "../../types/TextEditor";
import FakeConfiguration from "../fake/FakeConfiguration";
import FakeKeyValueStore from "../fake/FakeKeyValueStore";
import { FakeIDE } from "../fake/FakeIDE";
import type { GeneralizedRange } from "../../types/GeneralizedRange";
import type { TextEditor } from "../../types/TextEditor";
import type FakeConfiguration from "../fake/FakeConfiguration";
import type FakeKeyValueStore from "../fake/FakeKeyValueStore";
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;

View File

@ -1,10 +1,11 @@
import { pickBy, values } from "lodash-es";
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;

View File

@ -1,4 +1,4 @@
import { CommandId } from "./CommandId";
import type { CommandId } from "./CommandId";
export interface Capabilities {
/**

View File

@ -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;

View File

@ -1,4 +1,4 @@
import { Disposable } from "./ide.types";
import type { Disposable } from "./ide.types";
export type PathChangeListener = () => void;

View File

@ -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",

View File

@ -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;

View File

@ -1,4 +1,4 @@
import { TutorialId } from "../../types/tutorial.types";
import type { TutorialId } from "../../types/tutorial.types";
interface SingleTutorialProgress {
currentStep: number;

View File

@ -1,4 +1,4 @@
import { Disposable } from "@cursorless/common";
import type { Disposable } from "@cursorless/common";
/**
* Provides raw tree-sitter queries. These are usually read from `.scm` files

View File

@ -1,5 +1,5 @@
import { TestCaseFixtureLegacy } from "../../types/TestCaseFixture";
import { TutorialId } from "../../types/tutorial.types";
import type { TestCaseFixtureLegacy } from "../../types/TestCaseFixture";
import type { TutorialId } from "../../types/tutorial.types";
export interface TutorialContentProvider {
/**

View File

@ -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 { KeyValueStore } from "./KeyValueStore";
import type { FlashDescriptor } from "./FlashDescriptor";
import type { Messages } from "./Messages";
import type { QuickPickOptions } from "./QuickPickOptions";
import type { KeyValueStore } from "./KeyValueStore";
export type RunMode = "production" | "development" | "test";
export type HighlightId = string;

View File

@ -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

View File

@ -1,7 +1,5 @@
import {
LanguageScopeSupportFacetMap,
ScopeSupportFacetLevel,
} from "./scopeSupportFacets.types";
import type { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types";
import { ScopeSupportFacetLevel } from "./scopeSupportFacets.types";
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { supported, unsupported, notApplicable } = ScopeSupportFacetLevel;

View File

@ -1,7 +1,5 @@
import {
LanguageScopeSupportFacetMap,
ScopeSupportFacetLevel,
} from "./scopeSupportFacets.types";
import type { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types";
import { ScopeSupportFacetLevel } from "./scopeSupportFacets.types";
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { supported, unsupported, notApplicable } = ScopeSupportFacetLevel;

View File

@ -1,8 +1,6 @@
import { cScopeSupport } from "./c";
import {
LanguageScopeSupportFacetMap,
ScopeSupportFacetLevel,
} from "./scopeSupportFacets.types";
import type { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types";
import { ScopeSupportFacetLevel } from "./scopeSupportFacets.types";
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { supported, unsupported, notApplicable } = ScopeSupportFacetLevel;

View File

@ -1,7 +1,5 @@
import {
LanguageScopeSupportFacetMap,
ScopeSupportFacetLevel,
} from "./scopeSupportFacets.types";
import type { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types";
import { ScopeSupportFacetLevel } from "./scopeSupportFacets.types";
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { supported, unsupported, notApplicable } = ScopeSupportFacetLevel;

View File

@ -1,7 +1,5 @@
import {
LanguageScopeSupportFacetMap,
ScopeSupportFacetLevel,
} from "./scopeSupportFacets.types";
import type { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types";
import { ScopeSupportFacetLevel } from "./scopeSupportFacets.types";
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { supported, unsupported, notApplicable } = ScopeSupportFacetLevel;

View File

@ -1,7 +1,5 @@
import {
LanguageScopeSupportFacetMap,
ScopeSupportFacetLevel,
} from "./scopeSupportFacets.types";
import type { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types";
import { ScopeSupportFacetLevel } from "./scopeSupportFacets.types";
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { supported, unsupported, notApplicable } = ScopeSupportFacetLevel;

View File

@ -1,7 +1,5 @@
import {
LanguageScopeSupportFacetMap,
ScopeSupportFacetLevel,
} from "./scopeSupportFacets.types";
import type { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types";
import { ScopeSupportFacetLevel } from "./scopeSupportFacets.types";
const { supported, notApplicable } = ScopeSupportFacetLevel;

View File

@ -1,7 +1,5 @@
import {
LanguageScopeSupportFacetMap,
ScopeSupportFacetLevel,
} from "./scopeSupportFacets.types";
import type { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types";
import { ScopeSupportFacetLevel } from "./scopeSupportFacets.types";
const { supported, notApplicable } = ScopeSupportFacetLevel;

View File

@ -1,7 +1,5 @@
import {
LanguageScopeSupportFacetMap,
ScopeSupportFacetLevel,
} from "./scopeSupportFacets.types";
import type { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types";
import { ScopeSupportFacetLevel } from "./scopeSupportFacets.types";
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { supported, unsupported, notApplicable } = ScopeSupportFacetLevel;

View File

@ -1,8 +1,6 @@
import { javascriptScopeSupport } from "./javascript";
import {
LanguageScopeSupportFacetMap,
ScopeSupportFacetLevel,
} from "./scopeSupportFacets.types";
import type { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types";
import { ScopeSupportFacetLevel } from "./scopeSupportFacets.types";
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { supported, unsupported, notApplicable } = ScopeSupportFacetLevel;

View File

@ -1,7 +1,5 @@
import {
LanguageScopeSupportFacetMap,
ScopeSupportFacetLevel,
} from "./scopeSupportFacets.types";
import type { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types";
import { ScopeSupportFacetLevel } from "./scopeSupportFacets.types";
const { supported } = ScopeSupportFacetLevel;

View File

@ -1,8 +1,6 @@
import { jsonScopeSupport } from "./json";
import {
LanguageScopeSupportFacetMap,
ScopeSupportFacetLevel,
} from "./scopeSupportFacets.types";
import type { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types";
import { ScopeSupportFacetLevel } from "./scopeSupportFacets.types";
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { supported, unsupported, notApplicable } = ScopeSupportFacetLevel;

View File

@ -1,8 +1,6 @@
import { jsonScopeSupport } from "./json";
import {
LanguageScopeSupportFacetMap,
ScopeSupportFacetLevel,
} from "./scopeSupportFacets.types";
import type { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types";
import { ScopeSupportFacetLevel } from "./scopeSupportFacets.types";
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { supported, unsupported, notApplicable } = ScopeSupportFacetLevel;

View File

@ -20,7 +20,7 @@ import { rubyScopeSupport } from "./ruby";
import { rustScopeSupport } from "./rust";
import { scalaScopeSupport } from "./scala";
import { scmScopeSupport } from "./scm";
import { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types";
import type { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types";
import { scssScopeSupport } from "./scss";
import { talonScopeSupport } from "./talon";
import { typescriptScopeSupport } from "./typescript";

View File

@ -1,7 +1,5 @@
import {
LanguageScopeSupportFacetMap,
ScopeSupportFacetLevel,
} from "./scopeSupportFacets.types";
import type { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types";
import { ScopeSupportFacetLevel } from "./scopeSupportFacets.types";
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { supported, unsupported, notApplicable } = ScopeSupportFacetLevel;

View File

@ -1,7 +1,5 @@
import {
LanguageScopeSupportFacetMap,
ScopeSupportFacetLevel,
} from "./scopeSupportFacets.types";
import type { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types";
import { ScopeSupportFacetLevel } from "./scopeSupportFacets.types";
const { supported, notApplicable } = ScopeSupportFacetLevel;

View File

@ -1,7 +1,5 @@
import {
LanguageScopeSupportFacetMap,
ScopeSupportFacetLevel,
} from "./scopeSupportFacets.types";
import type { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types";
import { ScopeSupportFacetLevel } from "./scopeSupportFacets.types";
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { supported, unsupported, notApplicable } = ScopeSupportFacetLevel;

View File

@ -1,7 +1,5 @@
import {
LanguageScopeSupportFacetMap,
ScopeSupportFacetLevel,
} from "./scopeSupportFacets.types";
import type { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types";
import { ScopeSupportFacetLevel } from "./scopeSupportFacets.types";
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { supported, unsupported, notApplicable } = ScopeSupportFacetLevel;

View File

@ -1,7 +1,5 @@
import {
LanguageScopeSupportFacetMap,
ScopeSupportFacetLevel,
} from "./scopeSupportFacets.types";
import type { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types";
import { ScopeSupportFacetLevel } from "./scopeSupportFacets.types";
const { supported, notApplicable } = ScopeSupportFacetLevel;

View File

@ -1,7 +1,5 @@
import {
LanguageScopeSupportFacetMap,
ScopeSupportFacetLevel,
} from "./scopeSupportFacets.types";
import type { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types";
import { ScopeSupportFacetLevel } from "./scopeSupportFacets.types";
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { supported, unsupported, notApplicable } = ScopeSupportFacetLevel;

View File

@ -1,7 +1,5 @@
import {
LanguageScopeSupportFacetMap,
ScopeSupportFacetLevel,
} from "./scopeSupportFacets.types";
import type { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types";
import { ScopeSupportFacetLevel } from "./scopeSupportFacets.types";
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { supported, unsupported, notApplicable } = ScopeSupportFacetLevel;

View File

@ -1,7 +1,5 @@
import {
LanguageScopeSupportFacetMap,
ScopeSupportFacetLevel,
} from "./scopeSupportFacets.types";
import type { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types";
import { ScopeSupportFacetLevel } from "./scopeSupportFacets.types";
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { supported, unsupported, notApplicable } = ScopeSupportFacetLevel;

View File

@ -1,7 +1,5 @@
import {
LanguageScopeSupportFacetMap,
ScopeSupportFacetLevel,
} from "./scopeSupportFacets.types";
import type { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types";
import { ScopeSupportFacetLevel } from "./scopeSupportFacets.types";
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { supported, unsupported, notApplicable } = ScopeSupportFacetLevel;

View File

@ -1,4 +1,4 @@
import {
import type {
ScopeSupportFacet,
ScopeSupportFacetInfo,
} from "./scopeSupportFacets.types";

View File

@ -1,7 +1,5 @@
import {
SimpleScopeTypeType,
type ScopeType,
} from "../types/command/PartialTargetDescriptor.types";
import type { SimpleScopeTypeType } from "../types/command/PartialTargetDescriptor.types";
import { type ScopeType } from "../types/command/PartialTargetDescriptor.types";
export const scopeSupportFacets = [
"command",

View File

@ -1,8 +1,6 @@
import { cssScopeSupport } from "./css";
import {
LanguageScopeSupportFacetMap,
ScopeSupportFacetLevel,
} from "./scopeSupportFacets.types";
import type { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types";
import { ScopeSupportFacetLevel } from "./scopeSupportFacets.types";
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { supported, unsupported, notApplicable } = ScopeSupportFacetLevel;

View File

@ -1,7 +1,5 @@
import {
LanguageScopeSupportFacetMap,
ScopeSupportFacetLevel,
} from "./scopeSupportFacets.types";
import type { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types";
import { ScopeSupportFacetLevel } from "./scopeSupportFacets.types";
const { supported } = ScopeSupportFacetLevel;

View File

@ -1,4 +1,4 @@
import {
import type {
ScopeSupportFacetInfo,
TextualScopeSupportFacet,
} from "./scopeSupportFacets.types";

View File

@ -1,8 +1,6 @@
import { javascriptCoreScopeSupport } from "./javascript";
import {
LanguageScopeSupportFacetMap,
ScopeSupportFacetLevel,
} from "./scopeSupportFacets.types";
import type { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types";
import { ScopeSupportFacetLevel } from "./scopeSupportFacets.types";
const { supported } = ScopeSupportFacetLevel;

View File

@ -1,8 +1,6 @@
import { javascriptJsxScopeSupport } from "./javascript";
import {
LanguageScopeSupportFacetMap,
ScopeSupportFacetLevel,
} from "./scopeSupportFacets.types";
import type { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types";
import { ScopeSupportFacetLevel } from "./scopeSupportFacets.types";
import { typescriptScopeSupport } from "./typescript";
// eslint-disable-next-line @typescript-eslint/no-unused-vars

View File

@ -1,7 +1,5 @@
import {
LanguageScopeSupportFacetMap,
ScopeSupportFacetLevel,
} from "./scopeSupportFacets.types";
import type { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types";
import { ScopeSupportFacetLevel } from "./scopeSupportFacets.types";
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { supported, unsupported, notApplicable } = ScopeSupportFacetLevel;

View File

@ -1,7 +1,5 @@
import {
LanguageScopeSupportFacetMap,
ScopeSupportFacetLevel,
} from "./scopeSupportFacets.types";
import type { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types";
import { ScopeSupportFacetLevel } from "./scopeSupportFacets.types";
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { supported, unsupported, notApplicable } = ScopeSupportFacetLevel;

View File

@ -1,5 +1,5 @@
import { StoredTargetKey } from "../StoredTargetKey";
import {
import type { StoredTargetKey } from "../StoredTargetKey";
import type {
RangePlainObject,
SelectionPlainObject,
SerializedMarks,

View File

@ -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[],

View File

@ -1,9 +1,12 @@
import { storedTargetKeys } from "../StoredTargetKey";
import { SpyIDE } from "../ide/spy/SpyIDE";
import { ReadOnlyHatMap } from "../types/HatTokenMap";
import type { SpyIDE } from "../ide/spy/SpyIDE";
import type { ReadOnlyHatMap } from "../types/HatTokenMap";
import type { TestHelpers } from "../types/TestHelpers";
import { marksToPlainObject } from "../util/toPlainObject";
import { ExcludableSnapshotField, TestCaseSnapshot } from "./TestCaseSnapshot";
import type {
ExcludableSnapshotField,
TestCaseSnapshot,
} from "./TestCaseSnapshot";
import { extractTargetedMarks } from "./extractTargetedMarks";
/**

View File

@ -1,10 +1,10 @@
import { TestCaseFixtureLegacy } from "../types/TestCaseFixture";
import { ActionDescriptor } from "../types/command/ActionDescriptor";
import { CommandV6 } from "../types/command/CommandV6.types";
import { CommandV7 } from "../types/command/CommandV7.types";
import { Command } from "../types/command/command.types";
import { CommandV5 } from "../types/command/legacy/CommandV5.types";
import { EnforceUndefined } from "../util/typeUtils";
import type { TestCaseFixtureLegacy } from "../types/TestCaseFixture";
import type { ActionDescriptor } from "../types/command/ActionDescriptor";
import type { CommandV6 } from "../types/command/CommandV6.types";
import type { CommandV7 } from "../types/command/CommandV7.types";
import type { Command } from "../types/command/command.types";
import type { CommandV5 } from "../types/command/legacy/CommandV5.types";
import type { EnforceUndefined } from "../util/typeUtils";
import { serialize } from "./serialize";
function reorderFields(

View File

@ -1,9 +1,9 @@
import type { Message, SpyIDERecordedValues } from "..";
import {
import type {
PlainFlashDescriptor,
PlainHighlight,
generalizedRangeToPlainObject,
} from "../util/toPlainObject";
import { generalizedRangeToPlainObject } from "../util/toPlainObject";
export interface PlainSpyIDERecordedValues {
messages: Message[] | undefined;

View File

@ -1,4 +1,4 @@
import { Range } from "..";
import type { Range } from "..";
/** Represent a single edit/change in the document */
export interface Edit {

View File

@ -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

View File

@ -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

View File

@ -1,4 +1,5 @@
import { Range, TextDocument } from "..";
import type { TextDocument } from "..";
import { Range } from "..";
export class Position {
/**

View File

@ -1,4 +1,4 @@
import {
import type {
Disposable,
GeneralizedRange,
Range,

View File

@ -1,4 +1,4 @@
import {
import type {
ActionType,
ModifierType,
SimpleScopeTypeType,

View File

@ -1,5 +1,5 @@
import { Notifier } from "@cursorless/common";
import { SpokenFormMapKeyTypes, SpokenFormType } from "./SpokenFormType";
import type { Notifier } from "@cursorless/common";
import type { SpokenFormMapKeyTypes, SpokenFormType } from "./SpokenFormType";
/**
* Interface representing a communication mechanism whereby Talon can provide

View File

@ -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

View File

@ -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 {
/**

View File

@ -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.

View File

@ -1,4 +1,4 @@
import {
import type {
PartialListTargetDescriptor,
PartialPrimitiveTargetDescriptor,
PartialRangeTargetDescriptor,

View File

@ -1,4 +1,4 @@
import { PartialTargetDescriptorV3 } from "./PartialTargetDescriptorV3.types";
import type { PartialTargetDescriptorV3 } from "./PartialTargetDescriptorV3.types";
type ActionType =
| "callAsFunction"

View File

@ -1,4 +1,4 @@
import { PartialTargetDescriptorV4 } from "./PartialTargetDescriptorV4.types";
import type { PartialTargetDescriptorV4 } from "./PartialTargetDescriptorV4.types";
type ActionType =
| "callAsFunction"

View File

@ -1,5 +1,6 @@
import assert from "assert";
import { GeneralizedRange, generalizedRangeTouches, Position } from "..";
import type { GeneralizedRange } from "..";
import { generalizedRangeTouches, Position } from "..";
suite("generalizedRangeTouches", () => {
test("character", () => {

View File

@ -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;

View File

@ -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 {
/**

View File

@ -1,4 +1,4 @@
import { Disposable } from "../ide/types/ide.types";
import type { Disposable } from "../ide/types/ide.types";
/**
* Construct a disposable that disposes multiple disposables at once. This is

View File

@ -1,6 +1,6 @@
import { ActionType } from "../types/command/ActionDescriptor";
import { Command } from "../types/command/command.types";
import { PartialTargetV0V1 } from "../types/command/legacy/CommandV0V1.types";
import type { ActionType } from "../types/command/ActionDescriptor";
import type { Command } from "../types/command/command.types";
import type { PartialTargetV0V1 } from "../types/command/legacy/CommandV0V1.types";
import { isString } from "./type";
/**

View File

@ -1,6 +1,6 @@
import { range as lodashRange } from "lodash-es";
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

View File

@ -1,8 +1,8 @@
import { plainObjectToRange } from "../testUtil/fromPlainObject";
import { splitKey } from "./splitKey";
import { SerializedMarks } from "./toPlainObject";
import { TextEditor } from "../types/TextEditor";
import { TokenHat } from "../types/HatTokenMap";
import type { SerializedMarks } from "./toPlainObject";
import type { TextEditor } from "../types/TextEditor";
import type { TokenHat } from "../types/HatTokenMap";
export function serializedMarksToTokenHats(
marks: SerializedMarks | undefined,

View File

@ -4,9 +4,9 @@ import type {
LineRange,
} from "../types/GeneralizedRange";
import { isLineRange } from "../types/GeneralizedRange";
import { FlashStyle } from "../ide/types/FlashDescriptor";
import { Token } from "../types/Token";
import { Selection } from "../types/Selection";
import type { FlashStyle } from "../ide/types/FlashDescriptor";
import type { Token } from "../types/Token";
import type { Selection } from "../types/Selection";
export type PositionPlainObject = {
line: number;

View File

@ -1,16 +1,16 @@
import {
import type {
ActionDescriptor,
CommandComplete,
CommandHistoryEntry,
CommandServerApi,
IDE,
ReadOnlyHatMap,
type CommandHistoryStorage,
} from "@cursorless/common";
import { type CommandHistoryStorage } from "@cursorless/common";
import { produce } from "immer";
import { v4 as uuid } from "uuid";
import { CommandRunner } from "./CommandRunner";
import { CommandRunnerDecorator } from "./api/CursorlessEngineApi";
import type { CommandRunner } from "./CommandRunner";
import type { CommandRunnerDecorator } from "./api/CursorlessEngineApi";
const filePrefix = "cursorlessCommandHistory";

View File

@ -1,11 +1,10 @@
import {
import type {
CommandHistoryEntry,
Modifier,
PartialPrimitiveTargetDescriptor,
ScopeType,
showWarning,
type CommandHistoryStorage,
} from "@cursorless/common";
import { showWarning, type CommandHistoryStorage } from "@cursorless/common";
import { groupBy, map, sum } from "lodash-es";
import { canonicalizeAndValidateCommand } from "./core/commandVersionUpgrades/canonicalizeAndValidateCommand";
import { ide } from "./singletons/ide.singleton";

View File

@ -1,5 +1,5 @@
import { Disposable, IDE } from "@cursorless/common";
import { StoredTargetMap } from "./core/StoredTargets";
import type { Disposable, IDE } from "@cursorless/common";
import type { StoredTargetMap } from "./core/StoredTargets";
import { CursorStage } from "./processTargets/marks/CursorStage";
import { DecorationDebouncer } from "./util/DecorationDebouncer";

View File

@ -1,7 +1,7 @@
import type { TreeSitter } from "@cursorless/common";
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 { BreakLine } from "./BreakLine";
import { Bring, Move, Swap } from "./BringMoveSwap";
import Call from "./Call";
@ -59,7 +59,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";
import { Decrement, Increment } from "./incrementDecrement";
/**

View File

@ -1,15 +1,10 @@
import {
Edit,
FlashStyle,
Position,
Range,
TextEditor,
} from "@cursorless/common";
import type { Edit, TextEditor } from "@cursorless/common";
import { FlashStyle, Position, Range } from "@cursorless/common";
import { flatten, zip } from "lodash-es";
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 { flashTargets, runOnTargetsForEachEditor } from "../util/targetUtils";
import type { ActionReturnValue } from "./actions.types";

View File

@ -1,23 +1,18 @@
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-es";
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 { 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 {
flashTargets,
getContentRange,
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";

View File

@ -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) {

View File

@ -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-es";
import { selectionToStoredTarget } from "../core/commandRunner/selectionToStoredTarget";
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 {
ensureSingleEditor,
ensureSingleTarget,
@ -12,7 +13,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<void>;

View File

@ -1,9 +1,9 @@
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 { 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) {

View File

@ -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) {

View File

@ -1,7 +1,7 @@
import { ide } from "../singletons/ide.singleton";
import { Target } from "../typings/target.types";
import type { Target } from "../typings/target.types";
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() {

View File

@ -1,10 +1,10 @@
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 { 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";

View File

@ -1,8 +1,9 @@
import { EditableTextEditor, RangeExpansionBehavior } from "@cursorless/common";
import type { EditableTextEditor } from "@cursorless/common";
import { RangeExpansionBehavior } from "@cursorless/common";
import { zip } from "lodash-es";
import { RangeUpdater } from "../../core/updateSelections/RangeUpdater";
import type { RangeUpdater } from "../../core/updateSelections/RangeUpdater";
import { performEditsAndUpdateSelections } 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

View File

@ -1,7 +1,10 @@
import { CommandCapabilities, EditableTextEditor } from "@cursorless/common";
import { RangeUpdater } from "../../core/updateSelections/RangeUpdater";
import type {
CommandCapabilities,
EditableTextEditor,
} from "@cursorless/common";
import type { RangeUpdater } from "../../core/updateSelections/RangeUpdater";
import { performEditsAndUpdateSelections } 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

View File

@ -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,

View File

@ -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[] {

View File

@ -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

View File

@ -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 { ActionReturnValue, SimpleAction } from "./actions.types";
import type { Actions } from "./Actions";
import type { ActionReturnValue, SimpleAction } from "./actions.types";
abstract class Find implements SimpleAction {
constructor(private actions: Actions) {

View File

@ -1,12 +1,13 @@
import { FlashStyle, OpenLinkOptions } from "@cursorless/common";
import type { OpenLinkOptions } 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 {
createThatMark,
ensureSingleTarget,
flashTargets,
} from "../util/targetUtils";
import { ActionReturnValue, SimpleAction } from "./actions.types";
import type { ActionReturnValue, SimpleAction } from "./actions.types";
export default class FollowLink implements SimpleAction {
constructor(private options: OpenLinkOptions) {

View File

@ -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() {

View File

@ -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() {

Some files were not shown because too many files have changed in this diff Show More