diff --git a/.eslintrc.js b/.eslintrc.js index cab71ae1..7dc1ecf8 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -18,6 +18,11 @@ module.exports = { }, ], rules: { + "indent": ["error", 2, { + "VariableDeclarator": "first", + "flatTernaryExpressions": true, + "offsetTernaryExpressions": true, + }], "curly": ["error", "all"], "dot-location": ["error", "property"], "eqeqeq": ["error", "always", { null: "ignore" }], @@ -31,16 +36,18 @@ module.exports = { "max-len": [ "warn", { - code: 200, - comments: 120, - ignorePattern: "^ +(\\*|\\/\\/) http\\S+\\)?.?$", + code: 100, + comments: 80, + ignorePattern: "^ *(\\*|//) ([sS]ee )?http\\S+\\)?.?$|^ *// =+( [^=]+ =+)?$", }, ], + "multiline-ternary": ["error", "always-multiline"], "no-tabs": "error", "no-trailing-spaces": "error", "no-unexpected-multiline": "error", "no-unneeded-ternary": "error", "object-curly-spacing": ["error", "always"], + "operator-linebreak": ["error", "before"], "object-shorthand": "error", "quotes": ["error", "double", { avoidEscape: true, allowTemplateLiterals: true }], "semi": ["error", "always"], diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index b7c62f5d..00000000 --- a/.prettierignore +++ /dev/null @@ -1,5 +0,0 @@ -commands/index.ts -commands/README.md -node_modules/ -out/ -*.yml diff --git a/.prettierrc.js b/.prettierrc.js deleted file mode 100644 index 86cf3a77..00000000 --- a/.prettierrc.js +++ /dev/null @@ -1,12 +0,0 @@ -/** @type import("pretier").Options */ -module.exports = { - arrowParens: "always", - bracketSpacing: true, - endOfLine: "lf", - printWidth: 100, - quoteProps: "consistent", - semi: true, - singleQuote: false, - tabWidth: 2, - trailingComma: "all", -}; diff --git a/commands/generate.ts b/commands/generate.ts index 9bd04339..9b962768 100644 --- a/commands/generate.ts +++ b/commands/generate.ts @@ -178,8 +178,9 @@ for (const id in yaml) { ) .join(", "); - const docStringKeys = - docKeys.length === 0 ? "" : `\n *\n * Default key${keys.length === 1 ? "" : "s"}: ${docKeys}.`; + const docStringKeys = docKeys.length === 0 + ? "" + : `\n *\n * Default key${keys.length === 1 ? "" : "s"}: ${docKeys}.`; const docCommandName = command.command ? "" : `\`${prefix}.${id}\``; doc.write(`| ${docCommandName} | ${command.title} | ${command.descr} | ${docKeys} |\n`); @@ -250,8 +251,8 @@ ${commands.map((x) => ` /** ${yaml[x].descr} */\n ${writable(x)}`).join(",\n") */ export const enum Command { ${commands - .map((x) => ` /** ${yaml[x].descr} */\n ${writable(x)} = "${prefix}.${x}"`) - .join(",\n")}, + .map((x) => ` /** ${yaml[x].descr} */\n ${writable(x)} = "${prefix}.${x}"`) + .join(",\n")}, } /** diff --git a/package.json b/package.json index bd698b69..ba6dae8f 100644 --- a/package.json +++ b/package.json @@ -23,8 +23,8 @@ "vscode": "^1.44.0" }, "scripts": { - "check": "prettier --check . && eslint .", - "format": "prettier --write .", + "check": "eslint .", + "format": "eslint . --fix", "generate": "ts-node ./commands/generate.ts && ts-node package.ts", "vscode:prepublish": "yarn run generate && yarn run compile", "compile": "tsc -p ./", @@ -38,19 +38,17 @@ "@types/js-yaml": "^3.12.3", "@types/mocha": "^8.0.3", "@types/node": "^14.6.0", - "@types/prettier": "^2.1.2", "@types/vscode": "^1.44.0", - "@typescript-eslint/eslint-plugin": "^4.4.1", - "@typescript-eslint/parser": "^4.4.1", - "eslint": "^7.11.0", + "@typescript-eslint/eslint-plugin": "^4.18.0", + "@typescript-eslint/parser": "^4.18.0", + "eslint": "^7.22.0", "glob": "^7.1.6", "js-yaml": "^3.13.0", "mocha": "^8.1.1", - "prettier": "^2.1.2", "source-map-support": "^0.5.19", - "ts-node": "^8.9.1", - "typescript": "^4.0.2", - "vsce": "^1.75.0", + "ts-node": "^9.1.1", + "typescript": "^4.2.3", + "vsce": "^1.87.0", "vscode-test": "^1.3.0" }, "activationEvents": [ diff --git a/package.ts b/package.ts index e8b7795d..37711d04 100644 --- a/package.ts +++ b/package.ts @@ -13,7 +13,7 @@ const keybindings: { }[] = additionalKeyBindings.concat(); const alphanum = [..."abcdefghijklmnopqrstuvwxyz0123456789"], - keysToAssign = new Set([...alphanum, ...alphanum.map((x) => `Shift+${x}`), ...",'"]); + keysToAssign = new Set([...alphanum, ...alphanum.map((x) => `Shift+${x}`), ...",'"]); for (const command of Object.values(commands)) { for (const { key, when } of command.keybindings) { @@ -210,8 +210,8 @@ const pkg = { }, scripts: { - "check": "prettier --check . && eslint .", - "format": "prettier --write .", + "check": "eslint .", + "format": "eslint . --fix", "generate": "ts-node ./commands/generate.ts && ts-node package.ts", "vscode:prepublish": "yarn run generate && yarn run compile", "compile": "tsc -p ./", @@ -226,19 +226,17 @@ const pkg = { "@types/js-yaml": "^3.12.3", "@types/mocha": "^8.0.3", "@types/node": "^14.6.0", - "@types/prettier": "^2.1.2", "@types/vscode": "^1.44.0", - "@typescript-eslint/eslint-plugin": "^4.4.1", - "@typescript-eslint/parser": "^4.4.1", - "eslint": "^7.11.0", + "@typescript-eslint/eslint-plugin": "^4.18.0", + "@typescript-eslint/parser": "^4.18.0", + "eslint": "^7.22.0", "glob": "^7.1.6", "js-yaml": "^3.13.0", "mocha": "^8.1.1", - "prettier": "^2.1.2", "source-map-support": "^0.5.19", - "ts-node": "^8.9.1", - "typescript": "^4.0.2", - "vsce": "^1.75.0", + "ts-node": "^9.1.1", + "typescript": "^4.2.3", + "vsce": "^1.87.0", "vscode-test": "^1.3.0", }, @@ -257,15 +255,17 @@ const pkg = { type: ["string", "null"], default: "editor.hoverHighlightBackground", markdownDescription: - "Controls the line highlighting applied to active lines in normal mode. " + - "Can be an hex color, a [theme color](https://code.visualstudio.com/api/references/theme-color) or null.", + "Controls the line highlighting applied to active lines in normal mode. " + + "Can be an hex color, a [theme color](" + + "https://code.visualstudio.com/api/references/theme-color) or null.", }, "dance.insertMode.lineHighlight": { type: ["string", "null"], default: null, markdownDescription: - "Controls the line highlighting applied to active lines in insert mode. " + - "Can be an hex color, a [theme color](https://code.visualstudio.com/api/references/theme-color) or null.", + "Controls the line highlighting applied to active lines in insert mode. " + + "Can be an hex color, a [theme color](" + + "https://code.visualstudio.com/api/references/theme-color) or null.", }, "dance.normalMode.lineNumbers": { enum: ["off", "on", "relative", "inherit"], @@ -339,9 +339,11 @@ const pkg = { default: "caret", description: "Controls how selections behave within VS Code.", markdownEnumDescriptions: [ - "Selections are anchored to carets, which is the native VS Code behavior; that is, they are positioned *between* characters and can therefore be empty.", - "Selections are anchored to characters, like Kakoune; that is, they are positioned *on* characters, and therefore cannot be empty. " + - "Additionally, one-character selections will behave as if they were non-directional, like Kakoune.", + "Selections are anchored to carets, which is the native VS Code behavior; that is, " + + "they are positioned *between* characters and can therefore be empty.", + "Selections are anchored to characters, like Kakoune; that is, they are positioned " + + "*on* characters, and therefore cannot be empty. Additionally, one-character " + + "selections will behave as if they were non-directional, like Kakoune.", ], }, "dance.menus": { diff --git a/src/commands/changes.ts b/src/commands/changes.ts index 54ce6d1d..54be25a7 100644 --- a/src/commands/changes.ts +++ b/src/commands/changes.ts @@ -1,4 +1,5 @@ -// Changes: https://github.com/mawww/kakoune/blob/master/doc/pages/keys.asciidoc#changes +// Changes +// https://github.com/mawww/kakoune/blob/master/doc/pages/keys.asciidoc#changes import * as vscode from "vscode"; import { Command, CommandFlags, registerCommand } from "."; @@ -13,28 +14,28 @@ registerCommand( ({ editor }, _, undoStops) => { // Select all line endings. const selections = editor.selections, - len = selections.length, - newSelections = [] as vscode.Selection[], - document = editor.document; + len = selections.length, + newSelections = [] as vscode.Selection[], + document = editor.document; for (let i = 0; i < len; i++) { const selection = selections[i], - startLine = selection.start.line, - endLine = selection.end.line, - startAnchor = new vscode.Position(startLine, Number.MAX_SAFE_INTEGER), - startActive = new vscode.Position( - startLine + 1, - document.lineAt(startLine + 1).firstNonWhitespaceCharacterIndex, - ); + startLine = selection.start.line, + endLine = selection.end.line, + startAnchor = new vscode.Position(startLine, Number.MAX_SAFE_INTEGER), + startActive = new vscode.Position( + startLine + 1, + document.lineAt(startLine + 1).firstNonWhitespaceCharacterIndex, + ); newSelections.push(new vscode.Selection(startAnchor, startActive)); for (let line = startLine + 1; line < endLine; line++) { const anchor = new vscode.Position(line, Number.MAX_SAFE_INTEGER), - active = new vscode.Position( - line + 1, - document.lineAt(line + 1).firstNonWhitespaceCharacterIndex, - ); + active = new vscode.Position( + line + 1, + document.lineAt(line + 1).firstNonWhitespaceCharacterIndex, + ); newSelections.push(new vscode.Selection(anchor, active)); } @@ -92,8 +93,9 @@ function getSelectionsLines(selections: vscode.Selection[]) { function indent(editor: vscode.TextEditor, ignoreEmpty: boolean) { return editor .edit((builder) => { - const indent = - editor.options.insertSpaces === true ? " ".repeat(editor.options.tabSize as number) : "\t"; + const indent = editor.options.insertSpaces === true + ? " ".repeat(editor.options.tabSize as number) + : "\t"; for (const i of getSelectionsLines(editor.selections)) { if (ignoreEmpty && editor.document.lineAt(i).isEmptyOrWhitespace) { @@ -120,10 +122,10 @@ function deindent(editor: vscode.TextEditor, repetitions: number, further: boole for (const i of getSelectionsLines(editor.selections)) { const line = doc.lineAt(i), - text = line.text; + text = line.text; let column = 0, // Column, accounting for tab size - j = 0; // Index in source line, and number of characters to remove + j = 0; // Index in source line, and number of characters to remove for (; column < needed; j++) { const char = text[j]; @@ -191,7 +193,7 @@ registerCommand(Command.swapCase, CommandFlags.Edit, ({ editor }) => for (let i = 0; i < text.length; i++) { const x = text[i], - loCase = x.toLocaleLowerCase(); + loCase = x.toLocaleLowerCase(); builtText += loCase === x ? x.toLocaleUpperCase() : loCase; } diff --git a/src/commands/goto.ts b/src/commands/goto.ts index 317d72cc..9a8143ad 100644 --- a/src/commands/goto.ts +++ b/src/commands/goto.ts @@ -43,7 +43,7 @@ registerCommand( (editorState, state) => { if (state.input === null) { const { editor } = editorState, - { document } = editor; + { document } = editor; let line = state.currentCount - 1; if (line >= document.lineCount) { @@ -51,7 +51,7 @@ registerCommand( } const active = new vscode.Position(line, 0), - anchor = new vscode.Position(line, 0); + anchor = new vscode.Position(line, 0); editor.selections = [new vscode.Selection(anchor, active)]; @@ -72,7 +72,7 @@ registerCommand( (editorState, state) => { if (state.input === null) { const { editor } = editorState, - { document, selection } = editor; + { document, selection } = editor; let line = state.currentCount - 1; if (line >= document.lineCount) { @@ -80,7 +80,7 @@ registerCommand( } const anchor = selection.anchor, - active = new vscode.Position(line, 0); + active = new vscode.Position(line, 0); editor.selections = [new vscode.Selection(anchor, active)]; @@ -284,7 +284,7 @@ function toLastBufferModification(editorState: EditorState, extend: ExtendBehavi if (documentState.recordedChanges.length > 0) { const range = documentState.recordedChanges[documentState.recordedChanges.length - 1].range, - selection = range.selection(documentState.document); + selection = range.selection(documentState.document); editor.selection = extend ? new vscode.Selection(editor.selection.anchor, selection.active) diff --git a/src/commands/history.ts b/src/commands/history.ts index 81ac462e..55d67c86 100644 --- a/src/commands/history.ts +++ b/src/commands/history.ts @@ -44,8 +44,8 @@ registerCommand( const commandState = commands[i]; if ( - commandState.descriptor.flags & CommandFlags.ChangeSelections && - !(commandState.descriptor.flags & CommandFlags.Edit) + commandState.descriptor.flags & CommandFlags.ChangeSelections + && !(commandState.descriptor.flags & CommandFlags.Edit) ) { return CommandDescriptor.execute(editorState, commandState); } diff --git a/src/commands/index.ts b/src/commands/index.ts index 6499d99a..cacfa907 100644 --- a/src/commands/index.ts +++ b/src/commands/index.ts @@ -156,83 +156,84 @@ export class CommandDescriptor { let input: InputTypeMap[Input] | undefined; switch (this.input) { - case InputKind.RegExp: - if (typeof argument === "object" && typeof argument.input === "string") { - input = new RegExp(argument.input, this.inputDescr(editorState) as string) as any; - } else { - input = await promptRegex(this.inputDescr(editorState) as string, cancellationToken) as any; - } - break; - case InputKind.ListOneItem: - if (typeof argument === "object" && typeof argument.input === "string") { - input = argument.input; - } else { - input = await promptInList( - false, + case InputKind.RegExp: + if (typeof argument === "object" && typeof argument.input === "string") { + input = new RegExp(argument.input, this.inputDescr(editorState) as string) as any; + } else { + input = await promptRegex(this.inputDescr(editorState) as string, cancellationToken) as any; + } + break; + case InputKind.ListOneItem: + if (typeof argument === "object" && typeof argument.input === "string") { + input = argument.input; + } else { + input = await promptInList( + false, this.inputDescr(editorState) as [string, string][], cancellationToken, - ) as any; - } - break; - case InputKind.ListOneItemOrCount: - if (typeof argument === "object" && typeof argument.input === "string") { - input = argument.input; - } else if (editorState.extension.currentCount === 0) { - input = await promptInList( - false, + ) as any; + } + break; + case InputKind.ListOneItemOrCount: + if (typeof argument === "object" && typeof argument.input === "string") { + input = argument.input; + } else if (editorState.extension.currentCount === 0) { + input = await promptInList( + false, this.inputDescr(editorState) as [string, string][], cancellationToken, - ) as any; - } else { - input = null as any; - } - break; - case InputKind.ListManyItems: - if (typeof argument === "object" && typeof argument.input === "string") { - input = argument.input; - } else { - input = await promptInList( - true, + ) as any; + } else { + input = null as any; + } + break; + case InputKind.ListManyItems: + if (typeof argument === "object" && typeof argument.input === "string") { + input = argument.input; + } else { + input = await promptInList( + true, this.inputDescr(editorState) as [string, string][], cancellationToken, - ) as any; - } - break; - case InputKind.Text: - const inputDescr = this.inputDescr(editorState) as InputDescrMap[InputKind.Text]; + ) as any; + } + break; + case InputKind.Text: + const inputDescr = this.inputDescr(editorState) as InputDescrMap[InputKind.Text]; - if (inputDescr.setup !== undefined) { - inputDescr.setup(editorState); - } + if (inputDescr.setup !== undefined) { + inputDescr.setup(editorState); + } - if (typeof argument === "object" && typeof argument.input === "string") { - const error = await Promise.resolve(inputDescr.validateInput?.(argument.input)); - if (error) { - vscode.window.showErrorMessage(error); - } - input = argument.input; - } else { - input = await prompt(inputDescr, cancellationToken) as any; - } - break; - case InputKind.Key: - if (typeof argument === "object" && typeof argument.input === "string") { - input = argument.input; - } else { - const prevMode = editorState.mode; - - editorState.setMode(Mode.Awaiting); - input = await keypress(cancellationToken) as any; - editorState.setMode(prevMode); + if (typeof argument === "object" && typeof argument.input === "string") { + const error = await Promise.resolve(inputDescr.validateInput?.(argument.input)); + if (error) { + vscode.window.showErrorMessage(error); } - break; + input = argument.input; + } else { + input = await prompt(inputDescr, cancellationToken) as any; + } + break; + case InputKind.Key: + if (typeof argument === "object" && typeof argument.input === "string") { + input = argument.input; + } else { + const prevMode = editorState.mode; + + editorState.setMode(Mode.Awaiting); + input = await keypress(cancellationToken) as any; + editorState.setMode(prevMode); + } + break; } return input; } /** - * Executes the command completely, prompting the user for input and saving history entries if needed. + * Executes the command completely, prompting the user for input and saving + * history entries if needed. */ public async execute(editorState: EditorState, argument: any) { const { extension, editor } = editorState; @@ -262,8 +263,8 @@ export class CommandDescriptor { } if ( - this.flags & CommandFlags.ChangeSelections && - !(this.flags & CommandFlags.DoNotResetPreferredColumns) + this.flags & CommandFlags.ChangeSelections + && !(this.flags & CommandFlags.DoNotResetPreferredColumns) ) { editorState.preferredColumns.length = 0; } @@ -310,8 +311,8 @@ export class CommandDescriptor { for (let i = 0; i < len; i++) { const selection = selections[i]; - selections[i] = - selection.isReversed === shouldBeReversed + selections[i] + = selection.isReversed === shouldBeReversed ? selection : new vscode.Selection(selection.active, selection.anchor); } @@ -321,8 +322,8 @@ export class CommandDescriptor { for (let i = 0; i < len; i++) { const position = flags & CommandFlags.SwitchToInsertBefore - ? selections[i].start - : selections[i].end; + ? selections[i].start + : selections[i].end; selections[i] = new vscode.Selection(position, position); } @@ -381,11 +382,17 @@ export class CommandDescriptor { } /** - * Executes the given commands as part of a batch operation started by a macro, for example. + * Executes the given commands as part of a batch operation started by a + * macro, for example. */ - public static async executeMany(editorState: EditorState, commands: readonly CommandState[]) { - // In a batch execution, we don't change modes, and some things are not prompted again. - // Furthermore, a single entry is added to VS Code's history for the entire batch operation. + public static async executeMany( + editorState: EditorState, + commands: readonly CommandState[], + ) { + // In a batch execution, we don't change modes, and some things are not + // prompted again. + // Furthermore, a single entry is added to VS Code's history for the entire + // batch operation. let firstEditIdx = 0, lastEditIdx = commands.length - 1; @@ -427,8 +434,8 @@ export class CommandDescriptor { } if ( - descriptor.flags & - (CommandFlags.SwitchToInsertBefore | CommandFlags.SwitchToInsertAfter) + descriptor.flags + & (CommandFlags.SwitchToInsertBefore | CommandFlags.SwitchToInsertAfter) ) { currentMode = Mode.Insert; } else if (descriptor.flags & CommandFlags.SwitchToNormal) { @@ -494,7 +501,9 @@ export function registerCommand(...args: readonly any[]) { } export function setRemainingNormalCommands(remaining: number) { - remainingNormalCommands = remaining + 1; // Gotta add 1 to account for the currently executing command + remainingNormalCommands = remaining + 1; + // ^^^ to account for the currently + // executing command. } import "./changes"; diff --git a/src/commands/insert.ts b/src/commands/insert.ts index a0d9462d..cd79780e 100644 --- a/src/commands/insert.ts +++ b/src/commands/insert.ts @@ -25,11 +25,12 @@ registerCommand( CommandFlags.ChangeSelections | CommandFlags.SwitchToInsertBefore, ({ editor }) => { const selections = editor.selections, - len = selections.length; + len = selections.length; for (let i = 0; i < len; i++) { const selection = selections[i], - lineStart = editor.document.lineAt(selection.start.line).firstNonWhitespaceCharacterIndex; + lineStart = editor.document.lineAt(selection.start.line) + .firstNonWhitespaceCharacterIndex; selections[i] = new vscode.Selection( selection.anchor, @@ -46,7 +47,7 @@ registerCommand( CommandFlags.ChangeSelections | CommandFlags.SwitchToInsertAfter, ({ editor }) => { const selections = editor.selections, - len = selections.length; + len = selections.length; for (let i = 0; i < len; i++) { const selection = selections[i]; @@ -105,13 +106,13 @@ registerCommand(Command.newLineAbove, CommandFlags.Edit, (editorState, state, un const processedLines = new Set(); const selections = editor.selections, - len = selections.length, - selectionHelper = SelectionHelper.for(editorState, state); + len = selections.length, + selectionHelper = SelectionHelper.for(editorState, state); for (let i = 0; i < len; i++) { const selection = selections[i], - activeLine = - selection.active === selection.end + activeLine + = selection.active === selection.end ? selectionHelper.endLine(selection) : selection.active.line; @@ -131,13 +132,13 @@ registerCommand(Command.newLineBelow, CommandFlags.Edit, (editorState, state, un const processedLines = new Set(); const selections = editor.selections, - len = selections.length, - selectionHelper = SelectionHelper.for(editorState, state); + len = selections.length, + selectionHelper = SelectionHelper.for(editorState, state); for (let i = 0; i < len; i++) { const selection = selections[i], - activeLine = - selection.active === selection.end + activeLine + = selection.active === selection.end ? selectionHelper.endLine(selection) : selection.active.line; @@ -188,7 +189,7 @@ registerCommand(Command.repeatInsert, CommandFlags.Edit, async ({ editor }, stat for (let i = state.currentCount || 1; i > 0; i--) { for (let j = start; j <= end; j++) { const commandState = editorState.recordedCommands[j], - changes = commandState.followingChanges; + changes = commandState.followingChanges; if (changes === undefined) { continue; diff --git a/src/commands/macros.ts b/src/commands/macros.ts index 0011d118..0dd71526 100644 --- a/src/commands/macros.ts +++ b/src/commands/macros.ts @@ -5,8 +5,8 @@ registerCommand( Command.macrosRecordStart, CommandFlags.IgnoreInHistory, (editorState, { currentRegister, extension }) => { - const reg = - ((currentRegister as any) as MacroRegister & Register) ?? extension.registers.arobase; + const reg + = ((currentRegister as any) as MacroRegister & Register) ?? extension.registers.arobase; if (typeof reg.setMacro === "function") { return editorState.startMacroRecording(reg)?.then(() => void 0); diff --git a/src/commands/mark.ts b/src/commands/mark.ts index 3cd913f1..86a22920 100644 --- a/src/commands/mark.ts +++ b/src/commands/mark.ts @@ -1,4 +1,5 @@ -// Marks: https://github.com/mawww/kakoune/blob/master/doc/pages/keys.asciidoc#marks +// Marks +// https://github.com/mawww/kakoune/blob/master/doc/pages/keys.asciidoc#marks import * as vscode from "vscode"; import { Command, CommandFlags, InputKind, registerCommand } from "."; @@ -35,7 +36,7 @@ registerCommand( CommandFlags.None, ({ editor, extension, documentState }, { currentRegister }) => { const map = marksForRegister(currentRegister ?? extension.registers.caret), - existingMarks = map.get(editor.document); + existingMarks = map.get(editor.document); if (existingMarks !== undefined) { documentState.forgetSelections(existingMarks); @@ -53,7 +54,7 @@ registerCommand( CommandFlags.ChangeSelections, ({ editor, extension }, { currentRegister }) => { const map = marksForRegister(currentRegister ?? extension.registers.caret), - marks = map.get(editor.document); + marks = map.get(editor.document); if (marks !== undefined) { editor.selections = marks.map((savedSelection) => savedSelection.selection(editor.document)); @@ -95,64 +96,64 @@ function combineSelections( for (let i = 0; i < from.length; i++) { const a = from[i], - b = add[i]; + b = add[i]; switch (type) { - case 1: { - const anchor = a.start.isBefore(b.start) ? a.start : b.start, - active = a.end.isAfter(b.end) ? a.end : b.end; + case 1: { + const anchor = a.start.isBefore(b.start) ? a.start : b.start, + active = a.end.isAfter(b.end) ? a.end : b.end; - selections.push(new vscode.Selection(anchor, active)); - break; - } + selections.push(new vscode.Selection(anchor, active)); + break; + } - case 2: { - const anchor = a.start.isAfter(b.start) ? a.start : b.start, - active = a.end.isBefore(b.end) ? a.end : b.end; + case 2: { + const anchor = a.start.isAfter(b.start) ? a.start : b.start, + active = a.end.isBefore(b.end) ? a.end : b.end; - selections.push(new vscode.Selection(anchor, active)); - break; + selections.push(new vscode.Selection(anchor, active)); + break; + } + + case 3: + if (a.active.isBeforeOrEqual(b.active)) { + selections.push(a); + } else { + selections.push(b); } + break; - case 3: - if (a.active.isBeforeOrEqual(b.active)) { - selections.push(a); - } else { - selections.push(b); - } - break; - - case 4: - if (a.active.isAfterOrEqual(b.active)) { - selections.push(a); - } else { - selections.push(b); - } - break; - - case 5: { - const aLength = editor.document.offsetAt(a.end) - editor.document.offsetAt(a.start), - bLength = editor.document.offsetAt(b.end) - editor.document.offsetAt(b.start); - - if (aLength > bLength) { - selections.push(a); - } else { - selections.push(b); - } - break; + case 4: + if (a.active.isAfterOrEqual(b.active)) { + selections.push(a); + } else { + selections.push(b); } + break; - case 6: { - const aLength = editor.document.offsetAt(a.end) - editor.document.offsetAt(a.start), - bLength = editor.document.offsetAt(b.end) - editor.document.offsetAt(b.start); + case 5: { + const aLength = editor.document.offsetAt(a.end) - editor.document.offsetAt(a.start), + bLength = editor.document.offsetAt(b.end) - editor.document.offsetAt(b.start); - if (aLength < bLength) { - selections.push(a); - } else { - selections.push(b); - } - break; + if (aLength > bLength) { + selections.push(a); + } else { + selections.push(b); } + break; + } + + case 6: { + const aLength = editor.document.offsetAt(a.end) - editor.document.offsetAt(a.start), + bLength = editor.document.offsetAt(b.end) - editor.document.offsetAt(b.start); + + if (aLength < bLength) { + selections.push(a); + } else { + selections.push(b); + } + break; + } } } @@ -166,7 +167,7 @@ registerCommand( combineOpts, ({ editor, extension }, { currentRegister, input }) => { const map = marksForRegister(currentRegister ?? extension.registers.caret), - marks = map.get(editor.document); + marks = map.get(editor.document); if (marks === undefined) { return; @@ -188,7 +189,7 @@ registerCommand( combineOpts, ({ editor, extension }, { currentRegister, input }) => { const map = marksForRegister(currentRegister ?? extension.registers.caret), - marks = map.get(editor.document); + marks = map.get(editor.document); if (marks === undefined) { return; diff --git a/src/commands/misc.ts b/src/commands/misc.ts index f1f7a965..3eacaecc 100644 --- a/src/commands/misc.ts +++ b/src/commands/misc.ts @@ -1,12 +1,21 @@ import * as vscode from "vscode"; -import { Command, CommandDescriptor, CommandFlags, CommandState, InputKind, commandsByName, registerCommand } from "."; +import { + Command, + CommandDescriptor, + CommandFlags, + CommandState, + InputKind, + commandsByName, + registerCommand, +} from "."; registerCommand(Command.cancel, CommandFlags.IgnoreInHistory, () => { // Nop, because the caller cancels everything before calling us. }); type RunFunction = (vscodeObj: typeof vscode, danceObj: object, args: any) => Promise | any; -type RunFunctionConstructor = (vscodeObj: "vscode", danceObj: "dance", args: "args", code: string) => RunFunction; +type RunFunctionConstructor = + (vscodeObj: "vscode", danceObj: "dance", args: "args", code: string) => RunFunction; const AsyncFunction = async function () {}.constructor as RunFunctionConstructor; @@ -62,7 +71,9 @@ registerCommand(Command.run, CommandFlags.IgnoreInHistory, async (editorState, s commandName = command[0]; commandArgument = command[1]; } else { - throw new Error("execute arguments must be command names or [command name, argument] tuples"); + throw new Error( + "execute arguments must be command names or [command name, argument] tuples", + ); } if (commandName.startsWith(".")) { @@ -71,7 +82,10 @@ registerCommand(Command.run, CommandFlags.IgnoreInHistory, async (editorState, s if (commandName in commandsByName) { const descriptor = commandsByName[commandName as Command], - input = await descriptor.getInput(editorState, commandArgument, extension.cancellationTokenSource?.token); + input = await descriptor.getInput( + editorState, + commandArgument, + extension.cancellationTokenSource?.token); if (descriptor.input !== InputKind.None && input === undefined) { return; diff --git a/src/commands/move.ts b/src/commands/move.ts index ddcfa93f..ebbbaf0b 100644 --- a/src/commands/move.ts +++ b/src/commands/move.ts @@ -1,7 +1,8 @@ -// Movement: https://github.com/mawww/kakoune/blob/master/doc/pages/keys.asciidoc#movement +// Movement +// https://github.com/mawww/kakoune/blob/master/doc/pages/keys.asciidoc#movement import * as vscode from "vscode"; -import { Command, CommandFlags, CommandState, preferredColumnsPerEditor, registerCommand } from "."; +import { Command, CommandFlags, registerCommand } from "."; import { Backward, Direction, @@ -9,11 +10,9 @@ import { Extend, ExtendBehavior, Forward, - SelectionMapper, jumpTo, } from "../utils/selectionHelper"; import { Coord, SelectionHelper } from "../utils/selectionHelper"; -import { EditorState } from "../state/editor"; import { SelectionBehavior } from "../state/extension"; // Move around (h, j, k, l, H, J, K, L, arrows, shift+arrows) @@ -74,7 +73,7 @@ function registerMoveVertical(command: Command, direction: Direction, extend: Ex CommandFlags.ChangeSelections | CommandFlags.DoNotResetPreferredColumns, (editorState, state) => { const { editor, preferredColumns } = editorState, - selectionHelper = SelectionHelper.for(editorState, state); + selectionHelper = SelectionHelper.for(editorState, state); if (preferredColumns.length === 0) { for (let i = 0; i < editor.selections.length; i++) { diff --git a/src/commands/pipe.ts b/src/commands/pipe.ts index 8a347f16..987bc321 100644 --- a/src/commands/pipe.ts +++ b/src/commands/pipe.ts @@ -1,4 +1,5 @@ -// Pipes: https://github.com/mawww/kakoune/blob/master/doc/pages/keys.asciidoc#changes-through-external-programs +// Pipes +// https://github.com/mawww/kakoune/blob/master/doc/pages/keys.asciidoc#changes-through-external-programs import * as cp from "child_process"; import * as vscode from "vscode"; @@ -30,10 +31,10 @@ function getShell() { function execWithInput(command: string, input: string) { return new Promise<{ readonly val: string } | { readonly err: string }>((resolve) => { const shell = getShell() ?? true, - child = cp.spawn(command, { shell, stdio: "pipe" }); + child = cp.spawn(command, { shell, stdio: "pipe" }); let stdout = "", - stderr = ""; + stderr = ""; child.stdout.on("data", (chunk: Buffer) => (stdout += chunk.toString("utf-8"))); child.stderr.on("data", (chunk: Buffer) => (stderr += chunk.toString("utf-8"))); @@ -44,10 +45,10 @@ function execWithInput(command: string, input: string) { code === 0 ? resolve({ val: stdout.trimRight() }) : resolve({ - err: `Command exited with error ${code}: ${ - stderr.length > 0 ? stderr.trimRight() : "" - }`, - }), + err: `Command exited with error ${code}: ${ + stderr.length > 0 ? stderr.trimRight() : "" + }`, + }), ); }); } @@ -114,8 +115,9 @@ function pipe(command: string, selections: string[]) { return Promise.all(selections.map((selection) => execWithInput(command, selection))); } else if (command.startsWith("/")) { - // RegExp replace - const [regexp, replacement] = parseRegExp(command) as [RegExp, string]; // Safe to do; since the input is validated + // RegExp replace (note that it's safe to call parseRegExp since the input + // is validated) + const [regexp, replacement] = parseRegExp(command) as [RegExp, string]; return Promise.resolve(selections.map((x) => ({ val: x.replace(regexp, replacement) }))); } else { @@ -306,13 +308,13 @@ registerCommand( } const selections = editor.selections, - selectionLengths = [] as number[], - selectionHelper = SelectionHelper.for(editorState, state); + selectionLengths = [] as number[], + selectionHelper = SelectionHelper.for(editorState, state); await editor.edit((builder) => { for (let i = 0; i < outputs.length; i++) { const content = outputs[i].val!, - selection = selections[i]; + selection = selections[i]; builder.insert(selection.end, content); diff --git a/src/commands/rotate.ts b/src/commands/rotate.ts index ddbe88bd..72fe4011 100644 --- a/src/commands/rotate.ts +++ b/src/commands/rotate.ts @@ -4,8 +4,8 @@ import { Command, CommandFlags, registerCommand } from "."; function rotateSelections(editor: vscode.TextEditor) { const selections = editor.selections.slice(), - last = selections.length - 1, - firstSelection = selections[0]; + last = selections.length - 1, + firstSelection = selections[0]; for (let i = 0; i < last; i++) { selections[i] = selections[i + 1]; @@ -17,8 +17,8 @@ function rotateSelections(editor: vscode.TextEditor) { function rotateSelectionsBackwards(editor: vscode.TextEditor) { const selections = editor.selections.slice(), - last = selections.length - 1, - lastSelection = selections[last]; + last = selections.length - 1, + lastSelection = selections[last]; for (let i = last; i > 0; i--) { selections[i] = selections[i - 1]; diff --git a/src/commands/search.ts b/src/commands/search.ts index 58564285..2ae42148 100644 --- a/src/commands/search.ts +++ b/src/commands/search.ts @@ -1,4 +1,5 @@ -// Search: https://github.com/mawww/kakoune/blob/master/doc/pages/keys.asciidoc#searching +// Search +// https://github.com/mawww/kakoune/blob/master/doc/pages/keys.asciidoc#searching import * as vscode from "vscode"; import { Command, CommandFlags, InputKind, registerCommand } from "."; @@ -110,7 +111,8 @@ function needleInHaystack( return (selection, helper) => { const document = helper.editor.document; const regex = helper.state.regex!; - // Try finding in the normal search range first, then the wrapped search range. + // Try finding in the normal search range first, then the wrapped search + // range. for (const isWrapped of [false, true]) { const searchRange = getSearchRange(selection, document, direction, isWrapped); const text = document.getText(searchRange); @@ -156,8 +158,8 @@ function moveToNeedleInHaystack( function registerSearchCommand(command: Command, direction: Direction, extend: ExtendBehavior) { let initialSelections: readonly SavedSelection[], - register: WritableRegister, - helper: SelectionHelper; + register: WritableRegister, + helper: SelectionHelper; const mapper = moveToNeedleInHaystack(direction, extend); @@ -285,8 +287,8 @@ registerCommand( CommandFlags.ChangeSelections, ({ editor, extension }) => { const isWord = getCharSetFunction(CharSet.Word, editor.document), - firstLine = editor.document.lineAt(editor.selection.start).text, - firstLineStart = editor.selection.start.character; + firstLine = editor.document.lineAt(editor.selection.start).text, + firstLineStart = editor.selection.start.character; let text = escapeRegExp(editor.document.getText(editor.selection)); @@ -295,7 +297,7 @@ registerCommand( } const lastLine = editor.document.lineAt(editor.selection.end).text, - lastLineEnd = editor.selection.end.character; + lastLineEnd = editor.selection.end.character; if (lastLineEnd >= lastLine.length || !isWord(lastLine.charCodeAt(lastLineEnd))) { text = `${text}\\b`; @@ -338,7 +340,7 @@ function registerNextCommand(command: Command, direction: Direction, replace: bo } const regex = new RegExp(regexStr[0], "g"), - selections = editor.selections; + selections = editor.selections; const searchState = { selectionBehavior, regex }; const helper = SelectionHelper.for(editorState, searchState); let cur = selections[0]; diff --git a/src/commands/select.ts b/src/commands/select.ts index b92fa027..0d0b416b 100644 --- a/src/commands/select.ts +++ b/src/commands/select.ts @@ -1,4 +1,5 @@ -// Select / extend: https://github.com/mawww/kakoune/blob/master/doc/pages/keys.asciidoc#movement +// Select / extend +// https://github.com/mawww/kakoune/blob/master/doc/pages/keys.asciidoc#movement import * as vscode from "vscode"; import { Command, CommandFlags, CommandState, InputKind, registerCommand } from "."; @@ -38,8 +39,8 @@ function toNextCharacter(direction: Direction, include: boolean): CoordMapper { if (character === undefined) { character = text.length; } - const idx: number = - direction === Backward + const idx: number + = direction === Backward ? text.lastIndexOf(key, character - 1) : text.indexOf(key, character + 1); @@ -50,8 +51,8 @@ function toNextCharacter(direction: Direction, include: boolean): CoordMapper { } // No match on this line, let's keep going. - const isDocumentEdge = - direction === Backward ? line-- === 0 : ++line === helper.editor.document.lineCount; + const isDocumentEdge + = direction === Backward ? line-- === 0 : ++line === helper.editor.document.lineCount; if (isDocumentEdge) { // ... except if we've reached the start or end of the document. @@ -139,91 +140,97 @@ function selectByWord( const { repetitions } = state; const document = editorState.editor.document; const isWord = getCharSetFunction(wordCharset, document), - isBlank = getCharSetFunction(CharSet.Blank, document), - isPunctuation = getCharSetFunction(CharSet.Punctuation, document); + isBlank = getCharSetFunction(CharSet.Blank, document), + isPunctuation = getCharSetFunction(CharSet.Punctuation, document); for (let i = repetitions; i > 0; i--) { helper.mapEach( seekToRange( (from) => { let anchor = undefined, - active = from; - const text = document.lineAt(active.line).text; - const lineEndCol = - helper.selectionBehavior === SelectionBehavior.Caret ? text.length : text.length - 1; + active = from; + const text = document.lineAt(active.line).text; + const lineEndCol = helper.selectionBehavior === SelectionBehavior.Caret + ? text.length + : text.length - 1; // 1. Starting from active, try to seek to the word start. - const isAtLineBoundary = direction === Forward ? (active.character >= lineEndCol) : (active.character === 0); - if (isAtLineBoundary) { - const afterEmptyLines = skipEmptyLines(active, document, direction); - if (afterEmptyLines === undefined) { - if (direction === Backward && active.line > 0) { - // This is a special case in Kakoune and we try to mimic it here. - // Instead of overflowing, put anchor at document start and - // active always on the first character on the second line. - return [new Coord(0, 0), new Coord(1, 0)]; - } else { - // Otherwise the selection overflows. - return { remove: true, fallback: [anchor, active] }; - } - } - anchor = afterEmptyLines; - } else if (direction === Backward && active.character >= text.length) { - anchor = new Coord(active.line, text.length - 1); - } else { - let shouldSkip; - if (helper.selectionBehavior === SelectionBehavior.Character) { - // Skip current character if it is at boundary. (e.g. "ab[c] " =>`w`) - const column = active.character; - shouldSkip = - categorize(text.charCodeAt(column), isBlank, isWord) !== - categorize(text.charCodeAt(column + direction), isBlank, isWord); + const isAtLineBoundary = direction === Forward + ? (active.character >= lineEndCol) + : (active.character === 0); + if (isAtLineBoundary) { + const afterEmptyLines = skipEmptyLines(active, document, direction); + if (afterEmptyLines === undefined) { + if (direction === Backward && active.line > 0) { + // This is a special case in Kakoune and we try to mimic it + // here. + // Instead of overflowing, put anchor at document start and + // active always on the first character on the second line. + return [new Coord(0, 0), new Coord(1, 0)]; } else { - // Ignore the character on the right of the caret. - shouldSkip = direction === Backward; + // Otherwise the selection overflows. + return { remove: true, fallback: [anchor, active] }; } - anchor = shouldSkip ? new Coord(active.line, active.character + direction) : active; } - - active = anchor; - - // 2. Then scan within the current line until the word ends. - - const curLineText = document.lineAt(active).text; - let nextCol = active.character; // The next character to be tested. - if (end) { - // Select the whitespace before word, if any. - while ( - nextCol >= 0 && - nextCol < curLineText.length && - isBlank(curLineText.charCodeAt(nextCol)) - ) { - nextCol += direction; - } + anchor = afterEmptyLines; + } else if (direction === Backward && active.character >= text.length) { + anchor = new Coord(active.line, text.length - 1); + } else { + let shouldSkip; + if (helper.selectionBehavior === SelectionBehavior.Character) { + // Skip current character if it is at boundary. + // (e.g. "ab[c] " =>`w`) + const column = active.character; + shouldSkip + = categorize(text.charCodeAt(column), isBlank, isWord) + !== categorize(text.charCodeAt(column + direction), isBlank, isWord); + } else { + // Ignore the character on the right of the caret. + shouldSkip = direction === Backward; } - if (nextCol >= 0 && nextCol < curLineText.length) { - const startCharCode = curLineText.charCodeAt(nextCol); - const isSameCategory = isWord(startCharCode) ? isWord : isPunctuation; - while ( - nextCol >= 0 && - nextCol < curLineText.length && - isSameCategory(curLineText.charCodeAt(nextCol)) - ) { - nextCol += direction; - } + anchor = shouldSkip ? new Coord(active.line, active.character + direction) : active; + } + + active = anchor; + + // 2. Then scan within the current line until the word ends. + + const curLineText = document.lineAt(active).text; + let nextCol = active.character; // The next character to be tested. + if (end) { + // Select the whitespace before word, if any. + while ( + nextCol >= 0 + && nextCol < curLineText.length + && isBlank(curLineText.charCodeAt(nextCol)) + ) { + nextCol += direction; } - if (!end) { - // Select the whitespace after word, if any. - while ( - nextCol >= 0 && - nextCol < curLineText.length && - isBlank(curLineText.charCodeAt(nextCol)) - ) { - nextCol += direction; - } + } + if (nextCol >= 0 && nextCol < curLineText.length) { + const startCharCode = curLineText.charCodeAt(nextCol); + const isSameCategory = isWord(startCharCode) ? isWord : isPunctuation; + while ( + nextCol >= 0 + && nextCol < curLineText.length + && isSameCategory(curLineText.charCodeAt(nextCol)) + ) { + nextCol += direction; } - // If we reach here, nextCol must be the first character we encounter that - // does not belong to the current word (or -1 / line break). Exclude it. - active = new Coord(active.line, nextCol - direction); + } + if (!end) { + // Select the whitespace after word, if any. + while ( + nextCol >= 0 + && nextCol < curLineText.length + && isBlank(curLineText.charCodeAt(nextCol)) + ) { + nextCol += direction; + } + } + // If we reach here, nextCol must be the first character we encounter + // that does not belong to the current word (or -1 / line break). + // Exclude it. + active = new Coord(active.line, nextCol - direction); return [anchor!, active]; }, extend, @@ -288,14 +295,14 @@ registerCommand( CommandFlags.ChangeSelections, (editorState, { currentCount }) => { const editor = editorState.editor, - selections = editor.selections, - len = selections.length, - selectionHelper = SelectionHelper.for(editorState); + selections = editor.selections, + len = selections.length, + selectionHelper = SelectionHelper.for(editorState); if (currentCount === 0 || currentCount === 1) { for (let i = 0; i < len; i++) { const selection = selections[i], - isFullLine = selectionHelper.isEntireLines(selection); + isFullLine = selectionHelper.isEntireLines(selection); let line = selectionHelper.activeLine(selection); if (isFullLine) { @@ -307,10 +314,10 @@ registerCommand( } else { for (let i = 0; i < len; i++) { const selection = selections[i], - targetLine = Math.min( - selectionHelper.activeLine(selection) + currentCount - 1, - editor.document.lineCount - 1, - ); + targetLine = Math.min( + selectionHelper.activeLine(selection) + currentCount - 1, + editor.document.lineCount - 1, + ); selections[i] = new vscode.Selection(targetLine, 0, targetLine + 1, 0); } @@ -325,19 +332,19 @@ registerCommand( CommandFlags.ChangeSelections, (editorState, { currentCount, selectionBehavior }) => { const editor = editorState.editor, - selections = editor.selections, - len = selections.length, - selectionHelper = SelectionHelper.for(editorState); + selections = editor.selections, + len = selections.length, + selectionHelper = SelectionHelper.for(editorState); if (currentCount === 0 || currentCount === 1) { for (let i = 0; i < len; i++) { const selection = selections[i], - isSameLine = selectionHelper.isSingleLine(selection), - isFullLineDiff = selectionHelper.isEntireLine(selection) ? 1 : 0; + isSameLine = selectionHelper.isSingleLine(selection), + isFullLineDiff = selectionHelper.isEntireLine(selection) ? 1 : 0; const anchor = isSameLine ? selection.anchor.with(undefined, 0) : selection.anchor; - const active = - selection.active.character === 0 && !selection.isReversed && !isSameLine + const active + = selection.active.character === 0 && !selection.isReversed && !isSameLine ? selection.active.translate(1 + isFullLineDiff) : new vscode.Position(selectionHelper.activeLine(selection) + 1 + isFullLineDiff, 0); @@ -346,11 +353,11 @@ registerCommand( } else { for (let i = 0; i < len; i++) { const selection = selections[i], - targetLine = Math.min( - selectionHelper.activeLine(selection) + currentCount - 1, - editor.document.lineCount - 1, - ), - isSameLine = selectionHelper.isSingleLine(selection); + targetLine = Math.min( + selectionHelper.activeLine(selection) + currentCount - 1, + editor.document.lineCount - 1, + ), + isSameLine = selectionHelper.isSingleLine(selection); const anchor = isSameLine ? selection.anchor.with(undefined, 0) : selection.anchor; const active = new vscode.Position(targetLine + 1, 0); @@ -404,7 +411,7 @@ registerCommand( const expandLine: SelectionMapper = (selection, helper) => { // This command is idempotent. state.currentCount is intentionally ignored. const { start, end } = selection, - document = helper.editor.document; + document = helper.editor.document; // Move start to line start and end to include line break. const newStart = start.with(undefined, 0); let newEnd; @@ -447,10 +454,9 @@ const trimToFullLines: SelectionMapper = (selection, helper) => { // After trimming, the selection should be in the same direction as before. // Except when selecting only one empty line in non-directional mode, prefer // to keep the selection facing forward. - if ( - selection.isReversed && - !(helper.selectionBehavior === SelectionBehavior.Character && newStart.line + 1 === newEnd.line) - ) { + if (selection.isReversed + && !(helper.selectionBehavior === SelectionBehavior.Character + && newStart.line + 1 === newEnd.line)) { return new vscode.Selection(newEnd, newStart); } else { return new vscode.Selection(newStart, newEnd); @@ -478,8 +484,8 @@ export function skipWhile( endLine?: number, ): Coord | undefined { let col = current.character, - line = current.line, - text = document.lineAt(line).text; + line = current.line, + text = document.lineAt(line).text; if (endLine === undefined) { endLine = direction === Forward ? document.lineCount - 1 : 0; } @@ -516,7 +522,7 @@ export function skipWhileX( endLine?: number, ): Coord | undefined { let col = current.character, - line = current.line; + line = current.line; if (endLine === undefined) { endLine = direction === Forward ? document.lineCount - 1 : 0; } @@ -616,7 +622,8 @@ export function findMatching( } function selectEnclosing(extend: ExtendBehavior, direction: Direction) { - // This command intentionally ignores repetitions to be consistent with Kakoune. + // This command intentionally ignores repetitions to be consistent with + // Kakoune. // It only finds one next enclosing character and drags only once to its // matching counterpart. Repetitions > 1 does exactly the same with rep=1, // even though executing the command again will jump back and forth. @@ -627,21 +634,23 @@ function selectEnclosing(extend: ExtendBehavior, direction: Direction) { // First, find an enclosing char (which may be the current character). let currentCharacter = from; if (helper.selectionBehavior === SelectionBehavior.Caret) { - // When moving backwards, the first character to consider is the character - // to the left, not the right. However, we hackily special case `|[foo]>` - // (> is anchor, | is active) to jump to the end in the current group. + // When moving backwards, the first character to consider is the + // character to the left, not the right. However, we hackily special + // case `|[foo]>` (> is anchor, | is active) to jump to the end in the + // current group. const selection = helper.editor.selections[i]; if (direction === Backward && selection.isReversed) { currentCharacter = helper.coordAt(helper.offsetAt(currentCharacter) - 1); } - // Similarly, we special case `<[foo]|` to jump back in the current group. + // Similarly, we special case `<[foo]|` to jump back in the current + // group. if (direction === Forward && !selection.isReversed && !selection.isEmpty) { currentCharacter = helper.coordAt(helper.offsetAt(currentCharacter) - 1); } } if (helper.selectionBehavior === SelectionBehavior.Caret && direction === Backward) { - // When moving backwards, the first character to consider is the character - // to the left, not the right. + // When moving backwards, the first character to consider is the + // character to the left, not the right. currentCharacter = helper.coordAt(helper.offsetAt(currentCharacter) - 1); } const anchor = skipWhile(direction, currentCharacter, isNotEnclosingChar, document); @@ -651,17 +660,19 @@ function selectEnclosing(extend: ExtendBehavior, direction: Direction) { // Then, find the matching char of the anchor. const enclosingChar = document.lineAt(anchor.line).text.charCodeAt(anchor.character), - idxOfEnclosingChar = enclosingChars.indexOf(enclosingChar); + idxOfEnclosingChar = enclosingChars.indexOf(enclosingChar); let active; if (idxOfEnclosingChar & 1) { - // Odd enclosingChar index <=> enclosingChar is closing character - // <=> we go backward looking for the opening character + // Odd enclosingChar index + // <=> enclosingChar is closing character + // <=> we go backward looking for the opening character const matchingChar = enclosingChars[idxOfEnclosingChar - 1]; active = findMatching(Backward, anchor, matchingChar, enclosingChar, document); } else { - // Even enclosingChar index <=> enclosingChar is opening character - // <=> we go forward looking for the closing character + // Even enclosingChar index + // <=> enclosingChar is opening character + // <=> we go forward looking for the closing character const matchingChar = enclosingChars[idxOfEnclosingChar + 1]; active = findMatching(Forward, anchor, matchingChar, enclosingChar, document); } diff --git a/src/commands/selectObject.ts b/src/commands/selectObject.ts index 7dba8a55..f0e15b32 100644 --- a/src/commands/selectObject.ts +++ b/src/commands/selectObject.ts @@ -1,4 +1,5 @@ -// Objects: https://github.com/mawww/kakoune/blob/master/doc/pages/keys.asciidoc#object-selection +// Objects +// https://github.com/mawww/kakoune/blob/master/doc/pages/keys.asciidoc#object-selection import * as vscode from "vscode"; import { Command, CommandFlags, CommandState, registerCommand } from "."; @@ -10,10 +11,8 @@ import { DoNotExtend, DocumentStart, Extend, - ExtendBehavior, Forward, RemoveSelection, - SeekFunc, SelectionHelper, SelectionMapper, moveActiveCoord, @@ -24,7 +23,8 @@ import { findMatching, skipWhile, skipWhileX } from "./select"; import { SelectionBehavior } from "../state/extension"; // Selecting is a bit harder than it sounds like: -// 1. Dealing with multiple lines, whether forwards or backwards, is a bit of a pain. +// 1. Dealing with multiple lines, whether forwards or backwards, is a bit of a +// pain. // 2. Dealing with strings is a bit of a pain // 3. Dealing with inner objects is a bit of a pain @@ -108,11 +108,11 @@ function objectActions( function objectWithinPair(startCharCode: number, endCharCode: number) { const toStart: CoordMapper = (active, helper) => - findMatching(Backward, active, startCharCode, endCharCode, helper.editor.document) ?? - RemoveSelection; + findMatching(Backward, active, startCharCode, endCharCode, helper.editor.document) + ?? RemoveSelection; const toEnd: CoordMapper = (active, helper) => - findMatching(Forward, active, endCharCode, startCharCode, helper.editor.document) ?? - RemoveSelection; + findMatching(Forward, active, endCharCode, startCharCode, helper.editor.document) + ?? RemoveSelection; const toStartInner: CoordMapper = (active, helper, i) => { const pos = toStart(active, helper, i); @@ -189,13 +189,13 @@ function objectWithCharSet(charSet: CharSet | CharCodePredicate) { function toEdge(direction: Direction, includeTrailingWhitespace: boolean): CoordMapper { return (active, helper) => { const { document } = helper.editor; - const isInSet = - typeof charSet === "function" ? charSet : getCharSetFunction(charSet, document); + const isInSet + = typeof charSet === "function" ? charSet : getCharSetFunction(charSet, document); let col = active.character; const text = document.lineAt(active.line).text; if (col >= text.length) { - // A charset object cannot contain line break, therefore the cursor active - // is not within any such object. + // A charset object cannot contain line break, therefore the cursor + // active is not within any such object. return RemoveSelection; } while (isInSet(text.charCodeAt(col))) { @@ -229,8 +229,8 @@ function objectWithCharSet(charSet: CharSet | CharCodePredicate) { } function sentenceObject() { - // I bet that's the first time you see a Greek question mark used as an actual Greek question mark, - // rather than as a "prank" semicolon. + // I bet that's the first time you see a Greek question mark used as an actual + // Greek question mark, rather than as a "prank" semicolon. const punctCharCodes = new Uint32Array(Array.from(".!?¡§¶¿;՞。", (ch) => ch.charCodeAt(0))); function toBeforeBlank(allowSkipToPrevious: boolean) { @@ -279,7 +279,9 @@ function sentenceObject() { // We jumped over blank lines but didn't hit a punct char. Don't accept. return origin; } - // let result = beforeBlank.isEqual(DocumentStart) ? beforeBlank : helper.prevPos(beforeBlank) + // let result = beforeBlank.isEqual(DocumentStart) + // ? beforeBlank + // : helper.prevPos(beforeBlank) if (!hitPunctChar) { return beforeBlank; } @@ -376,8 +378,8 @@ function sentenceObject() { // sentence. If next line is also empty, we should just stay here. // However, start scanning from the next line if it is not empty. if ( - origin.line + 1 >= document.lineCount || - document.lineAt(origin.line + 1).text.length === 0 + origin.line + 1 >= document.lineCount + || document.lineAt(origin.line + 1).text.length === 0 ) { return origin; } else { @@ -493,9 +495,9 @@ function paragraphObject() { const lookBack: CoordMapper = (active, helper) => { const { line } = active; if ( - line > 0 && - active.character === 0 && - helper.editor.document.lineAt(line - 1).text.length === 0 + line > 0 + && active.character === 0 + && helper.editor.document.lineAt(line - 1).text.length === 0 ) { return new Coord(line - 1, 0); // Re-anchor to the previous line. } @@ -563,8 +565,8 @@ function paragraphObject() { return RemoveSelection; } if ( - direction === Forward && - helper.editor.document.lineAt(adjusted.line).text.length === 0 + direction === Forward + && helper.editor.document.lineAt(adjusted.line).text.length === 0 ) { return toEdge(new Coord(adjusted.line + 1, 0), helper, i); } else { @@ -600,9 +602,9 @@ function paragraphObject() { let start; if ( - active.line + 1 < document.lineCount && - document.lineAt(active.line).text.length === 0 && - document.lineAt(active.line + 1).text.length + active.line + 1 < document.lineCount + && document.lineAt(active.line).text.length === 0 + && document.lineAt(active.line + 1).text.length ) { // Special case: if current line is empty, check next line and select // the NEXT paragraph if next line is not empty. @@ -743,9 +745,9 @@ function indentObject() { }; } const toStart = toEdge(Backward, false), - toStartInner = toEdge(Backward, true), - toEnd = toEdge(Forward, false), - toEndInner = toEdge(Forward, true); + toStartInner = toEdge(Backward, true), + toEnd = toEdge(Forward, false), + toEndInner = toEdge(Forward, true); // When selecting a whole indent object, scanning separately toStart and then // toEnd will lead to wrong results like two different indentation levels and @@ -774,13 +776,14 @@ function argumentObject() { return (oldActive, helper) => { const { document } = helper.editor; let bbalance = 0, - pbalance = 0; + pbalance = 0; const afterSkip = skipWhile( direction, oldActive, (charCode) => { // TODO: Kak does not care about strings or ignoring braces in strings - // but maybe we should add a setting or an alternative command for that. + // but maybe we should add a setting or an alternative command for + // that. if (charCode === paren && pbalance === 0 && bbalance === 0) { return false; } else if (charCode === LPAREN) { @@ -834,9 +837,9 @@ function argumentObject() { } const toStart = toEdge(Backward, false), - toStartInner = toEdge(Backward, true), - toEnd = toEdge(Forward, false), - toEndInner = toEdge(Forward, true); + toStartInner = toEdge(Backward, true), + toEnd = toEdge(Forward, false), + toEndInner = toEdge(Forward, true); return objectActions(toStart, toEnd, toStartInner, toEndInner); } @@ -866,7 +869,8 @@ registerCommand( (editorState, state) => { if (!state.argument || !state.argument.object) { throw new Error( - "Argument must have shape {object: string, action: string, extend?: boolean, inner?: boolean}", + "Argument must have shape " + + "{object: string, action: string, extend?: boolean, inner?: boolean}", ); } const dispatch2 = dispatch[state.argument.object as keyof typeof dispatch]; diff --git a/src/commands/selections.ts b/src/commands/selections.ts index a96dfebc..68b89215 100644 --- a/src/commands/selections.ts +++ b/src/commands/selections.ts @@ -23,7 +23,7 @@ registerCommand(Command.selectionsReduce, CommandFlags.ChangeSelections, (editor registerCommand(Command.selectionsFlip, CommandFlags.ChangeSelections, ({ editor }) => { const selections = editor.selections, - len = selections.length; + len = selections.length; for (let i = 0; i < len; i++) { const selection = selections[i]; @@ -36,7 +36,7 @@ registerCommand(Command.selectionsFlip, CommandFlags.ChangeSelections, ({ editor registerCommand(Command.selectionsForward, CommandFlags.ChangeSelections, ({ editor }) => { const selections = editor.selections, - len = selections.length; + len = selections.length; for (let i = 0; i < len; i++) { const selection = selections[i]; @@ -51,7 +51,7 @@ registerCommand(Command.selectionsForward, CommandFlags.ChangeSelections, ({ edi registerCommand(Command.selectionsBackward, CommandFlags.ChangeSelections, ({ editor }) => { const selections = editor.selections, - len = selections.length; + len = selections.length; for (let i = 0; i < len; i++) { const selection = selections[i]; @@ -76,7 +76,7 @@ registerCommand(Command.selectionsAlign, CommandFlags.Edit, ({ editor }, _, undo return editor .edit((builder) => { const selections = editor.selections, - len = selections.length; + len = selections.length; for (let i = 0; i < len; i++) { const selection = selections[i]; @@ -95,7 +95,7 @@ registerCommand(Command.selectionsAlignCopy, CommandFlags.Edit, ({ editor }, sta return editor .edit((builder) => { const selections = editor.selections, - len = selections.length; + len = selections.length; for (let i = 0; i < len; i++) { if (i === sourceSelection.start.line) { @@ -143,9 +143,9 @@ registerCommand( () => "", ({ editor }, { input: regex }) => { const document = editor.document, - newSelections = editor.selections.filter((selection) => - regex.test(document.getText(selection)), - ); + newSelections = editor.selections.filter((selection) => + regex.test(document.getText(selection)), + ); if (newSelections.length > 0) { editor.selections = newSelections; @@ -160,9 +160,9 @@ registerCommand( () => "", ({ editor }, { input: regex }) => { const document = editor.document, - newSelections = editor.selections.filter( - (selection) => !regex.test(document.getText(selection)), - ); + newSelections = editor.selections.filter( + (selection) => !regex.test(document.getText(selection)), + ); if (newSelections.length > 0) { editor.selections = newSelections; @@ -180,13 +180,13 @@ registerCommand( () => "gm", ({ editor }, { input: regex }) => { const { document, selections } = editor, - len = selections.length, - newSelections = [] as vscode.Selection[]; + len = selections.length, + newSelections = [] as vscode.Selection[]; for (let i = 0; i < len; i++) { const selection = selections[i], - selectionText = document.getText(selection), - selectionStartOffset = document.offsetAt(selection.start); + selectionText = document.getText(selection), + selectionStartOffset = document.offsetAt(selection.start); let match: RegExpExecArray | null; @@ -215,13 +215,13 @@ registerCommand( () => "gm", ({ editor }, { input: regex }) => { const { document, selections } = editor, - len = selections.length, - newSelections = [] as vscode.Selection[]; + len = selections.length, + newSelections = [] as vscode.Selection[]; for (let i = 0; i < len; i++) { const selection = selections[i], - selectionText = document.getText(selection), - selectionStartOffset = document.offsetAt(selection.start); + selectionText = document.getText(selection), + selectionStartOffset = document.offsetAt(selection.start); let match: RegExpExecArray | null; let index = 0; @@ -253,8 +253,8 @@ registerCommand( registerCommand(Command.splitLines, CommandFlags.ChangeSelections, ({ editor }) => { const selections = editor.selections, - len = selections.length, - newSelections = [] as vscode.Selection[]; + len = selections.length, + newSelections = [] as vscode.Selection[]; for (let i = 0; i < len; i++) { const selection = selections[i]; @@ -266,12 +266,12 @@ registerCommand(Command.splitLines, CommandFlags.ChangeSelections, ({ editor }) } const startLine = selection.start.line, - startIndex = newSelections.length, - isReversed = selection.isReversed; + startIndex = newSelections.length, + isReversed = selection.isReversed; // Compute end line. const endAnchor = selection.end.with(undefined, 0), - endActive = selection.end; + endActive = selection.end; const endSelection = new vscode.Selection(endAnchor, endActive); @@ -286,7 +286,7 @@ registerCommand(Command.splitLines, CommandFlags.ChangeSelections, ({ editor }) // Add intermediate lines. for (let line = startLine + 1; line < selection.end.line; line++) { const anchor = new vscode.Position(line, 0), - active = new vscode.Position(line, Number.MAX_SAFE_INTEGER); + active = new vscode.Position(line, Number.MAX_SAFE_INTEGER); newSelections.unshift(new vscode.Selection(anchor, active)); } @@ -307,13 +307,13 @@ registerCommand(Command.splitLines, CommandFlags.ChangeSelections, ({ editor }) registerCommand(Command.selectFirstLast, CommandFlags.ChangeSelections, ({ editor }) => { const { document, selections } = editor, - len = selections.length, - newSelections = [] as vscode.Selection[]; + len = selections.length, + newSelections = [] as vscode.Selection[]; for (let i = 0; i < len; i++) { const selection = selections[i], - selectionStartOffset = document.offsetAt(selection.start), - selectionEndOffset = document.offsetAt(selection.end); + selectionStartOffset = document.offsetAt(selection.start), + selectionEndOffset = document.offsetAt(selection.end); if (selectionEndOffset - selectionStartOffset < 2) { newSelections.push(selection); @@ -321,7 +321,7 @@ registerCommand(Command.selectFirstLast, CommandFlags.ChangeSelections, ({ edito // Select start character. { const start = selection.start, - end = document.positionAt(document.offsetAt(start) + 1); + end = document.positionAt(document.offsetAt(start) + 1); newSelections.push(new vscode.Selection(start, end)); } @@ -329,7 +329,7 @@ registerCommand(Command.selectFirstLast, CommandFlags.ChangeSelections, ({ edito // Select end character. { const end = selection.end, - start = document.positionAt(document.offsetAt(end) - 1); + start = document.positionAt(document.offsetAt(end) - 1); newSelections.push(new vscode.Selection(start, end)); } @@ -349,8 +349,8 @@ function tryCopySelection( newActiveLine: number, ) { const active = selection.active, - anchor = selection.anchor, - activeLine = selectionHelper.activeLine(selection); + anchor = selection.anchor, + activeLine = selectionHelper.activeLine(selection); if (activeLine === anchor.line) { const newLine = document.lineAt(newActiveLine); @@ -383,16 +383,16 @@ function tryCopySelection( } const newSelection = new vscode.Selection(anchor.with(newAnchorLine), active.with(newActiveLine)); - const hasOverlap = - !( - selection.start.line < newSelection.start.line || - (selection.end.line === newSelection.start.line && - selection.end.character < newSelection.start.character) - ) && - !( - newSelection.start.line < selection.start.line || - (newSelection.end.line === selection.start.line && - newSelection.end.character < selection.start.character) + const hasOverlap + = !( + selection.start.line < newSelection.start.line + || (selection.end.line === newSelection.start.line + && selection.end.character < newSelection.start.character) + ) + && !( + newSelection.start.line < selection.start.line + || (newSelection.end.line === selection.start.line + && newSelection.end.character < selection.start.character) ); if (hasOverlap) { @@ -408,15 +408,15 @@ function copySelections( direction: Direction, ) { const editor = editorState.editor, - selections = editor.selections, - len = selections.length, - document = editor.document, - lineCount = document.lineCount, - selectionHelper = SelectionHelper.for(editorState); + selections = editor.selections, + len = selections.length, + document = editor.document, + lineCount = document.lineCount, + selectionHelper = SelectionHelper.for(editorState); for (let i = 0; i < len; i++) { const selection = selections[i], - selectionActiveLine = selectionHelper.activeLine(selection); + selectionActiveLine = selectionHelper.activeLine(selection); for ( let i = 0, currentLine = selectionActiveLine + direction; diff --git a/src/commands/yankPaste.ts b/src/commands/yankPaste.ts index 89a5848b..fa7983e8 100644 --- a/src/commands/yankPaste.ts +++ b/src/commands/yankPaste.ts @@ -11,7 +11,7 @@ function getRegister(state: CommandState, ctx: Extension) { function deleteSelections(editor: vscode.TextEditor, undoStops: UndoStops) { return editor.edit((builder) => { const selections = editor.selections, - len = selections.length; + len = selections.length; for (let i = 0; i < len; i++) { builder.delete(selections[i]); @@ -82,7 +82,7 @@ async function getContentsToPaste( } const results = [] as string[], - yankedLength = yanked.length; + yankedLength = yanked.length; let i = 0; @@ -99,8 +99,8 @@ async function getContentsToPaste( registerCommand(Command.pasteAfter, CommandFlags.Edit, async (editorState, state, undoStops) => { const { editor, extension } = editorState, - selections = editor.selections, - selectionHelper = SelectionHelper.for(editorState, state); + selections = editor.selections, + selectionHelper = SelectionHelper.for(editorState, state); const contents = await getContentsToPaste(editor, state, extension); @@ -113,7 +113,7 @@ registerCommand(Command.pasteAfter, CommandFlags.Edit, async (editorState, state await editor.edit((builder) => { for (let i = 0; i < contents.length; i++) { const content = contents[i], - selection = selections[i]; + selection = selections[i]; if (content.endsWith("\n")) { builder.insert(new vscode.Position(selectionHelper.endLine(selection) + 1, 0), content); @@ -146,7 +146,7 @@ registerCommand( await editor.edit((builder) => { for (let i = 0; i < contents.length; i++) { const content = contents[i], - selection = editor.selections[i]; + selection = editor.selections[i]; if (content.endsWith("\n")) { builder.insert(selection.start.with(undefined, 0), content); @@ -163,19 +163,19 @@ registerCommand( CommandFlags.ChangeSelections | CommandFlags.Edit, async (editorState, state, undoStops) => { const { editor, extension } = editorState, - contents = await getContentsToPaste(editor, state, extension); + contents = await getContentsToPaste(editor, state, extension); if (contents === undefined) { return; } const reverseSelection = [] as boolean[], - selectionHelper = SelectionHelper.for(editorState, state); + selectionHelper = SelectionHelper.for(editorState, state); await editor.edit((builder) => { for (let i = 0; i < contents.length; i++) { const content = contents[i], - selection = editor.selections[i]; + selection = editor.selections[i]; if (content.endsWith("\n")) { builder.insert(selection.end.with(selectionHelper.endLine(selection) + 1, 0), content); @@ -187,7 +187,8 @@ registerCommand( } }, undoStops); - // Reverse selections that were empty, since they are now extended in the wrong way. + // Reverse selections that were empty, since they are now extended in the + // wrong way. for (let i = 0; i < contents.length; i++) { const content = contents[i]; @@ -217,7 +218,7 @@ registerCommand( await editor.edit((builder) => { for (let i = 0; i < contents.length; i++) { const content = contents[i], - selection = editor.selections[i]; + selection = editor.selections[i]; if (content.endsWith("\n")) { builder.replace(selection.start.with(undefined, 0), content); @@ -246,7 +247,7 @@ registerCommand( await editor.edit((builder) => { for (let i = 0; i < contents.length; i++) { const content = contents[i], - selection = editor.selections[i]; + selection = editor.selections[i]; builder.replace(selection, content); } diff --git a/src/registers.ts b/src/registers.ts index 97bbc789..c660be04 100644 --- a/src/registers.ts +++ b/src/registers.ts @@ -118,30 +118,30 @@ export class Registers { public get(key: string) { switch (key) { - case '"': - return this.dquote; - case "/": - return this.slash; - case "@": - return this.arobase; - case "^": - return this.caret; - case "|": - return this.pipe; - - case "%": - return this.percent; - case ".": - return this.dot; - case "#": - return this.hash; - case "_": - return this.underscore; - case ":": - return this.colon; - - default: - return this.alpha[key] || (this.alpha[key] = new GeneralPurposeRegister(key)); + case '"': + return this.dquote; + case "/": + return this.slash; + case "@": + return this.arobase; + case "^": + return this.caret; + case "|": + return this.pipe; + + case "%": + return this.percent; + case ".": + return this.dot; + case "#": + return this.hash; + case "_": + return this.underscore; + case ":": + return this.colon; + + default: + return this.alpha[key] || (this.alpha[key] = new GeneralPurposeRegister(key)); } } } diff --git a/src/state/document.ts b/src/state/document.ts index f7d35705..2f4ffae4 100644 --- a/src/state/document.ts +++ b/src/state/document.ts @@ -22,7 +22,8 @@ export class DocumentState { ) {} /** - * Disposes of the resources owned by and of the subscriptions of this instance. + * Disposes of the resources owned by and of the subscriptions of this + * instance. */ public dispose() { const editorStates = this._editorStates.splice(0); @@ -35,20 +36,22 @@ export class DocumentState { } /** - * Returns the `EditorState` of each known `vscode.TextEditor`, where `editor.document === this.document`. + * Returns the `EditorState` of each known `vscode.TextEditor`, where + * `editor.document === this.document`. */ public editorStates() { return this._editorStates as readonly EditorState[]; } /** - * Gets the `EditorState` for the given `vscode.TextEditor`, where `editor.document === this.document`. + * Gets the `EditorState` for the given `vscode.TextEditor`, where + * `editor.document === this.document`. */ public getEditorState(editor: vscode.TextEditor) { assert(editor.document === this.document); const editorStates = this._editorStates, - len = editorStates.length; + len = editorStates.length; for (let i = 0; i < len; i++) { const editorState = editorStates[i]; @@ -95,13 +98,13 @@ export class DocumentState { // ============================================================================================= /** - * Saves the given selection, tracking changes to the given document and updating - * the selection correspondingly over time. + * Saves the given selection, tracking changes to the given document and + * updating the selection correspondingly over time. */ public saveSelection(selection: vscode.Selection) { const anchorOffset = this.document.offsetAt(selection.anchor), - activeOffset = this.document.offsetAt(selection.active), - savedSelection = new SavedSelection(anchorOffset, activeOffset); + activeOffset = this.document.offsetAt(selection.active), + savedSelection = new SavedSelection(anchorOffset, activeOffset); this._savedSelections.push(savedSelection); @@ -140,7 +143,8 @@ export class DocumentState { } /** - * Adds the given changes to the history of the editor following the given command. + * Adds the given changes to the history of the editor following the given + * command. */ private recordChanges(changes: readonly vscode.TextDocumentContentChangeEvent[]) { this._lastCommand?.recordFollowingChanges(changes); @@ -153,10 +157,10 @@ export class DocumentState { for (let i = 0, len = changes.length; i < len; i++) { const change = changes[i], - savedSelection = new SavedSelection( - change.rangeOffset, - change.rangeOffset + change.rangeLength, - ); + savedSelection = new SavedSelection( + change.rangeOffset, + change.rangeOffset + change.rangeLength, + ); this._savedSelections.push(savedSelection); recordedChanges.push(new RecordedChange(savedSelection, change.text)); diff --git a/src/state/editor.ts b/src/state/editor.ts index 69321613..05c1d5ef 100644 --- a/src/state/editor.ts +++ b/src/state/editor.ts @@ -29,7 +29,9 @@ export class EditorState { /** Selections that we had before entering insert mode. */ private _insertModeSelections?: readonly SavedSelection[]; - /** Whether a selection change event should be expected while in insert mode. */ + /** + * Whether a selection change event should be expected while in insert mode. + */ private _expectSelectionChangeEvent = false; /** Whether the next selection change event should be ignored. */ @@ -91,20 +93,21 @@ export class EditorState { } /** - * Disposes of the resources owned by and of the subscriptions of this instance. + * Disposes of the resources owned by and of the subscriptions of this + * instance. */ public dispose() { const lineNumbering = vscode.workspace.getConfiguration("editor").get("lineNumbers"), - options = this._editor.options; + options = this._editor.options; - options.lineNumbers = - lineNumbering === "on" + options.lineNumbers + = lineNumbering === "on" ? vscode.TextEditorLineNumbersStyle.On : lineNumbering === "relative" - ? vscode.TextEditorLineNumbersStyle.Relative - : lineNumbering === "interval" - ? vscode.TextEditorLineNumbersStyle.Relative + 1 - : vscode.TextEditorLineNumbersStyle.Off; + ? vscode.TextEditorLineNumbersStyle.Relative + : lineNumbering === "interval" + ? vscode.TextEditorLineNumbersStyle.Relative + 1 + : vscode.TextEditorLineNumbersStyle.Off; this.clearDecorations(this.extension.normalMode.decorationType); this.clearDecorations(this.extension.insertMode.decorationType); @@ -138,7 +141,7 @@ export class EditorState { } const { insertMode, normalMode } = this.extension, - documentState = this.documentState; + documentState = this.documentState; this._mode = mode; @@ -147,8 +150,8 @@ export class EditorState { this.setDecorations(insertMode.decorationType); const selections = this.editor.selections, - documentState = this.documentState, - savedSelections = [] as SavedSelection[]; + documentState = this.documentState, + savedSelections = [] as SavedSelection[]; for (let i = 0, len = selections.length; i < len; i++) { savedSelections.push(documentState.saveSelection(selections[i])); @@ -163,8 +166,8 @@ export class EditorState { } else { if (this._insertModeSelections !== undefined && this._insertModeSelections.length > 0) { const savedSelections = this._insertModeSelections, - editorSelections = this._editor.selections, - document = this.documentState.document; + editorSelections = this._editor.selections, + document = this.documentState.document; assert(editorSelections.length === savedSelections.length); @@ -224,12 +227,13 @@ export class EditorState { } /** - * Called when `vscode.window.onDidChangeActiveTextEditor` is triggered with this editor. + * Called when `vscode.window.onDidChangeActiveTextEditor` is triggered with + * this editor. */ public onDidBecomeActive() { const { editor, mode } = this, - modeConfiguration = - mode === Mode.Insert ? this.extension.insertMode : this.extension.normalMode; + modeConfiguration + = mode === Mode.Insert ? this.extension.insertMode : this.extension.normalMode; if (mode === Mode.Insert) { this.extension.statusBarItem.text = "$(pencil) INSERT"; @@ -246,7 +250,8 @@ export class EditorState { } /** - * Called when `vscode.window.onDidChangeActiveTextEditor` is triggered with another editor. + * Called when `vscode.window.onDidChangeActiveTextEditor` is triggered with + * another editor. */ public onDidBecomeInactive() { if (this.mode === Mode.Awaiting) { @@ -277,13 +282,13 @@ export class EditorState { this.setDecorations(this.extension.insertMode.decorationType); // Update insert mode decorations that keep track of previous selections. - const mustDropSelections = - e.kind === vscode.TextEditorSelectionChangeKind.Command || - e.kind === vscode.TextEditorSelectionChangeKind.Mouse || - !this._expectSelectionChangeEvent; + const mustDropSelections + = e.kind === vscode.TextEditorSelectionChangeKind.Command + || e.kind === vscode.TextEditorSelectionChangeKind.Mouse + || !this._expectSelectionChangeEvent; const selectionStyle = this.extension.insertModeSelectionStyle, - decorationRanges = [] as vscode.Range[]; + decorationRanges = [] as vscode.Range[]; if (mustDropSelections) { this._insertModeSelections = []; @@ -329,7 +334,8 @@ export class EditorState { } /** - * Called when `vscode.workspace.onDidChangeTextDocument` is triggered on the document of the editor. + * Called when `vscode.workspace.onDidChangeTextDocument` is triggered on the + * document of the editor. */ public onDidChangeTextDocument(e: vscode.TextDocumentChangeEvent) { if (this._mode === Mode.Insert) { @@ -348,8 +354,8 @@ export class EditorState { for (const selection of remainingSelections) { if ( - selection.active.isEqual(change.range.start) || - selection.active.isEqual(change.range.end) + selection.active.isEqual(change.range.start) + || selection.active.isEqual(change.range.end) ) { remainingSelections.delete(selection); @@ -384,13 +390,13 @@ export class EditorState { } const editor = this._editor, - selection = editor.selection, - extension = this.extension; + selection = editor.selection, + extension = this.extension; if ( - selection.end.character === 0 && - selection.end.line > 0 && - extension.selectionBehavior === SelectionBehavior.Character + selection.end.character === 0 + && selection.end.line > 0 + && extension.selectionBehavior === SelectionBehavior.Character ) { editor.setDecorations(decorationType, [ new vscode.Range(selection.start, selection.end.with(selection.end.line - 1, 0)), @@ -398,8 +404,8 @@ export class EditorState { editor.options.cursorStyle = vscode.TextEditorCursorStyle.LineThin; } else { editor.setDecorations(decorationType, [selection]); - editor.options.cursorStyle = - this.mode === Mode.Insert + editor.options.cursorStyle + = this.mode === Mode.Insert ? extension.insertMode.cursorStyle : extension.normalMode.cursorStyle; } @@ -412,7 +418,8 @@ export class EditorState { private readonly _commands = [] as CommandState[]; /** - * The commands that were last used in this editor, from the earliest to the latest. + * The commands that were last used in this editor, from the earliest to the + * latest. */ public get recordedCommands() { return this._commands as readonly CommandState[]; @@ -446,18 +453,20 @@ export class EditorState { private normalizeTimeoutToken: NodeJS.Timeout | undefined = undefined; /** - * Whether selection changes should be ignored, therefore not automatically normalizing selections. + * Whether selection changes should be ignored, therefore not automatically + * normalizing selections. */ public ignoreSelectionChanges = false; /** - * Make all selections in the editor non-empty by selecting at least one character. + * Make all selections in the editor non-empty by selecting at least one + * character. */ public normalizeSelections() { if ( - this._mode !== Mode.Normal || - this.extension.selectionBehavior === SelectionBehavior.Caret || - this.ignoreSelectionChanges + this._mode !== Mode.Normal + || this.extension.selectionBehavior === SelectionBehavior.Caret + || this.ignoreSelectionChanges ) { return; } @@ -472,9 +481,9 @@ export class EditorState { const selection = editor.selections[i]; const isReversedOneCharacterSelection = selection.isSingleLine ? selection.anchor.character === selection.active.character + 1 - : selection.anchor.character === 0 && - selection.anchor.line === selection.active.line + 1 && - editor.document.lineAt(selection.active).text.length === selection.active.character; + : selection.anchor.character === 0 + && selection.anchor.line === selection.active.line + 1 + && editor.document.lineAt(selection.active).text.length === selection.active.character; if (isReversedOneCharacterSelection) { if (normalizedSelections === undefined) { @@ -494,10 +503,12 @@ export class EditorState { if (active.character >= editor.document.lineAt(active.line).range.end.character) { // Selection is at line end. Select line break. if (active.line === editor.document.lineCount - 1) { - // Selection is at the very end of the document as well. Select the last character instead. + // Selection is at the very end of the document as well. Select the + // last character instead. if (active.character === 0) { if (active.line === 0) { - // There is no character in this document, so we give up on normalizing. + // There is no character in this document, so we give up on + // normalizing. continue; } else { normalizedSelections.push( @@ -523,7 +534,8 @@ export class EditorState { // Move cursor forward. normalizedSelections.push(new vscode.Selection(active, active.translate(0, 1))); } else { - // Selection is at the very end of the document. Select the last character instead. + // Selection is at the very end of the document. Select the last + // character instead. normalizedSelections.push(new vscode.Selection(active.translate(0, -1), active)); } } diff --git a/src/state/extension.ts b/src/state/extension.ts index 91e6b842..a5c2b516 100644 --- a/src/state/extension.ts +++ b/src/state/extension.ts @@ -147,35 +147,55 @@ export class ModeConfiguration { private lineNumbersStringToLineNumbersStyle(lineNumbers: ModeConfiguration.LineNumbers) { switch (lineNumbers) { + case "on": + return vscode.TextEditorLineNumbersStyle.On; + case "off": + return vscode.TextEditorLineNumbersStyle.Off; + case "relative": + return vscode.TextEditorLineNumbersStyle.Relative; + case "inherit": + default: + const vscodeLineNumbers = vscode.workspace + .getConfiguration() + .get("editor.lineNumbers", "on"); + + switch (vscodeLineNumbers) { case "on": return vscode.TextEditorLineNumbersStyle.On; case "off": return vscode.TextEditorLineNumbersStyle.Off; case "relative": return vscode.TextEditorLineNumbersStyle.Relative; - case "inherit": + case "interval": // This is a real option but its not in vscode.d.ts + return 3; default: - const vscodeLineNumbers = vscode.workspace - .getConfiguration() - .get("editor.lineNumbers", "on"); - - switch (vscodeLineNumbers) { - case "on": - return vscode.TextEditorLineNumbersStyle.On; - case "off": - return vscode.TextEditorLineNumbersStyle.Off; - case "relative": - return vscode.TextEditorLineNumbersStyle.Relative; - case "interval": // This is a real option but its not in vscode.d.ts - return 3; - default: - return vscode.TextEditorLineNumbersStyle.On; - } + return vscode.TextEditorLineNumbersStyle.On; + } } } private cursorStyleStringToCursorStyle(cursorStyle: ModeConfiguration.CursorStyle) { switch (cursorStyle) { + case "block": + return vscode.TextEditorCursorStyle.Block; + case "block-outline": + return vscode.TextEditorCursorStyle.BlockOutline; + case "line": + return vscode.TextEditorCursorStyle.Line; + case "line-thin": + return vscode.TextEditorCursorStyle.LineThin; + case "underline": + return vscode.TextEditorCursorStyle.Underline; + case "underline-thin": + return vscode.TextEditorCursorStyle.UnderlineThin; + + case "inherit": + default: + const vscodeCursorStyle = vscode.workspace + .getConfiguration() + .get("editor.cursorStyle", "line"); + + switch (vscodeCursorStyle) { case "block": return vscode.TextEditorCursorStyle.Block; case "block-outline": @@ -188,29 +208,9 @@ export class ModeConfiguration { return vscode.TextEditorCursorStyle.Underline; case "underline-thin": return vscode.TextEditorCursorStyle.UnderlineThin; - - case "inherit": default: - const vscodeCursorStyle = vscode.workspace - .getConfiguration() - .get("editor.cursorStyle", "line"); - - switch (vscodeCursorStyle) { - case "block": - return vscode.TextEditorCursorStyle.Block; - case "block-outline": - return vscode.TextEditorCursorStyle.BlockOutline; - case "line": - return vscode.TextEditorCursorStyle.Line; - case "line-thin": - return vscode.TextEditorCursorStyle.LineThin; - case "underline": - return vscode.TextEditorCursorStyle.Underline; - case "underline-thin": - return vscode.TextEditorCursorStyle.UnderlineThin; - default: - return vscode.TextEditorCursorStyle.Line; - } + return vscode.TextEditorCursorStyle.Line; + } } } } @@ -251,7 +251,8 @@ export class Extension implements vscode.Disposable { public enabled: boolean = false; /** - * The `CancellationTokenSource` for cancellable operations running in this editor. + * The `CancellationTokenSource` for cancellable operations running in this + * editor. */ public cancellationTokenSource?: vscode.CancellationTokenSource; @@ -279,8 +280,8 @@ export class Extension implements vscode.Disposable { "selectionBehavior", "caret", (value) => { - this._selectionBehavior = - value === "caret" ? SelectionBehavior.Caret : SelectionBehavior.Character; + this._selectionBehavior + = value === "caret" ? SelectionBehavior.Caret : SelectionBehavior.Character; }, true, ); @@ -394,9 +395,8 @@ export class Extension implements vscode.Disposable { prevKey = seenKeyCodes.get(keyCode); if (prevKey) { - showValidationError( - `menu ${menuDisplay} has duplicate key '${key[i]}' (specified by '${prevKey}' and '${key}').`, - ); + showValidationError(`menu ${menuDisplay} has duplicate key '${key[i]}' ` + + `(specified by '${prevKey}' and '${key}').`); continue; } @@ -437,11 +437,13 @@ export class Extension implements vscode.Disposable { } /** - * Listen for changes to the specified preference and calls the given handler when a change occurs. + * Listen for changes to the specified preference and calls the given handler + * when a change occurs. * * Must be called in the constructor. * - * @param triggerNow If `true`, the handler will also be triggered immediately with the current value. + * @param triggerNow If `true`, the handler will also be triggered immediately + * with the current value. */ public observePreference( section: string, @@ -564,7 +566,7 @@ export class Extension implements vscode.Disposable { */ public *documentStates() { const documents = vscode.workspace.textDocuments, - len = documents.length; + len = documents.length; for (let i = 0; i < len; i++) { const documentState = this._documentStates.get(documents[i]); diff --git a/src/utils/charset.ts b/src/utils/charset.ts index 60f222dc..d7a170a3 100644 --- a/src/utils/charset.ts +++ b/src/utils/charset.ts @@ -4,9 +4,9 @@ import * as vscode from "vscode"; // == CHARACTER SETS =========================================================================== // =============================================================================================== -const blankCharacters = - "\r\n\t " + - String.fromCharCode( +const blankCharacters + = "\r\n\t " + + String.fromCharCode( 0xa0, 0x1680, 0x2000, @@ -45,7 +45,8 @@ export const enum CharSet { } /** - * Returns a string containing all the characters belonging to the given charset. + * Returns a string containing all the characters belonging to the given + * charset. */ export function getCharacters(charSet: CharSet, document: vscode.TextDocument) { let characters = ""; @@ -68,11 +69,12 @@ export function getCharacters(charSet: CharSet, document: vscode.TextDocument) { } /** - * Returns an array containing all the characters belonging to the given charset. + * Returns an array containing all the characters belonging to the given + * charset. */ export function getCharCodes(charSet: CharSet, document: vscode.TextDocument) { const characters = getCharacters(charSet, document), - charCodes = new Uint32Array(characters.length); + charCodes = new Uint32Array(characters.length); for (let i = 0; i < characters.length; i++) { charCodes[i] = characters.charCodeAt(i); @@ -82,7 +84,8 @@ export function getCharCodes(charSet: CharSet, document: vscode.TextDocument) { } /** - * Returns a function that tests whether a character belongs to the given charset. + * Returns a function that tests whether a character belongs to the given + * charset. */ export function getCharSetFunction(charSet: CharSet, document: vscode.TextDocument) { const charCodes = getCharCodes(charSet, document); diff --git a/src/utils/prompt.ts b/src/utils/prompt.ts index c2410212..8f893b88 100644 --- a/src/utils/prompt.ts +++ b/src/utils/prompt.ts @@ -22,7 +22,9 @@ export function promptRegex(flags?: string, cancellationToken?: vscode.Cancellat ).then((x) => x === undefined ? undefined : new RegExp(x, flags)); } -export function keypress(cancellationToken?: vscode.CancellationToken): Thenable { +export function keypress( + cancellationToken?: vscode.CancellationToken, +): Thenable { return new Promise((resolve, reject) => { try { let done = false; @@ -44,9 +46,8 @@ export function keypress(cancellationToken?: vscode.CancellationToken): Thenable } }); } catch { - reject( - new Error('Unable to listen to keyboard events; is an extension overriding the "type" command (e.g VSCodeVim)?'), - ); + reject(new Error("Unable to listen to keyboard events; is an extension " + + 'overriding the "type" command (e.g VSCodeVim)?')); } }); } @@ -69,7 +70,7 @@ export function promptInList( ): Thenable { return new Promise((resolve) => { const quickPick = vscode.window.createQuickPick(), - quickPickItems = [] as vscode.QuickPickItem[]; + quickPickItems = [] as vscode.QuickPickItem[]; let isCaseSignificant = false; diff --git a/src/utils/savedSelection.ts b/src/utils/savedSelection.ts index 78aba2f2..fdce14ef 100644 --- a/src/utils/savedSelection.ts +++ b/src/utils/savedSelection.ts @@ -53,7 +53,7 @@ export class SavedSelection { */ public updateAfterDocumentChanged(e: vscode.TextDocumentContentChangeEvent) { const diff = e.text.length - e.rangeLength, - offset = e.rangeOffset + e.rangeLength; + offset = e.rangeOffset + e.rangeLength; if (offset <= this._activeOffset) { this._activeOffset += diff; diff --git a/src/utils/selectionHelper.ts b/src/utils/selectionHelper.ts index 55601e55..9a823e13 100644 --- a/src/utils/selectionHelper.ts +++ b/src/utils/selectionHelper.ts @@ -54,10 +54,10 @@ export class SelectionHelper456 ==(to 4)==> 01|234>56 // Need to increment to include the the symbol at `to`. @@ -160,8 +160,8 @@ export class SelectionHelper 01<234|5 // Include the symbol at `to`. @@ -241,9 +241,9 @@ export class SelectionHelper", "|"]; + endOffset = document.offsetAt(selection.end), + [startString, endString] = selection.isReversed ? ["|", "<"] : [">", "|"]; if (selection.isEmpty) { return content.substring(0, startOffset) + "|" + content.substring(startOffset); } else { return ( - content.substring(0, startOffset) + - startString + - content.substring(startOffset, endOffset) + - endString + - content.substring(endOffset) + content.substring(0, startOffset) + + startString + + content.substring(startOffset, endOffset) + + endString + + content.substring(endOffset) ); } } @@ -127,15 +127,15 @@ async function testCommands( // Execute commands. for (let i = 0; i < commands.length; i++) { const command = commands[i]; - const { command: commandName, args } = - typeof command === "string" ? { command, args: [] } : command; + const { command: commandName, args } + = typeof command === "string" ? { command, args: [] } : command; const promise = vscode.commands.executeCommand(commandName, ...args); while ( - i < commands.length - 1 && - typeof commands[i + 1] === "string" && - (commands[i + 1] as string).startsWith("type:") + i < commands.length - 1 + && typeof commands[i + 1] === "string" + && (commands[i + 1] as string).startsWith("type:") ) { await new Promise((resolve) => { setTimeout(() => { @@ -169,7 +169,8 @@ async function testCommands( assert.strictEqual( editor.selections.length, expectedSelections.length, - `${prefix}Expected ${expectedSelections.length} selection(s), but had ${editor.selections.length}.`, + `${prefix}Expected ${expectedSelections.length} selection(s), ` + + `but had ${editor.selections.length}.`, ); for (let i = 0; i < expectedSelections.length; i++) { @@ -189,7 +190,8 @@ async function testCommands( assert.deepStrictEqual( editor.selections[i], expectedSelections[i], - `(Actual Selection #${i} is at same spots in document as expected, but with different numbers)`, + `(Actual Selection #${i} is at same spots in document as expected, ` + + `but with different numbers)`, ); assert.fail(); } @@ -224,8 +226,8 @@ suite("Running commands", function () { }); } catch (err) { if ( - err instanceof Error && - err.message === `Expected Selection #0 to match ('>' is anchor, '|' is cursor).` + err instanceof Error + && err.message === `Expected Selection #0 to match ('>' is anchor, '|' is cursor).` ) { return; } @@ -237,11 +239,11 @@ suite("Running commands", function () { }); const basedir = this.file!.replace("\\out\\", "\\").replace("/out/", "/").replace(".test.js", ""), - fileNames = fs.readdirSync(basedir), - longestFileName = fileNames.reduce((longest, curr) => - curr.length > longest.length ? curr : longest, - ), - fileNamePadding = longestFileName.length; + fileNames = fs.readdirSync(basedir), + longestFileName = fileNames.reduce((longest, curr) => + curr.length > longest.length ? curr : longest, + ), + fileNamePadding = longestFileName.length; for (const file of fileNames) { const fullPath = path.join(basedir, file.padEnd(fileNamePadding)); @@ -279,7 +281,7 @@ suite("Running commands", function () { // Run all tests in the file. for (let i = 1; i < sections.length; i += 2) { const metadata = sections[i], - content = sections[i + 1]; + content = sections[i + 1]; const [full, from, to] = /^\/\/== ([\w.]+)(?: > ([\w.]+))?$/m.exec(metadata)!; const commands = metadata diff --git a/yarn.lock b/yarn.lock index 702d9f42..4c1655dc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,10 +2,10 @@ # yarn lockfile v1 -"@babel/code-frame@^7.0.0": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.10.4.tgz#168da1a36e90da68ae8d49c0f1b48c7c6249213a" - integrity sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg== +"@babel/code-frame@7.12.11": + version "7.12.11" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.12.11.tgz#f4ad435aa263db935b8f10f2c552d23fb716a63f" + integrity sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw== dependencies: "@babel/highlight" "^7.10.4" @@ -23,10 +23,10 @@ chalk "^2.0.0" js-tokens "^4.0.0" -"@eslint/eslintrc@^0.1.3": - version "0.1.3" - resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.1.3.tgz#7d1a2b2358552cc04834c0979bd4275362e37085" - integrity sha512-4YVwPkANLeNtRjMekzux1ci8hIaH5eGKktGqR0d3LWsKNn5B2X/1Z6Trxy7jQXl9EBGE6Yj02O+t09FMeRllaA== +"@eslint/eslintrc@^0.4.0": + version "0.4.0" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.4.0.tgz#99cc0a0584d72f1df38b900fb062ba995f395547" + integrity sha512-2ZPCc+uNbjV5ERJr+aKSPRwZgKd2z11x0EgLvb1PURmUrn9QNRXFqje0Ldq454PfAVyaJYyrDvvIKSFP4NnBog== dependencies: ajv "^6.12.4" debug "^4.1.1" @@ -35,7 +35,6 @@ ignore "^4.0.6" import-fresh "^3.2.1" js-yaml "^3.13.1" - lodash "^4.17.19" minimatch "^3.0.4" strip-json-comments "^3.1.1" @@ -98,84 +97,79 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-14.6.0.tgz#7d4411bf5157339337d7cff864d9ff45f177b499" integrity sha512-mikldZQitV94akrc4sCcSjtJfsTKt4p+e/s0AGscVA6XArQ9kFclP+ZiYUMnq987rc6QlYxXv/EivqlfSLxpKA== -"@types/prettier@^2.1.2": - version "2.1.2" - resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.1.2.tgz#4929992f87a0129f4960a110faeb526210562e7b" - integrity sha512-IiPhNnenzkqdSdQH3ifk9LoX7oQe61ZlDdDO4+MUv6FyWdPGDPr26gCPVs3oguZEMq//nFZZpwUZcVuNJsG+DQ== - "@types/vscode@^1.44.0": version "1.48.0" resolved "https://registry.yarnpkg.com/@types/vscode/-/vscode-1.48.0.tgz#c1841ccf80086d53b35a9d7f2eb3b4d949bd2d2f" integrity sha512-sZJKzsJz1gSoFXcOJWw3fnKl2sseUgZmvB4AJZS+Fea+bC/jfGPVhmFL/FfQHld/TKtukVONsmoD3Pkyx9iadg== -"@typescript-eslint/eslint-plugin@^4.4.1": - version "4.4.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.4.1.tgz#b8acea0373bd2a388ac47df44652f00bf8b368f5" - integrity sha512-O+8Utz8pb4OmcA+Nfi5THQnQpHSD2sDUNw9AxNHpuYOo326HZTtG8gsfT+EAYuVrFNaLyNb2QnUNkmTRDskuRA== +"@typescript-eslint/eslint-plugin@^4.18.0": + version "4.18.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.18.0.tgz#50fbce93211b5b690895d20ebec6fe8db48af1f6" + integrity sha512-Lzkc/2+7EoH7+NjIWLS2lVuKKqbEmJhtXe3rmfA8cyiKnZm3IfLf51irnBcmow8Q/AptVV0XBZmBJKuUJTe6cQ== dependencies: - "@typescript-eslint/experimental-utils" "4.4.1" - "@typescript-eslint/scope-manager" "4.4.1" + "@typescript-eslint/experimental-utils" "4.18.0" + "@typescript-eslint/scope-manager" "4.18.0" debug "^4.1.1" functional-red-black-tree "^1.0.1" + lodash "^4.17.15" regexpp "^3.0.0" semver "^7.3.2" tsutils "^3.17.1" -"@typescript-eslint/experimental-utils@4.4.1": - version "4.4.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.4.1.tgz#40613b9757fa0170de3e0043254dbb077cafac0c" - integrity sha512-Nt4EVlb1mqExW9cWhpV6pd1a3DkUbX9DeyYsdoeziKOpIJ04S2KMVDO+SEidsXRH/XHDpbzXykKcMTLdTXH6cQ== +"@typescript-eslint/experimental-utils@4.18.0": + version "4.18.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.18.0.tgz#ed6c955b940334132b17100d2917449b99a91314" + integrity sha512-92h723Kblt9JcT2RRY3QS2xefFKar4ZQFVs3GityOKWQYgtajxt/tuXIzL7sVCUlM1hgreiV5gkGYyBpdOwO6A== dependencies: "@types/json-schema" "^7.0.3" - "@typescript-eslint/scope-manager" "4.4.1" - "@typescript-eslint/types" "4.4.1" - "@typescript-eslint/typescript-estree" "4.4.1" + "@typescript-eslint/scope-manager" "4.18.0" + "@typescript-eslint/types" "4.18.0" + "@typescript-eslint/typescript-estree" "4.18.0" eslint-scope "^5.0.0" eslint-utils "^2.0.0" -"@typescript-eslint/parser@^4.4.1": - version "4.4.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-4.4.1.tgz#25fde9c080611f303f2f33cedb145d2c59915b80" - integrity sha512-S0fuX5lDku28Au9REYUsV+hdJpW/rNW0gWlc4SXzF/kdrRaAVX9YCxKpziH7djeWT/HFAjLZcnY7NJD8xTeUEg== +"@typescript-eslint/parser@^4.18.0": + version "4.18.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-4.18.0.tgz#a211edb14a69fc5177054bec04c95b185b4dde21" + integrity sha512-W3z5S0ZbecwX3PhJEAnq4mnjK5JJXvXUDBYIYGoweCyWyuvAKfGHvzmpUzgB5L4cRBb+cTu9U/ro66dx7dIimA== dependencies: - "@typescript-eslint/scope-manager" "4.4.1" - "@typescript-eslint/types" "4.4.1" - "@typescript-eslint/typescript-estree" "4.4.1" + "@typescript-eslint/scope-manager" "4.18.0" + "@typescript-eslint/types" "4.18.0" + "@typescript-eslint/typescript-estree" "4.18.0" debug "^4.1.1" -"@typescript-eslint/scope-manager@4.4.1": - version "4.4.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.4.1.tgz#d19447e60db2ce9c425898d62fa03b2cce8ea3f9" - integrity sha512-2oD/ZqD4Gj41UdFeWZxegH3cVEEH/Z6Bhr/XvwTtGv66737XkR4C9IqEkebCuqArqBJQSj4AgNHHiN1okzD/wQ== +"@typescript-eslint/scope-manager@4.18.0": + version "4.18.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.18.0.tgz#d75b55234c35d2ff6ac945758d6d9e53be84a427" + integrity sha512-olX4yN6rvHR2eyFOcb6E4vmhDPsfdMyfQ3qR+oQNkAv8emKKlfxTWUXU5Mqxs2Fwe3Pf1BoPvrwZtwngxDzYzQ== dependencies: - "@typescript-eslint/types" "4.4.1" - "@typescript-eslint/visitor-keys" "4.4.1" + "@typescript-eslint/types" "4.18.0" + "@typescript-eslint/visitor-keys" "4.18.0" -"@typescript-eslint/types@4.4.1": - version "4.4.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.4.1.tgz#c507b35cf523bc7ba00aae5f75ee9b810cdabbc1" - integrity sha512-KNDfH2bCyax5db+KKIZT4rfA8rEk5N0EJ8P0T5AJjo5xrV26UAzaiqoJCxeaibqc0c/IvZxp7v2g3difn2Pn3w== +"@typescript-eslint/types@4.18.0": + version "4.18.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.18.0.tgz#bebe323f81f2a7e2e320fac9415e60856267584a" + integrity sha512-/BRociARpj5E+9yQ7cwCF/SNOWwXJ3qhjurMuK2hIFUbr9vTuDeu476Zpu+ptxY2kSxUHDGLLKy+qGq2sOg37A== -"@typescript-eslint/typescript-estree@4.4.1": - version "4.4.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.4.1.tgz#598f6de488106c2587d47ca2462c60f6e2797cb8" - integrity sha512-wP/V7ScKzgSdtcY1a0pZYBoCxrCstLrgRQ2O9MmCUZDtmgxCO/TCqOTGRVwpP4/2hVfqMz/Vw1ZYrG8cVxvN3g== +"@typescript-eslint/typescript-estree@4.18.0": + version "4.18.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.18.0.tgz#756d3e61da8c16ab99185532c44872f4cd5538cb" + integrity sha512-wt4xvF6vvJI7epz+rEqxmoNQ4ZADArGQO9gDU+cM0U5fdVv7N+IAuVoVAoZSOZxzGHBfvE3XQMLdy+scsqFfeg== dependencies: - "@typescript-eslint/types" "4.4.1" - "@typescript-eslint/visitor-keys" "4.4.1" + "@typescript-eslint/types" "4.18.0" + "@typescript-eslint/visitor-keys" "4.18.0" debug "^4.1.1" globby "^11.0.1" is-glob "^4.0.1" - lodash "^4.17.15" semver "^7.3.2" tsutils "^3.17.1" -"@typescript-eslint/visitor-keys@4.4.1": - version "4.4.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.4.1.tgz#1769dc7a9e2d7d2cfd3318b77ed8249187aed5c3" - integrity sha512-H2JMWhLaJNeaylSnMSQFEhT/S/FsJbebQALmoJxMPMxLtlVAMy2uJP/Z543n9IizhjRayLSqoInehCeNW9rWcw== +"@typescript-eslint/visitor-keys@4.18.0": + version "4.18.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.18.0.tgz#4e6fe2a175ee33418318a029610845a81e2ff7b6" + integrity sha512-Q9t90JCvfYaN0OfFUgaLqByOfz8yPeTAdotn/XYNm5q9eHax90gzdb+RJ6E9T5s97Kv/UHWKERTmqA0jTKAEHw== dependencies: - "@typescript-eslint/types" "4.4.1" + "@typescript-eslint/types" "4.18.0" eslint-visitor-keys "^2.0.0" acorn-jsx@^5.2.0: @@ -183,6 +177,11 @@ acorn-jsx@^5.2.0: resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.2.0.tgz#4c66069173d6fdd68ed85239fc256226182b2ebe" integrity sha512-HiUX/+K2YpkpJ+SzBffkM/AQ2YE03S0U1kjTLVpoJdhZMOWy8qvXVN9JdLqv2QsaQ6MPYQIuNmwD8zOiYUofLQ== +acorn-jsx@^5.3.1: + version "5.3.1" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.1.tgz#fc8661e11b7ac1539c47dbfea2e72b3af34d267b" + integrity sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng== + acorn@^7.4.0: version "7.4.1" resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" @@ -195,7 +194,7 @@ agent-base@4, agent-base@^4.3.0: dependencies: es6-promisify "^5.0.0" -ajv@^6.10.0, ajv@^6.10.2: +ajv@^6.10.0: version "6.12.4" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.4.tgz#0614facc4522127fa713445c6bfd3ebd376e2234" integrity sha512-eienB2c9qVQs2KWexhkrdMLVDoIQCz5KSeLxwg9Lzk4DOfBtIK9PQwwufcsn1jjGuf9WZmqPMbGxOzfcuphJCQ== @@ -215,6 +214,16 @@ ajv@^6.12.4: json-schema-traverse "^0.4.1" uri-js "^4.2.2" +ajv@^7.0.2: + version "7.2.1" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-7.2.1.tgz#a5ac226171912447683524fa2f1248fcf8bac83d" + integrity sha512-+nu0HDv7kNSOua9apAVc979qd932rrZeb3WOvoiD31A/p1mIE5/9bN2027pE2rOPYEdS3UHzsvof4hY+lM9/WQ== + dependencies: + fast-deep-equal "^3.1.1" + json-schema-traverse "^1.0.0" + require-from-string "^2.0.2" + uri-js "^4.2.2" + ansi-colors@4.1.1, ansi-colors@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348" @@ -242,6 +251,13 @@ ansi-styles@^3.2.0, ansi-styles@^3.2.1: dependencies: color-convert "^1.9.0" +ansi-styles@^4.0.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" + integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== + dependencies: + color-convert "^2.0.1" + ansi-styles@^4.1.0: version "4.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.2.1.tgz#90ae75c424d008d2624c5bf29ead3177ebfcf359" @@ -285,10 +301,10 @@ array.prototype.map@^1.0.1: es-array-method-boxes-properly "^1.0.0" is-string "^1.0.4" -astral-regex@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9" - integrity sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg== +astral-regex@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31" + integrity sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ== azure-devops-node-api@^7.2.0: version "7.2.0" @@ -432,16 +448,21 @@ color-name@~1.1.4: resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== -commander@^2.8.1: - version "2.20.3" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" - integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== +commander@^6.1.0: + version "6.2.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-6.2.1.tgz#0792eb682dfbc325999bb2b84fddddba110ac73c" + integrity sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA== concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= +create-require@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" + integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== + cross-spawn@^7.0.2: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" @@ -582,6 +603,11 @@ emoji-regex@^7.0.1: resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" integrity sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA== +emoji-regex@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" + integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== + enquirer@^2.3.5: version "2.3.6" resolved "https://registry.yarnpkg.com/enquirer/-/enquirer-2.3.6.tgz#2a7fe5dd634a1e4125a975ec994ff5456dc3734d" @@ -693,13 +719,13 @@ eslint-visitor-keys@^2.0.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz#21fdc8fbcd9c795cc0321f0563702095751511a8" integrity sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ== -eslint@^7.11.0: - version "7.11.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.11.0.tgz#aaf2d23a0b5f1d652a08edacea0c19f7fadc0b3b" - integrity sha512-G9+qtYVCHaDi1ZuWzBsOWo2wSwd70TXnU6UHA3cTYHp7gCTXZcpggWFoUVAMRarg68qtPoNfFbzPh+VdOgmwmw== +eslint@^7.22.0: + version "7.22.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.22.0.tgz#07ecc61052fec63661a2cab6bd507127c07adc6f" + integrity sha512-3VawOtjSJUQiiqac8MQc+w457iGLfuNGLFn8JmF051tTKbh5/x/0vlcEj8OgDCaw7Ysa2Jn8paGshV7x2abKXg== dependencies: - "@babel/code-frame" "^7.0.0" - "@eslint/eslintrc" "^0.1.3" + "@babel/code-frame" "7.12.11" + "@eslint/eslintrc" "^0.4.0" ajv "^6.10.0" chalk "^4.0.0" cross-spawn "^7.0.2" @@ -709,13 +735,13 @@ eslint@^7.11.0: eslint-scope "^5.1.1" eslint-utils "^2.1.0" eslint-visitor-keys "^2.0.0" - espree "^7.3.0" - esquery "^1.2.0" + espree "^7.3.1" + esquery "^1.4.0" esutils "^2.0.2" - file-entry-cache "^5.0.1" + file-entry-cache "^6.0.1" functional-red-black-tree "^1.0.1" glob-parent "^5.0.0" - globals "^12.1.0" + globals "^13.6.0" ignore "^4.0.6" import-fresh "^3.0.0" imurmurhash "^0.1.4" @@ -723,7 +749,7 @@ eslint@^7.11.0: js-yaml "^3.13.1" json-stable-stringify-without-jsonify "^1.0.1" levn "^0.4.1" - lodash "^4.17.19" + lodash "^4.17.21" minimatch "^3.0.4" natural-compare "^1.4.0" optionator "^0.9.1" @@ -732,7 +758,7 @@ eslint@^7.11.0: semver "^7.2.1" strip-ansi "^6.0.0" strip-json-comments "^3.1.0" - table "^5.2.3" + table "^6.0.4" text-table "^0.2.0" v8-compile-cache "^2.0.3" @@ -745,15 +771,24 @@ espree@^7.3.0: acorn-jsx "^5.2.0" eslint-visitor-keys "^1.3.0" +espree@^7.3.1: + version "7.3.1" + resolved "https://registry.yarnpkg.com/espree/-/espree-7.3.1.tgz#f2df330b752c6f55019f8bd89b7660039c1bbbb6" + integrity sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g== + dependencies: + acorn "^7.4.0" + acorn-jsx "^5.3.1" + eslint-visitor-keys "^1.3.0" + esprima@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== -esquery@^1.2.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.3.1.tgz#b78b5828aa8e214e29fb74c4d5b752e1c033da57" - integrity sha512-olpvt9QG0vniUBZspVRN6lwB7hOZoTRtT+jzR+tS4ffYx2mzbw+z0XCOk44aaLYKApNX5nMm+E+P6o25ip/DHQ== +esquery@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.4.0.tgz#2148ffc38b82e8c7057dfed48425b3e61f0f24a5" + integrity sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w== dependencies: estraverse "^5.1.0" @@ -827,12 +862,12 @@ fd-slicer@~1.1.0: dependencies: pend "~1.2.0" -file-entry-cache@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-5.0.1.tgz#ca0f6efa6dd3d561333fb14515065c2fafdf439c" - integrity sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g== +file-entry-cache@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" + integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg== dependencies: - flat-cache "^2.0.1" + flat-cache "^3.0.4" fill-range@^7.0.1: version "7.0.1" @@ -856,14 +891,13 @@ find-up@^3.0.0: dependencies: locate-path "^3.0.0" -flat-cache@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-2.0.1.tgz#5d296d6f04bda44a4630a301413bdbc2ec085ec0" - integrity sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA== +flat-cache@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11" + integrity sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg== dependencies: - flatted "^2.0.0" - rimraf "2.6.3" - write "1.0.3" + flatted "^3.1.0" + rimraf "^3.0.2" flat@^4.1.0: version "4.1.0" @@ -872,10 +906,10 @@ flat@^4.1.0: dependencies: is-buffer "~2.0.3" -flatted@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.2.tgz#4575b21e2bcee7434aa9be662f4b7b5f9c2b5138" - integrity sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA== +flatted@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.1.1.tgz#c4b489e80096d9df1dfc97c79871aea7c617c469" + integrity sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA== fs.realpath@^1.0.0: version "1.0.0" @@ -928,6 +962,13 @@ globals@^12.1.0: dependencies: type-fest "^0.8.1" +globals@^13.6.0: + version "13.7.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-13.7.0.tgz#aed3bcefd80ad3ec0f0be2cf0c895110c0591795" + integrity sha512-Aipsz6ZKRxa/xQkZhNg0qIWXT6x6rD46f6x/PCnBomlttdIyAPak4YD9jTmKpZ72uROSMU87qJtcgpgHaVchiA== + dependencies: + type-fest "^0.20.2" + globby@^11.0.1: version "11.0.1" resolved "https://registry.yarnpkg.com/globby/-/globby-11.0.1.tgz#9a2bf107a068f3ffeabc49ad702c79ede8cfd357" @@ -1073,6 +1114,11 @@ is-fullwidth-code-point@^2.0.0: resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= +is-fullwidth-code-point@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" + integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== + is-glob@^4.0.0, is-glob@^4.0.1, is-glob@~4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc" @@ -1168,6 +1214,11 @@ json-schema-traverse@^0.4.1: resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== +json-schema-traverse@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz#ae7bcb3656ab77a73ba5c49bf654f38e6b6860e2" + integrity sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug== + json-stable-stringify-without-jsonify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" @@ -1208,11 +1259,16 @@ locate-path@^5.0.0: dependencies: p-locate "^4.1.0" -lodash@^4.15.0, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19: +lodash@^4.15.0, lodash@^4.17.15: version "4.17.20" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52" integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA== +lodash@^4.17.20, lodash@^4.17.21: + version "4.17.21" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" + integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== + log-symbols@3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-3.0.0.tgz#f3a08516a5dea893336a7dee14d18a1cfdab77c4" @@ -1266,18 +1322,6 @@ minimatch@3.0.4, minimatch@^3.0.3, minimatch@^3.0.4: dependencies: brace-expansion "^1.1.7" -minimist@^1.2.5: - version "1.2.5" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" - integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== - -mkdirp@^0.5.1: - version "0.5.5" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.5.tgz#d91cefd62d1436ca0f41620e251288d420099def" - integrity sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ== - dependencies: - minimist "^1.2.5" - mocha@^8.1.1: version "8.1.1" resolved "https://registry.yarnpkg.com/mocha/-/mocha-8.1.1.tgz#1de1ba4e9a2c955d96b84e469d7540848223592d" @@ -1490,11 +1534,6 @@ prelude-ls@^1.2.1: resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== -prettier@^2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.1.2.tgz#3050700dae2e4c8b67c4c3f666cdb8af405e1ce5" - integrity sha512-16c7K+x4qVlJg9rEbXl7HEGmQyZlG4R9AgP+oHKRMsMsuk8s+ATStlf1NpDqyBI1HpVyfjLOeMhH2LvuNvV5Vg== - progress@^2.0.0: version "2.0.3" resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" @@ -1556,6 +1595,11 @@ require-directory@^2.1.1: resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= +require-from-string@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" + integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== + require-main-filename@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" @@ -1571,13 +1615,6 @@ reusify@^1.0.4: resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== -rimraf@2.6.3: - version "2.6.3" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" - integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA== - dependencies: - glob "^7.1.3" - rimraf@^2.6.3: version "2.7.1" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" @@ -1585,6 +1622,13 @@ rimraf@^2.6.3: dependencies: glob "^7.1.3" +rimraf@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" + integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== + dependencies: + glob "^7.1.3" + run-parallel@^1.1.9: version "1.1.9" resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.1.9.tgz#c9dd3a7cf9f4b2c4b6244e173a6ed866e61dd679" @@ -1634,14 +1678,14 @@ slash@^3.0.0: resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== -slice-ansi@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-2.1.0.tgz#cacd7693461a637a5788d92a7dd4fba068e81636" - integrity sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ== +slice-ansi@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-4.0.0.tgz#500e8dd0fd55b05815086255b3195adf2a45fe6b" + integrity sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ== dependencies: - ansi-styles "^3.2.0" - astral-regex "^1.0.0" - is-fullwidth-code-point "^2.0.0" + ansi-styles "^4.0.0" + astral-regex "^2.0.0" + is-fullwidth-code-point "^3.0.0" source-map-support@^0.5.17, source-map-support@^0.5.19: version "0.5.19" @@ -1678,6 +1722,15 @@ string-width@^3.0.0, string-width@^3.1.0: is-fullwidth-code-point "^2.0.0" strip-ansi "^5.1.0" +string-width@^4.2.0: + version "4.2.2" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.2.tgz#dafd4f9559a7585cfba529c6a0a4f73488ebd4c5" + integrity sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.0" + string.prototype.trimend@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.1.tgz#85812a6b847ac002270f5808146064c995fb6913" @@ -1746,15 +1799,15 @@ supports-color@^5.3.0: dependencies: has-flag "^3.0.0" -table@^5.2.3: - version "5.4.6" - resolved "https://registry.yarnpkg.com/table/-/table-5.4.6.tgz#1292d19500ce3f86053b05f0e8e7e4a3bb21079e" - integrity sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug== +table@^6.0.4: + version "6.0.7" + resolved "https://registry.yarnpkg.com/table/-/table-6.0.7.tgz#e45897ffbcc1bcf9e8a87bf420f2c9e5a7a52a34" + integrity sha512-rxZevLGTUzWna/qBLObOe16kB2RTnnbhciwgPbMMlazz1yZGVEgnZK762xyVdVznhqxrfCeBMmMkgOOaPwjH7g== dependencies: - ajv "^6.10.2" - lodash "^4.17.14" - slice-ansi "^2.1.0" - string-width "^3.0.0" + ajv "^7.0.2" + lodash "^4.17.20" + slice-ansi "^4.0.0" + string-width "^4.2.0" text-table@^0.2.0: version "0.2.0" @@ -1775,12 +1828,13 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" -ts-node@^8.9.1: - version "8.10.2" - resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-8.10.2.tgz#eee03764633b1234ddd37f8db9ec10b75ec7fb8d" - integrity sha512-ISJJGgkIpDdBhWVu3jufsWpK3Rzo7bdiIXJjQc0ynKxVOVcg2oIrf2H2cejminGrptVc6q6/uynAHNCuWGbpVA== +ts-node@^9.9.1: + version "9.1.1" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-9.1.1.tgz#51a9a450a3e959401bda5f004a72d54b936d376d" + integrity sha512-hPlt7ZACERQGf03M253ytLY3dHbGNGrAq9qIHWUY9XHYl1z7wYngSr3OQ5xmui8o2AaxsONxIzjafLUiWBo1Fg== dependencies: arg "^4.1.0" + create-require "^1.1.0" diff "^4.0.1" make-error "^1.1.1" source-map-support "^0.5.17" @@ -1810,6 +1864,11 @@ type-check@^0.4.0, type-check@~0.4.0: dependencies: prelude-ls "^1.2.1" +type-fest@^0.20.2: + version "0.20.2" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4" + integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== + type-fest@^0.8.1: version "0.8.1" resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" @@ -1823,10 +1882,10 @@ typed-rest-client@1.2.0: tunnel "0.0.4" underscore "1.8.3" -typescript@^4.0.2: - version "4.0.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.0.2.tgz#7ea7c88777c723c681e33bf7988be5d008d05ac2" - integrity sha512-e4ERvRV2wb+rRZ/IQeb3jm2VxBsirQLpQhdxplZ2MEzGvDkkMmPglecnNDfSUBivMjP93vRbngYYDQqQ/78bcQ== +typescript@^4.2.3: + version "4.2.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.2.3.tgz#39062d8019912d43726298f09493d598048c1ce3" + integrity sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw== uc.micro@^1.0.1, uc.micro@^1.0.5: version "1.0.6" @@ -1860,15 +1919,15 @@ v8-compile-cache@^2.0.3: resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz#54bc3cdd43317bca91e35dcaf305b1a7237de745" integrity sha512-8OQ9CL+VWyt3JStj7HX7/ciTL2V3Rl1Wf5OL+SNTm0yK1KvtReVulksyeRnCANHHuUxHlQig+JJDlUhBt1NQDQ== -vsce@^1.75.0: - version "1.78.0" - resolved "https://registry.yarnpkg.com/vsce/-/vsce-1.78.0.tgz#a0edad3c508df13e715a5b58d204baf4c1b0384c" - integrity sha512-4CIUTwhcU+RlQDW+GNKO6AhQ7aZJCzDA9A9r7j262LTd+NoCowE/bRV2pCII9peXMowIumTtk+Sz/pQ5Ng0VJQ== +vsce@^1.87.0: + version "1.87.0" + resolved "https://registry.yarnpkg.com/vsce/-/vsce-1.87.0.tgz#d592142c8781c984bc49dec60be940f9d26528e6" + integrity sha512-7Ow05XxIM4gHBq/Ho3hefdmiZG0fddHtu0M0XJ1sojyZBvxPxTHaMuBsRnfnMzgCqxDTFI5iLr94AgiwQnhOMQ== dependencies: azure-devops-node-api "^7.2.0" chalk "^2.4.2" cheerio "^1.0.0-rc.1" - commander "^2.8.1" + commander "^6.1.0" denodeify "^1.2.1" glob "^7.0.6" leven "^3.1.0" @@ -1938,13 +1997,6 @@ wrappy@1: resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= -write@1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/write/-/write-1.0.3.tgz#0800e14523b923a387e415123c865616aae0f5c3" - integrity sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig== - dependencies: - mkdirp "^0.5.1" - y18n@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b"