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

Eagerly initialise local options and introduce option scope #667

Merged
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
0c1856e
Introduce declared scope for all options
citizenmatt Apr 6, 2023
e19d7f2
Update parsed value cache for declared scope
citizenmatt Apr 20, 2023
78928c3
Support local-to-buffer options
citizenmatt Apr 7, 2023
78c219f
Override IjVimEditor.toString for better debugging
citizenmatt Apr 10, 2023
fcbac54
Use Vim terminology in storage service
citizenmatt Apr 20, 2023
3924ff3
Initialise options when opening windows/buffers
citizenmatt Apr 24, 2023
5553086
Introduce AUTO scope for effective option values
citizenmatt Apr 24, 2023
35f4c02
Reset options for current editor only
citizenmatt Apr 24, 2023
d8de218
Only notify change if option has changed
citizenmatt Apr 25, 2023
92eca54
Support global-local options
citizenmatt Apr 25, 2023
346038a
Add support for resetting option to global value
citizenmatt Apr 25, 2023
fdf7f8c
Format unset global-local toggle options
citizenmatt Apr 25, 2023
dc6c5fd
Use accessor API to set global-local value
citizenmatt Apr 26, 2023
ef51df7
Add :setglobal command
citizenmatt Apr 27, 2023
a899ac0
Fix option scopes for :let command
citizenmatt Apr 27, 2023
9db8b26
Simplify guicursor caret attributes cache
citizenmatt Apr 28, 2023
0c08791
Introduce listener for global option changes
citizenmatt Apr 28, 2023
c04e0fa
Add simple one to many collection
citizenmatt Apr 28, 2023
1abaf33
Introduce option effective value change listener
citizenmatt May 1, 2023
1555c54
Migrate to effective value change listeners
citizenmatt May 1, 2023
f545350
Remove old option listener API
citizenmatt May 1, 2023
e662a49
Fix tests under latest SDK
citizenmatt Jul 19, 2023
0b331d9
Minor updates from code review
citizenmatt Jul 29, 2023
1793f75
Refactor parseOptionLine for readability
citizenmatt Jul 29, 2023
f096c85
Rename OptionsScope.AUTO to EFFECTIVE
citizenmatt Jul 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add :setglobal command
citizenmatt committed Jul 30, 2023
commit ef51df72878e96b4691152acfbf9ee150c8362f4
4 changes: 3 additions & 1 deletion src/main/antlr/Vimscript.g4
Original file line number Diff line number Diff line change
@@ -110,7 +110,7 @@ command:
(WS | COLON)* range? (WS | COLON)*
name = (
Y_LOWERCASE | YANK_LINES | X_LOWERCASE | WRITE_QUIT | WRITE_PREVIOUS | WRITE_NEXT | W_LOWERCASE | WRITE
| WRITE_ALL | U_LOWERCASE | UNDO | TAB_ONLY | TAB_CLOSE | SOURCE | V_SPLIT | SPLIT | SHELL | SET_HANDLER | SET | SETLOCAL
| WRITE_ALL | U_LOWERCASE | UNDO | TAB_ONLY | TAB_CLOSE | SOURCE | V_SPLIT | SPLIT | SHELL | SET_HANDLER | SET | SETGLOBAL | SETLOCAL
| SELECT_LAST_FILE | SELECT_FIRST_FILE | SELECT_FILE | AT | REDO | Q_LOWERCASE | QUIT | PUT_LINES | PROMPT_FIND
| PROMPT_REPLACE | P_LOWERCASE | P_UPPERCASE | PRINT | PREVIOUS_TAB | N_UPPERCASE | PREVIOUS_FILE | PLUG
| ONLY | NO_HL_SEARCH | NEXT_TAB | N_LOWERCASE | NEXT_FILE | M_LOWERCASE | MOVE_TEXT | MARKS | K_LOWERCASE
@@ -484,6 +484,7 @@ existingCommands: RETURN
| SELECT_FIRST_FILE
| SELECT_LAST_FILE
| SET
| SETGLOBAL
| SETLOCAL
| SET_HANDLER
| SHELL
@@ -658,6 +659,7 @@ SELECT_FILE: 'argu' | 'argum' | 'argume' | 'argumen' | 'argument';
SELECT_FIRST_FILE: 'fir' | 'firs' | 'first';
SELECT_LAST_FILE: 'la' | 'las' | 'last';
SET: 'se' | 'set';
SETGLOBAL: 'setg' | 'setgl' | 'setglo' | 'setglob' | 'setgloba' | 'setglobal';
SETLOCAL: 'setl' | 'setlo' | 'setloc' | 'setloca' | 'setlocal';
SET_HANDLER: 'sethandler';
SHELL: 'sh' | 'she' | 'shel' | 'shell';
Original file line number Diff line number Diff line change
@@ -70,8 +70,9 @@ import com.maddyhome.idea.vim.vimscript.model.commands.SelectFileCommand
import com.maddyhome.idea.vim.vimscript.model.commands.SelectFirstFileCommand
import com.maddyhome.idea.vim.vimscript.model.commands.SelectLastFileCommand
import com.maddyhome.idea.vim.vimscript.model.commands.SetCommand
import com.maddyhome.idea.vim.vimscript.model.commands.SetglobalCommand
import com.maddyhome.idea.vim.vimscript.model.commands.SetHandlerCommand
import com.maddyhome.idea.vim.vimscript.model.commands.SetLocalCommand
import com.maddyhome.idea.vim.vimscript.model.commands.SetlocalCommand
import com.maddyhome.idea.vim.vimscript.model.commands.ShellCommand
import com.maddyhome.idea.vim.vimscript.model.commands.ShiftLeftCommand
import com.maddyhome.idea.vim.vimscript.model.commands.ShiftRightCommand
@@ -602,11 +603,17 @@ internal object CommandVisitor : VimscriptBaseVisitor<Command>() {
"last" to SelectLastFileCommand::class,
"se" to SetCommand::class,
"set" to SetCommand::class,
"setl" to SetLocalCommand::class,
"setlo" to SetLocalCommand::class,
"setloc" to SetLocalCommand::class,
"setloca" to SetLocalCommand::class,
"setlocal" to SetLocalCommand::class,
"setg" to SetglobalCommand::class,
"setgl" to SetglobalCommand::class,
"setglo" to SetglobalCommand::class,
"setglob" to SetglobalCommand::class,
"setgloba" to SetglobalCommand::class,
"setglobal" to SetglobalCommand::class,
"setl" to SetlocalCommand::class,
"setlo" to SetlocalCommand::class,
"setloc" to SetlocalCommand::class,
"setloca" to SetlocalCommand::class,
"setlocal" to SetlocalCommand::class,
"sethandler" to SetHandlerCommand::class,
"sh" to ShellCommand::class,
"she" to ShellCommand::class,
Original file line number Diff line number Diff line change
@@ -335,6 +335,6 @@ class SetCommandTest : VimTestCase() {
assertCommandOutput("set virtualedit?", " virtualedit=block\n")
assertCommandOutput("setlocal virtualedit?", " virtualedit=\n")

// Note that :setlocal virtualedit< has different behaviour. See SetLocalCommandTest
// Note that :setlocal virtualedit< has different behaviour. See SetlocalCommandTest
}
}
Loading