mirror of
https://github.com/esm7/obsidian-vimrc-support.git
synced 2026-07-22 05:00:25 +00:00
chore: replace unnecessary CodeMirrorEditor import aliases
- CodeMirror.Editor is globally available as a type (and already used in other files), so lets just stick consistently to using that
This commit is contained in:
parent
80721a3053
commit
0b1168b2ae
5 changed files with 7 additions and 12 deletions
|
|
@ -1,4 +1,3 @@
|
|||
import { Editor as CodeMirrorEditor } from "codemirror";
|
||||
import { EditorPosition } from "obsidian";
|
||||
import { isWithinMatch, jumpToPattern } from "../utils/jumpToPattern";
|
||||
import { MotionFn } from "../utils/vimApi";
|
||||
|
|
@ -43,7 +42,7 @@ function jumpToHeading({
|
|||
repeat,
|
||||
direction,
|
||||
}: {
|
||||
cm: CodeMirrorEditor;
|
||||
cm: CodeMirror.Editor;
|
||||
cursorPosition: EditorPosition;
|
||||
repeat: number;
|
||||
direction: "next" | "previous";
|
||||
|
|
@ -60,7 +59,7 @@ function jumpToHeading({
|
|||
});
|
||||
}
|
||||
|
||||
function findAllCodeblocks(cm: CodeMirrorEditor): RegExpExecArray[] {
|
||||
function findAllCodeblocks(cm: CodeMirror.Editor): RegExpExecArray[] {
|
||||
const content = cm.getValue();
|
||||
return [...content.matchAll(FENCED_CODEBLOCK_REGEX)];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import { Editor as CodeMirrorEditor } from "codemirror";
|
||||
import { EditorPosition } from "obsidian";
|
||||
|
||||
/**
|
||||
|
|
@ -6,7 +5,7 @@ import { EditorPosition } from "obsidian";
|
|||
*/
|
||||
export function createFakeCodeMirrorEditor(
|
||||
contentLines: string[]
|
||||
): Pick<CodeMirrorEditor, "getValue" | "indexFromPos" | "posFromIndex"> {
|
||||
): Pick<CodeMirror.Editor, "getValue" | "indexFromPos" | "posFromIndex"> {
|
||||
const content = contentLines.join("\n");
|
||||
const lineStartIndexes = getLineStartIndexes(contentLines);
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import { Editor as CodeMirrorEditor } from "codemirror";
|
||||
import { EditorPosition } from "obsidian";
|
||||
|
||||
/**
|
||||
|
|
@ -27,7 +26,7 @@ export function jumpToPattern({
|
|||
filterMatch = () => true,
|
||||
direction,
|
||||
}: {
|
||||
cm: CodeMirrorEditor;
|
||||
cm: CodeMirror.Editor;
|
||||
cursorPosition: EditorPosition;
|
||||
repeat: number;
|
||||
regex: RegExp;
|
||||
|
|
|
|||
|
|
@ -2,14 +2,13 @@
|
|||
* Utility types and functions for defining Obsidian-specific Vim commands.
|
||||
*/
|
||||
|
||||
import { Editor as CodeMirrorEditor } from "codemirror";
|
||||
|
||||
import VimrcPlugin from "../main";
|
||||
import { MotionFn, VimApi } from "./vimApi";
|
||||
|
||||
export type ObsidianActionFn = (
|
||||
vimrcPlugin: VimrcPlugin, // Included so we can run Obsidian commands as part of the action
|
||||
cm: CodeMirrorEditor,
|
||||
cm: CodeMirror.Editor,
|
||||
actionArgs: { repeat: number },
|
||||
) => void;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,17 +6,16 @@
|
|||
* https://libvoyant.ucr.edu/resources/codemirror/doc/manual.html
|
||||
*/
|
||||
|
||||
import { Editor as CodeMirrorEditor } from "codemirror";
|
||||
import { EditorPosition } from "obsidian";
|
||||
|
||||
export type MotionFn = (
|
||||
cm: CodeMirrorEditor,
|
||||
cm: CodeMirror.Editor,
|
||||
cursorPosition: EditorPosition, // called `head` in the API
|
||||
motionArgs: { repeat: number }
|
||||
) => EditorPosition;
|
||||
|
||||
export type ActionFn = (
|
||||
cm: CodeMirrorEditor,
|
||||
cm: CodeMirror.Editor,
|
||||
actionArgs: { repeat: number },
|
||||
) => void;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue