-
Notifications
You must be signed in to change notification settings - Fork 755
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 some local options being used as global options #619
Merged
AlexPl292
merged 10 commits into
JetBrains:master
from
citizenmatt:refactor/fix-local-options
May 17, 2023
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
fdd1795
Treat 'matchpairs' as a local option
citizenmatt 64bd48c
Treat 'ideajoin' as a global-local option
citizenmatt 9727476
Treat 'idearefactor' as a global-local option
citizenmatt 1a08fd5
Treat 'virtualedit' as a global-local option
citizenmatt 91510c0
Refactor search helper companion to interface
citizenmatt e22fdad
Treat 'iskeyword' as a local-to-buffer option
citizenmatt 11a9010
Introduce simple cache for parsed option values
citizenmatt 16ed774
Add helper functions to storage service
citizenmatt 141b9bb
Use options API for more cached values
citizenmatt a5430ff
Fix typo in ideajoin notification
citizenmatt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we don't have some accessors API for this case and use direct
setOptionValue
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mainly because this is a global-local option which we don't currently support properly (but will in the next PR, currently in progress 😁).
The accessors are aimed at the common case of getting/setting the "effective" value of an option, but we don't really support "effective" scope in the API, only
GLOBAL
andLOCAL
, and this makes it hard to handle global-local options correctly. Global-local options are usually global, but can be overridden with a local value, so theideajoin
accessor is a property on theEffectiveIjOptions
class, with a scope ofLOCAL(editor)
. Getting the value from the accessor works fine, as a side effect of the implementation - because we lazily initialise options, when the local value isn't set, we fall back to the global value. But set will set the value atLOCAL
scope, which is not what we want here.So for now, we need to explicitly set it at
GLOBAL
scope viasetOptionValue
.I'm introducing an
AUTO
scope in the next PR which is the "effective" scope of an option, and the option accessors will use this to get/set at the right scope. The scopes now map closely to:set
,:setglobal
and:setlocal
, and the API behaves the same as the commands. GivenAUTO
scope and a global-local option,getOptionValue
(and the accessors) will return the local value if set, global otherwise.setOptionValue
follows Vim behaviour and updates the global value, and resets/updates the local value. (It's important to update the global value so that we can eagerly initialise options for new windows, which is itself important for options that are required at window initialisation time, such as, finally,'wrap'
😅)All of which means that with the next PR, we can use the accessors API to set this value.