Skip to content

Commit a967a85

Browse files
author
sql-koala
committed
Merge branch 'master' of https://github.com/VSCodeVim/Vim into masterRepo
2 parents 9849b91 + c942a63 commit a967a85

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1478
-1146
lines changed

CHANGELOG.md

Lines changed: 58 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,63 @@
11
# Change Log
22

3+
## [v1.21.3](https://github.com/vscodevim/vim/tree/v1.21.3) (2021-06-17)
4+
5+
[Full Changelog](https://github.com/vscodevim/vim/compare/v1.21.2...v1.21.3)
6+
7+
**Fixed Bugs:**
8+
9+
- `i"`/`a"` should match quotes on line when cursor is on quote [\#6761](https://github.com/VSCodeVim/Vim/issues/6761)
10+
- `a"` should include the space after the closing quote [\#6747](https://github.com/VSCodeVim/Vim/issues/6747)
11+
- Incorrect cursor position after `vi"c` when cursor on quote [\#6740](https://github.com/VSCodeVim/Vim/issues/6740)
12+
- `\<BS\>` deletes too much leading whitespace when using hard tabstops with `expandtab` enabled [\#6735](https://github.com/VSCodeVim/Vim/issues/6735)
13+
- `gd` that causes a file load followed by `h`/`j`/`k`/`l` jumps to random spot [\#6544](https://github.com/VSCodeVim/Vim/issues/6544)
14+
- The message on the status bar about how many to look for conflicts with "Normal" [\#6039](https://github.com/VSCodeVim/Vim/issues/6039)
15+
16+
## [v1.21.2](https://github.com/vscodevim/vim/tree/v1.21.2) (2021-06-11)
17+
18+
[Full Changelog](https://github.com/vscodevim/vim/compare/v1.21.1...v1.21.2)
19+
20+
**Fixed Bugs:**
21+
22+
- `\<Esc\>` does not cancel multi-cursor [\#6719](https://github.com/VSCodeVim/Vim/issues/6719)
23+
- incorrect undo of macro execution containing delete after join [\#6645](https://github.com/VSCodeVim/Vim/issues/6645)
24+
25+
## [v1.21.1](https://github.com/vscodevim/vim/tree/v1.21.1) (2021-06-10)
26+
27+
[Full Changelog](https://github.com/vscodevim/vim/compare/v1.21.0...v1.21.1)
28+
29+
**Fixed Bugs:**
30+
31+
- User Settings Getting Overridden [\#6717](https://github.com/VSCodeVim/Vim/issues/6717)
32+
- incorrect placement of brackets when using macros [\#6692](https://github.com/VSCodeVim/Vim/issues/6692)
33+
34+
## [v1.21.0](https://github.com/vscodevim/vim/tree/v1.21.0) (2021-06-09)
35+
36+
[Full Changelog](https://github.com/vscodevim/vim/compare/v1.20.3...v1.21.0)
37+
38+
**Enhancements:**
39+
40+
- `:s` should report \# of substitutions [\#6698](https://github.com/VSCodeVim/Vim/issues/6698)
41+
- Support virtual workspaces [\#6596](https://github.com/VSCodeVim/Vim/issues/6596)
42+
- Support Workspace Trust [\#6587](https://github.com/VSCodeVim/Vim/issues/6587)
43+
- Python Object Motions [\#6213](https://github.com/VSCodeVim/Vim/issues/6213)
44+
45+
**Fixed Bugs:**
46+
47+
- Bug with tab removal before odd number of characters [\#6327](https://github.com/VSCodeVim/Vim/issues/6327)
48+
49+
**Closed issues:**
50+
51+
- Enable `--noImplicitOverride` [\#6670](https://github.com/VSCodeVim/Vim/issues/6670)
52+
- Surround emulation gets positions wrong when tabs are involved [\#6564](https://github.com/VSCodeVim/Vim/issues/6564)
53+
54+
**Merged pull requests:**
55+
56+
- Implement :vsc to run VSCode commands [\#6694](https://github.com/VSCodeVim/Vim/pull/6694) ([meluskyc](https://github.com/meluskyc))
57+
- Surround Rewrite [\#6452](https://github.com/VSCodeVim/Vim/pull/6452) ([sql-koala](https://github.com/sql-koala))
58+
- Bugfix substitute with backslash\(fixes \#2710\) [\#6409](https://github.com/VSCodeVim/Vim/pull/6409) ([sekai013](https://github.com/sekai013))
59+
- Add Python specific motions \(fixes \#6213\) [\#6393](https://github.com/VSCodeVim/Vim/pull/6393) ([abid-mujtaba](https://github.com/abid-mujtaba))
60+
361
## [v1.20.3](https://github.com/vscodevim/vim/tree/v1.20.3) (2021-05-18)
462

563
[Full Changelog](https://github.com/vscodevim/vim/compare/v1.20.2...v1.20.3)
@@ -136,8 +194,6 @@
136194
- Fix even more dependency cycles [\#6243](https://github.com/VSCodeVim/Vim/pull/6243) ([inspirer](https://github.com/inspirer))
137195
- Fix several dependency cycles [\#6208](https://github.com/VSCodeVim/Vim/pull/6208) ([inspirer](https://github.com/inspirer))
138196
- Implement previous context marks \(add to jump list on m' / m`\) [\#6174](https://github.com/VSCodeVim/Vim/pull/6174) ([jose-elias-alvarez](https://github.com/jose-elias-alvarez))
139-
- Add Erlang style comments [\#5970](https://github.com/VSCodeVim/Vim/pull/5970) ([maxnordlund](https://github.com/maxnordlund))
140-
- Potential fix for non latin chars issue [\#5951](https://github.com/VSCodeVim/Vim/pull/5951) ([berknam](https://github.com/berknam))
141197

142198
## [v1.18.9](https://github.com/vscodevim/vim/tree/v1.18.9) (2021-02-05)
143199

@@ -160,21 +216,12 @@
160216

161217
[Full Changelog](https://github.com/vscodevim/vim/compare/v1.18.5...v1.18.7)
162218

163-
**Enhancements:**
164-
165-
- Implement `ZZ` and `ZQ` [\#5998](https://github.com/VSCodeVim/Vim/issues/5998)
166-
167-
**Fixed Bugs:**
168-
169-
- Cannot read property 'warn' of undefined [\#5983](https://github.com/VSCodeVim/Vim/issues/5983)
170-
171219
**Merged pull requests:**
172220

173221
- off load vimrc module in web [\#6067](https://github.com/VSCodeVim/Vim/pull/6067) ([rebornix](https://github.com/rebornix))
174222
- Fix multicursor insert register new [\#6065](https://github.com/VSCodeVim/Vim/pull/6065) ([sql-koala](https://github.com/sql-koala))
175223
- Fix 'cw' behavior on whitespace [\#6033](https://github.com/VSCodeVim/Vim/pull/6033) ([edemaine](https://github.com/edemaine))
176224
- Remove stray console.log statements [\#6032](https://github.com/VSCodeVim/Vim/pull/6032) ([edemaine](https://github.com/edemaine))
177-
- Document build/test process better [\#5946](https://github.com/VSCodeVim/Vim/pull/5946) ([edemaine](https://github.com/edemaine))
178225

179226
## [v1.18.5](https://github.com/vscodevim/vim/tree/v1.18.5) (2020-12-10)
180227

extensionBase.ts

Lines changed: 25 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ export async function activate(context: vscode.ExtensionContext, handleLocal: bo
284284
return;
285285
}
286286

287-
const mh = await getAndUpdateModeHandler();
287+
const mh = ModeHandlerMap.get(EditorIdentity.fromEditor(vscode.window.activeTextEditor));
288288
if (mh === undefined) {
289289
// We don't care if there is no active editor
290290
return;
@@ -332,15 +332,7 @@ export async function activate(context: vscode.ExtensionContext, handleLocal: bo
332332
return;
333333
}
334334

335-
taskQueue.enqueueTask(
336-
() => mh.handleSelectionChange(e),
337-
undefined,
338-
/**
339-
* We don't want these to become backlogged! If they do, we'll update
340-
* the selection to an incorrect value and see a jittering cursor.
341-
*/
342-
true
343-
);
335+
taskQueue.enqueueTask(() => mh.handleSelectionChange(e));
344336
},
345337
true,
346338
false
@@ -350,11 +342,17 @@ export async function activate(context: vscode.ExtensionContext, handleLocal: bo
350342
context,
351343
vscode.window.onDidChangeTextEditorVisibleRanges,
352344
async (e: vscode.TextEditorVisibleRangesChangeEvent) => {
353-
const mh = await getAndUpdateModeHandler();
354-
if (mh) {
345+
taskQueue.enqueueTask(async () => {
355346
// Scrolling the viewport clears any status bar message, even errors.
356-
StatusBar.clear(mh.vimState, true);
357-
}
347+
const mh = await getAndUpdateModeHandler();
348+
if (mh && StatusBar.lastMessageTime) {
349+
// TODO: Using the time elapsed works most of the time, but is a bit of a hack
350+
const timeElapsed = Number(new Date()) - Number(StatusBar.lastMessageTime);
351+
if (timeElapsed > 100) {
352+
StatusBar.clear(mh.vimState, true);
353+
}
354+
}
355+
});
358356
}
359357
);
360358

@@ -493,15 +491,20 @@ export async function activate(context: vscode.ExtensionContext, handleLocal: bo
493491
for (const boundKey of configuration.boundKeyCombinations) {
494492
const command = ['<Esc>', '<C-c>'].includes(boundKey.key)
495493
? async () => {
496-
const didStopRemap = await forceStopRecursiveRemap();
497-
if (!didStopRemap) {
498-
handleKeyEvent(`${boundKey.key}`);
494+
const mh = await getAndUpdateModeHandler();
495+
if (mh && !(await forceStopRecursiveRemap(mh))) {
496+
await mh.handleKeyEvent(`${boundKey.key}`);
499497
}
500498
}
501-
: () => {
502-
handleKeyEvent(`${boundKey.key}`);
499+
: async () => {
500+
const mh = await getAndUpdateModeHandler();
501+
if (mh) {
502+
await mh.handleKeyEvent(`${boundKey.key}`);
503+
}
503504
};
504-
registerCommand(context, boundKey.command, command);
505+
registerCommand(context, boundKey.command, async () => {
506+
taskQueue.enqueueTask(command);
507+
});
505508
}
506509

507510
{
@@ -621,21 +624,11 @@ function registerEventListener<T>(
621624
context.subscriptions.push(disposable);
622625
}
623626

624-
async function handleKeyEvent(key: string): Promise<void> {
625-
const mh = await getAndUpdateModeHandler();
626-
if (mh) {
627-
taskQueue.enqueueTask(async () => {
628-
await mh.handleKeyEvent(key);
629-
});
630-
}
631-
}
632-
633627
/**
634628
* @returns true if there was a remap being executed to stop
635629
*/
636-
async function forceStopRecursiveRemap(): Promise<boolean> {
637-
const mh = await getAndUpdateModeHandler();
638-
if (mh?.remapState.isCurrentlyPerformingRecursiveRemapping) {
630+
async function forceStopRecursiveRemap(mh: ModeHandler): Promise<boolean> {
631+
if (mh.remapState.isCurrentlyPerformingRecursiveRemapping) {
639632
mh.remapState.forceStopRecursiveRemapping = true;
640633
return true;
641634
}

package.json

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "Vim",
44
"description": "Vim emulation for Visual Studio Code",
55
"icon": "images/icon.png",
6-
"version": "1.20.3",
6+
"version": "1.21.3",
77
"publisher": "vscodevim",
88
"galleryBanner": {
99
"color": "#e3f4ff",
@@ -43,6 +43,12 @@
4343
"qna": "https://vscodevim.herokuapp.com/",
4444
"main": "./out/extension",
4545
"browser": "./out/extensionWeb",
46+
"capabilities": {
47+
"untrustedWorkspaces": {
48+
"supported": true
49+
},
50+
"virtualWorkspaces": true
51+
},
4652
"contributes": {
4753
"commands": [
4854
{
@@ -1122,6 +1128,7 @@
11221128
"lodash": "^4.17.21",
11231129
"neovim": "4.10.0",
11241130
"path-browserify": "1.0.1",
1131+
"queue": "^6.0.2",
11251132
"source-map-support": "0.5.19",
11261133
"untildify": "4.0.0",
11271134
"winston": "3.3.3",
@@ -1134,13 +1141,13 @@
11341141
"@types/glob": "7.1.3",
11351142
"@types/lodash": "4.14.170",
11361143
"@types/mocha": "8.2.2",
1137-
"@types/node": "12.20.14",
1144+
"@types/node": "12.20.15",
11381145
"@types/sinon": "10.0.2",
11391146
"@types/source-map-support": "0.5.3",
11401147
"@types/vscode": "1.42.0",
11411148
"clean-webpack-plugin": "3.0.0",
11421149
"event-stream": "4.0.1",
1143-
"fork-ts-checker-webpack-plugin": "6.2.10",
1150+
"fork-ts-checker-webpack-plugin": "6.2.12",
11441151
"gulp": "4.0.2",
11451152
"gulp-bump": "3.2.0",
11461153
"gulp-git": "2.10.1",
@@ -1149,18 +1156,18 @@
11491156
"gulp-tslint": "8.1.4",
11501157
"gulp-typescript": "5.0.1",
11511158
"minimist": "1.2.5",
1152-
"mocha": "8.4.0",
1159+
"mocha": "9.0.1",
11531160
"plugin-error": "1.0.1",
1154-
"prettier": "2.3.0",
1161+
"prettier": "2.3.2",
11551162
"sinon": "11.1.1",
1156-
"ts-loader": "9.2.2",
1163+
"ts-loader": "9.2.3",
11571164
"tslint": "6.1.3",
1158-
"typescript": "4.3.2",
1159-
"vsce": "1.91.0",
1165+
"typescript": "4.3.4",
1166+
"vsce": "1.95.0",
11601167
"vscode-test": "1.5.2",
1161-
"webpack": "5.38.1",
1162-
"webpack-cli": "4.7.0",
1163-
"webpack-merge": "5.7.3",
1168+
"webpack": "5.40.0",
1169+
"webpack-cli": "4.7.2",
1170+
"webpack-merge": "5.8.0",
11641171
"webpack-stream": "6.1.2"
11651172
}
11661173
}

src/actions/base.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ export abstract class BaseAction {
182182
* A command is something like <Esc>, :, v, i, etc.
183183
*/
184184
export abstract class BaseCommand extends BaseAction {
185-
isCommand = true;
185+
override isCommand = true;
186186

187187
/**
188188
* If isCompleteAction is true, then triggering this command is a complete action -
@@ -291,22 +291,22 @@ export function getRelevantAction(
291291
keysPressed: string[],
292292
vimState: VimState
293293
): BaseAction | KeypressState {
294-
let isPotentialMatch = false;
294+
const possibleActionsForMode = actionMap.get(vimState.currentMode) ?? [];
295295

296-
const possibleActionsForMode = actionMap.get(vimState.currentMode) || [];
296+
let hasPotentialMatch = false;
297297
for (const actionType of possibleActionsForMode) {
298+
// TODO: Constructing up to several hundred Actions every time we hit a key is moronic.
299+
// I think we can make `doesActionApply` and `couldActionApply` static...
298300
const action = new actionType();
299301
if (action.doesActionApply(vimState, keysPressed)) {
300302
action.keysPressed = vimState.recordedState.actionKeys.slice(0);
301303
return action;
302304
}
303305

304-
if (action.couldActionApply(vimState, keysPressed)) {
305-
isPotentialMatch = true;
306-
}
306+
hasPotentialMatch ||= action.couldActionApply(vimState, keysPressed);
307307
}
308308

309-
return isPotentialMatch ? KeypressState.WaitingOnKeys : KeypressState.NoPossibleMatch;
309+
return hasPotentialMatch ? KeypressState.WaitingOnKeys : KeypressState.NoPossibleMatch;
310310
}
311311

312312
export function RegisterAction(action: new () => BaseAction): void {

src/actions/baseMotion.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export function failedMovement(vimState: VimState): IMovement {
5050
export abstract class BaseMovement extends BaseAction {
5151
modes = [Mode.Normal, Mode.Visual, Mode.VisualLine, Mode.VisualBlock];
5252

53-
isMotion = true;
53+
override isMotion = true;
5454

5555
/**
5656
* If movement can be repeated with semicolon or comma this will be true when

0 commit comments

Comments
 (0)