Commit Graph

6896 Commits

Author SHA1 Message Date
Lewis Russell
3d2aeec68d refactor(lua): more efficient vim.tbl_islist
No need to run a full iteration of the table. Simply return false when
the next key isn't what we expect.
2024-03-06 10:57:04 +00:00
Lewis Russell
ea44f74d84 refactor(types): more fixes 2024-03-06 10:45:22 +00:00
Christian Clason
d72c9d1d19 vim-patch:63c39e4ef749
runtime(c): Recognize "__inline" (vim/vim#14145)

`__inline` is recognized by GCC, and may even be preferred, as MSVC does
not recognize `__inline__`.

63c39e4ef7

Co-authored-by: Wu Yongwei <wuyongwei@gmail.com>
2024-03-06 10:05:12 +01:00
Lewis Russell
a4290f462e docs(lua): improvements for LSP and Diagnostic 2024-03-05 13:36:46 +00:00
zeertzjq
0ffc926499
vim-patch:e5c9ba601573 (#27737)
runtime(vim): Update base-syntax, fix escaping :syn and :hi sub-groups (vim/vim#14137)

* runtime(vim): Update base-syntax, fix escaping :syn and :hi sub-groups

- Remove contained :syntax and :highlight sub-groups from the function
  body cluster.  These should only match in the respective commands.
- Remove vimSynLine syntax group from several clusters.  The definition
  of vimSynLine was removed in Vim 5.3.

* runtime(vim): Update syntax generator, use standard Last Change date format

The de facto standard date format is YYYY MMM DD.

e5c9ba6015

Co-authored-by: dkearns <dougkearns@gmail.com>
2024-03-05 11:28:34 +08:00
Christian Clason
9716020293 vim-patch:d9ebd46bd090
runtime(mswin): Use unnamed register when clipboard not working (vim/vim#13813)

* Use unnamed register while clipboard not exist
* Do not need to specify the unnamed register explicitly
fixes: vim/vim#13809

d9ebd46bd0

Co-authored-by: Shixian Li <34830785+znsoooo@users.noreply.github.com>
2024-03-04 23:03:09 +01:00
Christian Clason
66c9f987e7 vim-patch:1bdc9435c1a1
runtime(sh): Update syntax file, fix issue vim/vim#962 (vim/vim#14138)

Allow the opening parenthesis of a multiline array assignment, within an
if statement, to appear at EOL.

Fixes issue vim/vim#962.

1bdc9435c1

Co-authored-by: dkearns <dougkearns@gmail.com>
2024-03-04 23:03:09 +01:00
Christian Clason
56734226af vim-patch:e84490311ba3
runtime(css): update syntax script

e84490311b

Co-authored-by: Jay Sitter <jay@jaysitter.com>
2024-03-04 23:03:09 +01:00
altermo
a8131aee9e
fix(tohtml): replace hex escape with digit escape (#27728) 2024-03-04 19:08:23 +08:00
Luna Saphie Mittelbach
3df1211ebc
docs(lua): clarify when vim.bo/vim.wo acts like :setlocal (#27708) 2024-03-04 07:33:09 +08:00
zeertzjq
fc2be84e44 vim-patch:691aee8b0705
runtime(vim): Update base-syntax, fix issue vim/vim#14135 (vim/vim#14136)

Fix incorrect error highlighting for function calls in :command
definitions.  vimFunctionError should be restricted to :function header
lines.

fixes: vim/vim#14135

691aee8b07

Co-authored-by: dkearns <dougkearns@gmail.com>
2024-03-04 06:44:54 +08:00
zeertzjq
b86799a076 vim-patch:c4aef9a97b36
runtime(vim): Update base-syntax, improve :augroup highlighting (vim/vim#14125)

- Explicitly match the bang and group name in :aug! {name}.
- Allow any characters in a group name.
- Match default group switch marker, END.
- Match :aug without arguments (list command).

c4aef9a97b

Co-authored-by: dkearns <dougkearns@gmail.com>
2024-03-04 06:40:31 +08:00
Christian Clason
3971797be1 vim-patch:b3030b653bbd
runtime(java): Recognise text blocks (vim/vim#14128)

Also, accept as valid the space escape sequence `\s`.

Also, consistently use the claimed `javaDebug` prefix for
syntax group definitions kept under `g:java_highlight_debug`.

Since `javaStringError` is commented out for its generality,
let's comment out `javaDebugStringError`, its copy, as well.

References:
https://openjdk.org/jeps/378
https://docs.oracle.com/javase/specs/jls/se17/html/jls-3.html#jls-3.10.7

Closes vim/vim#10910.

b3030b653b

Co-authored-by: Aliaksei Budavei <32549825+zzzyxwvut@users.noreply.github.com>
2024-03-03 17:41:04 +01:00
Christian Clason
bf695b5ef4 vim-patch:e93afc2e6126
runtime(r,rhelp,rmd,rnoweb,rrst): Update ftplugin, browsefilter labels (vim/vim#14126)

Use the standard format for browsefilter labels:
  "File Description (*.ext1, *.ext2, *.ext3)"

e93afc2e61

Co-authored-by: dkearns <dougkearns@gmail.com>
2024-03-03 10:38:58 +01:00
Jaehwang Jung
dc8c086c7e
fix(lsp): directly rename the existing buffers when renaming (#27690)
Problem:
`vim.lsp.util.rename()` deletes the buffers that are affected by
renaming. This has undesireable side effects. For example, when renaming
a directory, all buffers under that directory are deleted and windows
displaying those buffers are closed. Also, buffer options may change
after renaming.

Solution:
Rename the buffers with :saveas.

An alternative approach is to record all the relevant states and restore
it after renaming, but that seems to be more complex. In fact, the older
version was attempting to restore the states but only partially and
incorrectly.
2024-03-02 15:21:53 +01:00
Jaehwang Jung
39cc38a87b
fix(lsp): defer writing error msgs (#27688)
Context:
Nvim catches errors from the user's `on_exit` and rpc handler callbacks
and prints the error message.

Problem:
Printing the error message uses Nvim api functions. But callbacks
mentioned above run in `:h lua-loop-callbacks` where most of `vim.api`
is not allowed, so Nvim itself raises error.

Solution:
`vim.schedule()` the error reporting when necessary.
2024-03-02 10:51:10 +01:00
Christian Clason
72e0ef2f46 vim-patch:100a665634a0
runtime(java): Improve the recognition of literals (vim/vim#14120)

* Emend the Unicode and octal escape sequence patterns;
* Accept the (repeated) underscore separators in all
  numerical literals;
* Recognise hexadecimal floating-point literals.

(The space escape sequence '\s' will be introduced along
with text blocks in another PR.)

References:
https://docs.oracle.com/javase/specs/jls/se17/html/jls-3.html#jls-3.3
https://docs.oracle.com/javase/specs/jls/se17/html/jls-3.html#jls-3.10.1
https://docs.oracle.com/javase/specs/jls/se17/html/jls-3.html#jls-3.10.2
https://docs.oracle.com/javase/specs/jls/se17/html/jls-3.html#jls-3.10.7

100a665634

Co-authored-by: Aliaksei Budavei <32549825+zzzyxwvut@users.noreply.github.com>
2024-03-02 10:06:26 +01:00
Lewis Russell
39928a7f24
Merge pull request #27347 from lewis6991/fswatch
feat(lsp): add fswatch watchfunc backend
2024-03-01 23:31:20 +00:00
Lewis Russell
a5fe8f59d9 docs: improve/add documentation of Lua types
- Added `@inlinedoc` so single use Lua types can be inlined into the
  functions docs. E.g.

  ```lua
  --- @class myopts
  --- @inlinedoc
  ---
  --- Documentation for some field
  --- @field somefield integer

  --- @param opts myOpts
  function foo(opts)
  end
  ```

  Will be rendered as

  ```
  foo(opts)

    Parameters:
      - {opts} (table) Object with the fields:
               - somefield (integer) Documentation
                 for some field
  ```

- Marked many classes with with `@nodoc` or `(private)`.
  We can eventually introduce these when we want to.
2024-03-01 23:02:18 +00:00
Lewis Russell
4ff3217bbd feat(lsp): add fswatch watchfunc backend
Problem:
  vim._watch.watchdirs has terrible performance.

Solution:
  - On linux use fswatch as a watcher backend if available.

  - Add File watcher section to health:vim.lsp. Warn if watchfunc is
    libuv-poll.
2024-03-01 23:00:20 +00:00
Will Hopkins
813dd36b72
fix(types): rename win_get_config return type to win_config
Follow-up to #27397
2024-03-02 06:59:32 +08:00
zeertzjq
1fe65b3457
vim-patch:87410ab3f556 (#27696)
runtime(doc): some improvements to getregion() docs (vim/vim#14122)

- Mention the default selection behavior
- Remove useless sentence
- Correct description about space padding

87410ab3f5
2024-03-02 06:42:39 +08:00
Lewis Russell
816b56f878 fix(lsp): cancel watchers when closing a client 2024-03-01 22:30:27 +00:00
Lewis Russell
bf1e098d97 refactor(watch): simplify filechanges processing 2024-03-01 22:30:27 +00:00
Lewis Russell
b87505e116 refactor(watch): general tidy up
- Rename watch.poll to watch.watchdirs
- Unify how include and exclude is applied
- Improve type hints
2024-03-01 22:30:27 +00:00
Jaehwang Jung
b413f5d048
fix(lsp): rename undofile when renaming (#27684)
Problem:
After `rename()`, the undo information for the renamed file(s) are lost.

Solution:
Rename the undofile as well.
2024-03-01 18:31:54 +01:00
glepnir
a5ade3c63d fix(snippet): correct indent with newline
Problem: snippet newline use before line indent after expand.

Solution: it should level + 1.
2024-03-01 14:35:52 +08:00
Christian Clason
41f2cbe171 vim-patch:8fad5d58874e
runtime(doc,netrw): update "Last Change header", remove trailing whitespace

Update Last-Change Header for netrw and doc/indent.txt, fix a trailing
whitespace in indent.txt and make CI happy.

8fad5d5887

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-02-29 22:54:57 +01:00
Christian Clason
c8299d15db vim-patch:b4eb3f1e4489
runtime(yaml): disable multiline_scalar detection by default

There have been many complaints about Yaml indenting too much, because
it considers values to be multi-line by default, which leads to
unintended indenting for (apparently most) users.

So let's hide this feature behind the new feature flag, keep it
simple and prefer single line value key pairs by default.

If you want the old behaviour, set the following value: >

  :let g:yaml_indent_multiline_scalar = 1

If not set, it will indent the same as the previous line.

closes vim/vim#13845

b4eb3f1e44

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-02-29 22:54:57 +01:00
Christian Clason
bfcf5666cc vim-patch:56b7da3c051f
runtime(netrw): handle file/dir symlinks specifically in tree mode

fixes: vim/vim#2386
related: vim/vim#3609

56b7da3c05

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-02-29 22:54:57 +01:00
glepnir
6ab0876f51 docs(eval): getline and indent function support string type
Problem: getline and indent function missing string type in param.

Solution: add string type in eval gen.
2024-02-29 13:30:25 +00:00
Christian Clason
2c8f36a3b0 fix(lsp): use plain loop for non-list-like table of protocol values
Fixup for #27628

Closes #27669
2024-02-29 11:37:30 +01:00
Christian Clason
86c3f284fc vim-patch:9ecf02cd5f5f
runtime(java): Recognise _when_ clauses in _switch_ blocks

Also:

- distinguish _yield_ when used as a contextual keyword from
  when used qualified as a method or a method reference (as
  can be seen in testdir/input/java_switch.java, variables
  and method declarations named _yield_ will be recognised
  as the namesake keyword--consider picking other names for
  variables, and defining g:java_highlight_functions to have
  method names painted; since _yield_ statements can have
  trailing parens, they must be recognised as statements,
  for only qualified _yield_ method calls are supported);

- recognise grouped _default_ _case_ labels;

- describe primitive types for _case_ labels (JLS, §14.11,
  §3.10.1);

- recognise some non-ASCII identifiers (see javaLambdaDef,
  javaUserLabel) (further improvement for better recognition
  of identifiers will be arranged in a separate PR).

Because the arrow '->' is used in two kinds of expressions,
lambda (abstractions) and _switch_, necessary changes were
made for the recognition of either (and further improvement
touching lambda expressions will be separately arranged).

Because 'default' is used for instance method declarations
in interfaces and in _switch_ labels, necessary changes were
made for the recognition of either (and further improvement
touching method declarations will be separately arranged).

Finally, it deemed appropriate to put 'yield' in the syntax
group of javaOperator rather than javaStatement, for its
member 'var' is also another contextual keyword (e.g., this
is valid syntax: "var var = var(test.var);").

References:
https://openjdk.org/jeps/361 (Switch Expressions)
https://openjdk.org/jeps/440 (Record Patterns)
https://openjdk.org/jeps/441 (Pattern Matching for switch)

Also, add a Java specific filetype plugin for the syntax
test, so that no soft-wrapping of long indented lines occur.

Otherwise the syntax scripts would miss a few lines during
scrolling and verification of the screen dumps.

closes: vim/vim#14105

9ecf02cd5f

Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
2024-02-29 09:53:09 +01:00
zeertzjq
f9e7c4c9c4
refactor(defaults): use getregion() for Visual mode gx (#27663)
Also make it work better on a multiline selection.
2024-02-29 08:21:13 +08:00
zeertzjq
ce7c51a1a3
vim-patch:9.1.0142: getregion() can be improved (#27662)
Problem:  getregion() can be improved (after v9.1.120)
Solution: change getregion() implementation to use pos as lists and
          one optional {opt} dictionary (Shougo Matsushita)

Note: The following is a breaking change!

Currently, the getregion() function (included as of patch v9.1.120) takes
3 arguments: the first 2 arguments are strings, describing a position,
arg3 is the type string.

However, that is slightly inflexible, there is no way to specify
additional arguments. So let's instead change the function signature to:

getregion(pos1, pos2 [, {Dict}]) where both pos1 and pos2 are lists.
This is slightly cleaner, and gives us the flexibility to specify
additional arguments as key/value pairs to the optional Dict arg.

Now it supports the "type" key to specify the selection type
(characterwise, blockwise or linewise) and now in addition one can also
define the selection type, independently of what the 'selection' option
actually is.

Technically, this is a breaking change, but since the getregion()
Vimscript function is still quite new, this should be fine.

closes: vim/vim#14090

19b718828d

Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
2024-02-29 07:19:26 +08:00
Maria José Solano
f912030d4e
docs(lpeg): remove double backticks from meta (#27659) 2024-02-29 06:14:49 +08:00
Maria José Solano
853f647da6 fix(lsp): handle reverse lookup in capabilities 2024-02-28 20:20:02 +00:00
Maria José Solano
d981670bc9 refactor(lsp): remove outdated comment 2024-02-28 20:20:02 +00:00
Christian Clason
0246f1a897 fix(tohtml): set filetype of generated HTML to html
Problem: `:TOhtml` opens the generated HTML code in a split, meaning it
inherits the `help` filetype if a help buffer is to be converted.

Solution: Explicitly set the filetype to `html`.
2024-02-28 18:34:12 +00:00
notomo
aa62898ae3
fix(lsp): correct the error message's cmd on spawning (#27632) 2024-02-28 17:36:28 +01:00
Jaehwang Jung
7311958e12
fix(lsp): remove unnecessary file load/write when renaming (#27621)
Previously rename would unconditionally read the to-be-renamed file from the
disk and write it to the disk. This is redundant in some cases

If the file is not already loaded, it's not attached to lsp client, so nvim
doesn't need to care about this file.
If the file is loaded but has no change, it doesn't need to be written.
2024-02-28 17:32:25 +01:00
altermo
2f85bbe615 feat!: rewrite TOhtml in lua
Co-authored-by: wookayin <wookayin@gmail.com>
Co-authored-by: clason <c.clason@uni-graz.at>
Co-authored-by: Lewis Russell <me@lewisr.dev>
2024-02-28 16:26:00 +00:00
Christian Clason
07b4b7524f vim-patch:e84d2d4432cd
runtime(sh): Update ftplugin, fix vim/vim#14101 (vim/vim#14102)

Add the 'b' flag to 'comments', so that the shebang line is not detected as comment.

Fixes vim/vim#14101.

e84d2d4432

Co-authored-by: dkearns <dougkearns@gmail.com>
2024-02-28 10:56:58 +01:00
Ilia Choly
0190771713
fix(lua): remove uri fragment from file paths (#27647)
Problem: Some LSP servers return `textDocument/documentLink` responses
         containing file URIs with line/column numbers in the fragment.
         `vim.uri_to_fname` returns invalid file names for these URIs.

Solution: Remove the URI fragment from file URIs.
2024-02-28 10:50:53 +01:00
Maria José Solano
cb146cc4aa docs(lpeg): merge upstream changes 2024-02-28 09:22:09 +00:00
zeertzjq
a7788c2e25
vim-patch:b1427b46f5fe (#27652)
runtime(vim): Update base-syntax, improve :echo highlighting (vim/vim#14103)

- Normalise behaviour of :echo commands and improve expression matching.
- Allow continued argument lines.
- Refine string interpolation groups.
- Remove duplicated :menu and :map generated commands that are handled
  specially later in the file.

b1427b46f5

Co-authored-by: dkearns <dougkearns@gmail.com>
2024-02-28 07:57:18 +08:00
Maria José Solano
63f9c2da9a feat(lsp): support completion itemDefaults 2024-02-27 16:50:51 +01:00
Maria José Solano
3d96e3f9f2 refactor(lsp): alias for CompletionResult 2024-02-27 16:50:51 +01:00
Lewis Russell
9beb40a4db feat(docs): replace lua2dox.lua
Problem:

The documentation flow (`gen_vimdoc.py`) has several issues:
- it's not very versatile
- depends on doxygen
- doesn't work well with Lua code as it requires an awkward filter script to convert it into pseudo-C.
- The intermediate XML files and filters makes it too much like a rube goldberg machine.

Solution:

Re-implement the flow using Lua, LPEG and treesitter.

- `gen_vimdoc.py` is now replaced with `gen_vimdoc.lua` and replicates a portion of the logic.
- `lua2dox.lua` is gone!
- No more XML files.
- Doxygen is now longer used and instead we now use:
  - LPEG for comment parsing (see `scripts/luacats_grammar.lua` and `scripts/cdoc_grammar.lua`).
  - LPEG for C parsing (see `scripts/cdoc_parser.lua`)
  - Lua patterns for Lua parsing (see `scripts/luacats_parser.lua`).
  - Treesitter for Markdown parsing (see `scripts/text_utils.lua`).
- The generated `runtime/doc/*.mpack` files have been removed.
   - `scripts/gen_eval_files.lua` now instead uses `scripts/cdoc_parser.lua` directly.
- Text wrapping is implemented in `scripts/text_utils.lua` and appears to produce more consistent results (the main contributer to the diff of this change).
2024-02-27 14:41:17 +00:00
Maria José Solano
7ad2e3c645
docs: fix type of setreg() argument {options} (#27631) 2024-02-27 19:53:49 +08:00
Christian Clason
1a7c38caec vim-patch:c7ddc9b73543
runtime(debian): update Debian syntax files (#14098)

* debversions.vim: Move lunar to unsupported release
* debsources: Add word boundaries around keyword match patterns

c7ddc9b735

Co-authored-by: James McCoy <jamessan@jamessan.com>
Co-authored-by: James Addison <jay@jp-hosting.net>
2024-02-27 10:31:11 +01:00
zeertzjq
a4b4442524
vim-patch:2c51e15b66a4 (#27637)
runtime(vim): Update syntax file, improve :substitute matching (vim/vim#14093)

- Differentiate between :substitute and substitute(), fixes vim/vim#13883.
- Match all allowed :substitute delimiters.
- Remove leading context from :substitute matches.

2c51e15b66

Co-authored-by: dkearns <dougkearns@gmail.com>
2024-02-27 06:22:57 +08:00
zeertzjq
0d75324e3b
vim-patch:9.1.0137: <Del> in cmdline mode doesn't delete composing chars (#27636)
Problem:  <Del> in cmdline mode doesn't delete composing chars
Solution: Use mb_head_off() and mb_ptr2len() (zeertzjq)

closes: vim/vim#14095

ff2b79d239
2024-02-27 06:09:06 +08:00
Gregory Anders
a8e4ee2f2b
fix(defaults): validate 'channel' before responding to OSC request (#27594)
Validate the channel number before responding to an OSC 10/11 request.
When used with nvim_open_term, the channel number is unset (since there
is no process on the other side of the PTY).
2024-02-26 11:33:16 -06:00
VanaIgr
ad5a155b1f
fix(mbyte): fix bugs in utf_cp_*_off() functions
Problems:
- Illegal bytes after valid UTF-8 char cause utf_cp_*_off() to fail.
- When stream isn't NUL-terminated, utf_cp_*_off() may go over the end.
Solution: Don't go over end of the char of end of the string.
2024-02-26 18:12:55 +08:00
Maria José Solano
185752614d refactor(types): fix miscellaneous type warnings 2024-02-25 22:08:11 +00:00
zeertzjq
c651a0f643
vim-patch:partial:d086b8f646a6 (#27623)
runtime(doc): fix inconsistent indent (vim/vim#14089)

d086b8f646
2024-02-25 16:38:34 +08:00
Gregory Anders
2e1f5055ac
fix(lsp): add assertion for explicit bufnr in apply_text_edits (#27614)
Assert that the buffer number passed to apply_text_edits is fully
resolved (not 0 or null). Pass the known buffer number to
apply_text_edits from lsp.formatexpr().
2024-02-24 19:21:57 -06:00
Evgeni Chasnovski
c2ddef30e7
docs: fix several misleading and superfluous wordings (#27609) 2024-02-25 08:45:34 +08:00
zeertzjq
52fe3741aa
vim-patch:374e26aba2e5 (#27617)
runtime(doc): clarify ':set[l] {option}<' behaviour

closes: vim/vim#14062

374e26aba2

Co-authored-by: Matt Ellis <m.t.ellis@gmail.com>
2024-02-25 08:19:43 +08:00
Jaehwang Jung
8addd27504
fix(lsp): when renaming directory, check path prefix of buffer names (#27603)
For example, when renaming /path/to/dir, buffers like
fern://drawer/file:///path/to/dir, /path/to/dir123 should not be
matched.
2024-02-24 16:47:34 +01:00
Christian Clason
a0394b648c docs(lsp): mark ClientConfig.init_options as optional
Followup to neovim/neovim#27443
2024-02-24 15:45:54 +01:00
Jaehwang Jung
90f6d999b1
refactor(lsp): remove redundant code (#27601)
* use builtin function
* buffer:// was removed in 236c20795e.
2024-02-24 13:14:12 +01:00
zeertzjq
9418381ccc
vim-patch:a35235e824bb (#27598)
runtime(doc) Update help text for matchbufline() and matchstrlist()

closes: vim/vim#14080

a35235e824

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2024-02-24 17:55:32 +08:00
Tim Pope
15f7ac6a04
docs(lsp): remove obsolete didChangeConfiguration explanation (#27595)
Rendered obsolete by c6d747e6a5.
2024-02-24 07:19:33 +01:00
Christian Clason
7e008799a8 vim-patch:315cd1fbcbba
runtime(spec): Recognize SourceLicense tag name in RPM spec syntax (#14046)

rpm-4.19.0 added a new SourceLicense tag. It is used at the same place
as License tag.

This patch adds the new tag name into a Vim syntax file to be
highligted the same way as the License tag. Note that it has to be
defined in the syntax file before Source\d* regexp. Otherwise it's not
recognized by Vim.

315cd1fbcb

Co-authored-by: Petr Pisar <ppisar@redhat.com>
2024-02-23 09:31:30 +01:00
zeertzjq
eb4783fb6c
refactor(defaults): use getregion() for default * and # mappings 2024-02-23 08:12:46 +08:00
zeertzjq
df1795cd6b
vim-patch:1624970d321c (#27582)
runtime(vim): Update base-syntax, fix :unabbrev highlighting (vim/vim#14077)

Fixes issue vim/vim#7876

1624970d32

Co-authored-by: dkearns <dougkearns@gmail.com>
2024-02-23 07:13:33 +08:00
zeertzjq
06df895e71 vim-patch:9.1.0126: Internal error when using upper-case mark in getregion()
Problem:  Internal error when passing mark in another buffer to
          getregion().
Solution: Don't allow marks in another buffer (zeertzjq)

closes: vim/vim#14076

Internal error when passing mark in another buffer to getregion()

421b597470
2024-02-23 06:39:05 +08:00
zeertzjq
20e4001eee vim-patch:9.1.0120: hard to get visual region using Vim script
Problem:  hard to get visual region using Vim script
Solution: Add getregion() Vim script function
          (Shougo Matsushita, Jakub Łuczyński)

closes: vim/vim#13998
closes: vim/vim#11579

3f905ab3c4

Cherry-pick changes from patch 9.1.0122, with :echom instead of :echow.

Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
Co-authored-by: Jakub Łuczyński <doubleloop@o2.pl>
2024-02-23 06:39:03 +08:00
再生花
bb15fa0356
feat(treesitter): add folding for InspectTree (#27518)
As the InspectTree buffer is now a valid tree-sitter query tree, we can
use the bundled fold queries to have folding for the tree.
2024-02-22 14:58:59 -06:00
Evgeni Chasnovski
85cb0b0ddc
fix(defaults): make terminal autoclose not block other events (#27581)
Problem: When terminal is autocloses, it blocks other events, like
  `BufEnter`.

Solution: Use `nested = true`.
2024-02-22 13:54:21 -06:00
Christian Clason
0760d98680 vim-patch:20d61e1b94e5
runtime(java): add syntax support for Java switch expressions (#9124)

20d61e1b94

Co-authored-by: Nick Hanley <nicholasjhanley@gmail.com>
2024-02-22 16:27:56 +01:00
zeertzjq
eef2aedff6
fix(defaults): remove tmux background detection passthrough (#27571)
There is now a new tmux 3.4 release that queries background color from
the parent terminal if background is not set in tmux, so removing the
passthrough still works when background is not set in tmux, and fixes
the incorrect detection when background is set in tmux.
2024-02-22 21:15:56 +08:00
zeertzjq
741a6684e0
docs(builtin): show tag at first line with multiple signatures (#27577)
Problem:
When a function has multiple signatures, putting its tag at the last one
may make one think that's its only signature.

Solution:
When a function has multiple signatures, put its tag at the first one.
2024-02-22 19:39:58 +08:00
Christian Clason
42f8ada59d build(deps): bump luv to v1.48.0-0
* fix: Use os_uname() to check for Linux by @cryptomilk in #686
    * docs: typo in a table field name by @Bilal2453 in #689
    * docs: most new_handle methods won't return fail by @Bilal2453 in #683
    * test-tty: Don't depend on stdin/stdout handle type by @squeek502 in #688
    * Bump/libuv by @zhaozg in #690
    * Annotate .gitmodules with branch and tag by @creationix in #693
2024-02-22 10:07:04 +01:00
Christian Clason
bba4834ede vim-patch:e8f6af609178
runtime(tmux): Update tmux syntax (#14065)

e8f6af6091

Co-authored-by: Eric Pruitt <eric.pruitt@gmail.com>
2024-02-22 09:50:35 +01:00
altermo
e2e63bd045
fix(lua): make highlight.on_yank use win-local highlight (#27349)
Currently, highlight.on_yank() does buffer-local highlighting, this PR
makes it window scoped.

Also fix the problem that when yanking in a buffer, moving to another
buffer, and yanking before the original buffer highlight disappears, the
original buffer highlight won't disappear on timeout.
2024-02-22 16:39:32 +08:00
altermo
1c032ad703 feat(extmark): window scoped extmark
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2024-02-21 16:11:50 +01:00
rktjmp
6d8bbfe19d
docs: remove mention of foreground/background/special keys in nvim_set_hl (#27558)
To align the output of `nvim_get_hl` with its documentation -- which
points to `nvim_set_hl`, remove mentions of the keys `foreground`,
`background` and `special`.

The long keys are are still supported (via fallback checks inside
`dict2hlattrs`), but the `fg`, `bg` and `sp` keys are preferenced.
2024-02-21 21:25:08 +08:00
Maria José Solano
ac0e8323dc
fix(lsp): add parentheses to generated union array types (#27560) 2024-02-21 12:31:56 +01:00
zeertzjq
9bb046d1be
vim-patch:f9ca139e3aa1 (#27554)
runtime(misc): announce adoption of various runtime files

f9ca139e3a

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-02-21 06:30:18 +08:00
zeertzjq
f25c0c1eb9
vim-patch:ef387c062bb1 (#27553)
runtime(filetype): Modula-2 files with priority not detected (vim/vim#14055)

Problem:  Modula-2 files with a specified priority are not detected.
Solution: Match the priority syntax in module header lines when
          performing heuristic content detection.

Disable the :defcompile debug line.  This was accidentally left enabled
in commit 68a8947.

ef387c062b

Co-authored-by: dkearns <dougkearns@gmail.com>
2024-02-21 06:29:53 +08:00
Vu Nhat Chuong
5e4a5f1aaa
fix(vim.ui.open): use explorer.exe instead of wslview #26947
Problem:
`vim.ui.open` uses `wslview`, which is slow and require a package from external PPA:
https://wslutiliti.es/wslu/install.html#ubuntu

Solution:
Use `explorer.exe` instead. WSL supports it by default:
https://learn.microsoft.com/en-us/windows/wsl/filesystems#view-your-current-directory-in-windows-file-explorer
2024-02-20 09:14:50 -08:00
itchyny
ddda5e0a48
feat(help): hide filename of "gO" outline using conceal #27547
Help outlines, invoked by `gO`, displays the help section titles in the
location list window. This feature is implemented by setting the buffer
lines after opening the window, but this implementation breaks the
assumption that the quickfix window texts are consistently constructed
by the quickfix list items. I think we can use the conceal feature here.
Using conceal here improves interoperability between quickfix plugins,
and also simplifies the outline implementation.

Originally reported at https://github.com/itchyny/vim-qfedit/issues/12
2024-02-20 03:57:13 -08:00
zeertzjq
a0790558c3
fix(extmarks): priority order of inline and non-inline virt_text (#27532) 2024-02-20 19:53:49 +08:00
Maria José Solano
cc15ba212c refactor(lsp): typings for protocol constants 2024-02-19 11:23:35 +00:00
zeertzjq
a9f578b7a5
docs: improve 'tabline' click label docs (#27529) 2024-02-19 11:22:00 +08:00
Nacho Nieva
fa131de9ad
feat(tabline): middle mouse button now closes tab (#27522) 2024-02-19 10:49:33 +08:00
Gregory Anders
478273a423
fix: fix iter_matches call in query linter (#27496) 2024-02-16 14:00:19 -06:00
Thomas Vigouroux
bd5008de07
fix(treesitter): correctly handle query quantifiers (#24738)
Query patterns can contain quantifiers (e.g. (foo)+ @bar), so a single
capture can map to multiple nodes. The iter_matches API can not handle
this situation because the match table incorrectly maps capture indices
to a single node instead of to an array of nodes.

The match table should be updated to map capture indices to an array of
nodes. However, this is a massively breaking change, so must be done
with a proper deprecation period.

`iter_matches`, `add_predicate` and `add_directive` must opt-in to the
correct behavior for backward compatibility. This is done with a new
"all" option. This option will become the default and removed after the
0.10 release.

Co-authored-by: Christian Clason <c.clason@uni-graz.at>
Co-authored-by: MDeiml <matthias@deiml.net>
Co-authored-by: Gregory Anders <greg@gpanders.com>
2024-02-16 11:54:47 -06:00
Marcus Michaels
1ba3500abd
docs(tutor): include https urls where applicable (#27461)
Problem:  URLs in :Tutor use "http" instead of "https".
Solution: Update URLs with a valid "https" equivalent.
2024-02-16 20:54:32 +08:00
zeertzjq
615b48aca6 fix(runtime): add more Nvim-only highlight groups to Vim syntax 2024-02-16 19:06:10 +08:00
zeertzjq
608f238bc6 vim-patch:1633de8c35fd
runtime(vim): Update base-syntax, remove unused vimString region

These were included with the initial release of the syntax file for Vim
5 and were probably intended to allow for syn-region start/skip/end
patterns with a '!' or '+' delimiter.  However, these cases are
currently handled by the vimSynRegPat group.

The removed patterns never match anywhere in the distributed runtime
files and it is believed that this is generally true.

closes: vim/vim#14035

1633de8c35

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2024-02-16 19:06:10 +08:00
zeertzjq
18dfe175e7 vim-patch:fe6d5b0ae47e
runtime(vim): Update base-syntax, fix :behave highlighting

closes: vim/vim#14036

fe6d5b0ae4

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2024-02-16 19:06:10 +08:00
zeertzjq
7751ff7394 vim-patch:5c3855bcab42
runtime(vim): update Vim Syntax generator

- Add missing "Last Change:" line.
- The date on this line in vim.vim is updated by update_date.vim at
  Make time. (I made a mistake in the file path)
- Remove unnecessary "b:loaded_syntax_vim_ex".
- Remove "Base File Date:" line in vim.vim.base
- Add Doug Kearns as Maintainer

closes: vim/vim#14031

5c3855bcab

Co-authored-by: h-east <h.east.727@gmail.com>
2024-02-16 19:06:10 +08:00
zeertzjq
2a6c7d0ccc vim-patch:9b53c052d58f
runtime(vim): include Vim Syntax generator

fixes: vim/vim#13939
closes: vim/vim#14021
related: vim-jp/syntax-vim-ex#28

9b53c052d5

Omit the generator as it cannot be used for Nvim.
Keep vimHLGroup and vimOnlyHLGroup separate.

N/A patch:
vim-patch:b418a51933bb

Co-authored-by: h-east <h.east.727@gmail.com>
2024-02-16 19:05:57 +08:00
zeertzjq
5de14b7206 vim-patch:ceed36873e92
runtime(vim): accept dot in completionList for Vim9 syntax (vim/vim#13832)

if you have autoloaded command complete function in vim9script, it shouldn't be highlighted as Error:

```
import autoload "share.vim"
command! -range=% -nargs=? -complete=custom,share.Complete Share share.Paste(<q-args>, <line1>, <line2>)
```

`share.Complete` is a valid complete function.

ceed36873e

Co-authored-by: Maxim Kim <habamax@gmail.com>
2024-02-16 19:05:50 +08:00
Christian Clason
422b090e0c vim-patch:79230f027a25
runtime(less): update "Last Change:" header

Commit 103f1dfb7df350650a5d7caadb0364bd79e9d25b forgot to update the
"Last Change:" header. So update it now.

79230f027a

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-02-16 08:57:45 +01:00
Christian Clason
a1d977d8eb vim-patch:103f1dfb7df3
runtime(less): reset readonly setting when disabling less mode

While at it, also do the unmap only if a specific key has been mapped.
There are some keys that are only selectively mapped and it would cause
an error if we are trying to unmap such a key (e.g. z when your
foldmethod is not manual).

fixes: vim/vim#14040

103f1dfb7d

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-02-16 08:57:45 +01:00
Gregory Anders
55a4aa41bb
docs: document breaking change for nvim_create_autocmd callback (#27484)
https://github.com/neovim/neovim/pull/27428 changed the semantics of
callbacks passed to nvim_create_autocmd such that any truthy value will
delete the autocommand (rather than just the literal boolean value
`true`). Update the documentation accordingly and add an entry to
`news.txt`.

The behavior is now consistent between nvim_create_autocmd and
nvim_buf_attach.
2024-02-15 19:56:58 -06:00
Lewis Russell
35f453f65d fix: type warnings in shared.lua 2024-02-15 11:32:50 +00:00
Christian Clason
0a51e7626a vim-patch:9.1.0111: filetype: no support for bats files
The '*.bats' file type is for Bash Automated Testing System (BATS)
scripts. BATS scripts are Bash with a special '@test' extension but they
otherwise work with Vim's bash filetype.

See https://github.com/bats-core/bats-core

closes: vim/vim#14039

d00fb4b3a2

Co-authored-by: Brandon Maier <brandon.maier@collins.com>
2024-02-15 10:01:16 +01:00
Christian Clason
d0599b0ed9 vim-patch:9.1.0110: filetype: add 'Config.in' filetype detection
The 'Config.in' file type is for Buildroot configuration files.
Buildroot Config.in files use the same Kconfig backend as the Linux
kernel's Kconfig files.

Buildroot also has other filename variants that follow "Config.in.*",
they are used to distinguish multiple Config.in files in the same
directory.

See https://buildroot.org/downloads/manual/manual.html#_literal_config_in_literal_file

closes: vim/vim#14038

5f20f050ef

Co-authored-by: Brandon Maier <brandon.maier@collins.com>
2024-02-15 10:01:16 +01:00
Christian Clason
7ed75d410a vim-patch:9.1.0109: filetype: no support for its files
Problem:  filetype: no support for its files
Solution: Add detection for *.its files as dts file type
          (Brandon Maier)

The '*.its' file type is for U-Boot Flattened Image Trees (FIT) which
use the flattened devicetree format.

See https://github.com/u-boot/u-boot/blob/master/doc/usage/fit/source_file_format.rst#terminology

closes: vim/vim#14037

cf1d65e060

Co-authored-by: Brandon Maier <brandon.maier@collins.com>
2024-02-15 10:01:16 +01:00
Christian Clason
4f07ad7786 vim-patch:9.1.0108: filetype: no support for dtso files
Problem:  filetype: no support for dtso files
Solution: Add detection for *.dtso files as dts file type
          (Markus Schneider-Pargmann)

*.dtso files are devicetree overlay files which have the same syntax as dts or dtsi files.

closes: vim/vim#14026

b1700fb33f

Co-authored-by: Markus Schneider-Pargmann <msp@baylibre.com>
2024-02-15 10:01:16 +01:00
Christian Clason
989312ed84 vim-patch:1da0e8581671
runtime(asciidoc): include basic ftplugin

closes: vim/vim#13873

1da0e85816

Co-authored-by: Luca Saccarola <github.e41mv@aleeas.com>
2024-02-15 10:00:59 +01:00
zeertzjq
31b3c62845 vim-patch:9.1.0106: Visual highlight hard to read with 'termguicolors'
Problem:  Visual highlight hard to read with 'termguicolors'
          (Maxim Kim)
Solution: Set Visual GUI foreground to black (with background=light)
          and lightgrey (with background=dark)
          (Maxim Kim)

fixes: vim/vim#14024
closes: vim/vim#14025

34e4a05d02

Co-authored-by: Maxim Kim <habamax@gmail.com>
2024-02-15 10:50:29 +08:00
zeertzjq
440ce0d246 vim-patch:9.1.0068: Visual highlighting can still be improved
Problem:  Visual highlighting can still be improved
Solution: Update Visual highlighting for 8 color terminals,
          use uniform grey highlighting for dark and light bg
          (Maxim Kim)

Update terminal Visual

1. Use `ctermbg=Grey ctermfg=Black` for both dark and light

This uniforms Visual highlighting between default dark and light colors
And should work for vim usually detecting light background for terminals
with black/dark background colors.

Previously used `ctermfg=White` leaks `cterm=bold` if available colors
are less than 16.

2. Use `term=reverse cterm=reverse ctermbg=NONE ctermfg=NONE`
   for terminals reporting less than 8 colors available

If the terminal has less than 8 colors, grey just doesn't work right

closes: vim/vim#13940

59bafc8171

Co-authored-by: Maxim Kim <habamax@gmail.com>
2024-02-15 07:49:23 +08:00
Tomasz N
d09957e0a0
fix(lsp): rename: load and list new buffer if attached to window (#27408) 2024-02-14 21:11:29 +01:00
Lewis Russell
9f8c96240d refactor(lsp): resolve the config-client entanglement
Previously the LSP-Client object contained some fields that are also
in the client config, but for a lot of other fields, the config was used
directly making the two objects vaguely entangled with either not having
a clear role.

Now the config object is treated purely as config (read-only) from the
client, and any fields the client needs from the config are now copied
in as additional fields.

This means:
- the config object is no longet normalised and is left as the user
  provided it.
- the client only reads the config on creation of the client and all
  other implementations now read the clients version of the fields.

In addition, internal support for multiple callbacks has been added to
the client so the client tracking logic (done in lua.lsp) can be done
more robustly instead of wrapping the user callbacks which may error.
2024-02-13 14:49:20 +00:00
bfredl
1a3a8d903e refactor(lua): use a keyset for vim.diff opts parsing 2024-02-13 11:54:44 +01:00
bfredl
0353dd3029 refactor(lua): use Arena when converting from lua stack to API args
and for return value of nlua_exec/nlua_call_ref, as this uses
the same family of functions.

NB: the handling of luaref:s is a bit of a mess.
add api_luarefs_free_XX functions as a stop-gap as refactoring
luarefs is a can of worms for another PR:s.

as a minor feature/bug-fix, nvim_buf_call and nvim_win_call now preserves
arbitrary return values.
2024-02-13 11:54:44 +01:00
Jongwook Choi
89135cff03 fix(loader): remove cyclic dependency on vim.fs (when --luamod-dev)
Problem: Loading `vim.fs` via the `vim.loader` Lua package loader will
result in a stack overflow due to a cyclic dependency. This may happen
when the `vim.fs` module isn't byte-compiled, i.e. when `--luamod-dev`
is used (#27413).

Solution: `vim.loader` depends on `vim.fs`. Therefore `vim.fs` should
be loaded in advance.
2024-02-13 10:29:22 +00:00
Jongwook Choi
309c36d3c9 docs(builtin): fix lua types for vim.fn.sign_getplaced
Per :help sign_getplaced():

- Parameter {dict}: lnum also accepts integer as well as string
- Return value: item has field bufnr, not buf
2024-02-13 08:22:32 +00:00
Maria José Solano
1c7b0b9d5f
docs: stricter bufname and bufnr types (#27454) 2024-02-13 12:15:27 +08:00
Lewis Russell
597ecf7516 fix(lsp): re-add client.commands and mark private 2024-02-12 13:18:23 +01:00
altermo
6c168c0f4d
docs: correct on_key docs (#27429) 2024-02-12 20:03:53 +08:00
Lewis Russell
917172dd96 fix(lsp): semantic token defer loading
Fixes #27424
2024-02-12 09:31:48 +00:00
zeertzjq
950a0ac61c
vim-patch:b614b284ee06 (#27433)
runtime(vim): Update syntax file (vim/vim#14009)

- allow comments after :highight commands
- match the bang in a :highlight[!] command
- highlight the bang in :map[!], :menu[!] and :unlet[!] with vimOper
  like all other commands

b614b284ee

Co-authored-by: dkearns <dougkearns@gmail.com>
2024-02-12 06:56:48 +08:00
Christian Clason
46390635cd vim-patch:6d91227267a5
runtime(gpg): Mark dangerous use-embedded-filename with WarningMsg

The syntax highlighter is likely to encourage people to use the listed
commands.

But `use-embedded-filename` is a dangerous option that can cause GnuPG
to write arbitrary data to arbitrary files whenever GnuPG encounters
malicious data.

GnuPG upstream explicitly warns against using this option:

https://dev.gnupg.org/T4500
https://dev.gnupg.org/T6972

However, since this is a valid option, we cannot just drop it from the
syntax script. Instead, let's mark it with the WarningMsg highlighting
to make it obvious, that this option is different (and should not be
used for security reasons).

closes: vim/vim#13961

6d91227267

Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2024-02-11 20:09:43 +01:00
Lewis Russell
ed1b66bd99
refactor(lsp): move more code to client.lua
The dispatchers used by the RPC client should be defined in the client,
so they have been moved there. Due to this, it also made sense to move
all code related to client configuration and the creation of the RPC
client there too.

Now vim.lsp.start_client is significantly simplified and now mostly
contains logic for tracking open clients.

- Renamed client.new -> client.start
2024-02-11 12:37:20 +00:00
Lewis Russell
8e86193502
Merge pull request #27420 from MariaSolOs/warning-anxiety
refactor(lsp): fix type annotations and add shared diagnostic helper
2024-02-11 11:42:21 +00:00
Maria José Solano
eac7e3fc6c refactor(lsp): add vim.lsp.sync.Range type 2024-02-10 20:05:47 -08:00
Maria José Solano
5a6868c888 refactor(lsp): add shared diagnostic handler 2024-02-10 20:05:47 -08:00
Maria José Solano
c73d67d283 refactor(lsp): add type annotations 2024-02-10 20:05:47 -08:00
Trevor Arjeski
170c890dca
feat(shortmess): "q" flag fully hides recording message (#27415)
When "q" is set in 'shortmess' it now fully hides the "recording @a" message
when you are recording a macro instead of just shortening to "recording". This
removes duplication when using reg_recording() in the statusline.

Related #19193
2024-02-11 07:39:39 +08:00
bfredl
320eec496c
Merge pull request #27253 from MariaSolOs/codelens-refresh
feat(lsp): add opts to vim.lsp.codelens.refresh
2024-02-10 21:48:45 +01:00
Christian Clason
71429c90ee build(deps): bump tree-sitter-bash to v0.20.5 2024-02-10 14:49:09 +01:00
Pablo Arias
8e739af064
fix(startup): multiprocess startuptime #26790
Problem:
Since 2448816956, the --startuptime report shows
two blocks of data. The TUI process and its embedded nvim process write to the
file concurrently, which may interleave the two startup sequences into the same
timeline.

Solution:
Report each process as a separate section in the same file.
1. Each process buffers the full report.
2. After startup is finished, the buffer is flushed (appended) to the file.

Fix #23036
Sample report:

    --- Startup times for process: Primary/TUI ---

    times in msec
     clock   self+sourced   self:  sourced script
     clock   elapsed:              other lines

    000.006  000.006: --- NVIM STARTING ---
    000.428  000.422: event init
    000.728  000.301: early init
    ...
    005.880  000.713: init highlight
    005.882  000.002: --- NVIM STARTED ---

    --- Startup times for process: Embedded ---

    times in msec
     clock   self+sourced   self:  sourced script
     clock   elapsed:              other lines

    000.006  000.006: --- NVIM STARTING ---
    000.409  000.403: event init
    000.557  000.148: early init
    000.633  000.077: locale set
    ...
    014.383  000.430: first screen update
    014.387  000.003: --- NVIM STARTED ---
2024-02-09 14:56:52 -08:00
Will Hopkins
44ec4b5b18
refactor: rename FloatConfig to WinConfig #27397
`FloatConfig` is no longer used only for floats, so the name is counterintuitive.

Followup to #25550
2024-02-09 08:17:10 -08:00
Maria José Solano
0fe86f7e24 feat(lsp): add opts paramater to vim.lsp.codelens.refresh 2024-02-08 20:24:40 -08:00
ite-usagi
32b49448b2
feat(tutor): add Japanese tutor #27268
Add Japanese Tutor
2024-02-08 14:43:18 -08:00
Tomasz N
f0e61e6d92
fix(lsp): rename fails on missing parent directory #27291
Problem:
If a rename results in a path that has missing parent directory(s), it
will fail.

Solution:
Do a recursive mkdir before attempting the rename.
2024-02-08 13:06:54 -08:00
Lewis Russell
451bc50d40 feat(lsp): deprecate severity_limit
Problem:
  `vim.lsp.diagnostic.on_diagnostic` accepts an undocumented severity_limit
  option which is widely used.

Solution:
  Deprecate it in favour of `{min = severity}` used in `vim.diagnostic`.
  Since this is undocumented, the schedule for removal is accelerated to
  0.11.
2024-02-08 16:58:49 +00:00
Jongwook Choi
d0e9e36a78 refactor(treesitter): {start,stop} are optional in Query:iter_* methods
Document that the `start` and `stop` parameters in
`Query:iter_captures()` and `Query:iter_matches()` are optional.

The tree-sitter lib has been bumped up to 0.20.9, so we also no longer
need "Requires treesitter >= 0.20.9".
2024-02-08 12:42:19 +00:00
Jongwook Choi
800134ea5e refactor(treesitter): typing for Query, TSQuery, and TSQueryInfo
- `TSQuery`: userdata object for parsed query.

- `vim.treesitter.Query`: renamed from `Query`.
  - Add a new field `lang`.

- `TSQueryInfo`:
  - Move to `vim/treesitter/_meta.lua`, because C code owns it.
  - Correct typing for `patterns`, should be a map from `integer`
    (pattern_id) to `(integer|string)[][]` (list of predicates or
    directives).

- `vim.treesitter.QueryInfo` is added.
  - This currently has the same structure as `TSQueryInfo` (exported
    from C code).
  - Document the fields (see `TSQuery:inspect`).

- Add typing for `vim._ts_parse_query()`.
2024-02-08 12:40:16 +00:00
Lewis Russell
1f9da3d083 refactor(lsp): tidy up logging 2024-02-08 11:11:46 +00:00
zeertzjq
2a7c4aca42
vim-patch:b8170143c8f8 (#27387)
runtime(doc): further improve docs about List/Blob += operator

closes: vim/vim#13990

b8170143c8
2024-02-08 19:07:31 +08:00
nikolightsaber
b162adbb7c
feat(api): pass 0 to nvim_get_chan_info for current channel (#27321)
Getting current channel info was kind of annoying via RPC. Two
functions had to be called:
1. `nvim_get_api_info` which returns `[channel_id, meta_data]`.
  - This results in `channel_id = api.nvim_get_api_info()[0]`.
  - Here the meta_data is sent but never used.
2. Finally call `nvim_get_chan_info(channel_id)`.

This commit reduces the need for `nvim_get_api_info` as passing 0
returns current channel info.
2024-02-08 18:59:31 +08:00
zeertzjq
ceed5739e0 vim-patch:c9c2e2d2ff44
runtime(doc): Clarify list-concatenation a bit more

Make doc list-concatenation more clear as for += and extend().

1. describe `+=` for list-concatenation more accurately
2. add `extend()` example for list-concatenation
3. Fix CI errors for missing helptags reference |+=|

closes: vim/vim#13983

c9c2e2d2ff

Co-authored-by: qeatzy <qeatzy@users.noreply.github.com>
2024-02-08 08:09:01 +08:00
zeertzjq
d75022d205 vim-patch:partial:9.1.0080: unexpected error for modifying final list using +=
Problem:  unexpected error for modifying final list using += operator
          (Ernie Rael)
Solution: Allow List value modification of a final variable using +=
          operator
          (Yegappan Lakshmanan)

fixes: vim/vim#13745
fixes: vim/vim#13959
closes: vim/vim#13962

1af35631f8

Only port eval.txt changes.

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2024-02-08 08:08:18 +08:00
Maximilian Fricke
70a0049296
fix(runtime): source c ftplugins in correct order (#27377) 2024-02-08 07:42:16 +08:00
zeertzjq
5785c32f11
fix(lsp): set fallback client name properly 2024-02-08 07:34:38 +08:00
Lewis Russell
59cf827f99 refactor(lsp): move client code to a regular Lua class
Problem:
  The LSP client code is implemented as a complicated closure-class
  (class defined in a single function).

Solution:
  Move LSP client code to a more conventional Lua class and move to a
  separate file.
2024-02-07 19:48:37 +00:00
altermo
c0b99bb1de
feat(treesitter): show root nodes in :InspectTree (#26944)
Co-authored-by: altermo <>
Co-authored-by: Jongwook Choi <wookayin@gmail.com>
2024-02-06 14:51:53 -06:00
Lewis Russell
c4417ae70c fix(doc): prevent doxygen confusion 2024-02-06 15:29:01 +00:00
Lewis Russell
3be2536ca0 fix(lsp): send back diagnostic tags to the server
Fixes: #27318
2024-02-06 12:35:31 +00:00
dundargoc
63b810c9d8
docs: small fixes (#27213)
Co-authored-by: Matthieu Coudron <886074+teto@users.noreply.github.com>
2024-02-06 19:30:02 +08:00
Christian Clason
9a761019da vim-patch:f7f33e3719c8
runtime(dosbatch): improve '::' comment highlighting

Added a syntax region for command blocks so that the highlighting of
`::` comments in them can be controlled.  The `dosbatch_colons_comment`
variable now controls if all `::` comments in a code block are
highlighted as comments or errors.  A `::` comment at the end of a
command block is always highlighted as an error.

This re-enables the highlighting of `::` comments in `.bat` files as
requested in vim/vim#13666, while allowing control of highlighting them in
command blocks requested in vim/vim#11778 and first attempted in vim/vim#11980.

related: vim/vim#11980
fixes: vim/vim#13666

f7f33e3719

Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Mike Williams <mikew@globalgraphics.com>
2024-02-06 11:42:15 +01:00
Jongwook Choi
a478bf936b feat(treesitter): use 0-based indexing to show ranges in :InspectTree
Problem:

- `:InspectTree` was showing node ranges in 1-based indexing, i.e., in
  vim cursor position (lnum, col). However, treesitter API adopts
  0-based indexing to represent ranges (Range4). This can often be
  confusing for developers and plugin authors when debugging code
  written with treesiter APIs.

Solution:

- Change to 0-based indexing from 1-based indexing to show node ranges
  in `:InspectTree`.

- Note: To make things not complicated, we do not provide an option or
  keymap to configure which indexing mode to use.
2024-02-05 16:23:22 -05:00
Maria José Solano
0e9a33572d fix(lsp): handle adjacent snippet tabstops 2024-02-05 15:03:46 +00:00
Lewis Russell
43661a0abf
Merge pull request #27328 from wookayin/fix/lsp-tagfunc 2024-02-05 10:35:25 +00:00
altermo
6c8387067d fix(treesitter): inspect-tree remember opts on buf change 2024-02-04 15:53:29 +00:00
Christian Clason
1d5f86f694 vim-patch:9.1.0076: luau config file not detected
Problem:  luau config file not detected
          (lopy)
Solution: Detect it as jsonc
          (lopy)

fixes: vim/vim#13960
closes: vim/vim#13970

de7f5bde6c

Co-authored-by: lopy <70210066+lopi-py@users.noreply.github.com>
2024-02-04 11:14:40 +01:00
zeertzjq
cd3399f6bd
vim-patch:7c5aeaffa2be (#27327)
runtime(vim): Update syntax file (vim/vim#13969)

Improve string interpolation highlighting.

Use the vimSep group to highlight interpolation braces as vimOperParen
has no highlighting of its own and employs vimSep via matchgroup.

Add vimNumber to the interpolation group's contained list.

7c5aeaffa2

Co-authored-by: dkearns <dougkearns@gmail.com>
2024-02-04 07:09:54 +08:00
Jongwook Choi
f487e5af01 fix(lsp): fix infinite loop on vim.lsp.tagfunc
Problem: vim.lsp.tagfunc() causes an infinite loop.

This is a bug happened while introducing deferred loading.

Solution: Rename the private module to `vim.lsp._tagfunc`.
2024-02-03 17:47:56 -05:00
dundargoc
2e982f1aad refactor: create function for deferred loading
The benefit of this is that users only pay for what they use. If e.g.
only `vim.lsp.buf_get_clients()` is called then they don't need to load
all modules under `vim.lsp` which could lead to significant startuptime
saving.

Also `vim.lsp.module` is a bit nicer to user compared to
`require("vim.lsp.module")`.

This isn't used for some nested modules such as `filetype` as it breaks
tests with error messages such as "attempt to index field 'detect'".
It's not entirely certain the reason for this, but it is likely it is
due to filetype being precompiled which would imply deferred loading
isn't needed for performance reasons.
2024-02-03 16:53:41 +01:00
zeertzjq
9b7cf4f0be
fix(vim.system): don't process non-fast events during wait() (#27300)
Problem:
Processing non-fast events during SystemObj:wait() may cause two pieces
of code to interfere with each other, and is different from jobwait().

Solution:
Don't process non-fast events during SystemObj:wait().
2024-02-02 21:52:01 +08:00
zeertzjq
e98decf9a6
feat(quickfix): support -q - to read 'errorfile' from stdin (#27303)
Note that this only works when stdin is a pipe.
2024-02-02 21:17:37 +08:00
Christian Clason
1bf645918e vim-patch:9204f39580bd
runtime(fortran): update syntax (vim/vim#13953)

* runtime (Fortran) update syntax
* runtime (Fortran) small fix

9204f39580

Co-authored-by: Ajit-Thakkar <142174202+Ajit-Thakkar@users.noreply.github.com>
2024-02-02 08:59:49 +01:00
zeertzjq
1405e5c8c1
refactor(runtime): remove nvimMap and nvimUnmap syntax groups (#27298)
They are no longer needed as they are covered by vimMap and vimUnmap.
Also fix some other mistakes and missing changes.
2024-02-02 10:45:15 +08:00
zeertzjq
11acbd6df4 vim-patch:e3e3934bb182
runtime(vim): Update syntax file (vim/vim#13948)

Improve string escape sequence and special key matching.

e3e3934bb1

Co-authored-by: dkearns <dougkearns@gmail.com>
2024-02-02 06:46:11 +08:00
zeertzjq
882d5fa558 vim-patch:69866449ddb2
runtime(vim): Improve keymap file highlighting (vim/vim#13550)

- Match :loadkeymap to EOF as a region and contain only allowed items.
- Add highlighting for <Char- notation.
- add basic syntax highlighting tests

69866449dd

N/A patches:
vim-patch:35928ee8f80ea721e92bb856c8ecde2cced46bb9
vim-patch:b5352931b354eb67eb7d223cc09c98dcf1b547b6

Co-authored-by: dkearns <dougkearns@gmail.com>
2024-02-02 06:45:06 +08:00
dundargoc
4c91194611 build: various fixes
- Consistently use the variable CMAKE_BUILD_TYPE to select build type.
- Remove broken `doc_html` target.
- Remove swap files created by oldtest when cleaning.
- Only rerun `lintdoc` if any documentation files has changed.
2024-02-01 12:06:55 +01:00
Christian Clason
0da18ae5ce vim-patch:c46c21b4ca47
runtime(netrw): fixing remote file removal via ssh (vim/vim#13942)

Make pattern, which retrieves the path component from e.g.
`scp://user@host//opt/program/file.ext` non-greedy.

c46c21b4ca

Co-authored-by: MiguelBarro <45819833+MiguelBarro@users.noreply.github.com>
2024-02-01 10:04:32 +01:00
Christian Clason
e0961aaa5a vim-patch:83f627ff42a3
runtime(racket): add missing space to b:undo_indent var (vim/vim#13945)

This copies commit 2a4862a (fixup! indent: only reset some options when
has vim9, 2024-01-31) from https://github.com/benknoble/vim-racket and
fixes 26b0176a9 (runtime(racket): undo some indent options only when
vim9script is available (vim/vim#13935), 2024-01-30).

83f627ff42

Co-authored-by: D. Ben Knoble <ben.knoble+github@gmail.com>
2024-02-01 10:04:32 +01:00
Will Hopkins
6bba4beced
feat(api): make nvim_open_win support non-floating windows (#25550)
Adds support to `nvim_open_win` and `nvim_win_set_config` for creating
and manipulating split (non-floating) windows.
2024-02-01 11:43:35 +08:00
Christian Clason
f4b3636f24 vim-patch:bdb9d9afba97
runtime(netrw): Use :exec norm! <leftmouse> before :call mapping in netrw (vim/vim#12180)

fixes: vim/vim#12143

bdb9d9afba

Co-authored-by: user202729 <25191436+user202729@users.noreply.github.com>
2024-01-31 09:55:08 +01:00
Christian Clason
6e8e3a2a3a vim-patch:26b0176a98f8
runtime(racket): undo some indent options only when vim9script is available (vim/vim#13935)

This copies commit 64edf95 (indent: only reset some options when has
vim9, 2024-01-30) from https://github.com/benknoble/vim-racket.

26b0176a98

Co-authored-by: D. Ben Knoble <ben.knoble+github@gmail.com>
2024-01-31 09:55:08 +01:00
Justin M. Keyes
a060c13f55
Merge #27246 from justinmk/health 2024-01-29 09:43:49 -08:00
Evgeni Chasnovski
4f788f78f8
vim-patch:9.1.0061: UX of visual highlighting can be improved (#27256)
Problem:  UX of visual highlighting can be improved
Solution: Improve readibility of visual highlighting,
          by setting better foreground and background
          colors

The default visual highlighting currently is nice in that it overlays
the actual syntax highlighting by using a separate distinct background
color.

However, this can cause hard to read text, because the contrast
between the actual syntax element and the background color is way too
low. That is an issue, that has been bothering colorschemes authors for
quite some time so much, that they are defining the Visual highlighting
group to use a separate foreground and background color, so that the
syntax highlighting vanishes, but the text remains readable (ref:
vim/colorschemesvim/vim#250)

So this is an attempt to perform the same fix for the default Visual
highlighting and just use a default foreground and background color
instead of using reverse.

I also removed the hard-coded changes to the Visual highlighting in
init_highlight. It's not quite clear to me, why those were there and not
added directly to the highlighting_init_<dark|light> struct.

closes: vim/vim#13663
related: vim/colorschemes#250

e6d8b4662d

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-01-29 18:39:57 +08:00
Will Hopkins
ca9f6f5694
feat(api): add nvim_tabpage_set_win (#27222)
Allows setting the current window of a non-current tabpage
without switching tabpages.
2024-01-29 15:18:33 +08:00
zeertzjq
5e5b004da4 vim-patch:cf8695d48cdd
runtime(vim): Highlight string interpolation

closes: vim/vim#13923

cf8695d48c

Co-authored-by: thinca <thinca@gmail.com>
2024-01-29 11:25:35 +08:00
zeertzjq
7db83d47b2 vim-patch:21ce159e0561
runtime(vim): Update syntax and ftplugin files (vim/vim#13924)

Improve matching of line-continuations and interspersed comments.

These are now also matched in multiline syntax command patterns,
dictionary literals, and parenthesised expressions and argument lists.

21ce159e05

Co-authored-by: dkearns <dougkearns@gmail.com>
2024-01-29 11:25:35 +08:00
zeertzjq
d62b3fa623 vim-patch:c79646dfb101
runtime(vim): Update syntax file (vim/vim#13671)

Support multiline :syntax commands.

Match :syn-cchar option in :syn-{keyword,region}.

c79646dfb1

Co-authored-by: dkearns <dougkearns@gmail.com>
2024-01-29 11:25:35 +08:00
zeertzjq
f1e51528d2 vim-patch:71b6d3397649
Update runtime files

71b6d33976

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2024-01-29 11:25:35 +08:00
Gregory Anders
15e77a56b7
feat(extmarks): subpriorities (relative to declaration order) (#27131)
The "priority" field of extmarks can be used to set priorities of
extmarks which dictates which highlight group a range will actually have
when there are multiple extmarks applied. However, when multiple
extmarks have the same priority, the only way to enforce an actual
priority is through the order in which the extmarks are set.

It is not always possible or desirable to set extmarks in a specific
order, however, so we add a new "subpriority" field that explicitly
enforces the ordering of extmarks that have the same priority.

For now this will be used only to enforce priority of treesitter
highlights. A single node in a treesitter tree may match multiple
captures, in which case that node will have multiple extmarks set. The
order in which captures are returned from the treesitter API is not
_necessarily_ in the same order they are defined in a query file, so we
use the new subpriority field to force that ordering.

For now subpriorites are not documented and are not meant to be used by
external code, and it only applies to ephemeral extmarks. We indicate
the "private" nature of subpriorities by prefixing the field name with
an "_".
2024-01-28 21:13:58 -06:00
Maria José Solano
eee52d3427
refactor(lsp): client_hints typo #27250 2024-01-28 18:38:36 -08:00
Jongwook Choi
5b1b765610
docs: enforce "treesitter" spelling #27110
It's the "tree-sitter" project, but "treesitter" in our code and docs.
2024-01-28 17:53:14 -08:00
Justin M. Keyes
e39b6d0c52 fix(health): "attempt to concatenate nil"
Problem:
If `neovim` module is not installed, python and ruby healthchecks fail:

    - ERROR Failed to run healthcheck for "provider.python" plugin. Exception:
      .../runtime/lua/provider/python/health.lua:348: attempt to concatenate local 'pyname' (a nil value)
    - ERROR Failed to run healthcheck for "provider.ruby" plugin. Exception:
      .../runtime/lua/provider/ruby/health.lua:25: attempt to index local 'host' (a nil value)

Solution:
Check for non-nil.
2024-01-28 23:56:06 +01:00
Justin M. Keyes
50cd5ed360 fix(health): check more "old" files 2024-01-28 23:56:03 +01:00
Sean Dewar
d85f180f26
vim-patch:9.1.0049: Make "[Command Line]" a special buffer name
Problem:  E95 is possible if a buffer called "[Command Line]" already
          exists when opening the cmdwin. This can also happen if the
          cmdwin's buffer could not be deleted when closing.

Solution: Un-name the cmdwin buffer, and give it a special name instead,
          similar to what's done for quickfix buffers and for unnamed
          prompt and scratch buffers. As a result, BufFilePre/Post are
          no longer fired when opening the cmdwin. Add a "command" key
          to the dictionary returned by getbufinfo() to differentiate
          the cmdwin buffer instead. (Sean Dewar)

Cherry-pick test_normal changes from v9.0.0954.

1fb4103206
2024-01-28 12:29:42 +00:00
Justin M. Keyes
2cd76a758b
docs(lua): update ":{range}lua" docs + error message #27231
- `:lua (no file)` is misleading because `:lua` never takes a file arg,
  unlike `:source`.
- Update various related docs.
2024-01-27 10:40:30 -08:00
Christian Clason
17b298b7c8 vim-patch:0cc6108fea21
runtime(ant): Update syntax file (vim/vim#13926)

Remove invalid display option from syn-keyword commands.

Take over maintenance of this file.

0cc6108fea

Co-authored-by: dkearns <dougkearns@gmail.com>
2024-01-27 19:38:05 +01:00
Christian Clason
e35ae6fbc2 vim-patch:772f8f542513
runtime(hurl): add hurl filetype plugin(vim/vim#13921)

772f8f5425

Co-authored-by: Melker Ulander <melker.ulander@pm.me>
2024-01-27 12:02:59 +01:00
luukvbaal
c2433589dc
feat(ex_cmds): ranged :lua #27167
:{range}lua executes the specified lines in the current buffer as
Lua code, regardless of its extension or 'filetype'.

Close #27103
2024-01-26 17:00:50 -08:00
Till Bungert
0892c080d1
revert: "feat(treesitter): add foldtext with treesitter highlighting"
This reverts commit 9ce1623 in favor of #20750.
2024-01-27 08:38:56 +08:00
Evgeni Chasnovski
a9df0c5ce6
fix(osc52): do not use 'vim.iter' (#27218)
Problem: Using 'vim.iter' loads it during startup.

Solution: Do not use 'vim.iter'.
2024-01-26 12:06:13 -06:00
Lewis Russell
28d1640dd6 feat: improve return type annotations for vim.api.* 2024-01-26 15:07:25 +00:00
Christian Clason
b7e3003106 vim-patch:046a0f75d025
runtime(mail): fix vim/vim#13913 (vim/vim#13917)

switch to the DFA engine for the emoji collaction range

046a0f75d0

Co-authored-by: gi1242 <gi1242+github@gmail.com>
Co-authored-by: GI <gi1242+vim@gmail.com>
2024-01-26 08:51:13 +01:00
zeertzjq
226466a469
vim-patch:9.1.0058: Cannot map Super Keys in GTK UI (#27204)
Problem:  Cannot map Super Keys in GTK UI
          (Casey Tucker)
Solution: Enable Super Key mappings in GTK using <D-Key>
          (Casey Tucker)

As a developer who works in both Mac and Linux using the same keyboard,
it can be frustrating having to remember different key combinations or
having to rely on system utilities to remap keys.

This change allows `<D-z>` `<D-x>` `<D-c>` `<D-v>` etc. to be recognized
by the `map` commands, along with the `<D-S-...>` shifted variants.

```vimrc
if has('gui_gtk')
	nnoremap  <D-z>    u
	nnoremap  <D-S-Z>  <C-r>
	vnoremap  <D-x>    "+d
	vnoremap  <D-c>    "+y
	cnoremap  <D-v>    <C-R>+
	inoremap  <D-v>    <C-o>"+gP
	nnoremap  <D-v>    "+P
	vnoremap  <D-v>    "-d"+P
	nnoremap  <D-s>    :w<CR>
	inoremap  <D-s>    <C-o>:w<CR>
	nnoremap  <D-w>    :q<CR>
	nnoremap  <D-q>    :qa<CR>
	nnoremap  <D-t>    :tabe<CR>
	nnoremap  <D-S-T>  :vs#<CR><C-w>T
	nnoremap  <D-a>    ggVG
	vnoremap  <D-a>    <ESC>ggVG
	inoremap  <D-a>    <ESC>ggVG
	nnoremap  <D-f>    /
	nnoremap  <D-g>    n
	nnoremap  <D-S-G>  N
	vnoremap  <D-x>    "+x
endif
```

closes: vim/vim#12698

92e90a1e10

Co-authored-by: Casey Tucker <dctucker@hotmail.com>
2024-01-26 11:04:54 +08:00
Evgeni Chasnovski
1e0996b572 feat(colorscheme): update treesitter groups
Problem: Currently default color scheme defines most of treesitter
  highlight groups. This might be an issue for users defining their own
  color scheme as it breaks the "fallback property" for some of groups.

Solution: Define less default treesitter groups; just enough for default
  color scheme to be useful. That is:
    - All first level groups (`@character`, `@string`, etc.).
    - All `@xxx.builtin` groups as a most common subgroup.
    - Some special cases (links/URLs, `@diff.xxx`, etc.).
2024-01-25 20:09:24 +01:00
Evgeni Chasnovski
3ab6f60dc8 fix(runtime): update 'vim' color scheme to use new tree-sitter groups 2024-01-25 18:19:15 +01:00
dundargoc
76a659eb77
docs: various fixes (#27063)
Co-authored-by: lmenou <menl94629@gmail.com>
Co-authored-by: altermo <107814000+altermo@users.noreply.github.com>
Co-authored-by: VanaIgr <vanaigranov@gmail.com>
Co-authored-by: Gregory Anders <greg@gpanders.com>
2024-01-25 07:34:18 +08:00
Gregory Anders
6ea6b3fee2
feat(ui): add support for OSC 8 hyperlinks (#27109)
Extmarks can contain URLs which can then be drawn in any supporting UI.
In the TUI, for example, URLs are "drawn" by emitting the OSC 8 control
sequence to the TTY. On terminals which support the OSC 8 sequence this
will create clickable hyperlinks.

URLs are treated as inline highlights in the decoration subsystem, so
are included in the `DecorSignHighlight` structure. However, unlike
other inline highlights they use allocated memory which must be freed,
so they set the `ext` flag in `DecorInline` so that their lifetimes are
managed along with other allocated memory like virtual text.

The decoration subsystem then adds the URLs as a new highlight
attribute. The highlight subsystem maintains a set of unique URLs to
avoid duplicating allocations for the same string. To attach a URL to an
existing highlight attribute we call `hl_add_url` which finds the URL in
the set (allocating and adding it if it does not exist) and sets the
`url` highlight attribute to the index of the URL in the set (using an
index helps keep the size of the `HlAttrs` struct small).

This has the potential to lead to an increase in highlight attributes
if a URL is used over a range that contains many different highlight
attributes, because now each existing attribute must be combined with
the URL. In practice, however, URLs typically span a range containing a
single highlight (e.g. link text in Markdown), so this is likely just a
pathological edge case.

When a new highlight attribute is defined with a URL it is copied to all
attached UIs with the `hl_attr_define` UI event. The TUI manages its own
set of URLs (just like the highlight subsystem) to minimize allocations.
The TUI keeps track of which URL is "active" for the cell it is
printing. If no URL is active and a cell containing a URL is printed,
the opening OSC 8 sequence is emitted and that URL becomes the actively
tracked URL. If the cursor is moved while in the middle of a URL span,
we emit the terminating OSC sequence to prevent the hyperlink from
spanning multiple lines.

This does not support nested hyperlinks, but that is a rare (and,
frankly, bizarre) use case. If a valid use case for nested hyperlinks
ever presents itself we can address that issue then.
2024-01-24 16:36:25 -06:00
Christian Clason
f7bda77f9e vim-patch:a262d3f41bc5
runtime(netrw): Don't change global options (vim/vim#13910)

Originally reported at: https://github.com/vim-jp/issues/issues/1428
'isk' was unintentionally changed by netrw, regression
introduced in Commit: 71badf9547e8f89571b9a095183671cbb333d528

a262d3f41b

Co-authored-by: K.Takata <kentkt@csc.jp>
2024-01-24 23:23:23 +01:00
Christian Clason
964dd93266 vim-patch:e1ddc2d5875d
runtime(fortran): update syntax and documentation (vim/vim#13912)

* runtime (doc): update Fortran section
* runtime(syntax): Complete support for Fortran 2023.
   Minor improvements.

e1ddc2d587

Co-authored-by: Ajit-Thakkar <142174202+Ajit-Thakkar@users.noreply.github.com>
2024-01-24 23:23:23 +01:00
dundargoc
b280d57db9 refactor: rewrite ruby provider in lua 2024-01-24 19:26:53 +01:00
dundargoc
ae3eed53d6 build: various build improvements
- remove "ran-" prefix from touch files as it's redundant since the
  they're already in the directory named `touches`.
- Include `contrib` when formatting with `make formatlua`.
- Use TARGET_FILE generator expression instead of assuming the
  executable location.
- reuse logic that determines whether to use lua or luajit.
- add translations to the `nvim` target.

Makefile improvements:
- rename variable `CMAKE_PRG` to `CMAKE` to make it more consistent with
  the builtin `MAKE` variable.
- stop propagating flags to generator. Users should use cmake for
  non-standard use cases.
- remove `+` prefix from targets. If the user for whatever reason wants
  to dry-run a target then they should be able to.
2024-01-24 12:41:09 +01:00
Daniel Kongsgaard
32849d5667 fix(treesitter): avoid # of nil in _query_linter 2024-01-24 11:03:54 +00:00
dundargoc
576db141be refactor: rewrite perl provider in lua 2024-01-24 11:55:28 +01:00
zeertzjq
8c044f0862
fix(spell): always accept ':' as filename char in 'spellfile' (#27172)
Follow-up to #25236
2024-01-24 18:13:39 +08:00
Christian Clason
0c1119ac75 vim-patch:ca0e9823a1df
runtime(c): Highlight user defined functions

closes: vim/vim#13763

ca0e9823a1

Co-authored-by: Luca Saccarola <github.e41mv@aleeas.com>
2024-01-24 11:05:25 +01:00
Christian Clason
9808a781d3 vim-patch:9c5b90db035b
runtime(vim): Update syntax file (vim/vim#13906)

Highlight :2match and :3match and add these to :help ex-cmd-index.

9c5b90db03

Co-authored-by: dkearns <dougkearns@gmail.com>
2024-01-24 11:05:25 +01:00
Christian Clason
f4acacdb53 vim-patch:50dbe16cd818
runtime(qml): Use shiftwidth() in indent plugin (vim/vim#13908)

Fixes vim/vim#13907

50dbe16cd8

Co-authored-by: dkearns <dougkearns@gmail.com>
2024-01-24 11:05:25 +01:00
Christian Clason
6916533a52 vim-patch:36e2c0f29332
runtime(mail): updated syntax file

36e2c0f293

Co-authored-by: GI <gi1242@gmail.com>
2024-01-24 11:05:25 +01:00
Jongwook Choi
913469ff21 docs(treesitter): add more examples, and improve consistency
Docs for treesitter would benefit from including more real-world and
practical examples of queries and usages, rather than hypothetical ones
(e.g. names such as "foo", "bar"). Improved examples should be more
user-friendly and clear to understand.

In addition, align the capture names in some examples with the actual
ones being used in the built-in query files or in the nvim-treesitter
plugin, e.g.:

- `@parameter` -> `@variable.parameter`
- `@comment.doc.java` -> `@comment.documentation.java`
- etc.
2024-01-24 11:04:16 +01:00
Phạm Huy Hoàng
617d1b28d6 fix(treesitter): prefix treesitter types with vim 2024-01-24 10:01:56 +00:00
zeertzjq
6cbfe45454
vim-patch:e13b665a6e2a (#27163)
runtime(doc): change "VIsual mode" to "Visual mode" in :h SafeState (vim/vim#13901)

"Visual mode" is used everywhere else in the help when not referring to
something in the source code.

e13b665a6e
2024-01-24 06:07:42 +08:00
Lewis Russell
0054c18500 test: typing for screen.lua
Very rough buts resolves most diagnostic errors and should provide
some useful hovers.
2024-01-23 11:45:17 +00:00
Jongwook Choi
89ffdebd20 fix(diagnostic): fix typing on field |diagnostic-severity|
Problem: vim.diagnostic.{underline,float,virtual_text...}.severity
will have a type warning on list-like or table (min-max) inputs,
e.g. `vim.diagnostic.config { float = { severity = { min = INFO } } }`.

Solution: Correct the typing as documented in |diagnostic-severity|.
2024-01-23 11:43:57 +00:00
Christian Clason
46aa1936e4 vim-patch:add31baedaf0
runtime(sh): Add handling for ksh93 shared-state comsubs and mksh valsubs (vim/vim#13884)

This commit adds support for ksh93 shared-state command
substitutions (syntax: ${ command; }) and mksh's value
substitutions (syntax: ${|command;}) in the sh syntax script.

Also add a syntax test for ksh subshares with dumps included
to make sure it doesn't regress.

fixes: vim/vim#9514

add31baeda

Co-authored-by: Johnothan King <johnothanking@protonmail.com>
2024-01-22 23:40:50 +01:00
Christian Clason
c7da55a835 vim-patch:3b2c27415d7d
runtime(chuck): include ChucK syntax file (vim/vim#13895)

3b2c27415d

Co-authored-by: Andrea C from The App <3269984+gacallea@users.noreply.github.com>
Co-authored-by: gacallea <gacallea@users.noreply.github.com>
2024-01-22 23:40:50 +01:00
Christian Clason
e2553c3d5d vim-patch:ea9a93e5b098
runtime(go): update Go syntax file (vim/vim#13896)

Update the Go syntax file with some recent changes made to vim-go.

ea9a93e5b0

Co-authored-by: Billie Cleek <bhcleek@users.noreply.github.com>
2024-01-22 23:40:50 +01:00
dundargoc
eb5d15e383 refactor: rewrite python provider in lua 2024-01-22 22:36:40 +01:00
zeertzjq
cb6320e13f
docs(options): remove misleading sentence (#27129)
Setting 'verbose' to 1 doesn't cause Nvim to produce messages. It adds
more information to existing messages, which is documented above.
2024-01-22 22:54:45 +08:00
Lewis Russell
1233ac467d
feat(fold): transparent foldtext
'foldtext' can be set to an empty string to disable and render the
line with:
  - extmark highlight
  - syntax highlighting
  - search highlighting
  - no line wrapping
  - spelling
  - conceal
  - inline virtual text
  - respects `fillchars:fold`

Currently normal virtual text is not displayed


Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2024-01-22 10:13:35 +00:00
bfredl
21b36c7d7f
Merge pull request #27076 from glepnir/extmark_hlgroup
refactor(api): use hl id directly in nvim_buf_set_extmark
2024-01-22 09:10:34 +01:00
Raphael
12d123959f
fix(eval): properly support checking v:lua function in exists() (#27124) 2024-01-22 16:04:50 +08:00
bfredl
d66ed4ea46 refactor(api): give "hl_group" more accurate _meta type
These can either be number or string in lua, so we can specify this
directly as "number|string".
2024-01-22 08:51:54 +01:00
zeertzjq
8c6de9147c
Merge pull request #26813 from VanaIgr/screen-pos-speedup
perf: make screen size and position calculations more efficient

N/A patches for version.c:
vim-patch:9.1.0037: Calling get_breakindent_win() repeatedly when computing virtcol
vim-patch:9.1.0038: Unnecessary loop in getvcol()
2024-01-22 10:00:11 +08:00
VanaIgr
fd08de4b85 docs(news): expand the list of performance improvements
When computing on-screen size or position, the size 'breakindent' and 'showbreak' is now cached,
and checks for whether a faster character size function can be used are performed only once at the start.
Multibyte characters are not decodes multiple times anymore, and character decoding functions are more efficient.
Additionally, the amount of trailing spaces for pasted blockwise text is now calculated correctly for multibyte characters.
Internal lisp formatting now doesn't erroneously use inline virtual text from a different line.
2024-01-22 09:05:01 +08:00
Jongwook Choi
fa4b02fa67 feat(vim.version): add vim.version.le and vim.version.ge
- Problem: One cannot easily write something like, for example:
    `version_current >= {0, 10, 0}`; writing like
    `not vim.version.lt(version_current, {0, 10, 0})` is verbose.

- Solution: add {`le`,`ge`} in addition to {`lt`,`gt`}.

- Also improve typing on the operator methods: allow `string` as well.

- Update the example in `vim.version.range()` docs: `ge` in place of
  `gt` better matches the semantics of `range:has`.
2024-01-21 11:41:50 +01:00
Christian Clason
c75af76b71 vim-patch:27a4632af675
runtime(filetype): detect *.ck files as Chuck filetype (vim/vim#13888)

closes vim/vim#13886

27a4632af6

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-01-21 11:10:53 +01:00
Christian Clason
f5dc453109 feat(treesitter)!: new standard capture names
Problem: Sharing queries with upstream and Helix is difficult due to
different capture names.

Solution: Define and document a new set of standard captures that
matches tree-sitter "standard captures" (where defined) and is closer to
Helix' Atom-style nested groups.

This is a breaking change for colorschemes that defined highlights based
on the old captures. On the other hand, the default colorscheme now
defines links for all standard captures (not just those used in bundled
queries), improving the out-of-the-box experience.
2024-01-21 10:41:18 +01:00
glepnir
646fdf1073 refactor(api): use hl id directly in nvim_buf_set_extmark 2024-01-20 21:31:11 +08:00
Jongwook Choi
fa9a85ae46 fix(lsp): clean up duplicate and unused meta type annotations 2024-01-20 14:02:16 +01:00
dundargoc
f936a962d0 build: create separate targets for nvim with and without runtime files
This distinction is important for correct dependency management, as the
nvim binary is used to create some runtime files. The nvim binary (and
the target to build it) is thus called `nvim_bin` and the target to
build all of nvim (binary+runtime) is called `nvim`.
2024-01-20 12:59:27 +01:00
Raphael
98a4ed0a11
feat(api): support getting abbreviations (#26868) 2024-01-20 08:08:44 +08:00
Gregory Anders
d3a8e9217f
feat(ui): add chdir UI event (#27093)
When an embedded Nvim instance changes its current directory a "chdir"
UI event is emitted. Attached UIs can use this information however they
wish. In the TUI it is used to synchronize the cwd of the TUI process
with the cwd of the embedded Nvim process.
2024-01-19 14:51:10 -06:00
Jongwook Choi
5a8fe0769c fix(vim.deprecate): show deprecation warning in devel versions as well
Problem:

On devel(nightly) versions, deprecation warnings for hard-deprecated
features are not being displayed. E.g.,
  - to be removed in: 0.11
  - hard-deprecation since 0.10
  - soft-deprecation since 0.9

then 0.10-nightly (0.10.0-dev) versions as well as 0.10.0 (stable)
should display the deprecation warning message.

Solution:

Improve the code and logic on `vim.deprecate()`, and improve
test cases with mocked `vim.version()`.
2024-01-19 12:00:47 +00:00
altermo
9707363b09 refactor(lua): refactored glob 2024-01-19 11:54:04 +00:00
bfredl
0b36cbbafd
Merge pull request #27061 from luukvbaal/extmark
fix(extmarks): do not remove invalid marks from decor upon deletion
2024-01-19 10:49:13 +01:00
Luuk van Baal
2645c9d576 docs(extmarks): add undocumented "details" array fields 2024-01-18 17:06:47 +01:00
Christian Clason
674f2513d4 fix(treesitter): validate language alias for injections
Problem: Parsed language annotations can be random garbage so
`nvim_get_runtime_file` throws an error.

Solution: Validate that `alias` is a valid language name before trying
to find a parser for it.
2024-01-18 15:46:08 +01:00
notomo
ab3a7fc3e3
docs(vim.iter): correct bool to boolean (#27018) 2024-01-18 07:01:57 -06:00
Justin M. Keyes
95cbedaa17
docs: various #25289
Co-authored-by: Jongwook Choi <wookayin@gmail.com>
Co-authored-by: Oliver Marriott <hello@omarriott.com>
Co-authored-by: Benoit de Chezelles <bew@users.noreply.github.com>
Co-authored-by: Jongwook Choi <wookayin@gmail.com>
2024-01-18 00:14:48 -08:00
Christian Clason
11e8e14628 vim-patch:46d67d22b9ba
runtime(swayconfig): add focus_follows_mouse and smart_qaps syntax keywords

See:
0aceff7469/sway/sway.5.scd (L680)
`focus_follows_mouse yes|no|always`
0aceff7469/sway/sway.5.scd (L770)

closes: vim/vim#13797

46d67d22b9

Co-authored-by: James Eapen <james.eapen@vai.org>
2024-01-18 08:42:00 +01:00
Christian Clason
9b0b3cdc7a vim-patch:a39af0290496
runtime(i3config): remove always from `focus_follows_mouse`

The always option does not exist in i3, only sway.

From https://i3wm.org/docs/userguide.html:
`focus_follows_mouse yes|no`

Version number incremented by 2 because the last commit did not
increment the version.

a39af02904

Co-authored-by: James Eapen <james.eapen@vai.org>
2024-01-18 08:42:00 +01:00
Christian Clason
223a6afd8f vim-patch:6e5a6c9965f6
runtime(netrw): minor changes to fix move cmd on windows (vim/vim#13823)

6e5a6c9965

Co-authored-by: MiguelBarro <45819833+MiguelBarro@users.noreply.github.com>
2024-01-18 08:42:00 +01:00
zeertzjq
780dd88b68
vim-patch:9.1.0039: too vague errors for 'listchars'/'fillchars' (#27070)
Problem:  too vague errors for 'listchars'/'fillchars'
Solution: Include the field name in error message.
          (zeertzjq)

related: #27050
closes: vim/vim#13877

6a8d2e1634

Co-authored-by: Cole Frankenhoff <cole.nhf@gmail.com>
2024-01-18 07:14:12 +08:00
altermo
5aa14e1231
fix(lua): return after assert returns assert message (#27064) 2024-01-17 13:34:25 -06:00
Sean Dewar
f5d59340a6
vim-patch:9b03d3e75b42 (#27059)
Translate the Vim9 script Godot files to legacy.

`<scriptcmd>` is not ported yet, so replace it with `<Cmd>` and `<SID>`.
If it's ported, `<scriptcmd>call s:` can be used instead.

Includes changes from:

vim-patch:0daafaa7d99e (was partial, but is now pretty much fully ported)
vim-patch:9712ff1288f9

Co-authored-by: Maxim Kim <habamax@gmail.com>
2024-01-17 14:47:40 +00:00
Lewis Russell
14b7ffcf89 feat: add __call typing for vim.inspect() 2024-01-17 10:11:32 +00:00
dundargoc
b3e5587b7f
docs: various fixes (#26929)
Co-authored-by: Patrick Bollinger <owner@pjbollinger.com>
Co-authored-by: vilo1839 <139687192+vilo1839@users.noreply.github.com>
2024-01-17 14:01:39 +08:00
Sean Dewar
aa5819f5a5
vim-patch:211211052d04 (#27048)
runtime(odin): include ftplugin, syntax and indent script (vim/vim#13867)

211211052d

Translate the files from Vim9 script to legacy Vim script. Notably:

- Prefer case-matching comparisons where needed.
- Save and restore `&cpo`.
- Make the functions script-local. (Pretty easy to use these in expr options now
  since Vim 9.0 anyways)

Add a note after the header for each file stating that they're manually
translated.

Co-authored-by: Maxim Kim <habamax@gmail.com>
2024-01-16 23:08:41 +00:00
Jongwook Choi
3973a5e405 refactor(lsp): deprecate vim.lsp.util.lookup_section
This function is used only in the `workspace/configuration` handler,
and does not warrant a public API because of its confusing return types.

The only caller `vim.lsp.handlers["workspace.configuration"]` is also
refactored to use `vim.tbl_get()` instead.
2024-01-16 20:14:17 +00:00
Sean Dewar
91dc04a5e1
vim-patch:9.1.0013: Modula2 filetype support lacking (#27020)
Problem:  Modula2 filetype support lacking
Solution: Improve the Modula-2 runtime support, add additional modula2
          dialects, add compiler plugin, update syntax highlighting,
          include syntax tests, update Makefiles (Doug Kearns)

closes: vim/vim#6796
closes: vim/vim#8115

68a8947069

- Luaify the detection script:

  - Split the `(*!m2foo*)` and `(*!m2foo+bar*)` detection into two Lua patterns,
    as Lua capture groups cannot be used with `?` and friends (as they only work
    on character classes).

  - Use `vim.api.nvim_buf_call()` (ew) to call `modula2#SetDialect()` to ensure
    `b:modula2` is set for the given bufnr.

- Skip the syntax screendump tests. (A shame as they test some of the detection
  from `(*!m2foo+bar*)` tags, but I tested this locally and it seems to work)

- Port the synmenu.vim changes from Vim9 script. (Also tested this locally)

- (And also add the missing comma for `b:browsefilter` from earlier.)

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2024-01-16 17:45:57 +00:00
Luuk van Baal
463cb28a22 docs(column): 'statuscolumn' redraw interaction with 'relativenumber' 2024-01-16 12:14:00 +01:00