This function replaces both vim.treesitter.get_node_at_pos() and
vim.treesitter.get_node_at_cursor(). These two functions are similar
enough that they don't need separate interfaces. Even worse,
get_node_at_pos() returns a TSNode while get_node_at_cursor() returns a
string, so the two functions behave slightly differently.
vim.treesitter.get_node() combines these two into a more streamlined
interface. With no arguments, it returns the node under the cursor in
the current buffer. Optionally, it can accept a buffer number or a
position to get the node at a given position in a given buffer.
Problem:
vim.treesitter does not know how to map a specific filetype to a parser.
This creates problems since in a few places (including in vim.treesitter itself), the filetype is incorrectly used in place of lang.
Solution:
Add an API to enable this:
- Add vim.treesitter.language.add() as a replacement for vim.treesitter.language.require_language().
- Optional arguments are now passed via an opts table.
- Also takes a filetype (or list of filetypes) so we can keep track of what filetypes are associated with which langs.
- Deprecated vim.treesitter.language.require_language().
- Add vim.treesitter.language.get_lang() which returns the associated lang for a given filetype.
- Add vim.treesitter.language.register() to associate filetypes to a lang without loading the parser.
This commit implements the ability to control all of the XDG paths
Neovim should use. This is done by setting an environment variable named
NVIM_APPNAME. For example, setting $NVIM_APPNAME makes Neovim look for
its configuration directory in $XDG_CONFIG_HOME/$NVIM_APPNAME instead of
$XDG_CONFIG_HOME/nvim.
If NVIM_APPNAME is not set or is an empty string, "nvim" will be used as
default.
The usecase for this feature is to enable an easy way to switch from
configuration to configuration. One might argue that the various $XDG
environment variables can already be used for this usecase. However,
setting $XDG environment variables also affects tools spawned by Neovim.
For example, while setting $XDG_CONFIG_HOME will enable Neovim to use a
different configuration directory, it will also prevent Git from finding
its "default" configuration.
Closes https://github.com/neovim/neovim/issues/21691
Make it more clear that on unix the "pipe" mode of sockconnect uses unix
local domain sockets, not named pipes (FIFOs) which are not currently
supported.
See discussion in #22080.
Signed-off-by: Thayne McCombs
Problem: Some injections (like markdown) allow specifying arbitrary
language names for code blocks, which may be lead to errors when
looking for a corresponding parser in runtime path.
Solution: Validate that the language name only contains alphanumeric
characters and `_` (e.g., for `c_sharp`) and error otherwise.
Problem: :runtime completion can be further improved.
Solution: Also complete the {where} argument values and adjust the
completion for that. (closesvim/vim#11874)
5c8771bc5a
Problem:
Build is not reproducible, because generated source files (.c/.h/) are not
deterministic, mostly because Lua pairs() is unordered by design (for security).
https://github.com/LuaJIT/LuaJIT/issues/626#issuecomment-707005671https://www.lua.org/manual/5.1/manual.html#pdf-next
> The order in which the indices are enumerated is not specified [...]
>
>> The hardening of the VM deliberately randomizes string hashes. This in
>> turn randomizes the iteration order of tables with string keys.
Solution:
- Update the code generation scripts to be deterministic.
- That is only a partial solution: the exported function
(funcs_metadata.generated.h) and ui event
(ui_events_metadata.generated.h) metadata have some mpack'ed
tables, which are not serialized deterministically.
- As a workaround, introduce `PRG_GEN_LUA` cmake setting, so you can
inject a modified build of luajit (with LUAJIT_SECURITY_PRN=0)
that preserves table order.
- Longer-term we should change the mpack'ed data structure so it no
longer uses tables keyed by strings.
Closes#20124
Co-Authored-By: dundargoc <gocdundar@gmail.com>
Co-Authored-By: Arnout Engelen <arnout@bzzt.net>
Problem: 'statuscolumn' click definitions are cleared, evaluated,
allocated and filled each redraw for every row in a window.
This despite the fact that we only store a single click
definition array for the entire column as opposed to one
for each row.
Solution: Only fill the 'statuscolumn' click definition array once per
window per redraw.
Resolve https://github.com/neovim/neovim/issues/21767.
Problem: Cannot lock a variable in legacy Vim script like in Vim9.
Solution: Make ":lockvar 0" work.
a187c43cfe
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Cannot read back what setcellwidths() has done.
Solution: Add getcellwidths(). (Kota Kato, closesvim/vim#11837)
66bb9ae70f
Co-authored-by: Kota Kato <github@kat0h.com>
Problem: No fuzzy cmdline completion for user defined completion.
Solution: Add fuzzy completion for user defined completion. (Yegappan
Lakshmanan, closesvim/vim#9858)
afd4ae35d6
Cherry-pick related docs from Vim runtime.
N/A patches for version.c:
vim-patch:8.2.4485: compiler warning for uninitialized variable
vim-patch:8.2.4732: duplicate code to free fuzzy matches
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Problem: getcompletion() does not work properly when 'wildoptions
contains "fuzzy".
Solution: Do not use addstar(). (Yegappan Lakshmanan, closesvim/vim#9992,
closesvim/vim#9986)
e7dd0fa2c6
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Problem: Completion only uses strict matching.
Solution: Add the "fuzzy" item for 'wildoptions'. (Yegappan Lakshmanan,
closesvim/vim#9803)
38b85cb4d7
Use MAX_FUZZY_MATCHES in fuzzy_match_str().
Omit fuzmatch_str_free() as it is only used on allocation failure.
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Problem: The `'statuscolumn'` was not re-evaluated for wrapped lines,
when preceded by virtual/filler lines. There was also no way
to distinguish virtual and wrapped lines in the status column.
Solution: Make sure to rebuild the statuscolumn, and replace variable
`v:wrap` with `v:virtnum`. `v:virtnum` is negative when drawing
virtual lines, zero when drawing the actual buffer line, and
positive when drawing the wrapped part of a buffer line.