Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix BaseAction.couldActionApply to work with two-dimensional keys array #2288

Merged
merged 4 commits into from
Jan 15, 2018

Conversation

jpotterm
Copy link
Contributor

When BaseAction.couldActionApply slices the keys array it assumes it is one-dimensional (e.g. ['a', 'b']). This pull request fixes it so that it also works when the keys array is two-dimensional (e.g. [['a', 'b'], ['c', 'd']]).

@jpoon
Copy link
Member

jpoon commented Jan 14, 2018

Hmm, the code change seems to make sense. I'm surprised we didn't catch this before. Any chance you can add some tests?

@TravisBuddy
Copy link

Travis tests have failed

Hey Jonathan Potter,
Please read the following log in order to understand the failure reason.
It'll be awesome if you fix what's wrong and commit the changes.

Node.js: 8.9.1

git ls-tree -r HEAD --name-only | grep ".*.[t|j]s$" | xargs ./node_modules/prettier/bin/prettier.js --write --print-width 100 --single-quote --trailing-comma es5
extension.tsextension.ts 484ms
gulpfile.jsgulpfile.js 78ms
src/actions/base.tssrc/actions/base.ts 97ms
src/actions/commands/actions.tssrc/actions/commands/actions.ts 1181ms
src/actions/commands/insert.tssrc/actions/commands/insert.ts 165ms
src/actions/include-all.tssrc/actions/include-all.ts 11ms
src/actions/motion.tssrc/actions/motion.ts 396ms
src/actions/operator.tssrc/actions/operator.ts 209ms
src/actions/plugins/easymotion/easymotion.cmd.tssrc/actions/plugins/easymotion/easymotion.cmd.ts 92ms
src/actions/plugins/easymotion/easymotion.tssrc/actions/plugins/easymotion/easymotion.ts 98ms
src/actions/plugins/easymotion/markerGenerator.tssrc/actions/plugins/easymotion/markerGenerator.ts 28ms
src/actions/plugins/easymotion/registerMoveActions.tssrc/actions/plugins/easymotion/registerMoveActions.ts 44ms
src/actions/plugins/easymotion/types.tssrc/actions/plugins/easymotion/types.ts 5ms
src/actions/plugins/surround.tssrc/actions/plugins/surround.ts 129ms
src/actions/textobject.tssrc/actions/textobject.ts 417ms
src/cmd_line/commandLine.tssrc/cmd_line/commandLine.ts 25ms
src/cmd_line/commands/close.tssrc/cmd_line/commands/close.ts 7ms
src/cmd_line/commands/deleteRange.tssrc/cmd_line/commands/deleteRange.ts 19ms
src/cmd_line/commands/file.tssrc/cmd_line/commands/file.ts 19ms
src/cmd_line/commands/nohl.tssrc/cmd_line/commands/nohl.ts 3ms
src/cmd_line/commands/only.tssrc/cmd_line/commands/only.ts 4ms
src/cmd_line/commands/quit.tssrc/cmd_line/commands/quit.ts 7ms
src/cmd_line/commands/read.tssrc/cmd_line/commands/read.ts 39ms
src/cmd_line/commands/register.tssrc/cmd_line/commands/register.ts 16ms
src/cmd_line/commands/setoptions.tssrc/cmd_line/commands/setoptions.ts 14ms
src/cmd_line/commands/sort.tssrc/cmd_line/commands/sort.ts 19ms
src/cmd_line/commands/substitute.tssrc/cmd_line/commands/substitute.ts 35ms
src/cmd_line/commands/tab.tssrc/cmd_line/commands/tab.ts 33ms
src/cmd_line/commands/wall.tssrc/cmd_line/commands/wall.ts 4ms
src/cmd_line/commands/write.tssrc/cmd_line/commands/write.ts 17ms
src/cmd_line/commands/writequit.tssrc/cmd_line/commands/writequit.ts 12ms
src/cmd_line/commands/writequitall.tssrc/cmd_line/commands/writequitall.ts 14ms
src/cmd_line/lexer.tssrc/cmd_line/lexer.ts 53ms
src/cmd_line/node.tssrc/cmd_line/node.ts 26ms
src/cmd_line/parser.tssrc/cmd_line/parser.ts 16ms
src/cmd_line/scanner.tssrc/cmd_line/scanner.ts 17ms
src/cmd_line/subparser.tssrc/cmd_line/subparser.ts 21ms
src/cmd_line/subparsers/close.tssrc/cmd_line/subparsers/close.ts 5ms
src/cmd_line/subparsers/deleteRange.tssrc/cmd_line/subparsers/deleteRange.ts 3ms
src/cmd_line/subparsers/file.tssrc/cmd_line/subparsers/file.ts 12ms
src/cmd_line/subparsers/nohl.tssrc/cmd_line/subparsers/nohl.ts 2ms
src/cmd_line/subparsers/only.tssrc/cmd_line/subparsers/only.ts 2ms
src/cmd_line/subparsers/quit.tssrc/cmd_line/subparsers/quit.ts 7ms
src/cmd_line/subparsers/read.tssrc/cmd_line/subparsers/read.ts 12ms
src/cmd_line/subparsers/register.tssrc/cmd_line/subparsers/register.ts 4ms
src/cmd_line/subparsers/setoptions.tssrc/cmd_line/subparsers/setoptions.ts 31ms
src/cmd_line/subparsers/sort.tssrc/cmd_line/subparsers/sort.ts 5ms
src/cmd_line/subparsers/substitute.tssrc/cmd_line/subparsers/substitute.ts 47ms
src/cmd_line/subparsers/tab.tssrc/cmd_line/subparsers/tab.ts 13ms
src/cmd_line/subparsers/wall.tssrc/cmd_line/subparsers/wall.ts 4ms
src/cmd_line/subparsers/write.tssrc/cmd_line/subparsers/write.ts 10ms
src/cmd_line/subparsers/writequit.tssrc/cmd_line/subparsers/writequit.ts 8ms
src/cmd_line/subparsers/writequitall.tssrc/cmd_line/subparsers/writequitall.ts 4ms
src/cmd_line/token.tssrc/cmd_line/token.ts 5ms
src/common/matching/matcher.tssrc/common/matching/matcher.ts 38ms
src/common/matching/quoteMatcher.tssrc/common/matching/quoteMatcher.ts 6ms
src/common/matching/tagMatcher.tssrc/common/matching/tagMatcher.ts 14ms
src/common/motion/position.tssrc/common/motion/position.ts 247ms
src/common/motion/range.tssrc/common/motion/range.ts 18ms
src/common/number/numericString.tssrc/common/number/numericString.ts 51ms
src/configuration/configuration.tssrc/configuration/configuration.ts 91ms
src/configuration/decoration.tssrc/configuration/decoration.ts 7ms
src/configuration/notation.tssrc/configuration/notation.ts 14ms
src/configuration/remapper.tssrc/configuration/remapper.ts 64ms
src/editorIdentity.tssrc/editorIdentity.ts 9ms
src/error.tssrc/error.ts 11ms
src/globals.tssrc/globals.ts 2ms
src/history/historyTracker.tssrc/history/historyTracker.ts 176ms
src/mode/mode.tssrc/mode/mode.ts 15ms
src/mode/modeHandler.tssrc/mode/modeHandler.ts 313ms
src/mode/modeHandlerMap.tssrc/mode/modeHandlerMap.ts 8ms
src/mode/modes.tssrc/mode/modes.ts 21ms
src/neovim/nvimUtil.tssrc/neovim/nvimUtil.ts 35ms
src/register/register.tssrc/register/register.ts 70ms
src/state/globalState.tssrc/state/globalState.ts 7ms
src/state/recordedState.tssrc/state/recordedState.ts 17ms
src/state/replaceState.tssrc/state/replaceState.ts 5ms
src/state/searchState.tssrc/state/searchState.ts 49ms
src/state/vimState.tssrc/state/vimState.ts 23ms
src/statusBar.tssrc/statusBar.ts 7ms
src/taskQueue.tssrc/taskQueue.ts 18ms
src/textEditor.tssrc/textEditor.ts 80ms
src/transformations/transformations.tssrc/transformations/transformations.ts 30ms
src/util.tssrc/util.ts 11ms
test/actions/base.test.tstest/actions/base.test.ts 7ms
test/baseAction.test.tstest/baseAction.test.ts 16ms
test/cmd_line/lexer.test.tstest/cmd_line/lexer.test.ts 52ms
test/cmd_line/parser.test.tstest/cmd_line/parser.test.ts 11ms
test/cmd_line/scanner.test.tstest/cmd_line/scanner.test.ts 16ms
test/cmd_line/sort.test.tstest/cmd_line/sort.test.ts 8ms
test/cmd_line/subparser.close.test.tstest/cmd_line/subparser.close.test.ts 7ms
test/cmd_line/subparser.quit.test.tstest/cmd_line/subparser.quit.test.ts 9ms
test/cmd_line/subparser.substitute.test.tstest/cmd_line/subparser.substitute.test.ts 17ms
test/cmd_line/subparser.test.tstest/cmd_line/subparser.test.ts 12ms
test/cmd_line/substitute.test.tstest/cmd_line/substitute.test.ts 59ms
test/cmd_line/vsplit.test.tstest/cmd_line/vsplit.test.ts 8ms
test/cmd_line/writequit.test.tstest/cmd_line/writequit.test.ts 14ms
test/configuration/notation.test.tstest/configuration/notation.test.ts 6ms
test/error.test.tstest/error.test.ts 5ms
test/extension.test.tstest/extension.test.ts 25ms
test/index.tstest/index.ts 4ms
test/macro.test.tstest/macro.test.ts 14ms
test/mode/modeHandler.test.tstest/mode/modeHandler.test.ts 7ms
test/mode/modeHandlerMap.test.tstest/mode/modeHandlerMap.test.ts 12ms
test/mode/modeInsert.test.tstest/mode/modeInsert.test.ts 56ms
test/mode/modeNormal.test.tstest/mode/modeNormal.test.ts 323ms
test/mode/modeReplace.test.tstest/mode/modeReplace.test.ts 9ms
test/mode/modeVisual.test.tstest/mode/modeVisual.test.ts 182ms
test/mode/modeVisualBlock.test.tstest/mode/modeVisualBlock.test.ts 86ms
test/mode/modeVisualLine.test.tstest/mode/modeVisualLine.test.ts 132ms
test/mode/normalModeTests/commands.test.tstest/mode/normalModeTests/commands.test.ts 79ms
test/mode/normalModeTests/dot.test.tstest/mode/normalModeTests/dot.test.ts 22ms
test/mode/normalModeTests/motions.test.tstest/mode/normalModeTests/motions.test.ts 119ms
test/motion.test.tstest/motion.test.ts 211ms
test/number/numericString.test.tstest/number/numericString.test.ts 31ms
test/operator/comment.test.tstest/operator/comment.test.ts 8ms
test/operator/put.test.tstest/operator/put.test.ts 6ms
test/plugins/easymotion.test.tstest/plugins/easymotion.test.ts 24ms
test/plugins/surround.test.tstest/plugins/surround.test.ts 12ms
test/register/register.test.tstest/register/register.test.ts 24ms
test/register/repeatableMovement.test.tstest/register/repeatableMovement.test.ts 6ms
test/testSimplifier.tstest/testSimplifier.ts 37ms
test/testUtils.tstest/testUtils.ts 22ms
test/textEditor.test.tstest/textEditor.test.ts 23ms
typings/custom/promised-neovim-client.d.tstypings/custom/promised-neovim-client.d.ts 94ms

gulp
npm WARN deprecated [email protected]: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
npm WARN deprecated [email protected]: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
/home/travis/.nvm/versions/node/v8.9.1/bin/gulp -> /home/travis/.nvm/versions/node/v8.9.1/lib/node_modules/gulp/bin/gulp.js
+ [email protected]
added 274 packages in 6.876s

$ npm install;

> [email protected] postinstall /home/travis/build/VSCodeVim/Vim/node_modules/typings-global
> node ./dist/install.js

@types/node already installed

> [email protected] postinstall /home/travis/build/VSCodeVim/Vim
> node ./node_modules/vscode/bin/install && gulp init

Detected VS Code engine version: ^1.17.0
Found minimal version that qualifies engine range: 1.17.0
Fetching vscode.d.ts from: https://raw.githubusercontent.com/Microsoft/vscode/be377c0faf7574a59f84940f593a6849f12e4de7/src/vs/vscode.d.ts
vscode.d.ts successfully installed!

[02:28:16] Using gulpfile ~/build/VSCodeVim/Vim/gulpfile.js
[02:28:16] Starting 'typings'...
[02:28:17] Finished 'typings' after 1.07 s
[02:28:17] Starting 'typings-vscode-definitions'...
[02:28:17] Finished 'typings-vscode-definitions' after 4.96 ms
[02:28:17] Starting 'init'...
[02:28:17] Finished 'init' after 32 μs
added 624 packages in 15.147s

$ git ls-tree -r HEAD --name-only | grep ".*.[t|j]s$" | xargs ./node_modules/prettier/bin/prettier.js --write --print-width 100 --single-quote --trailing-comma es5
extension.tsextension.ts 484ms
gulpfile.jsgulpfile.js 78ms
src/actions/base.tssrc/actions/base.ts 97ms
src/actions/commands/actions.tssrc/actions/commands/actions.ts 1181ms
src/actions/commands/insert.tssrc/actions/commands/insert.ts 165ms
src/actions/include-all.tssrc/actions/include-all.ts 11ms
src/actions/motion.tssrc/actions/motion.ts 396ms
src/actions/operator.tssrc/actions/operator.ts 209ms
src/actions/plugins/easymotion/easymotion.cmd.tssrc/actions/plugins/easymotion/easymotion.cmd.ts 92ms
src/actions/plugins/easymotion/easymotion.tssrc/actions/plugins/easymotion/easymotion.ts 98ms
src/actions/plugins/easymotion/markerGenerator.tssrc/actions/plugins/easymotion/markerGenerator.ts 28ms
src/actions/plugins/easymotion/registerMoveActions.tssrc/actions/plugins/easymotion/registerMoveActions.ts 44ms
src/actions/plugins/easymotion/types.tssrc/actions/plugins/easymotion/types.ts 5ms
src/actions/plugins/surround.tssrc/actions/plugins/surround.ts 129ms
src/actions/textobject.tssrc/actions/textobject.ts 417ms
src/cmd_line/commandLine.tssrc/cmd_line/commandLine.ts 25ms
src/cmd_line/commands/close.tssrc/cmd_line/commands/close.ts 7ms
src/cmd_line/commands/deleteRange.tssrc/cmd_line/commands/deleteRange.ts 19ms
src/cmd_line/commands/file.tssrc/cmd_line/commands/file.ts 19ms
src/cmd_line/commands/nohl.tssrc/cmd_line/commands/nohl.ts 3ms
src/cmd_line/commands/only.tssrc/cmd_line/commands/only.ts 4ms
src/cmd_line/commands/quit.tssrc/cmd_line/commands/quit.ts 7ms
src/cmd_line/commands/read.tssrc/cmd_line/commands/read.ts 39ms
src/cmd_line/commands/register.tssrc/cmd_line/commands/register.ts 16ms
src/cmd_line/commands/setoptions.tssrc/cmd_line/commands/setoptions.ts 14ms
src/cmd_line/commands/sort.tssrc/cmd_line/commands/sort.ts 19ms
src/cmd_line/commands/substitute.tssrc/cmd_line/commands/substitute.ts 35ms
src/cmd_line/commands/tab.tssrc/cmd_line/commands/tab.ts 33ms
src/cmd_line/commands/wall.tssrc/cmd_line/commands/wall.ts 4ms
src/cmd_line/commands/write.tssrc/cmd_line/commands/write.ts 17ms
src/cmd_line/commands/writequit.tssrc/cmd_line/commands/writequit.ts 12ms
src/cmd_line/commands/writequitall.tssrc/cmd_line/commands/writequitall.ts 14ms
src/cmd_line/lexer.tssrc/cmd_line/lexer.ts 53ms
src/cmd_line/node.tssrc/cmd_line/node.ts 26ms
src/cmd_line/parser.tssrc/cmd_line/parser.ts 16ms
src/cmd_line/scanner.tssrc/cmd_line/scanner.ts 17ms
src/cmd_line/subparser.tssrc/cmd_line/subparser.ts 21ms
src/cmd_line/subparsers/close.tssrc/cmd_line/subparsers/close.ts 5ms
src/cmd_line/subparsers/deleteRange.tssrc/cmd_line/subparsers/deleteRange.ts 3ms
src/cmd_line/subparsers/file.tssrc/cmd_line/subparsers/file.ts 12ms
src/cmd_line/subparsers/nohl.tssrc/cmd_line/subparsers/nohl.ts 2ms
src/cmd_line/subparsers/only.tssrc/cmd_line/subparsers/only.ts 2ms
src/cmd_line/subparsers/quit.tssrc/cmd_line/subparsers/quit.ts 7ms
src/cmd_line/subparsers/read.tssrc/cmd_line/subparsers/read.ts 12ms
src/cmd_line/subparsers/register.tssrc/cmd_line/subparsers/register.ts 4ms
src/cmd_line/subparsers/setoptions.tssrc/cmd_line/subparsers/setoptions.ts 31ms
src/cmd_line/subparsers/sort.tssrc/cmd_line/subparsers/sort.ts 5ms
src/cmd_line/subparsers/substitute.tssrc/cmd_line/subparsers/substitute.ts 47ms
src/cmd_line/subparsers/tab.tssrc/cmd_line/subparsers/tab.ts 13ms
src/cmd_line/subparsers/wall.tssrc/cmd_line/subparsers/wall.ts 4ms
src/cmd_line/subparsers/write.tssrc/cmd_line/subparsers/write.ts 10ms
src/cmd_line/subparsers/writequit.tssrc/cmd_line/subparsers/writequit.ts 8ms
src/cmd_line/subparsers/writequitall.tssrc/cmd_line/subparsers/writequitall.ts 4ms
src/cmd_line/token.tssrc/cmd_line/token.ts 5ms
src/common/matching/matcher.tssrc/common/matching/matcher.ts 38ms
src/common/matching/quoteMatcher.tssrc/common/matching/quoteMatcher.ts 6ms
src/common/matching/tagMatcher.tssrc/common/matching/tagMatcher.ts 14ms
src/common/motion/position.tssrc/common/motion/position.ts 247ms
src/common/motion/range.tssrc/common/motion/range.ts 18ms
src/common/number/numericString.tssrc/common/number/numericString.ts 51ms
src/configuration/configuration.tssrc/configuration/configuration.ts 91ms
src/configuration/decoration.tssrc/configuration/decoration.ts 7ms
src/configuration/notation.tssrc/configuration/notation.ts 14ms
src/configuration/remapper.tssrc/configuration/remapper.ts 64ms
src/editorIdentity.tssrc/editorIdentity.ts 9ms
src/error.tssrc/error.ts 11ms
src/globals.tssrc/globals.ts 2ms
src/history/historyTracker.tssrc/history/historyTracker.ts 176ms
src/mode/mode.tssrc/mode/mode.ts 15ms
src/mode/modeHandler.tssrc/mode/modeHandler.ts 313ms
src/mode/modeHandlerMap.tssrc/mode/modeHandlerMap.ts 8ms
src/mode/modes.tssrc/mode/modes.ts 21ms
src/neovim/nvimUtil.tssrc/neovim/nvimUtil.ts 35ms
src/register/register.tssrc/register/register.ts 70ms
src/state/globalState.tssrc/state/globalState.ts 7ms
src/state/recordedState.tssrc/state/recordedState.ts 17ms
src/state/replaceState.tssrc/state/replaceState.ts 5ms
src/state/searchState.tssrc/state/searchState.ts 49ms
src/state/vimState.tssrc/state/vimState.ts 23ms
src/statusBar.tssrc/statusBar.ts 7ms
src/taskQueue.tssrc/taskQueue.ts 18ms
src/textEditor.tssrc/textEditor.ts 80ms
src/transformations/transformations.tssrc/transformations/transformations.ts 30ms
src/util.tssrc/util.ts 11ms
test/actions/base.test.tstest/actions/base.test.ts 7ms
test/baseAction.test.tstest/baseAction.test.ts 16ms
test/cmd_line/lexer.test.tstest/cmd_line/lexer.test.ts 52ms
test/cmd_line/parser.test.tstest/cmd_line/parser.test.ts 11ms
test/cmd_line/scanner.test.tstest/cmd_line/scanner.test.ts 16ms
test/cmd_line/sort.test.tstest/cmd_line/sort.test.ts 8ms
test/cmd_line/subparser.close.test.tstest/cmd_line/subparser.close.test.ts 7ms
test/cmd_line/subparser.quit.test.tstest/cmd_line/subparser.quit.test.ts 9ms
test/cmd_line/subparser.substitute.test.tstest/cmd_line/subparser.substitute.test.ts 17ms
test/cmd_line/subparser.test.tstest/cmd_line/subparser.test.ts 12ms
test/cmd_line/substitute.test.tstest/cmd_line/substitute.test.ts 59ms
test/cmd_line/vsplit.test.tstest/cmd_line/vsplit.test.ts 8ms
test/cmd_line/writequit.test.tstest/cmd_line/writequit.test.ts 14ms
test/configuration/notation.test.tstest/configuration/notation.test.ts 6ms
test/error.test.tstest/error.test.ts 5ms
test/extension.test.tstest/extension.test.ts 25ms
test/index.tstest/index.ts 4ms
test/macro.test.tstest/macro.test.ts 14ms
test/mode/modeHandler.test.tstest/mode/modeHandler.test.ts 7ms
test/mode/modeHandlerMap.test.tstest/mode/modeHandlerMap.test.ts 12ms
test/mode/modeInsert.test.tstest/mode/modeInsert.test.ts 56ms
test/mode/modeNormal.test.tstest/mode/modeNormal.test.ts 323ms
test/mode/modeReplace.test.tstest/mode/modeReplace.test.ts 9ms
test/mode/modeVisual.test.tstest/mode/modeVisual.test.ts 182ms
test/mode/modeVisualBlock.test.tstest/mode/modeVisualBlock.test.ts 86ms
test/mode/modeVisualLine.test.tstest/mode/modeVisualLine.test.ts 132ms
test/mode/normalModeTests/commands.test.tstest/mode/normalModeTests/commands.test.ts 79ms
test/mode/normalModeTests/dot.test.tstest/mode/normalModeTests/dot.test.ts 22ms
test/mode/normalModeTests/motions.test.tstest/mode/normalModeTests/motions.test.ts 119ms
test/motion.test.tstest/motion.test.ts 211ms
test/number/numericString.test.tstest/number/numericString.test.ts 31ms
test/operator/comment.test.tstest/operator/comment.test.ts 8ms
test/operator/put.test.tstest/operator/put.test.ts 6ms
test/plugins/easymotion.test.tstest/plugins/easymotion.test.ts 24ms
test/plugins/surround.test.tstest/plugins/surround.test.ts 12ms
test/register/register.test.tstest/register/register.test.ts 24ms
test/register/repeatableMovement.test.tstest/register/repeatableMovement.test.ts 6ms
test/testSimplifier.tstest/testSimplifier.ts 37ms
test/testUtils.tstest/testUtils.ts 22ms
test/textEditor.test.tstest/textEditor.test.ts 23ms
typings/custom/promised-neovim-client.d.tstypings/custom/promised-neovim-client.d.ts 94ms

@jpotterm
Copy link
Contributor Author

@jpoon I've added tests!

@jpoon jpoon merged commit 18f0aa8 into VSCodeVim:master Jan 15, 2018
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants