Commit Graph

69 Commits

Author SHA1 Message Date
Matteo Planchet
5dd3810926
A few small fixes (#8955)
- Fix a typo in the warning message that appears when the .vimrc file fails to open
- Use loadConfiguration` from `extension.ts` instead of `configuration.load
- Use context.globalStorageUri.fsPath instead of context.globalStoragePath which is deprecated
2024-03-25 20:53:48 -04:00
Foo-x
d712063aa0
Closes #4483: migrate to eslint (#8702) 2023-12-22 20:16:43 -05:00
Dan Brown
15c84a6536
Fix vim.remap: Add missing await on executeCommand (#8645) 2023-10-09 20:18:01 -04:00
Jaemin Park
8ad694f56c
Revert TaskQueue removal (#8622)
Fixes #8577, fixes #8603
2023-09-25 22:48:47 -04:00
renovate[bot]
8c544d512e
Update dependency prettier to v3 (#8486) 2023-09-09 19:57:26 -04:00
Jason Fields
50bc4fe1e3 Remove TaskQueue
At some point this class had a purpose, but at this point I think it's just serving to maybe add some latency and indeterminism to the mix.
2023-04-20 21:12:08 -04:00
Jason Fields
c80f6f58c5 A few small refactors 2023-03-22 00:15:27 -04:00
Jason Fields
85e5ee7d54 Small refactor in ModeHandlerMap 2023-03-16 20:16:05 -04:00
Jason Fields
100845f7ad Bail from onDidChangeTextEditorSelection callback if we're in output panel 2023-03-16 15:10:39 -04:00
Jason Fields
76f9723e5f Attempt to fix undo. Refs #8157.
The issue is pretty clearly that a recent VS Code update caused `onDidChangeTextDocument` events to be created (unreliably, from my testing) in such a way that trips our "change from disk" logic. We respond to that situation rather pessimistically by throwing out our undo stack, rather than trying to do something clever.
I haven't had the time lately to dig into the nitty gritty details of what changed on VS Code's side, so this is a bit of a shot in the dark.
The "change from disk" logic has caused issues in the past and I'm not sure how to reliably make it work, so I'm just deleting it for now. This may cause problems in some edge cases, but judging by my dogfooding, that'll be much less disruptive than losing your undo stack frequently enough that you can't trust it.
2023-02-28 22:21:35 -05:00
Jason Fields
5210e120f3 Some logging improvements 2023-02-15 23:22:59 -05:00
Jason Fields
d447a27c24 Fix jump tracking when lines are added
This logic is pretty sloppy and apparently not well-tested. Not dealing with that now, just patching the obvious bug.
2022-12-30 01:44:20 -05:00
Jason Fields
baa82a2d7b Simplify Logger by removing concept of scope
I may re-introduce this at some point, but for now, it's not worth the clutter.
2022-12-29 22:03:28 -05:00
Jason Fields
f122b747a0 Replace logging framework with a simple wrapper around VS Code's new LogOutputChannel 2022-12-27 23:03:07 -05:00
Evgeny Gryaznov
c3dd400854
Fix the remaining dependency cycles. (#7483)
Fixes #6177
2022-12-05 22:08:15 -05:00
Jason Fields
44ebdd1229 Fix selection tracking in VisualBlock mode at EOL 2022-08-21 17:10:00 -04:00
Piotr Kalinowski
d6fad7841a
Fix the jump list (#7862)
Fix for #7357 not only started setting # register but also added
additional call to file jump handling that broke the jump list. So,
still set # register if activeTextEditor is undefined, but skip the
extra task.

Fixes #7825.
2022-08-01 22:23:42 -04:00
Jason Fields
156022912c Use Date.now() rather than performance.now() or Number(new Date()) to get timestamp 2022-06-27 20:44:06 -04:00
Jason Fields
16ab1eb61e Move VimState.selectionsChanged into ModeHandler
I'm not sure why it was ever in VimState... it's very much implementation detail that no Action should be interacting with.
2022-03-14 00:19:31 -04:00
Jason Fields
b64799c2b5 Fix <C-^> when activeTextEditor is set to undefined
Fixes #7357
2022-03-08 23:33:19 -05:00
Jason Fields
52f4a9a0c6 Ensure VimState.editor is never undefined
Fixes #6139
2022-03-08 22:18:51 -05:00
Jean Pierre
5985f1416f
Fix extension for web (#7520)
Fixes #7469
2022-02-18 12:12:05 -05:00
waynewaynetsai
214118d348
Fix vimrc.path containing $HOME (#7360)
- Handle vimrc path with $home variable correctly after saving vimrc file
- Fix vim.editVimrc command's error with vimrcPath's $HOME variable
- Display warning message when no vimrcPath is found

Fixes #7359, fixes #7358
2022-01-02 01:30:46 -05:00
Jason Fields
4585ef2723 Fix undo/redo in Jupyter notebooks
Two things going on here:

- Notebook cells have the same file name, but different Documents/Uris
  (fragment is different). We now use Uri (rather than file name) as the
  ModeHandler key, so cells have separate VimStates and therefore undo
  histories. VS Code lets you customize that behavior, but we don't
  currently respect that setting.

- TextDocuments associated with notebook cells don't ever seem to have
  `isDirty` set (not sure if this is a bug/limitation or the intended
  design). This caused a "file changed on disk" handler to be triggered
  on every change, which wipes that file's undo history. I've added
  notebook cells as a special case disabling that, as a stopgap.

Fixes #6960
2021-12-10 02:04:02 -05:00
Jason Fields
028e9c6533 Big refactor of command line & search
This removes a lot of code duplication, creates a better abstraction,
makes testing easier, and lays the groundwork for some features like:
- `:s` and similar commands working with `hlsearch` (#4934)
- The expression register (#4383)
- Better `incsearch` support (#4837)

The central change here is to take various pieces of global state which
were scattered and throughout the project and bring them together,
localizing them where possible to an object (`CommandLine`) held by
`VimState` (this naturally fixes #7038).

This applies to both ex commands and the search command line, which
means we finally have a uniform interface for them!
2021-10-21 01:26:45 -04:00
Jason Fields
06ca186055 Move VimState.focusChanged into ModeHandler 2021-08-30 21:39:05 -04:00
Jason Fields
127add640c Revert "Don't reload .vimrc every time any setting at all changes"
Yeah, this doesn't work - will require some more thought to implement correctly.
2021-07-23 17:50:15 -04:00
Jason Fields
2292afe546 Don't reload .vimrc every time any setting at all changes
This is mainly an optimization for `statusBarColorControl`
2021-07-23 12:55:20 -04:00
Jason Fields
62b0508ff7 Use task queue library instead of broken hand-rolled crap 2021-06-16 20:24:45 -04:00
Jason Fields
6dcdd2a6c5 Always create ModeHandler on task queue, never before enqueueing a task
This fixes problems where rapid selection changes would cause multiple ModeHandlers to be created for the same TextEditor. Then only some selection changes would be reflected in VimState.
Fixes #6544
2021-06-16 20:21:33 -04:00
Jason Fields
e3dc1a394f Fix race condition in certain actions like n which caused the status bar to flicker
Fixes #6039
2021-06-12 19:24:53 -04:00
renovate[bot]
3f6ba73944
Update dependency prettier to v2.3.0 (#6604)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-05-10 01:29:40 -04:00
Jason Fields
045cabeef5 Big fat refactor of registers
- Each register now points to an array - the i'th slot contains the content for the i'th cursor
- If there are more cursors than slots, the first slot is used as a backup
- Each slot contains either a RecordedState (in the case of a macro) or a string
- Newlines in those strings should be interpreted in the context of the associated RegisterMode
- The interface was changed somewhat to be safer and more consistent

I probably broke *something*, but the tests pass and this refactor enables further improvement of the terrible put logic, so I'll fix things as they come up.
2021-04-09 23:17:59 -04:00
Jason Fields
1c2cdc26be Remove Globals.mockModeHandler, which is no longer necessary 2021-03-31 18:40:24 -04:00
Jason Fields
6a6afd8bef Fix build 2021-03-21 23:36:09 -04:00
Jason Fields
daee0c0226 Remove some unused variables 2021-03-21 22:56:20 -04:00
Jason Fields
dfae9b7109 Implement # register and <C-^>
Fixes #4959
2021-03-17 11:48:30 -04:00
berknam
55f71bd731
Potential fix for non-Latin chars issue (#5951)
Fixes #5900
2021-03-15 21:28:59 -04:00
Evgeny Gryaznov
32d5b92f5c
Fix even more dependency cycles (#6243)
Refs #6177
2021-03-10 22:39:25 -05:00
Jason Fields
5a2dc0210d Simplify tslint.json by extending tslint:recommended
As a side-effect, our linting just got substantially stricter, and this had to be a pretty wide-reaching change to comply. Sorry if this complicates any merges!
2021-03-05 20:20:44 -05:00
Jason Fields
9c0689e439 Overhaul HistoryTracker to eliminate a few of its pitfalls
- Create a light wrapper around the undo stack which should protect us from index out of bounds errors
- Remove an optimization which made our undo stack ignore regular VSCode commands
- Stop adding an initial undo step before anything is done (not sure what the rationale there was)

Fixes #5209, fixes #4978
2021-02-06 01:01:02 -05:00
berknam
05961c7c8f Fix race condition on composition input
- If user inputs some text using the composition state, like when using
Korean input, that doesn't open a popup box, then pressing space should
be inserted straight away, but because the CompositionEnd wasn't being
awaited, the space would trigger as a normal 'type' command and would
join the previous ongoing CompositionEnd handling, preventing the space
from being handled.
- fixes #5865
2020-12-13 18:34:04 +00:00
Jason Fields
03cd9b7294 Better implementation of StatusBar clearing when viewport scrolls
Doing this in an event handler allows us to NOT await postponed view changes (see prior commit) while correctly clearing the status bar even in cases like hitting `scrolloff` or scrolling with mouse wheel.
Refs #5858
2020-12-10 14:29:23 -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
berknam
6b98a089cd
Remove "vim.remap" from the command palette (#5843)
* Remove "vim.remap" from the command palette
- This command is supposed to be used in keybindings, it can't be used
directly from the command palette
- fixes #5841

* Bugfixes on command "vim.remap"
- Add better error message to vim.remap
- Remove 'return' from 'after' handling so that the commands can still
run after finishing handling the 'after' keys.
2020-12-07 14:05:15 -05:00
rebornix
fd9f793e29 fix web compability. 2020-12-07 09:18:49 -08:00
Jason Fields
0ca247d1ac When syncing cursor on activation, make sure we aren't going to column -1
Refs #5728
2020-11-24 15:43:43 -05:00
Jason Fields
38dd31a34d Sync cursors on activation, removing existing selections and making sure cursor is not on EOL
Fixes #5728
2020-11-21 17:24:14 -05:00
Jason Fields
b9d982fa01 Save registers to disk only once - when the extension is deactivated
Frankly, I'm a bit embarrassed that I wrote code to serialize and save the registers every time one changes. This can actually have a noticeable effect on performance if any registers have even modestly large values.
It seems `globalState` doesn't work in `deactivate`, so we need to store the register data in a file.
Fixes #5707
2020-11-20 22:48:28 -05:00
Jason Fields
422e92a207 Return undefined from getAndUpdateModeHandler if document is closed
I think this should protect us from disposed editors. It certainly seems like a reasonable safety check, if nothing else.
2020-11-18 19:08:16 -05:00