Commit Graph

78 Commits

Author SHA1 Message Date
Jason Fields
1c2cdc26be Remove Globals.mockModeHandler, which is no longer necessary 2021-03-31 18:40:24 -04:00
Jason Fields
11a4a87032 Slight refactor of test harness
This simplifies things, reduces jank, and makes test setup a little bit faster. A lot more refactoring could be done, but this is a good start.
2021-03-29 20:01:43 -04:00
Jason Fields
18327e0ff0 Improve startup performance by calling getCommands only once 2021-03-26 14:27:05 -04:00
Jason Fields
4043c978bd Remove leading underscores from private members
(Except when they're necessary because of getters/setters)
2021-03-22 00:06:36 -04:00
Jason Fields
daee0c0226 Remove some unused variables 2021-03-21 22:56:20 -04:00
Jason Fields
5be9ef9905 Remove some deprecated TextEditor functions
Refs #5663
2021-02-22 21:12:30 -05:00
Jason Fields
a6c0fce4ae assert.deepEqual -> assert.deepStrictEqual
The former is deprecated
2021-02-22 20:16:16 -05:00
Jason Fields
8631f9982c Move remapping-related state from VimState to new RemapState
The motivation behind this is mostly to reduce the surface area Actions can interact with.
Remappings should not be visible to them (this is fundamentally logic internal to ModeHandler/Remapper).
2020-12-07 20:57:37 -05:00
Jason Fields
1c0072af63 Remove more instances of activeTextEditor
Refs #5663
2020-12-06 14:41:56 -05:00
renovate[bot]
bb9a78979d
Update dependency typescript to v4.1.2 (#5703) 2020-11-20 13:53:31 -05:00
Jason Fields
3e56996a75 Simplify testItWithRemaps slightly
The use of nested Promises here hurt my head when trying to accommodate a breaking change in typescript 4.1, so I'm just sorting this out for myself before doing the typescript upgrade.
2020-11-20 13:41:53 -05:00
Jason Fields
8a15cdb842 Make getAndUpdateModeHandler return undefined when there is no active editor
This means `vimState.editor` should never be undefined - now we should start using that instead of `vscode.window.activeTextEditor` to avoid a whole bunch of pesky race conditions.
Refs #5663
2020-11-16 14:58:05 -05:00
Jason Fields
1564e647dc Replace getTestingFunctions with plain old exports/imports
Not sure why it was ever done this way
2020-11-16 13:42:09 -05:00
Jason Fields
ba244bb4ce Stop using custom Position class in favor of augmenting vscode.Position
This means no more need to convert back and forth between the two.
Closes #4820
2020-11-13 21:48:12 -05:00
berknam
91ca71f860
Overhaul remapping logic (#4735)
This is a pretty massive change; see pull request #4735 for full details

Most notably:
- Support for operator-pending mode, including remaps and a half-cursor decoration
- Correct handling of ambiguous remaps with timeout
- Correct handling of recursive special case when the RHS starts with the LHS
- Correct handling of multi-key remaps in insert mode
- Failed movements that occur partway through a remap stop & discard the rest of the remap
- Implement `unmap` and `mapclear` in .vimrc

Refs #463, refs #4908
Fixes #1261, fixes #1398, fixes #1579, fixes #1821, fixes #1835
Fixes #1870, fixes #1883, fixes #2041, fixes #2234, fixes #2466
Fixes #2897, fixes #2955, fixes #2975, fixes #3082, fixes #3086
Fixes #3171, fixes #3373, fixes #3413, fixes #3742, fixes #3768
Fixes #3988, fixes #4057, fixes #4118, fixes #4236, fixes #4353
Fixes #4464, fixes #4530, fixes #4532, fixes #4563, fixes #4674
Fixes #4756, fixes #4883, fixes #4928, fixes #4991, fixes #5016
Fixes #5057, fixes #5067, fixes #5084, fixes #5125
2020-08-16 14:22:51 -04:00
Jason Fields
147ac8c757 Add config option to newTest, which will override specific settings for the duration of that test
This makes testing different setting combinations MUCH easier.
Settings coverage is very much lacking in our test suite, which we should definitely make an effort to improve. More sane test organization and automated code coverage detection would make our gaps more obvious.
2020-07-05 22:00:46 -04:00
Jason Fields
c204f51309 Make a few tests pass on windows, make test failure messages more helpful
Refs #4844
2020-05-16 22:05:28 -04:00
renovate[bot]
b6d75ca49a
Update dependency prettier to v2 (#4661)
All line endings are now unix-style (\n), and arrow functions always have parentheses around their parameters.
2020-03-26 13:02:33 -04:00
Jason Fields
f9faffa339 Add pattern/command to error messages when not found 2020-02-26 05:03:38 -05:00
Jason Fields
ea28879e6e
Fix tests (#4442)
I thought my last commit was innocuous, but that's always a dangerous attitude to have :)
`Position.withColumn()` now does bounds checking, which the test framework wasn't too happy about
2019-12-30 13:19:55 -05:00
Jason Fields
758c1098ae
Stop using timeout and waiting for event in getCursorsAfterSync() (#4433)
The issue this function was meant to solve seems to have disappeared...
Fixes #4432
2019-12-29 13:00:22 -05:00
Jason Fields
5faa87ac57
Some basic sneakReplacesF tests (#4422) 2019-12-26 16:32:22 -05:00
Jason Fields
9feb9aa11e Simplify & clean up some tests
No functional changes here, just migrating some old tests to the `newTest` framework, enhanced that framework to check status bar, improved some test names, etc.
2019-12-22 21:55:15 -05:00
Jason Fields
381f026af4 gulp forceprettier
Not sure why this was necessary - did a prettier update change the default formatting of nested lists, etc.?
2019-12-22 00:33:01 -05:00
Jason Fields
516778be1e Rename ModeName to Mode since after the refactor, that separation is gone 2019-11-29 15:59:20 -05:00
Jason Fields
de2cdb7e53 Big refactor of modes to not use OOP
This is a step toward fixing our janky status bar logic. Basically, I want to make information about the current mode easily available from a VimState without needing the ModeHandler.
The Mode class has been destroyed, replaced by some functions that take a ModeName.
More refactoring could be done, I'm sure, but I think this is a BIG step in the right directions.
2019-11-29 15:59:20 -05:00
Jason Fields
d1b5bb90e3
Replace assert.equal with assert.strictEqual (#4199)
The former is deprecated and does not check the types of its arguments.
2019-10-21 00:29:23 -04:00
Jason Fields
6c8e67776d Use const instead of let when possible in tests
I'd love to enable `prefer-const` in tslint, but with 17 pull requests outstanding, I think it might cause some merge conflicts. Making the switch in test/** is a step toward that goal which should result in essentially no conflicts.
2019-10-20 23:26:26 -04:00
hetmankp
a19098f077 Make it possible to add skipped tests (#4129)
It would be nice to add tests that can be skipped until future support
for the specified behaviour can be implemented.
2019-10-04 00:38:28 -04:00
Jason Fields
a0e230996c Small refactor: globalState shouldn't be a member of VimState 2019-08-26 01:05:55 -04:00
Jason Poon
ee91316768 refactor: no need for so many different ways to create a position object 2019-02-02 14:55:25 -08:00
Shawn Axsom
bbad5f1958 Clean up comments and old methods 2018-09-05 22:15:04 -04:00
Shawn Axsom
5e4c260b18 jumpTracker can handle deleted lines. Also refactored jumpTracker tests. 2018-09-05 09:52:51 -04:00
Jason Poon
6fa46cbf0b refactor: clean-up util functions. add logging 2018-06-10 01:47:07 -07:00
Jason Poon
c4cd9a3f7f refactor: move util.ts into util folder. separate clipboard/messages to own files. don't export default 2018-06-10 01:47:07 -07:00
Horace He
845a7cddcf Set the timeout to 0 for waitforcursorupdatestopropagate 2018-03-07 10:56:15 -05:00
Jason Poon
8a2a825632 fix: x-plat all test keys 2018-02-20 13:52:04 +03:00
Jason Poon
9c7b8e6e73 refactor: allow 'configuration' class to be mocked in tests 2018-01-31 15:36:10 -08:00
jessewmc
86007ae374 Fix: Left shift fix closes #2299 (#2300)
* Fix tokenizeKeySequence to allow left shift operator in keysPressed.

* Tests for #2299 and other left and right shift operations.

* Fix #2299 left shift operator off by one bug

* Fix tokenizeKeySequence bug introduced by handling left shift.

* Make rawTokenize clearer.
2018-01-19 01:56:31 -08:00
Jason Poon
68b45a05e7 fix(prettier) 2017-12-28 22:33:20 +11:00
Jason Poon
bdb7d07a6b refactor(modehandler): remove getter for vimstate. it was confusing as hell and everything is pass by ref anyways 2017-12-28 22:33:20 +11:00
Jason Poon
352cbda275 refactor remapper to use configuration 2017-12-13 11:36:31 +11:00
Jason Poon
1f20072098 sort and remove unused imports 2017-12-13 11:36:31 +11:00
Jason Poon
1e30095763 moar clean-up 2017-12-13 11:36:31 +11:00
Jason Poon
4c3403eae2 fix(prettier) 2017-11-12 22:48:56 -05:00
Horace He
dbe22d05af Updated packages and re-ran prettier 2017-08-30 13:10:31 -04:00
Philip Mateescu
c0e54419c5 prettier doesn't work in windows 2017-07-17 15:22:39 -07:00
Philip Mateescu
1adfba81e0 see if I can get more info by asserting the lines 2017-07-17 15:22:39 -07:00
Horace He
edd08c0f46 Formattted everything with prettier 2017-06-30 14:11:03 -07:00
Horace He
bc4e5bcdb7 replaced all instances of new ModeHandler() with getAndUpdateModeHandler()? 2017-05-24 00:01:13 -04:00