forked from neovim/neovim
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(lua): SID for sourced anon vim script from lua
Unfortunately, even after our changes that allow for <SID> to be always usable in anonymous Vim scripts, the changes in neovim#15079 break this for Lua scripts due to the use of SID_LUA over a unique SID in places such as nvim_exec. Instead, use the special SID offset SID_FROM_LUA to identify scripts from Lua contexts in which nlua_set_sctx can be used. Encoding it this way avoids the need to store such information in an allocated script item or elsewhere. However, SID_FROM_LUA produces ugly script IDs, so it's only used when :verbose logging for Lua is enabled. As a result, it's now even more strongly recommended to start nvim as `nvim -V1` rather than to set verbose=1 in the middle of a session, otherwise tracing for previously sourced Lua scripts before verbose was set will not work (as they won't have the SID_FROM_LUA offset). Remove the previous LastSet sctx dancing logic when accessing "s:" scope. It's no longer needed as anonymous Lua scripts now get a unique SID. Add some tests that would previously fail due to bugs with the old verbose Lua approach. Also, remove find_sid (unused leftover from the autocmd API PR) and change sid_T's type to a fixed-width type (int64_t).
- Loading branch information
Showing
11 changed files
with
141 additions
and
102 deletions.
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
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.