Commit Graph
100 Commits
Author SHA1 Message Date
Matt EllisandAlex Pláte bc808403fb Rename localEditors to getEditors
The fact that these methods only return local editors (i.e., editors for the local user while hosting a Code With Me session) is an implementation detail
2024-02-23 17:01:32 +02:00
Matt EllisandAlex Pláte 9d6dc317a4 Only notify editors for the current buffer 2024-02-23 17:01:32 +02:00
Matt EllisandAlex Pláte cf29c50f31 Ensure editors are initialised before use
Fixes VIM-3256
2024-02-23 17:01:32 +02:00
Matt EllisandAlex Pláte bd192561ae Stop IdeaVim actions flowing into JB Client
IdeaVim actions are local only - they control local behaviour and should not be visible in the Client

Fixes VIM-3283
2024-02-23 15:54:20 +02:00
Matt EllisandAlex Pláte 66ff56a05e Move document listeners to global listeners
This means we listen to changes in all documents, rather than just the changes in the documents for open local editors. And this means that we correctly update e.g. marks when a non-local editor changes a file that isn't open in a local editor.
2024-02-23 15:54:20 +02:00
Matt EllisandAlex Pláte def86d179e Review disabled editor checks 2024-02-23 15:54:20 +02:00
Matt EllisandAlex Pláte 3c9a343f8b Review listeners to only work with local editors
Reviews all IntelliJ listeners to ensure that they only work with supported local editors. Editor creation was initialising IdeaVim for all editors, which meant that behaviour could leak into Code With Me guest editors. E.g. guest editors incorrectly drawing relative line numbers, or the host using the guest's last selected tab when switching to an alternate file.

This leads to a change in behaviour with some local editors. The editor creation listener will now check to see if the editor is local *and supported*. This means it can exclude single line editors, editors in database cells or dialogs, depending on the state of 'ideavimsupport' at creation time. The behaviour at creation time is now more correct, but if 'ideavimsupport' is modified, existing matching editors will not be initialised.

Fixes VIM-3274, fixes VIM-3275
2024-02-23 15:54:20 +02:00
Matt EllisandAlex Pláte 10b6b05fab Clear disposable after disposing 2024-02-23 15:54:20 +02:00
Matt EllisandAlex Pláte caa4ef736a Rename method for clarity 2024-02-23 15:54:20 +02:00
Matt EllisandAlex Pláte 23702345a9 Fix comments 2024-02-23 15:54:20 +02:00
Matt EllisandAlex Pláte ba89babd10 Move listener to app level
Fixes VIM-2167
2024-02-23 15:54:20 +02:00
Matt EllisandAlex Pláte 2ce3fbd677 Use common APIs to get local editors 2024-02-23 15:54:20 +02:00
Matt EllisandAlex Pláte d8de73a06d Use correct APIs to get local only editors
Always ignores non-local, hidden editors opened by remote guests in Code With Me sessions.

Fixes VIM-3268
2024-02-23 15:54:20 +02:00
Matt EllisandAlex Pláte f439474b73 Fix set command tests
Also hides more feature flags and diagnostic settings from users and unit tests. Shows them when in internal mode.
2024-02-23 10:04:23 +02:00
Matt EllisandAlex Pláte d6cd92e256 Migrate extensions to use operatorfunc option 2024-02-23 10:04:23 +02:00
Matt EllisandAlex Pláte 3a294268d9 Introduce operatorfunc option
Allows creating custom operators in script, as shown in JetBrains/ideavim#702
2024-02-23 10:04:23 +02:00
Matt EllisandAlex Pláte 825b62a2a9 Refactor to remove lazy properties 2024-01-04 15:58:36 +02:00
Matt EllisandAlex Pláte 5ec817776c Use "vim" prefix for option keys 2024-01-04 15:58:36 +02:00
Matt EllisandAlex Pláte 3ad0519add Extract initialisation strategies to new class 2024-01-04 15:58:36 +02:00
Matt EllisandAlex Pláte 9868522341 Only calculate stack trace if logging is enabled 2024-01-04 15:58:36 +02:00
Matt EllisandAlex Pláte 5b8d8c617f Improve type handling 2024-01-04 15:58:36 +02:00
Matt EllisandAlex Pláte a1f66061e3 Extract option storage to separate class 2024-01-04 15:58:36 +02:00
Matt EllisandAlex Pláte d8811933c9 Simplify resetting options for testing 2024-01-04 15:58:36 +02:00
Matt EllisandAlex Pláte c9864dde8d Extract parsed values cache 2024-01-04 15:58:36 +02:00
Matt EllisandAlex Pláte ca849d6649 Simplify API of OptionListenersImpl 2024-01-04 15:58:36 +02:00
Matt EllisandAlex Pláte 95a2354a86 Fix issue where global value wasn't properly set 2024-01-04 15:58:36 +02:00
Matt EllisandAlex Pláte 538e0ac48c Extract listener notification
Refactoring - no intentional changes in behaviour
2024-01-04 15:58:36 +02:00
Matt EllisandAlex Pláte 1c17411f04 Add test for changing number global-local options
The local value is not unset, but set to a copy of the new value, so we need to make sure that we notify editors that are not "unset"
2024-01-04 15:58:36 +02:00
Matt EllisandAlex Pláte cbe0f89548 Extract listener registration to separate class
Refactoring - no intentional changes in behaviour
2024-01-04 15:58:36 +02:00
Matt EllisandAlex Pláte 615b071dcb Rename methods for clarity 2024-01-04 15:58:36 +02:00
Matt EllisandAlex Pláte 8ab43e98fe Remove unnecessary keeping visual mode flag
The value was only ever set to false.
2023-12-22 10:55:00 +02:00
Matt EllisandAlex Pláte 4f407ccc03 Remove unused multikey-undo flag
It's uncertain what this was introduced for, and it's no longer used for any behaviour
2023-12-22 10:55:00 +02:00
Matt EllisandAlex Pláte 5f3fddd3e4 Remove unnecessary post process method
We no longer need to post process the selection because it is up to the operator implementation to end in the correct mode
2023-12-22 10:55:00 +02:00
Matt EllisandAlex Pláte 392f3b536d Remove unnecessary mode reset
Visual mode should already have been exited before executing the operator. The operator's implementation is responsible for handling the final mode
2023-12-22 10:55:00 +02:00
Matt EllisandAlex Pláte 155de2b396 Remove always true check and always exit visual 2023-12-22 10:55:00 +02:00
Matt EllisandAlex Pláte 6c9930ac2a Removes unnecessary 'exit visual' command flag
This flag is only used to modify the behaviour of visual operators, but all visual operators have the flag, which means it's unnecessary. The only behaviour for visual operators now is to exit visual mode.

Note that visual motions are implemented separately, and handle their own visual mode requirements (e.g. MotionArrowLeftAction).
2023-12-22 10:55:00 +02:00
Matt EllisandAlex Pláte 9dddf4f4bc Minor cleanup 2023-12-22 10:55:00 +02:00
Matt EllisandAlex Pláte 1841b7c4e6 Allow tilde forward slash on Windows 2023-11-03 08:46:57 +02:00
Matt EllisandAlex Pláte f0abe5d80d Fix range for fall back comment mode
Callback to reset caret was always called, even if action was unavailable. Fall back action would therefore act on current line only.
2023-10-27 12:45:02 +03:00
Matt EllisandGitHub 5fd54dccd3 Add support for ShowHoverInfo action to 2023.1 and 2023.2 (#733)
* Fix(VIM-2106) Implement ShowHoverInfo if not provided by platform

* Bump minimum build to 2023.1 RTM
2023-10-27 11:06:11 +03:00
Matt EllisandAlex Pláte 405b9ba7ea Fix(VIM-2562): Fix hang with multi-width chars in command line 2023-10-11 11:08:08 +03:00
Matt EllisandAlex Pláte 585b815472 Only notify changes if the value is different
This is primarily to avoid instantiating inactive extensions when
resetting all options back to default values, which sets extensions
inactive.
It applies to global and local options, but not to global-local. The
notifications for global-local options are already complex, as they can
be reacting to changes to both the global and local value, and only
notifying editors that are affected.
2023-09-11 11:04:09 +03:00
Matt EllisandAlex Pláte c37e2f4176 Update fallback window when all windows close 2023-09-11 11:04:09 +03:00
Matt EllisandAlex Pláte 626d59d3fc Only use fallback for first initialisation
Subsequent initialisation will be treated like EDIT
2023-09-11 11:04:09 +03:00
Matt EllisandAlex Pláte ddd058a26f Fix name of usage statistic 2023-09-11 11:04:09 +03:00
Matt EllisandAlex Pláte 32b8d03c5e Improve modifying string and string list options 2023-09-11 11:04:09 +03:00
Matt EllisandAlex Pláte 71f3e1b4f1 Support per-window global values
For local-to-window options
2023-09-11 11:04:09 +03:00
Matt EllisandAlex Pláte aa6f53fa68 Require editor when getting/setting global option 2023-09-11 11:04:09 +03:00
Matt EllisandAlex Pláte 1335e9f7f2 Improve detection of editor open scenarios 2023-09-11 11:04:09 +03:00
Matt EllisandAlex Pláte c75599b6a0 Refactor editor options initialisation 2023-09-11 11:04:09 +03:00
Matt EllisandAlex Pláte 2efdfbd988 Remove unnecessary calls from tests 2023-09-11 11:04:09 +03:00
Matt EllisandAlex Pláte 700198d8bc Remove test only vimscript execute method 2023-09-11 11:04:09 +03:00
Matt EllisandAlex Pláte 3efab5928e Evaluate ideavimrc in the fallback window context 2023-09-11 11:04:09 +03:00
Matt EllisandAlex Pláte 93037b6866 Add fallback window to capture local option state 2023-09-11 11:04:09 +03:00
Matt EllisandAlex Pláte 0f19e50c69 Improve hierarchy of option accessors
Getting the effective IJ options would allow access to Vim global and IJ global, but not Vim effective. IntelliJ specific options are now a separate hierarchy, so the Vim effective and IJ effective accessors now simply access all Vim or all IJ options.
2023-09-11 11:04:09 +03:00
Matt EllisandAlex Pláte 66ea6ad3d4 Rename OptionScope to OptionAccessScope 2023-09-11 11:04:09 +03:00
Matt EllisandAlex Pláte cb8385a092 Fix issue adding back hidden status bar widget 2023-08-03 15:00:28 +03:00
Matt EllisandAlex Pláte d4aa1f87e0 Fix read-only stdin when running application 2023-08-03 14:58:47 +03:00
Matt EllisandAlex Pláte d112030a8e Add explanatory comment about InsertExitModeAction 2023-08-01 12:22:26 +03:00
Matt EllisandAlex Pláte 98ca4080dd Do not enter INSERT mode for read-only editors
It's not enough that the document is writable, the editor needs to be non-read-only, too.

Fixes VIM-2313, fixes VIM-2318, fixes VIM-2666, fixes VIM-2951
2023-08-01 12:22:26 +03:00
Matt EllisandAlex Pláte dd24ebf184 Rename OptionsScope.AUTO to EFFECTIVE 2023-07-31 11:28:32 +03:00
Matt EllisandAlex Pláte 7ef2be625f Refactor parseOptionLine for readability 2023-07-31 11:28:32 +03:00
Matt EllisandAlex Pláte e3957d2207 Minor updates from code review 2023-07-31 11:28:32 +03:00
Matt EllisandAlex Pláte 8ce1307d51 Fix tests under latest SDK 2023-07-31 11:28:32 +03:00
Matt EllisandAlex Pláte e1141dcd1c Remove old option listener API 2023-07-31 11:28:32 +03:00
Matt EllisandAlex Pláte 4e33b5f351 Migrate to effective value change listeners 2023-07-31 11:28:32 +03:00
Matt EllisandAlex Pláte 54dc184dd0 Introduce option effective value change listener 2023-07-31 11:28:32 +03:00
Matt EllisandAlex Pláte 1977ce3ea5 Add simple one to many collection 2023-07-31 11:28:32 +03:00
Matt EllisandAlex Pláte c8c9d1729e Introduce listener for global option changes 2023-07-31 11:28:32 +03:00
Matt EllisandAlex Pláte e6e4b81f3b Simplify guicursor caret attributes cache 2023-07-31 11:28:32 +03:00
Matt EllisandAlex Pláte 1c465f028e Fix option scopes for :let command 2023-07-31 11:28:32 +03:00
Matt EllisandAlex Pláte 12824c22c4 Add :setglobal command 2023-07-31 11:28:32 +03:00
Matt EllisandAlex Pláte 64c5ad72a3 Use accessor API to set global-local value 2023-07-31 11:28:32 +03:00
Matt EllisandAlex Pláte 080c2059ee Format unset global-local toggle options 2023-07-31 11:28:32 +03:00
Matt EllisandAlex Pláte a288850010 Add support for resetting option to global value 2023-07-31 11:28:32 +03:00
Matt EllisandAlex Pláte 16811602d2 Support global-local options 2023-07-31 11:28:32 +03:00
Matt EllisandAlex Pláte 6d94d719e3 Only notify change if option has changed 2023-07-31 11:28:32 +03:00
Matt EllisandAlex Pláte 749d111e89 Reset options for current editor only
Matches Vim behaviour for `:set all&`
2023-07-31 11:28:32 +03:00
Matt EllisandAlex Pláte 365d8d34ce Introduce AUTO scope for effective option values 2023-07-31 11:28:32 +03:00
Matt EllisandAlex Pláte ced25bbf28 Initialise options when opening windows/buffers
Note that this temporarily changes the semantics of `:set` to always set the local option, instead of setting the global option (because we now eagerly initialise local values). Neither is correct, but we don't yet have a way to support the proper behaviour.
2023-07-31 11:28:32 +03:00
Matt EllisandAlex Pláte 7e1ce5a203 Use Vim terminology in storage service 2023-07-31 11:28:32 +03:00
Matt EllisandAlex Pláte aeec754f7e Override IjVimEditor.toString for better debugging 2023-07-31 11:28:32 +03:00
Matt EllisandAlex Pláte 9a3fcb56a1 Support local-to-buffer options
Previously, all local options were treated as local-to-window
2023-07-31 11:28:32 +03:00
Matt EllisandAlex Pláte aff956f4c8 Update parsed value cache for declared scope 2023-07-31 11:28:32 +03:00
Matt EllisandAlex Pláte 0f49fd6406 Introduce declared scope for all options 2023-07-31 11:28:32 +03:00
Matt EllisandAlex Pláte 6bd1782c4b Fix OS specific values in tests 2023-07-19 18:04:02 +03:00
Matt EllisandAlex Pláte 2f5d402c61 Support :set! to output as a single column 2023-07-19 18:04:02 +03:00
Matt EllisandAlex Pláte 8fb2ea5845 Output options in column order, not row order
This means that the last column might not be full, rather than the last row. Same as Vim.
2023-07-19 18:04:02 +03:00
Matt EllisandAlex Pláte a78e21a167 Use soft wraps instead of hard wraps in ex output
Hard wraps require figuring out the width of the panel, and all we have is the width of the associated editor, which excludes gutter, etc. Easier to let the UI toolkit handle it
2023-07-19 18:04:02 +03:00
Matt EllisandAlex Pláte 2e9b626523 Fix formatting of value pair options 2023-07-19 18:04:02 +03:00
Matt EllisandAlex Pláte 4487b8904c Sort options output before formatting
Sorts on option name, not including "no" prefix for toggle options
2023-07-19 18:04:02 +03:00
Matt EllisandAlex Pláte 1f01f915dc Remove trailing padding from options list 2023-07-19 18:04:02 +03:00
Matt EllisandAlex Pláte 94ef9692f2 Fix typo in ideajoin notification 2023-05-17 10:54:13 +02:00
Matt EllisandAlex Pláte 798750bf95 Use options API for more cached values 2023-05-17 10:54:13 +02:00
Matt EllisandAlex Pláte e8d9bd551f Add helper functions to storage service 2023-05-17 10:54:13 +02:00
Matt EllisandAlex Pláte d08ea2ee9b Introduce simple cache for parsed option values 2023-05-17 10:54:13 +02:00
Matt EllisandAlex Pláte 52dcb2d290 Treat 'iskeyword' as a local-to-buffer option 2023-05-17 10:54:13 +02:00
Matt EllisandAlex Pláte 4cc883f174 Refactor search helper companion to interface
Helper functions now take the editor rather than the text, ready for search to rely on per-editor options (i.e. '`iskeyword'`). Also standardises on `Int` for search parameters. While the file size is a `Long`, the editor returns a `CharSequence`, which is indexed by `Int`.
2023-05-17 10:54:13 +02:00
Matt EllisandAlex Pláte 5a3c5bd761 Treat 'virtualedit' as a global-local option 2023-05-17 10:54:13 +02:00
Matt EllisandAlex Pláte 66830b7cb3 Treat 'idearefactor' as a global-local option 2023-05-17 10:54:13 +02:00