Commit Graph

5458 Commits

Author SHA1 Message Date
zeertzjq
22ea5ec166 vim-patch:ff0baca86523
runtime(syntax): unlet b:filetype_in_cpp_family for cpp & squirrel

Update runtime/syntax/cpp.vim and runtime/syntax/squirrel.vim to unlet
b:filetype_in_cpp_family as it remains set even after updating the ft of
a file manually or through a modeline, not allowing c specific keywords
to be highlighted.

Since the variable b:filetype_in_cpp_family is only used by the c.vim
syntax script, unlet it directly after sourcing the c.vim runtime file
instead of at the end of the script.

Also update the last Change Header for both files.

closes: vim/vim#13650

ff0baca865

Co-authored-by: laburnumT <laburnumtec@gmail.com>
(cherry picked from commit 6333be96ca)
2023-12-08 23:45:48 +00:00
Christian Clason
4ca8f7f60d fix(treesitter): remove incompatible c query (again) 2023-12-07 22:39:47 +01:00
github-actions[bot]
8a4464cd14
[Backport release-0.9] fix: vim.treesitter.get_node() now correctly takes opts.lang (#26382)
[Backport release-0.9] fix(treesitter): allow passing lang to get_node()
2023-12-04 10:03:55 +01:00
Gregory Anders
7f74d9bd77
fix: remove nested for_each_tree in TSTreeView (#26331)
Problem:
`LanguageTree:for_each_tree` calls itself for child nodes, so when we
calls `for_each_tree` inside `for_each_tree`, this quickly leads to
exponential tree calls.

Solution:
Use `pairs(child:trees())` directly in this case, as we don't need the
extra callback for each children, this is already handled from the outer
`for_each_tree` call

(cherry picked from commit 0712a4c085)

Co-authored-by: Pham Huy Hoang <hoangtun0810@gmail.com>
2023-11-30 11:04:49 -06:00
Pham Huy Hoang
753f8bcaab fix: make InspectTree handle nested injection
fixup: Use `TSNode:byte_length` instead
(cherry picked from commit 757bcdda30)
2023-11-29 14:17:14 +00:00
Samuel (ThinLinc team)
8a85eb7a21 fix: dont create data dir if it's a broken symlink
Checking if it's non-empty and not a directory gets us quite far, but
not all the way. While a working symlink would trigger the earlier
checks, a broken symlink does not.

This commit fixes the special case where ~/.local/share/nvim  already
exists but is a broken symlink. Thus, it fixes the following error on
startup:

E739: Cannot create directory /home/samuel/.local/share/nvim: file
already exists

(cherry picked from commit a6051e68a3)
2023-11-28 11:27:28 +00:00
zeertzjq
900772f8eb docs(starting.txt): correct step number
(cherry picked from commit ba513b7438)
2023-11-23 23:19:25 +00:00
Justin M. Keyes
2a467acc86
fix(defaults): set 'fsync' #26039
backport #26034

Problem:
'nofsync' may lose data if the system has a hard shutdown. #9888

Solution:
Change default to 'fsync'. This may be revisited in the future when
'nofsync' can be made safer.

Co-authored-by: Ploum <1233155+ploum@users.noreply.github.com>
2023-11-14 03:34:59 -08:00
zeertzjq
3320c3a322 fix(man): make :Man with a range work
(cherry picked from commit e41309c3b6)
2023-11-07 02:39:45 +00:00
altermo
1413f3a971 fix(lua): correct return value for on_key with no arguments
(cherry picked from commit 3edc8417f0)
2023-11-07 00:33:58 +00:00
github-actions[bot]
87bfa82bdf
[Backport release-0.9] feat(highlight): Allow hyphens (-) in highlight group names (#25661)
feat(highlight): allow hyphens (-) in highlight group names

Fixes: https://github.com/neovim/neovim/issues/23184
(cherry picked from commit f37916b93b)

Co-authored-by: Gregory Anders <greg@gpanders.com>
2023-10-15 14:21:54 -05:00
Christian Clason
c5edfb16f9 fix(treesitter): foldexpr tweaks
(cherry-picked from 26cc946226)

Co-authored-by: rafikdraoui
2023-10-14 17:07:36 +02:00
zeertzjq
9ee75f4781 fix(lsp): handle NUL bytes in popup text
Fix #25610

(cherry picked from commit 762a9e138b)
2023-10-12 07:40:01 +00:00
bfredl
d772f697a2 NVIM 0.9.4
This is a maintenance release, focusing on bugfixes.

BUG FIXES
- build: Fix exporting symbols on macOS Sonoma
- api: Handle NUL in nvim_err_write() and nvim_out_write()
- autocmd: Api functions accepting garbage after event name
- clang: Null pointer dereference in parse_msgpack
- clipboard: Don't pass --foreground to wl-copy
- exception: Remember whether message is multiline
- float: Update position of anchored windows first
- float: Fix some other crashes with :unhide or :all
- lua: Not using global value in vim.opt_global
- lua: Show error message when failing to set variable
- mouse: Click on 'statuscolumn' with 'rightleft'
- path: Accept special characters on Windows
- provider: Fix python3 provider cannot detect python3.12
- provider/pythonx: Import the correct module
- rpc: Fix race condition
- runtime: Add commentstring for D ftplugin
- statuscolumn: Update number hl for each screen line
- terminal: Check terminal size at end of screen update
- treesitter: Remove more double recursion
- ui: "resize -1" with cmdheight=0
- unhide: Close floating windows first
- unittests: Ignore __s128 and __u128 types in ffi
- tutor: Clarify the meaning of ✗ and ✓

BUILD SYSTEM!
- deps: Bump libmpack-lua to 1.0.11
- ci: fix mac release for Sonoma
2023-10-09 22:38:17 +02:00
bfredl
3257fdac36 NVIM 0.9.3
This is a maintenance release, focusing on bugfixes.

BUG FIXES
- build: Fix exporting symbols on macOS Sonoma
- api: Handle NUL in nvim_err_write() and nvim_out_write()
- autocmd: Api functions accepting garbage after event name
- clang: Null pointer dereference in parse_msgpack
- clipboard: Don't pass --foreground to wl-copy
- exception: Remember whether message is multiline
- float: Update position of anchored windows first
- float: Fix some other crashes with :unhide or :all
- lua: Not using global value in vim.opt_global
- lua: Show error message when failing to set variable
- mouse: Click on 'statuscolumn' with 'rightleft'
- path: Accept special characters on Windows
- provider: Fix python3 provider cannot detect python3.12
- provider/pythonx: Import the correct module
- rpc: Fix race condition
- runtime: Add commentstring for D ftplugin
- statuscolumn: Update number hl for each screen line
- terminal: Check terminal size at end of screen update
- treesitter: Remove more double recursion
- ui: "resize -1" with cmdheight=0
- unhide: Close floating windows first
- unittests: Ignore __s128 and __u128 types in ffi
- tutor: Clarify the meaning of ✗ and ✓

BUILD SYSTEM!
- deps: Bump libmpack-lua to 1.0.11
2023-10-09 21:59:13 +02:00
Christian Clason
837f64f98a
[backport release-0.9] backport #25464 (#25560)
feat(lsp): fallback to code-action command on resolve failure
2023-10-09 16:39:30 +02:00
zeertzjq
1403779ae0 fix(clipboard): don't pass --foreground to wl-copy
Fix #25466

(cherry picked from commit a1e351b8d7)
2023-10-03 03:24:53 +00:00
Axel Ricard
da4d59018d fix(runtime): add commentstring for D ftplugin
Problem: No commentstring is set for D buffers after removing the
default C-style commentstring

Same solution than neovim#23039

(cherry picked from commit 222196824f)
2023-09-25 22:14:18 +00:00
zeertzjq
25ac45386c fix(provider/pythonx): import the correct module
(cherry picked from commit aede22caa9)
2023-09-24 14:04:48 +00:00
Jongwook Choi
b49cb1826a fix(provider): fix python3 provider cannot detect python3.12
PROBLEM: The builtin python3 provider cannot auto-detect python3.12
when g:python3_host_prog is not set. As a result, when python3 on $PATH
is currently python 3.12, neovim will fail to load python3 provider
and result in `has("python3") == 0`, e.g.,
"Failed to load python3 host. You can try to see what happened by ..."

ROOT CAUSE: the `system()` call from `provider#pythonx#DetectByModule`
does not ignore python warnings, and `pkgutil.get_loader` will print
a warning message in the very first line:
```
<string>:1: DeprecationWarning: 'pkgutil.get_loader' is deprecated and
slated for removal in Python 3.14; use importlib.util.find_spec() instead
```

SOLUTION:
- Use `importlib.util.find_spec` instead (python >= 3.4)
- Use `-W ignore` option to prevent any potential warning messages

(cherry picked from commit 3da511f1d0)
2023-09-23 15:29:02 +02:00
zeertzjq
82e0a6028c vim-patch:9.0.1915: r_CTRL-C works differently in visual mode
Problem:  r_CTRL-C works differently in visual mode
Solution: Make r_CTRL-C behave consistent in visual mode
          in terminal and Windows GUI

in visual mode, r CTRL-C behaves strange in Unix like environments. It
seems to end visual mode, but still is waiting for few more chars,
however it never seems to replace it by any characters and eventually
just returns back into normal mode.

In contrast in Windows GUI mode, r_CTRL-C replaces in the selected area
all characters by a literal CTRL-C.

Not sure why it behaves like this. It seems in the Windows GUI, got_int
is not set and therefore behaves as if any other normal character has
been pressed.

So remove the special casing of what happens when got_int is set and
make it always behave like in Windows GUI mode. Add a test to verify it
always behaves like replacing in the selected area each selected
character by a literal CTRL-C.

closes: vim/vim#13091
closes: vim/vim#13112

476733f3d0

Co-authored-by: Christian Brabandt <cb@256bit.org>
(cherry picked from commit d2678c78dc)
2023-09-19 22:38:39 +00:00
zeertzjq
249e930eaf docs(tutor): clarify the meaning of ✗ and ✓
Also reformat tutor.tutor.json to use 2-space indent while at it.

(cherry picked from commit f619ea1fc1)
2023-09-17 00:51:46 +00:00
Phelipe Teles
3a5b46e6bb fix(lua): not using global value in vim.opt_global 2023-09-17 06:44:43 +08:00
Lewis Russell
68ae7ea529 refactor: rename _meta.lua to _options.lua 2023-09-17 06:44:14 +08:00
L Lllvvuu
f0898d438e [Backport release-0.9] fix(treesitter): language.add - only register parser if it exists
Backport of #25151.

Fixes: #24531
2023-09-15 10:10:37 +02:00
Lewis Russell
f0b1e46f91 fix(treesitter): fixup for InspectTree
Fixes #25120

(cherry picked from commit 040cba1faa)
2023-09-12 14:56:07 +00:00
Lewis Russell
5f8676c268 fix(treesitter): remove more double recursion
Do not call `for_each_child` in functions that are already recursive.

(cherry picked from commit e76ae3d232)
2023-09-12 11:23:31 +00:00
L Lllvvuu
64160bac5b
[Backport release-0.9] fix(languagetree): remove double recursion in LanguageTree:parse
`LanguageTree:parse` is recursive, and calls
`LanguageTree:for_each_child`, which is also recursive.

That means that, starting from the third level (child of child of root),
nodes will be parsed twice.

Which then means that if the tree is N layers deep, there will be ~2^N
parses even if the branching factor is 1.

Fixes: #25104
2023-09-12 00:22:30 -07:00
bfredl
fe869a8ce2 NVIM 0.9.2
This is a maintenance release, focused on bug fixes and improvements.
However, There are included features related to TUI and :terminal.

BRAM

Nvim is a fork of the Vim editor, created and developed by Bram Moolenaar.
On August 3, 2023, he passed away at the age of 62. If Vim or Nvim have
been of use to you in your life, read `:help Bram` and `:help Uganda`
and consider honoring his memory in a way you see fit.

CHANGES SINCE 0.9.1

BREAKING CHANGES

An adjustment was made to the `grid_line` event as part of the exernal
UI protocol the `cells` array might now end with a `[' ', attr, 0]` item
with a repeat count of zero. This is needed by the TUI to disambiguate
final spaces on a line from just clearing the line, which will make a
difference when copying text using the terminal emulators builtin
primary selection support.

External UI:s can safely ignore such an empty item and most UIs already
handle this fine. But it could break some UI:s which has an assert to
validate the cell count to be bigger than zero, or similar checks.

FEATURES

- tui: Support Super and Meta modifiers
- terminal: forward more special keys and modifier-mouse combinations

BUG FIXES

- lua: Always set arg0 to lua scripts
- api: Redundant error when using `nvim_cmd`
- api, lua: Make blank lines in a message work properly
- column: fix bugs related to signs in 'statuscol'
- completion: Don't add backslash in runtime completion
- diff: Filler lines for hunks bigger than linematch limit
- edit: Fix K_EVENT interfering with 'digraph'
- editorconfig: Better validation and error handling
- events: Don't expand non-file as file name
- events: Trigger VimResume on next UI request
- extmarks: Wrong display when changing text with virt_lines
- folds: Update folds in Insert mode with fdm=indent
- helptags: Make multibyte help tags work properly
- highlight: Make CurSearch work properly with 'winhl'
- inccommand: Fix saving of undo info
- keycodes: Recognize <t_xx> as a key
- lsp: Do not assume client capability exists in watchfiles check (#24558)
- mouse: Handle folded lines with virt_lines attached to line above
- remote: Make --remote-expr print to stdout
- remote: Restore previous --remote-expr output formatting
- spell: Splice extmarks on :spellrepall
- startup: Don't truncate when printing with -l
- startup: Run embedded Nvim with real path
- statusline: Redraw when Visual submode changes
- statusline: Fill for double-width char after moving items
- treesitter: updates to queries and injections
- treesitter: Fix TSNode:tree() double free
- ui: Propagate line wrapping state on grid_line events
- ui: Avoid ambiguity about chunk that clears part of line

PERFORMANCE
- extmarks: Avoid unnecessary marktree traversal with folds
- substitute: Don't reallocate new_start every time

BUILD SYSTEM
- deps: Bump libvterm to 0.3.3
- deps: Bump LuaJIT to HEAD - 03c31124c
- deps: Bump libuv to v1.46.0
- deps: Bump Luv to 1.45.0-0
- deps: Bump tree-sitter-c to v0.20.5
- deps: Bump tree-sitter-lua to v0.0.18
2023-09-07 12:26:08 +02:00
zeertzjq
3ada031231
Revert "Revert "[Backport release-0.9] fix(ui): propagate line flags on grid_line events""
This reverts commit be14ead380.
2023-09-02 17:16:54 +08:00
zeertzjq
be14ead380
Revert "[Backport release-0.9] fix(ui): propagate line flags on grid_line events" 2023-08-31 12:04:57 +08:00
github-actions[bot]
fec20ce15c
[Backport release-0.9] fix(filetype): make sure buffer is valid before call nvim_buf_call (#24950)
fix(filetype): make sure buffer is valid before call nvim_buf_call

(cherry picked from commit c3e611694e)

Co-authored-by: HongboLiu <lhbf@qq.com>
2023-08-30 12:21:01 -05:00
Christian Clason
e3389c1533 build(deps): bump tree-sitter-lua to v0.0.18
also update highlight queries
2023-08-28 11:03:42 +09:00
Christian Clason
f5e6f592b6 build(deps): bump tree-sitter-c to v0.20.5
also update highlight queries and test

fixup: tests
2023-08-28 11:03:42 +09:00
Lewis Russell
3cca5449ac fix(editorconfig): only warn once on errors
(cherry picked from commit f3e8942ce2)
2023-08-27 21:04:32 +00:00
ObserverOfTime
2aa88ee86a feat(editorconfig): update Lua code in syntax file
(cherry picked from commit 5f29f7b59f)
2023-08-27 20:49:50 +00:00
ObserverOfTime
2ac6405e80 fix(editorconfig): add metadata comment
(cherry picked from commit aa4900dff0)
2023-08-27 20:49:50 +00:00
ObserverOfTime
96dc2d559b fix(editorconfig): highlight properties with dashes
(cherry picked from commit bcf91761bf)
2023-08-27 20:49:50 +00:00
Bogdan Grigoruță
11cb728c35 fix(editorconfig): add missing root validation
(cherry picked from commit a94d35fcde)
2023-08-27 20:35:49 +00:00
Lewis Russell
9f928902c7 fix(editorconfig): do not set 'endofline'
Problem:
  'endofline' can be used to detect if a file ends of <EOL>, however
  editorconfig can break this.

Solution:
  Set 'endofline' during BufWritePre

Fixes: #24869
(cherry picked from commit 84376afc72)
2023-08-27 20:13:39 +00:00
zeertzjq
392e0b56f0
docs: backport intro.txt changes to release-0.9 (#24698) 2023-08-13 21:18:01 +08:00
Lewis Russell
ac2dff64a5 fix(treesitter): make sure injections don't return empty ranges (#24595)
When an injection has not set include children, make sure not to add
the injection if no ranges are determined.

This could happen when there is an injection with a child that has the
same range as itself. e.g. consider this Makefile snippet

```make
foo:
  $(VAR)
```

Line 2 has an injection for bash and a make variable reference. If
include-children isn't set (default), then there is no range on line 2
to inject since the variable reference needs to be excluded.

This caused the language tree to return an empty range, which the parser
now interprets to mean the full buffer. This caused makefiles to have
completely broken highlighting.
2023-08-10 18:08:54 +02:00
Sean Dewar
df63474930
fix(lsp): do not assume client capability exists in watchfiles check (#24558)
Backports #24550.

Adjusts test to expect that didChangeWatchedFiles is *not* registered if
client `capabilities` is nil (as it's not enabled by default for v0.9).
2023-08-04 10:16:54 +01:00
zeertzjq
d6733abc69 fix(ui-ext): backport win_viewport fixes to release-0.9 2023-07-25 22:56:02 +08:00
fredizzimo
dfed74188d
[Backport release-0.9] fix(ui): delay win_viewport until screen update #24182 (#24480)
fix(ui): delay win_viewport until screen update #24182

Problem:
Sometimes, when nvim sends the `win_viewport` event, for example when scrolling
with visible folds on the screen, it reports the `scroll_delta` value one batch
into "future". So when the client application is trying to show the new viewport
it's not yet updated, resulting in temporary corruption / screen flickering.

For more details see #23609, and starting from [this comment](
https://github.com/neovide/neovide/pull/1790#issuecomment-1518697747) in
https://github.com/neovide/neovide/pull/1790,, where the issue was first
detected. Note that some of the conclusions in those are not fully accurate, but
the general observations are.

Solution:
When there are pending updates to a Window, delay the `win_viewport` UI event
until the updates are sent. This ensures that there's no flush between sending
the viewport and updating of the lines corresponding to the new viewport.

Document the existing viewport behaviour (for cases where there are no
extra flushes), give a hint about how applications can deal with the slightly
surprising behaviour of the viewport event being sent after the updates.

Fixes https://github.com/neovim/neovim/issues/23609
2023-07-25 05:37:07 -07:00
Mike
c0c6294123 fix(fs.lua): normalize slash truncation
Preserve last slash in windows' root drive directories

(cherry picked from commit 886996ff74)
2023-07-18 06:36:24 +00:00
Kai Ting
65d9407835 clipboard: suppression exit warning if exit code is >= 128
This is a matching change to 939d9053bd

Fixes: 7054
(cherry picked from commit 62b5d66e43)
2023-07-16 14:24:57 +00:00
Sean Dewar
6808f47ec5 fix(tutor): don't use concealed text in expected lines
(cherry picked from commit 24c3962a2e)
2023-07-11 17:11:07 +00:00
Ricky Zhou
08ae485984 fix(ui): propagate line wrapping state on grid_line events
This fixes the TUI's line-wrapping behavior, which was broken with the
migration to the msgpack-based UI protocol (see
https://github.com/neovim/neovim/issues/7369#issuecomment-1571812273).

(cherry picked from commit 981acc2922)
2023-07-03 21:07:38 +00:00
Christian Clason
657072fc62 fix(ftplugin): respect runtimepath ordering
Problem: bundled `ftplugin/foo/*.vim` are sourced before user
`ftplugin/foo.vim`.

Solution: call `runtime!` once on all patterns to be sourced.

Followup to #23801. Fixes #24003.

(cherry picked from commit 502a7a0558)
2023-06-30 10:22:24 +00:00