mirror of
https://github.com/VSCodeVim/Vim.git
synced 2024-11-20 11:22:16 +03:00
Add .prettierignore
and yarn prettier
command
This commit is contained in:
parent
210ad6b96d
commit
1d09e2a8b7
2
.prettierignore
Normal file
2
.prettierignore
Normal file
@ -0,0 +1,2 @@
|
||||
.vscode-test
|
||||
out
|
@ -1,6 +1,6 @@
|
||||
# Change Log
|
||||
|
||||
## ***NOTE: For versions 1.23.0 and newer, include the lastest changes; please see [CHANGELOG.md](CHANGELOG.md).***
|
||||
## **_NOTE: For versions 1.23.0 and newer, include the lastest changes; please see [CHANGELOG.md](CHANGELOG.md)._**
|
||||
|
||||
## [v1.22.2](https://github.com/vscodevim/vim/tree/v1.22.2) (2022-02-18)
|
||||
|
||||
|
22
README.md
22
README.md
@ -124,7 +124,7 @@ Below is an example of a [settings.json](https://code.visualstudio.com/Docs/cust
|
||||
These settings are specific to VSCodeVim.
|
||||
|
||||
| Setting | Description | Type | Default Value |
|
||||
| -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | ----------------------------------------- |
|
||||
| -------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | ------------------------------------------------------------- |
|
||||
| vim.changeWordIncludesWhitespace | Include trailing whitespace when changing word. This configures the <kbd>cw</kbd> action to act consistently as its siblings (<kbd>yw</kbd> and <kbd>dw</kbd>) instead of acting as <kbd>ce</kbd>. | Boolean | false |
|
||||
| vim.cursorStylePerMode._{Mode}_ | Configure a specific cursor style for _{Mode}_. Omitted modes will use [default cursor type](https://github.com/VSCodeVim/Vim/blob/4a6fde6dbd4d1fac1f204c0dc27c32883651ef1a/src/mode/mode.ts#L34) Supported cursors: line, block, underline, line-thin, block-outline, and underline-thin. | String | None |
|
||||
| vim.digraphs._{shorthand}_ | Set custom digraph shorthands that can override the default ones. Entries should map a two-character shorthand to a descriptive string and one or more UTF16 code points. Example: `"R!": ["🚀", [55357, 56960]]` | Object | `{"R!": ["🚀", [0xD83D, 0xDE80]]` |
|
||||
@ -399,29 +399,29 @@ It is highly recommended to remap keys using vim commands like `"vim.normalModeK
|
||||
|
||||
You can then add a new entry to the keybindings like so:
|
||||
|
||||
```json
|
||||
{
|
||||
```json
|
||||
{
|
||||
"key": "YOUR_KEY_COMBINATION",
|
||||
"command": "vim.remap",
|
||||
"when": "inputFocus && vim.mode == 'VIM_MODE_YOU_WANT_TO_REBIND'",
|
||||
"args": {
|
||||
"after": ["YOUR_VIM_ACTION"]
|
||||
}
|
||||
}
|
||||
```
|
||||
}
|
||||
```
|
||||
|
||||
For example, to rebind `ctrl+shift+y` to VSCodeVim's `yy` (yank line) in normal mode, add this to your keybindings.json:
|
||||
|
||||
```json
|
||||
{
|
||||
```json
|
||||
{
|
||||
"key": "ctrl+shift+y",
|
||||
"command": "vim.remap",
|
||||
"when": "inputFocus && vim.mode == 'Normal'",
|
||||
"args": {
|
||||
"after": ["y", "y"],
|
||||
"after": ["y", "y"]
|
||||
}
|
||||
}
|
||||
```
|
||||
}
|
||||
```
|
||||
|
||||
If keybindings.json is empty the first time you open it, make sure to add opening `[` and closing `]` square brackets to the file as the keybindings should be inside a JSON Array.
|
||||
|
||||
@ -529,7 +529,7 @@ Change the color of the status bar based on the current mode. Once enabled, conf
|
||||
Based on [vim-easymotion](https://github.com/easymotion/vim-easymotion) and configured through the following settings:
|
||||
|
||||
| Setting | Description | Type | Default Value |
|
||||
| ------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------- | ------------------------------ |
|
||||
| ------------------------------------------------ | -------------------------------------------------------------------------------------------------------- | ------- | -------------------------------------------------- |
|
||||
| vim.easymotion | Enable/disable easymotion plugin | Boolean | false |
|
||||
| vim.easymotionMarkerBackgroundColor | The background color of the marker box. | String | '#0000' |
|
||||
| vim.easymotionMarkerForegroundColorOneChar | The font color for one-character markers. | String | '#ff0000' |
|
||||
|
@ -1140,7 +1140,7 @@
|
||||
"build-dev": "gulp build-dev",
|
||||
"build-test": "gulp prepare-test",
|
||||
"test": "node ./out/test/runTest.js",
|
||||
"forceprettier": "gulp forceprettier",
|
||||
"prettier": "npx prettier -w .",
|
||||
"watch": "npx webpack -c webpack.dev.js --watch",
|
||||
"package": "yarn run vsce package --yarn --allow-star-activation"
|
||||
},
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { Position } from 'vscode';
|
||||
import { Cursor } from '../common/motion/cursor';
|
||||
import { Notation } from '../configuration/notation';
|
||||
import { ActionType, IBaseAction } from "./types";
|
||||
import { ActionType, IBaseAction } from './types';
|
||||
import { isTextTransformation } from '../transformations/transformations';
|
||||
import { configuration } from './../configuration/configuration';
|
||||
import { Mode } from './../mode/mode';
|
||||
@ -57,7 +57,8 @@ export abstract class BaseAction implements IBaseAction {
|
||||
*/
|
||||
public doesActionApply(vimState: VimState, keysPressed: string[]): boolean {
|
||||
if (
|
||||
vimState.currentModeIncludingPseudoModes === Mode.OperatorPendingMode && this.actionType === 'command'
|
||||
vimState.currentModeIncludingPseudoModes === Mode.OperatorPendingMode &&
|
||||
this.actionType === 'command'
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
@ -73,7 +74,8 @@ export abstract class BaseAction implements IBaseAction {
|
||||
*/
|
||||
public couldActionApply(vimState: VimState, keysPressed: string[]): boolean {
|
||||
if (
|
||||
vimState.currentModeIncludingPseudoModes === Mode.OperatorPendingMode && this.actionType === 'command'
|
||||
vimState.currentModeIncludingPseudoModes === Mode.OperatorPendingMode &&
|
||||
this.actionType === 'command'
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
@ -100,12 +100,10 @@ class RemoveFold extends BaseCommand {
|
||||
readonly commandName = 'editor.removeManualFoldingRanges';
|
||||
|
||||
override async exec(position: Position, vimState: VimState): Promise<void> {
|
||||
|
||||
await vscode.commands.executeCommand(this.commandName);
|
||||
|
||||
const newCursorPosition = vimState.currentMode === Mode.Visual
|
||||
? vimState.editor.selection.start
|
||||
: position;
|
||||
const newCursorPosition =
|
||||
vimState.currentMode === Mode.Visual ? vimState.editor.selection.start : position;
|
||||
vimState.cursors = [new Cursor(newCursorPosition, newCursorPosition)];
|
||||
await vimState.setCurrentMode(Mode.Normal); // Vim behavior
|
||||
}
|
||||
|
@ -1935,7 +1935,7 @@ export class MoveAroundParentheses extends MoveInsideCharacter {
|
||||
// special treatment for curly braces
|
||||
export abstract class MoveCurlyBrace extends MoveInsideCharacter {
|
||||
override modes = [Mode.Normal, Mode.Visual, Mode.VisualLine, Mode.VisualBlock];
|
||||
protected charToMatch: string = '{'
|
||||
protected charToMatch: string = '{';
|
||||
|
||||
public override async execAction(
|
||||
position: Position,
|
||||
@ -1943,7 +1943,6 @@ export abstract class MoveCurlyBrace extends MoveInsideCharacter {
|
||||
firstIteration: boolean,
|
||||
lastIteration: boolean
|
||||
): Promise<IMovement> {
|
||||
|
||||
// curly braces has a special treatment. In case the cursor is before an opening curly brace,
|
||||
// and there are no characters before the opening curly brace in the same line, it should jump
|
||||
// to the next opening curly brace, even if it already inside a pair of curly braces.
|
||||
@ -1955,7 +1954,10 @@ export abstract class MoveCurlyBrace extends MoveInsideCharacter {
|
||||
text.substring(0, position.character + openCurlyBraceIndexFromCursor).trim().length === 0 &&
|
||||
startSameAsEnd
|
||||
) {
|
||||
const curlyPos = position.with(position.line, position.character + openCurlyBraceIndexFromCursor);
|
||||
const curlyPos = position.with(
|
||||
position.line,
|
||||
position.character + openCurlyBraceIndexFromCursor
|
||||
);
|
||||
vimState.cursorStartPosition = vimState.cursorStopPosition = curlyPos;
|
||||
const movement = await super.execAction(curlyPos, vimState, firstIteration, lastIteration);
|
||||
if (movement.failed) {
|
||||
@ -1975,8 +1977,7 @@ export abstract class MoveCurlyBrace extends MoveInsideCharacter {
|
||||
vimState.cursorStartPosition = start;
|
||||
vimState.cursorStopPosition = stop;
|
||||
return movement;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return super.execAction(position, vimState, firstIteration, lastIteration);
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,10 @@ export class ReadCommand extends ExCommand {
|
||||
async execute(vimState: VimState): Promise<void> {
|
||||
const textToInsert = await this.getTextToInsert(vimState);
|
||||
if (textToInsert) {
|
||||
vimState.recordedState.transformer.insert(vimState.cursorStopPosition.getLineEnd(), '\n' + textToInsert);
|
||||
vimState.recordedState.transformer.insert(
|
||||
vimState.cursorStopPosition.getLineEnd(),
|
||||
'\n' + textToInsert
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -152,7 +152,6 @@ export class TabCommand extends ExCommand {
|
||||
}
|
||||
|
||||
if (this.arguments.count) {
|
||||
|
||||
const tabGroup = vscode.window.tabGroups.activeTabGroup;
|
||||
if (0 < this.arguments.count && this.arguments.count <= tabGroup.tabs.length) {
|
||||
const tab = tabGroup.tabs[this.arguments.count - 1];
|
||||
|
@ -67,7 +67,7 @@ export class NumericString {
|
||||
): { num: NumericString; suffixOffset: number } | undefined {
|
||||
const filteredMatchings =
|
||||
targetRadix !== undefined
|
||||
? NumericString.matchings.filter(matching => matching.radix === targetRadix)
|
||||
? NumericString.matchings.filter((matching) => matching.radix === targetRadix)
|
||||
: NumericString.matchings;
|
||||
|
||||
// Find core numeric part of input
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { alt, any, Parser, regexp, string, noneOf } from "parsimmon";
|
||||
import { configuration } from "../configuration/configuration";
|
||||
import { alt, any, Parser, regexp, string, noneOf } from 'parsimmon';
|
||||
import { configuration } from '../configuration/configuration';
|
||||
|
||||
const leaderParser = regexp(/<leader>/).map(() => configuration.leader); // lazy evaluation of configuration.leader
|
||||
const specialCharacters = regexp(/<(?:Esc|C-\w|A-\w|C-A-\w)>/)
|
||||
const specialCharacters = regexp(/<(?:Esc|C-\w|A-\w|C-A-\w)>/);
|
||||
|
||||
const specialCharacterParser = alt(specialCharacters, leaderParser);
|
||||
|
||||
@ -17,10 +17,10 @@ const escapedParser = string('\\')
|
||||
return '\n';
|
||||
}
|
||||
return '\\' + escaped;
|
||||
})
|
||||
});
|
||||
|
||||
export const keystrokesExpressionParser: Parser<string[]> = alt(
|
||||
escapedParser,
|
||||
specialCharacterParser,
|
||||
noneOf('"'),
|
||||
noneOf('"')
|
||||
).many();
|
||||
|
@ -1,6 +1,9 @@
|
||||
import * as assert from 'assert';
|
||||
import { Position, window } from 'vscode';
|
||||
import { getCurrentParagraphBeginning, getCurrentParagraphEnd } from '../../src/textobject/paragraph';
|
||||
import {
|
||||
getCurrentParagraphBeginning,
|
||||
getCurrentParagraphEnd,
|
||||
} from '../../src/textobject/paragraph';
|
||||
import { WordType } from '../../src/textobject/word';
|
||||
import { TextEditor } from '../../src/textEditor';
|
||||
import { assertEqualLines, cleanUpWorkspace, setupWorkspace } from '../testUtils';
|
||||
|
@ -5,10 +5,7 @@ import { getAndUpdateModeHandler } from '../../extension';
|
||||
import { ExCommandLine } from '../../src/cmd_line/commandLine';
|
||||
import { ModeHandler } from '../../src/mode/modeHandler';
|
||||
import { exCommandParser } from '../../src/vimscript/exCommandParser';
|
||||
import {
|
||||
cleanUpWorkspace,
|
||||
setupWorkspace,
|
||||
} from '../testUtils';
|
||||
import { cleanUpWorkspace, setupWorkspace } from '../testUtils';
|
||||
|
||||
function clearBreakpoints() {
|
||||
vscode.debug.removeBreakpoints(vscode.debug.breakpoints);
|
||||
@ -30,8 +27,14 @@ suite('Breakpoints command', () => {
|
||||
await new ExCommandLine('breaka', modeHandler.vimState.currentMode).run(modeHandler.vimState);
|
||||
assert.strictEqual(vscode.debug.breakpoints.length, 1);
|
||||
const breakpoint = vscode.debug.breakpoints[0] as vscode.SourceBreakpoint;
|
||||
assert.strictEqual(breakpoint.location.uri.fsPath, modeHandler.vimState.editor.document.uri.fsPath);
|
||||
assert.strictEqual(breakpoint.location.range.start.line, modeHandler.vimState.cursorStartPosition.line);
|
||||
assert.strictEqual(
|
||||
breakpoint.location.uri.fsPath,
|
||||
modeHandler.vimState.editor.document.uri.fsPath
|
||||
);
|
||||
assert.strictEqual(
|
||||
breakpoint.location.range.start.line,
|
||||
modeHandler.vimState.cursorStartPosition.line
|
||||
);
|
||||
});
|
||||
|
||||
test('`:breakd` delete breakpoint', async () => {
|
||||
@ -45,11 +48,11 @@ suite('Breakpoints command', () => {
|
||||
test('test "here" is redundant', async () => {
|
||||
assert.deepStrictEqual(
|
||||
exCommandParser.tryParse(':breaka here'),
|
||||
exCommandParser.tryParse(':breaka'),
|
||||
exCommandParser.tryParse(':breaka')
|
||||
);
|
||||
assert.deepStrictEqual(
|
||||
exCommandParser.tryParse(':breakd here'),
|
||||
exCommandParser.tryParse(':breakd'),
|
||||
exCommandParser.tryParse(':breakd')
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@ -297,16 +297,18 @@ suite('cmd_line tabComplete', () => {
|
||||
`:e ${filePath}|`.toLowerCase(),
|
||||
'Cannot complete path case-insensitive on windows'
|
||||
);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
await modeHandler.handleMultipleKeyEvents(cmd);
|
||||
const statusBarBeforeTab = StatusBar.getText();
|
||||
await modeHandler.handleKeyEvent('<tab>');
|
||||
const statusBarAfterTab = StatusBar.getText().trim();
|
||||
await modeHandler.handleKeyEvent('<Esc>');
|
||||
assert.strictEqual(statusBarBeforeTab, statusBarAfterTab, 'Is case-insensitive on non-windows');
|
||||
assert.strictEqual(
|
||||
statusBarBeforeTab,
|
||||
statusBarAfterTab,
|
||||
'Is case-insensitive on non-windows'
|
||||
);
|
||||
}
|
||||
|
||||
} finally {
|
||||
await t.removeFile(filePath);
|
||||
await t.removeDir(dirPath);
|
||||
|
@ -92,12 +92,16 @@ suite('LineRange parsing', () => {
|
||||
parseTest(
|
||||
'Separator but no first address',
|
||||
`${sep}5`,
|
||||
new LineRange(new Address({type: 'current_line'}), sep, new Address({type: 'number', num: 5}))
|
||||
new LineRange(
|
||||
new Address({ type: 'current_line' }),
|
||||
sep,
|
||||
new Address({ type: 'number', num: 5 })
|
||||
)
|
||||
);
|
||||
parseTest(
|
||||
'Separator but no address at all',
|
||||
`${sep}`,
|
||||
new LineRange(new Address({type: 'current_line'}), sep)
|
||||
new LineRange(new Address({ type: 'current_line' }), sep)
|
||||
);
|
||||
parseTest(
|
||||
'Two numbers',
|
||||
|
@ -19,7 +19,7 @@
|
||||
},
|
||||
"resolveJsonModule": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"esModuleInterop": true,
|
||||
"esModuleInterop": true
|
||||
// "isolatedModules": true,
|
||||
},
|
||||
"exclude": ["node_modules", "!node_modules/@types"]
|
||||
|
Loading…
Reference in New Issue
Block a user