Commit Graph

25109 Commits

Author SHA1 Message Date
Lewis Russell
ae263aff95
refactor(treesitter): use byte ranges from treesitter (#22589) 2023-03-09 16:09:39 +00:00
red
64d3f68c07
build: fix build warning when using gcc 4.9.2
Problem:
When building with gcc 4.9.2, tree-sitter throws warning: "for loop initial
declarations are only allowed in C99 or C11 mode"

Solution:
set CMAKE_C_STANDARD option to 99
2023-03-09 16:46:34 +01:00
Michal Liszcz
9ef7297ef1
feat(lsp): overwrite omnifunc/tagfunc set by ftplugin #22267
Problem:
Some built-in ftplugins set omnifunc/tagfunc/formatexpr which causes
lsp.lua:set_defaults() to skip setup of defaults for those filetypes.
For example the C++ ftplugin has:
    omnifunc=ccomplete#Complete
          Last set from /usr/share/nvim/runtime/ftplugin/c.vim line 30
so the changes done in #95c65a6b221fe6e1cf91e8322e7d7571dc511a71
will always be skipped for C++ files.

Solution:
Overwrite omnifunc/tagfunc/formatexpr options that were set by stock
ftplugin.

Fixes #21001
2023-03-09 06:12:56 -08:00
Justin M. Keyes
ce0fddf5ae
feat: try to recover from missing tempdir #22573
Problem:
If vim_tempdir mysteriously goes missing (typically by "antivirus" on
Windows), any plugins using tempname() will be broken for the rest of
the session. #1432 #9833 https://groups.google.com/g/vim_use/c/ef55jNm5czI
Steps:
    mkdir foo
    TMPDIR=./foo nvim
    :echo tempname()
    !rm -r foo
    :echo tempname()
    tempname() still uses the foo path even though it was deleted.

Solution:
- Don't assume that vim_tempdir exists.
- If it goes missing once, retry vim_mktempdir and log (silently) an error.
- If it goes missing again, retry vim_mktempdir and show an error.

Rejected in Vim for performance reasons:
  https://groups.google.com/g/vim_use/c/qgRob9SWDv8/m/FAOFVVcDTv0J
  https://groups.google.com/g/vim_dev/c/cogp-Vye4oo/m/d_SVFXBbnnoJ
But, logging shows that `vim_gettempdir` is not called frequently.

Fixes #1432
Fixes #9833
Fixes #11250
Related: stdpath("run") f50135a32e
2023-03-09 05:07:36 -08:00
bfredl
46d4d420e5
Merge pull request #22547 from luukvbaal/statusline
perf(statusline): UI elements are always redrawn on K_EVENT
2023-03-09 11:06:47 +01:00
Evgeni Chasnovski
e17581fa53
docs: add missing highlight groups for floats 2023-03-09 10:54:39 +01:00
zeertzjq
3ad8458824
vim-patch:8.2.1067: expression "!expr->func()" does not work (#22585)
Problem:    Expression "!expr->func()" does not work.
Solution:   Apply plus and minus earlier. (closes vim/vim#6348)

0b1cd52ff6

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-03-09 13:47:01 +08:00
zeertzjq
89a525de9f
fix(buffer_updates): save and restore current window cursor (#16732)
When a buffer update callback is called, textlock is active so buffer
text cannot be changed, but cursor can still be moved. This can cause
problems when the buffer update is in the middle of an operator, like
the one mentioned in #16729. The solution is to save cursor position and
restore it afterwards, like how cursor is saved and restored when
evaluating an <expr> mapping.
2023-03-09 10:19:00 +08:00
zeertzjq
eaccd0decd
vim-patch:9.0.1392: using NULL pointer with nested :open command (#22583)
Problem:    Using NULL pointer with nested :open command.
Solution:   Check that ccline.cmdbuff is not NULL.

7ac5023a5f

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-03-09 08:15:06 +08:00
Lewis Russell
be0461e3c2
fix(treesitter): is_in_node_range (#22582)
TS ranges are end column exclusive, so fix is_in_node_range
to account for that.
2023-03-08 23:45:43 +00:00
Amaan Qureshi
ae70e946ee
vim-patch:9.0.1395: Odin files are not recognized (#22580)
Problem:    Odin files are not recognized.
Solution:   Add a pattern for Odin files. (Amaan Qureshi, closes vim/vim#12122)

638388b8ef
2023-03-09 00:19:18 +01:00
Amaan Qureshi
6dd9770baf
vim-patch:9.0.1394: Unx Tal files are not recognized (#22579)
Problem:    Unx Tal files are not recognized.
Solution:   Add a pattern for Unx Tal files. (Amaan Qureshi, closes vim/vim#12117)

cde1f8714e
2023-03-09 00:19:10 +01:00
Lewis Russell
b9f19d3e28
Revert "refactor(treesitter): delegate region calculation to treesitter" (#22575)
Revert "refactor(treesitter): delegate region calculation to treesitter (#22553)"

This reverts commit 276b647fdb.
2023-03-08 17:59:45 +00:00
Lewis Russell
276b647fdb
refactor(treesitter): delegate region calculation to treesitter (#22553) 2023-03-08 17:22:28 +00:00
Christian Clason
898f902e00
ci(news): don't run on draft (#22574) 2023-03-08 18:18:03 +01:00
Luuk van Baal
fe11079721 perf(statusline): UI elements are always redrawn on K_EVENT
Problem:    'statusline'-format UI elements are redrawn on each K_EVENT.
Solution:   Only redraw UI elements when something relevant has changed.
2023-03-08 12:36:03 +01:00
Luuk van Baal
1fb585a9db test(statusline): UI elements are not redrawn on K_EVENT unnecessarily 2023-03-08 12:35:33 +01:00
Lewis Russell
ddd257f753
feat(treesitter): use upstream format for injection queries 2023-03-08 11:03:11 +00:00
zeertzjq
06aed7c177
vim-patch:8.2.3741: using freed memory in open command (#22568)
Problem:    Using freed memory in open command.
Solution:   Make a copy of the current line.

e031fe90cf

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-03-08 11:17:49 +08:00
zeertzjq
0e7edd70a9
test(old): move memfile_test.c to test/old/ (#22567) 2023-03-08 10:46:09 +08:00
bfredl
e0e474a4bb
Merge pull request #22561 from bfredl/cmakeinstall
refactor(build): make installation of runtime/ more effective
2023-03-07 21:15:20 +01:00
bfredl
30632dd21a refactor(build): make installation of runtime/ more effective
Currently files to install in runtime/ is detected by recursive glob
pattern which has two problems:

- cmake needs to do a of work at config time and
  build/runtime/cmake_install.cmake becomes HUGE (2.5MB, biggest config file)
- we need to explicitly specify each file suffix used in the entire
  runtime, which is duplication of information.

These globs specify every single file in a subdirectory.
Thus, we can just install every runtime/ subdirectory as a single
install command. Furthermore, at the top-level, only .vim and .lua files
need to be installed.

Further possible refactor: we could move files which does not belong
in $PREFIX/runtime out of $REPO/runtime. Then runtime could be installed
with a single install_helper(DIRECTORY ...) command.
2023-03-07 20:16:52 +01:00
jdrouhard
4385f8a743
fix(lsp): change LspTokenUpdate to use buffer instead of pattern (#22559) 2023-03-07 17:35:12 +01:00
Justin M. Keyes
32ef36cb87
Merge #22503 from eriks47/man-spaces
feat(man.lua): support spaces in manpage names
2023-03-07 09:38:35 -05:00
Justin M. Keyes
04e8e1f9ea
refactor(runtime): use vim.version to compare versions #22550
TODO:
Unfortunately, cannot (yet) use vim.version for tmux version comparison,
because `vim.version.parse(…,{strict=false})` does not coerce tmux's
funny "tmux 3.3a" version string.
6969d3d749/runtime/autoload/provider/clipboard.vim (L148)
2023-03-07 06:28:53 -08:00
Justin M. Keyes
304477ff35 fix(man.lua): tests, naming 2023-03-07 15:23:06 +01:00
Eriks Muhins
160a019ffa feat(man.lua): support spaces in manpage names
Problem:
:Man command errors if given more than two arguments. Thus, it is
impossible to open man pages that contain spaces in their names.

Solution:
Adjust :Man so that it tries variants with spaces and underscores, and
uses the first found.
2023-03-07 15:19:24 +01:00
zeertzjq
7a462c10d5
Merge pull request #22558 from zeertzjq/vim-8.2.3969 2023-03-07 21:23:40 +08:00
dundargoc
1637bcce7b
build!: make libintl a required dependency
Libintl being an optional dependency is not by design, but a workaround
as it didn't use work on all platforms. That should be fixed by now.
2023-03-07 09:39:08 +01:00
Jaehwang Jung
706bcab75e
docs(lsp): change type annotations from number → integer (#22510) 2023-03-07 07:17:52 +01:00
zeertzjq
08d0f99ae1 vim-patch:partial:944697ae196
Update runtime files

944697ae19

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-03-07 11:41:35 +08:00
zeertzjq
2882b1543a vim-patch:8.2.3969: value of MAXCOL not available in Vim script
Problem:    Value of MAXCOL not available in Vim script.
Solution:   Add v:maxcol. (Naohiro Ono, closes vim/vim#9451)

56200eed62

The variable is always 2147483647, but introducing it makes functions
easier to document.

Co-authored-by: naohiro ono <obcat@icloud.com>
2023-03-07 11:33:23 +08:00
zeertzjq
7a44231832
docs(gitignore): correct oldtest path 2023-03-07 11:16:55 +08:00
dundargoc
af23d17388
test: move oldtests to test directory (#22536)
The new oldtest directory is in test/old/testdir. The reason for this is
that many tests have hardcoded the parent directory name to be
'testdir'.
2023-03-07 11:13:04 +08:00
luukvbaal
bf4eada2c8
fix(column): issues with 'statuscolumn' width (#22542)
Problem:    'statuscolumn' width can be incorrect when toggling 'number'
            or setting 'statuscolumn'.
Solution:   Make sure the width is reset and re-estimated when
            'statuscolumn' and 'number' are set. (When 'relativenumber'
            is set this already happens because it always changes
            "nrwidth_line_count".)
2023-03-07 08:45:08 +08:00
bfredl
39096f48f0
Merge pull request #13834 from bfredl/omnilua
omnifunc for builtin lua
2023-03-07 00:28:53 +01:00
Björn Linse
79571b92ce feat(lua): omnifunc for builting lua interpreter
also make implicit submodules "uri" and "_inspector" work with completion

this is needed for `:lua=vim.uri_<tab>` wildmenu completion
to work even before uri or _inspector functions are used.
2023-03-06 23:12:21 +01:00
dundargoc
6aa5346b04
build: enable unit testing on release builds (#22554)
Unittests not working on release builds can lead to confusing
situations, such as contributors wondering why their tests aren't
working if they forgot they've built with a release build. This only
increased the Release executable size by 8 kB on my personal machine,
which is an acceptable tradeoff.
2023-03-06 22:36:04 +01:00
swarn
1cc23e1109
feat(lsp)!: add rule-based sem token highlighting (#22022)
feat(lsp)!: change semantic token highlighting

Change the default highlights used, and add more highlights per token.

Add an LspTokenUpdate event and a highlight_token function.

:Inspect now shows any highlights applied by token highlighting rules,
default or user-defined.

BREAKING CHANGE: change the default highlight groups used by semantic
token highlighting.
2023-03-06 19:03:13 +01:00
Lewis Russell
98f2df931a
fix(diff): add NULL check 2023-03-06 16:10:04 +00:00
Justin M. Keyes
6969d3d749
Merge #22325 vim.version semver parser 2023-03-06 10:04:13 -05:00
Justin M. Keyes
74ffebf8ec fix(vim.version): incorrect version.cmp()
Problem:
If major<major but minor>minor, cmp_version_core returns 1

Solution:
- Fix logic in cmp_version_core
- Delete most eq()/gt()/lt() tests, they are redundant.
2023-03-06 15:36:25 +01:00
Justin M. Keyes
e31e49a8e3 refactor(vim.version): cleanup
- version.cmp(): assert valid version
- add test for loading vim.version (the other tests use shared.lua in
  the test runner)
- reduce test scopes, reword test descriptions
2023-03-06 14:51:56 +01:00
Kelly Lin
0e7196438d feat(lua): add semver api 2023-03-06 13:45:59 +01:00
Lewis Russell
f9a46391ab
refactor(treesitter): simplify some range functions 2023-03-06 10:57:14 +00:00
zeertzjq
b0620ffe5a
vim-patch:9.0.1386: options test fails with some window width (#22548)
Problem:    Options test fails with some window width.
Solution:   Adjust what text the test checks with. (closes vim/vim#12111)

30585e03a7
2023-03-06 16:45:57 +08:00
zeertzjq
e389b18902
vim-patch:9.0.1385: g'Esc is considered an error (#22544)
Problem:    g'Esc is considered an error.
Solution:   Make g'Esc silently abandon the command. (closes vim/vim#12110)

f86dea8119
2023-03-06 07:52:11 +08:00
Justin M. Keyes
533d671271
docs: module-level docstrings (@defgroup) #22498
Problem:
gen_vimdoc.py / lua2dox.lua does not support @defgroup or \defgroup
except for "api-foo" modules.

Solution:
Modify `gen_vimdoc.py` to look for section names based on `helptag_fmt`.

TODO:
- Support @module ?
  https://github.com/LuaLS/lua-language-server/wiki/Annotations#module
2023-03-05 15:15:29 -08:00
bfredl
1b49841969
Merge pull request #22539 from dundargoc/build/luv
build: remove workaround for incorrectly packaged libluv
2023-03-06 00:05:42 +01:00
dundargoc
da0c66bcdd build: remove workaround for incorrectly packaged libluv
This removes a workaround for incorrectly packaged libluv in
90e44ecf11 as it should not be needed
anymore.
2023-03-05 21:13:28 +01:00