Commit Graph

1295 Commits

Author SHA1 Message Date
lvimuser
0773a9ee3a
feat(lsp): support window/showDocument (#19977) 2022-10-08 10:22:25 +02:00
Folke Lemaitre
1da7b4eb69 feat: added support for specifying types for lua2dox 2022-10-06 15:42:21 +01:00
Folke Lemaitre
24a1c7f556 feat: added support for optional params to lua2dox 2022-10-06 15:38:28 +01:00
Folke Lemaitre
c8d1b9a2d6 docs: added proper annotations to functions in shared.lua 2022-10-06 15:38:27 +01:00
Elizabeth Paź
548a4e2587 docs(docstrings): fix runtime type annotations 2022-10-05 15:25:03 +02:00
August Masquelier
b075f49d92
feat(lsp): add bufnr option to lsp.start (#20473) 2022-10-04 20:44:19 +02:00
Raphael
a5e347ce1d
refactor(diagnostic): remove deprecated function (#20423) 2022-10-01 09:36:11 -06:00
Mathias Fußenegger
e54541f7f9
refactor(lsp): remove deprecated lsp functions (#20421) 2022-10-01 11:35:36 +02:00
dundargoc
df646572c5
docs: fix typos (#20394)
Co-authored-by: Raphael <glephunter@gmail.com>
Co-authored-by: smjonas <jonas.strittmatter@gmx.de>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2022-09-30 09:53:52 +02:00
Jonas Strittmatter
33dd917d7f
fix(filetype): add missing return to changelog detection function (#20403) 2022-09-29 16:26:19 +02:00
Sergey Berezhnoy
94718e479d
fix(query): fix unnatural order for inherits in treesitter queries (#20298)
close #20297
2022-09-29 16:25:07 +02:00
Justin M. Keyes
16336c486e feat(gen_help_html.lua): adapt to new parser
- adapt to parser changes from https://github.com/vigoux/tree-sitter-vimdoc/pull/16
- numerous other generator improvements
2022-09-28 18:34:20 +02:00
ObserverOfTime
f46060c4cb
vim-patch:9.0.0604: luacheckrc file is not recognized (#20371)
Problem:    Luacheckrc file is not recognized.
Solution:   Use lua filetype for luacheckrc. (closes vim/vim#11236)
49c311c9b1
2022-09-27 16:10:19 +02:00
Christian Clason
fe0727a1bf vim-patch:9.0.0602: new TypeScript extensions are not recognized
Problem:    New TypeScript extensions are not recognized.
Solution:   Recognize .mts and .cts files. (closes vim/vim#11237)
7fc6c0e4da
2022-09-27 13:04:34 +02:00
Christian Clason
e176f9dacf vim-patch:9.0.0600: GYP files are not recognized
Problem:    GYP files are not recognized.
Solution:   Recognize GYP files. (closes vim/vim#11242)
d324742292
2022-09-27 12:39:09 +02:00
Christian Clason
760a8754c0 vim-patch:9.0.0599: latexmkrc files are not recognized
Problem:    Latexmkrc files are not recognized.
Solution:   Use Perl filetype for latexmkrc files. (closes vim/vim#11241)
cde0319385
2022-09-27 12:37:44 +02:00
Justin M. Keyes
63be765182
fix(docs): invalid :help links #20345
Fix those naughty single quotes.

closes #20159
2022-09-25 16:58:27 -07:00
Justin M. Keyes
4686bda06c
Merge #20331 refactor(treesitter)!: rename x_position => x_pos 2022-09-25 08:37:05 -04:00
Christian Clason
2a5692c646
vim-patch:9.0.0583: only recognizing .m3u8 files is inconsistent (#20342)
Problem:    Only recognizing .m3u8 files is inconsistent.
Solution:   Also matc .m3u files. (issue vim/vim#11204)
b9725bc7f6
2022-09-25 13:59:11 +02:00
Justin M. Keyes
3169fc54a1 refactor(treesitter): rename x_position => x_pos
"pos" has a long precedent as "position" in vim, and there is no reason
to use a verbose name here.
2022-09-25 13:46:15 +02:00
Christian Clason
f8b656c582
vim-patch:9.0.0566: Nim files are not recognized (#20317)
Problem:    Nim files are not recognized.
Solution:   Add patterns for Nim files. (Nbiba Bedis, closes vim/vim#11205)
9fd1583c83
2022-09-24 12:59:37 +02:00
shaunsingh
caf5738fa9
fix(lsp): create missing directory before creating file (#19835)
Co-authored-by: Mathias Fussenegger <f.mathias@zignar.net>
2022-09-24 12:46:21 +02:00
Christian Clason
24b5449b3d
vim-patch:9.0.0562: HSL playlist files are not recognized (#20307)
Problem:    HSL playlist files are not recognized.
Solution:   Add a pattern to recognize HSL palylist files. (Benoît Ryder,
            closes vim/vim#11204)
35fdd9a67d
2022-09-24 10:16:30 +02:00
Mike
14610332b2
fix(lsp): use correct function name in deprecated message (#20308)
fix: use correct function name in deprecated message
2022-09-23 19:20:56 -06:00
Lewis Russell
679f3072f6
Merge pull request #20103 from lewis6991/refactor/vim_opt 2022-09-22 13:59:04 +01:00
Jonas Strittmatter
b4b05f160d
feat(filetype): expand environment variables in filetype patterns (#20145) 2022-09-21 15:58:57 -06:00
ofwinterpassed
ec94014cd1
fix(lsp): out of bounds error in lsp.util.apply_text_edits (#20137)
Co-authored-by: Jonas Strittmatter <40792180+smjonas@users.noreply.github.com>
2022-09-20 22:14:58 +02:00
Christian Clason
ae30e388de
vim-patch:9.0.0510: Chatito files are not recognized (#20260)
Problem:    Chatito files are not recognized.
Solution:   Add a pattern for Chatito files. (closes vim/vim#11174)
7c046ae99b
2022-09-20 14:10:00 +02:00
Lewis Russell
abe2d90693
feat(lua): move compat module from runtime to test (#20257) 2022-09-20 11:15:32 +01:00
Lewis Russell
e762158305
docs(lua): opts in vim.keymap.{set,del} can be optional (#20255) 2022-09-20 10:42:45 +01:00
Mathias Fußenegger
10196f1b46
fix(lsp): support false result in handlers (#20252)
Closes https://github.com/neovim/neovim/issues/20111
2022-09-20 09:28:23 +02:00
Christian Clason
8dc61713d9
vim-patch:9.0.0497: LyRiCs files are not recognized (#20239)
Problem:    LyRiCs files are not recognized.
Solution:   Add a pattern to detect LyRiCs files. (closes vim/vim#11155)
65ee49decf
2022-09-18 14:16:24 +02:00
Christian Clason
e512d3ecf2
vim-patch:9.0.0479: in :def function all closures in loop get the sam… (#20220)
vim-patch:9.0.0479: in :def function all closures in loop get the same variables

Problem:    In a :def function all closures in a loop get the same variables.
Solution:   Use a separate list of variables for LOADOUTER and SAVEOUTER.
1aea184a0d

(note: patch description is wrong)
2022-09-16 17:52:08 +02:00
Christian Clason
9ec4b20be6
fix(treesitter): return full metadata for get_captures_at_position (#20203)
fix(treesitter): get_captures_at_position returns metadata

Return the full `metadata` table for the capture instead of just the
priority.

Further cleanup of related docs.
2022-09-16 09:05:05 +02:00
Gregory Anders
982fef6018
fix(diagnostic): populate data key in DiagnosticChanged autocmd in reset (#20207)
Follow up to #20173.
2022-09-15 11:03:07 -06:00
Christian Clason
ddb762f401
docs(treesitter): clean up and update treesitter.txt (#20142)
* add type annotations to code
* clean up and expand static documentation
* consistent use of tags for static and generated docs
2022-09-14 11:08:31 +02:00
Mathias Fußenegger
a8c9e721d9
feat(fs): extend fs.find to accept predicate (#20193)
Makes it possible to use `vim.fs.find` to find files where only a
substring is known.
This is useful for `vim.lsp.start` to get the `root_dir` for languages
where the project-file is only known by its extension, not by the full
name.
For example in .NET projects there is usually a `<projectname>.csproj`
file in the project root.

Example:

    vim.fs.find(function(x) return vim.endswith(x, '.csproj') end, { upward = true })
2022-09-13 14:16:20 -06:00
Gregory Anders
1970d2ac43
feat(diagnostic): pass diagnostics as data to DiagnosticChanged autocmd (#20173) 2022-09-13 08:33:39 -06:00
Christian Clason
fd70e2bff2
Merge pull request #20141 from vigoux/ts-self-inherits
fix(treesitter): prevent endless loop on self-inheritence

docs(treesitter): suggest using extends to extend queries
2022-09-12 17:35:49 +02:00
Christian Clason
afe01842ef
vim-patch:9.0.0448: SubRip files are not recognized (#20167)
Problem:    SubRip files are not recognized.
Solution:   Add a pattern for SubRip. (closes vim/vim#11113)
5a4eb55122
2022-09-12 15:12:39 +02:00
Christian Clason
f98cff9575
vim-patch:9.0.0443: blueprint files are not recognized (#20155)
Problem:    Blueprint files are not recognized.
Solution:   Add a pattern for blueprint files. (Gabriele Musco, closes vim/vim#11107)
cce82a55b8
2022-09-11 16:07:54 +02:00
Thomas Vigouroux
1939518eba
fix(treesitter): prevent endless loop on self-inheritence
Fixes #20139
2022-09-11 08:16:50 +02:00
Gregory Anders
9b4cab0126
fix(lsp): schedule removal of client object (#20148)
The execution of the LspDetach autocommands in the LSP client's on_exit
function are scheduled on the event loop to avoid making API calls in a
fast context; however, this means that by the time the LspDetach
autocommands finally run the client object has already been deleted.

To address this, we also schedule the deletion of the client on the
event loop so that it is guaranteed to occur after all of the LspDetach
autocommands have fired.
2022-09-10 18:56:29 -06:00
Christian Clason
40f9f479b7
vim-patch:9.0.0434: gitignore files are not recognized (#20143)
Problem:    gitignore files are not recognized.
Solution:   Add patterns for the gitignore filetype. (closes vim/vim#11102)
9ba2786f15
2022-09-10 13:30:54 +02:00
Christian Clason
9b0e1256e2
vim-patch:9.0.0427: Drupal theme files are not recognized (#20138)
Problem:    Drupal theme files are not recognized.
Solution:   Use php filetype for Drupl theme files.  Remove trailing spaces.
            (Rodrigo Aguilera, closes vim/vim#11096)
8995c4cd4e
2022-09-09 18:48:12 +02:00
Christian Clason
ad2d6a624b
vim-patch:9.0.0424: gitattributes files are not recognized (#20134)
Problem:    gitattributes files are not recognized.
Solution:   Add patterns to match gitattributes files. (closes vim/vim#11085)
7d56cfc861
2022-09-09 17:53:15 +02:00
Lewis Russell
038c711539 refactor(vim.opt): de-nest code 2022-09-09 12:38:15 +01:00
Lewis Russell
9272d20ea4 refactor(vim.opt): use local function syntax 2022-09-09 12:38:15 +01:00
Lewis Russell
ad972990ad refactor(vim.opt): optimize append/prepend/remove 2022-09-09 12:38:15 +01:00
Lewis Russell
b364bc2c34 refactor(vim.opt): dry up and tidy 2022-09-09 12:38:10 +01:00
Lewis Russell
925a811990 refactor(vim.opt): remove value_mutator() 2022-09-09 09:54:54 +01:00
Lewis Russell
7533ceec13 refactor(vim.opt): unify vim.bo/wo building 2022-09-09 09:54:53 +01:00
Mathias Fußenegger
19a3b2c26e
docs(lsp): update rpc.start stdio limitations (#20120) 2022-09-08 10:25:16 -07:00
Lewis Russell
164752b380 refactor(vim.opt): remove make_meta_accessor() 2022-09-08 17:24:17 +01:00
Raphael
30ca6d23a9
fix(lsp): when buffer detach remove buffer from client attached buffers (#20081)
Co-authored-by: Mathias Fussenegger <f.mathias@zignar.net>
2022-09-08 17:09:32 +02:00
Lewis Russell
514a1679dc refactor(vim.opt): simplify get_option_metatype 2022-09-08 15:44:00 +01:00
Lewis Russell
b8de5ada80 refactor(vim.opt): replace _setup with lazy table 2022-09-08 15:42:17 +01:00
Lewis Russell
f21e2a51ba refactor(vim.opt): remove enums 2022-09-08 15:32:26 +01:00
Lewis Russell
bc88691dbd refactor(vim.opt): remove del arg 2022-09-08 15:32:26 +01:00
Christian Clason
08602ec1ab
vim-patch:9.0.0417: Jsonnet files are not recognized (#20119)
Problem:    Jsonnet files are not recognized.
Solution:   Add a pattern for Jsonnet files. (Cezary Drożak, closes vim/vim#11073,
            closes vim/vim#11081)
2a4c885d54
2022-09-08 16:06:00 +02:00
Mathias Fußenegger
11167ab6d5
feat(lsp): add range option to lsp.buf.format (#19998) 2022-09-08 11:33:04 +02:00
Christian Clason
8c59d7e6a7
Merge pull request #20093 from neovim/upstream-ts-util
* feat(treesitter): upstream get_{node,captures} utility functions
* refactor(treesitter): get_{nodes,captures}_at_{position,cursor}
2022-09-08 11:23:26 +02:00
bfredl
893b659e88
fix(treesitter): use the right loading order for base queries (#20117)
Use the first, not last, query for a language on runtimepath. Typically,
this implies that a user query will override a site plugin query, which 
will override a bundled runtime query.
2022-09-08 11:17:29 +02:00
Thomas Vigouroux
0405594399
feat(treesitter)!: do not merge queries by default (#20105)
Problem: Treesitter queries for a given language in runtime were merged together, 
leading to errors if they targeted different parser versions (e.g., bundled viml queries 
and those shipped by nvim-treesitter).
Solution:  Runtime queries now work as follows:
* The last query in the rtp without `; extends` in the header will be used as the base query
* All queries (without a specific order) with `; extends` are concatenated with the base query

BREAKING CHANGE: queries need to be updated if they are meant to extend other queries
2022-09-08 09:47:36 +02:00
zeertzjq
99e6e0f221 docs(treesitter): fix doxygen 2022-09-08 12:54:41 +08:00
ii14
4dc4cf3467
fix(options): mark winhighlight as list style (#19477)
Also add missing fcs, lcs and winhighlight to list of key-value options for `vim.opt`.

Co-authored-by: ii14 <ii14@users.noreply.github.com>
2022-09-07 17:59:27 +02:00
Christian Clason
9d1d3a6707
vim-patch:9.0.0402: javascript module files are not recoginzed (#20108)
Problem:    Javascript module files are not recoginzed.
Solution:   Recognize "*.jsm" files as Javascript. (Brett Holman,
            closes vim/vim#11069)
bb6c4073e7
2022-09-07 15:55:39 +02:00
Thomas Vigouroux
fd1595514b
Use weak tables in tree-sitter code (#17117)
feat(treesitter): use weak tables when possible

Also add the defaulttable function to create a table whose values are created when a key is missing.
2022-09-07 08:39:56 +02:00
Sean Dewar
f32fd19f1e
fix(diagnostic): remove buf from cache on BufWipeout (#20099)
Doing so on `BufDelete` has issues:
  - `BufDelete` is also fired for listed buffers that are made unlisted.
  - `BufDelete` is not fired for unlisted buffers that are deleted.

This means that diagnostics will be lost for a buffer that becomes unlisted.

It also means that if an entry exists for an unlisted buffer, deleting that
buffer later will not remove its entry from the cache (and you may see "Invalid
buffer id" errors when using diagnostic functions if it was wiped).

Instead, remove a buffer from the cache if it is wiped out.
This means simply `:bd`ing a buffer will not clear its diagnostics now.
2022-09-06 20:55:03 -06:00
Lewis Russell
707edfc9e6
fix(ts): do not clobber spelloptions (#20095) 2022-09-06 19:22:05 +01:00
Christian Clason
d01cadd82f fix(treesitter): don't support legacy syntax in start() 2022-09-06 17:33:44 +02:00
Thomas Vigouroux
75adfefc85 feat(extmarks,ts,spell): full support for spelling
- Added 'spell' option to extmarks:

  Extmarks with this set will have the region spellchecked.

- Added 'noplainbuffer' option to 'spelloptions':

  This is used to tell Neovim not to spellcheck the buffer. The old
  behaviour was to spell check the whole buffer unless :syntax was set.

- Added spelling support to the treesitter highlighter:

  @spell captures in highlights.scm are used to define regions which
  should be spell checked.

- Added support for navigating spell errors for extmarks:

  Works for both ephemeral and static extmarks

- Added '_on_spell_nav' callback for decoration providers:

  Since ephemeral callbacks are only drawn for the visible screen,
  providers must implement this callback to instruct Neovim which
  regions in the buffer need can be spell checked.

  The callback takes a start position and an end position.

  Note: this callback is subject to change hence the _ prefix.

- Added spell captures for built-in support languages

Co-authored-by: Lewis Russell <lewis6991@gmail.com>
Co-authored-by: Björn Linse <bjorn.linse@gmail.com>
2022-09-06 10:14:11 +01:00
Christian Clason
95fd1ad83e refactor(treesitter): get_{nodes,captures}_at_{position,cursor} 2022-09-06 10:15:23 +02:00
Quentin Rasmont
ffe98531b9 feat(treesitter): upstream get_node_at_cursor()
Util from the nvim-treesitter project.
2022-09-06 10:14:05 +02:00
Christian Clason
0822896efc feat(treesitter): add vim.treesitter.start(), enable for Lua
* Add vim.treesitter.start() for starting treesitter highlighting via
  ftplugin or autocommand (can be extended later for fold, indent,
  matchpairs, ...)
* Add vim.treesitter.stop() for manually stopping treesitter
  highlighting
* Enable treesitter highlighting for Lua if
  `vim.g.ts_highlight_lua = true` is set in `init.lua`
2022-09-06 08:08:29 +02:00
Jonas Strittmatter
ce80b8f50d
vim-patch:9.0.0349: filetype of *.sil files not well detected (#20050)
Problem:    Filetype of *.sil files not well detected.
Solution:   Inspect the file contents to guess the filetype.
be807d5824
2022-09-02 08:16:17 +02:00
Christian Clason
6b7eed1884
Vim 9.0.{0314,0319}: some filetypes are not recognized (#20005)
* vim-patch:9.0.0314: VDM files are not recognized

Problem:    VDM files are not recognized.
Solution:   Add patterns for VDM files. (Alessandro Pezzoni, closes vim/vim#11004)
bf26941f40

* vim-patch:9.0.0319: Godot shader files are not recognized

Problem:    Godot shader files are not recognized.
Solution:   Add patterns for "gdshader". (Maxim Kim, closes vim/vim#11006)
d5c8f11905
2022-08-30 21:16:03 +02:00
Mathias Fußenegger
981ae83fad
fix(docs): update lsp.rpc.start docs to match return value changes (#20003)
Follow up to https://github.com/neovim/neovim/pull/19916
2022-08-30 13:14:27 +02:00
Raphael
efacb6e974
fix(lsp): clean the diagnostic cache when buffer delete (#19449)
Co-authored-by: Gregory Anders <greg@gpanders.com>
2022-08-29 19:09:14 +02:00
Mathias Fussenegger
60ec6e34d5 feat(lsp): add tcp support 2022-08-28 14:07:53 +02:00
Mathias Fussenegger
46bb34e26b refactor(lsp): extract rpc client from rpc.start
Makes the previously inner functions re-usable for a TCP client
2022-08-28 14:07:53 +02:00
Mathias Fussenegger
7d3e4aee6a refactor(lsp): encapsulate rpc uv handle
To prepare for different transports like TCP where the handle won't have
a kill method.
2022-08-28 14:07:53 +02:00
Mathias Fussenegger
f9641d1ac6 refactor(lsp): factor out read_loop function 2022-08-28 14:07:53 +02:00
bfredl
b04ef7f6b9 fix(treesitter): make it get_captures_at_position 2022-08-26 13:57:31 +02:00
Quentin Rasmont
064ecb9ec5 feat(treesitter): upstream get_hl_groups_at_position()
Util from the nvim-treesitter project.
2022-08-26 13:57:31 +02:00
bfredl
030b422d1e feat(treesitter)!: use @foo.bar style highlight groups
This removes the support for defining links via
vim.treesitter.highlighter.hl_map (never documented, but plugins did
anyway), or the uppercase-only `@FooGroup.Bar` to `FooGroup` rule.

The fallback is now strictly `@foo.bar.lang` to `@foo.bar` to `@foo`,
and casing is irrelevant (as it already was outside of treesitter)

For compatibility, define default links to builting syntax groups
as defined by pre-existing color schemes
2022-08-26 13:57:31 +02:00
Quentin Rasmont
244a115e49 feat(treesitter): clarify similar 'get_node_range' functions
The private 'get_node_range' function from the languagetree module has
been renamed and remains private as it serve a purpose that is only
relevant inside the languagetree module.

The 'get_node_range' upstreamed from nvim-treesitter in the treesitter
module has been made public as it is in itself a utlity function.
2022-08-25 18:01:15 +02:00
Quentin Rasmont
133ff6e11e feat(treesitter): upstream node_contains()
Util from the nvim-treesitter project.
2022-08-25 18:01:15 +02:00
Quentin Rasmont
6b2d42eb03 feat(treesitter): add ability to retreive a tree/node given a range 2022-08-25 18:01:14 +02:00
Quentin Rasmont
733b2e12b8 feat(treesitter): add opts.concat to query.get_text_node
As part of the upstream of utility functions from nvim-treesitter, this
option when set to false allows to return a table (downstream behavior).
Effectively making the switch from the downstream to the upstream
function much easier.
2022-08-25 18:01:14 +02:00
Quentin Rasmont
3aba4ba378 feat(treesitter): upstream is_parent()
Util from the nvim-treesitter project.
Renamed is_parent to is_ancestor for clarity.
2022-08-25 18:01:14 +02:00
Thomas Vigouroux
9be4bfc5f4
Merge pull request #19496 from vigoux/ts_internal_lang
feat(treesitter): allow customizing language symbol name
2022-08-24 15:36:58 +02:00
Simon Wachter
e892b7b383
fix(inspect): escape identifiers that are lua keywords (#19898)
A lua keyword is not a valid table identifier
2022-08-23 13:02:55 +02:00
Thomas Vigouroux
3c1d70f20b
feat(treesitter): allow customizing language symbol name 2022-08-22 15:34:10 +02:00
Christian Clason
b2f979b30b
fix(filetype): only check first 100 and last line of buffer (#19819)
fix(filetype): only pass first 100 and last lines to contents check

sufficient for current content checks and avoids performance issues for
buffers with a large number of lines

fixes #19817
2022-08-19 19:30:35 +02:00
Mathias Fußenegger
341ef46d00
docs(lsp): remove lsp.buf_request from docs (#19738)
This starts a soft phase-out of `buf_request`.

`buf_request` is quite error prone:

- Positional `params` depend on the client because of the
  `offset_encoding`. Currently if there is one client using UTF-8 offset
  encoding and another using UTF-16, the positions in the request are
  wrong for one of the clients. To solve this the params would need to
  be created per client instead of once for all of them.

- `handler` is called *per* client but many users of it assume it is
  only called once.

  This can lead to a "select n + 1"
  kind of problem, where the handler makes another call to `buf_request`,
  multiplying the amount of requests.
  (There are in fact still some places where this happens in core)

  Or it leads to erratic behavior if called multiple times (E.g. the
  quicklist list flickering & being overwritten)
  (See hover or references implementation)

  `buf_request_all` returns an aggregate of the responses which is more
  sensible as it avoids this problem.

  For off-spec extensions it also has the problem that it sends requests to
  clients which cannot handle a given request.

Given that `buf_request` is in use by a lot of plugins this starts a
soft-phase out. Planned Steps:

- Remove from docs
- Provide an alternative, either `buf_request_all`, maybe with
  extensions (params being a function), or an entirely new method.
- Mark as deprecated in 0.9
- Remove in 0.10

To note:

- `buf_request_all` currently isn't ideal either because it suffers from
the `params` problem as well.

- This implies that the `vim.lsp.with` pattern will die, because the
  global handlers as they are don't fit a multi-client model, as most of
  the time an aggregate is needed.
2022-08-18 10:57:17 +02:00
Jonas Strittmatter
7a076306e4
docs(lsp): rename on-list-handler to lsp-on-list-handler (#19813)
This makes it easier to find documentation about the on-list-handler
when starting the search term with "lsp".
2022-08-17 12:39:38 +02:00
Antoine Cotten
5854103dad
docs(lua): clarify vim.keymap.set() opts (#19761) 2022-08-14 06:38:31 +08:00
Christian Clason
33b49d5f55
vim-patch:9.0.0197: astro files are not detected (#19755)
Problem:    Astro files are not detected.
Solution:   Add a pattern to match Astro files. (Emilia Zapata, closes vim/vim#10904)
6a76e84f55
2022-08-13 15:11:03 +02:00
Christian Clason
a850b15e19
vim-patch:9.0.0195: metafun files are not recogized (#19746)
Problem:    Metafun files are not recogized.
Solution:   Add filetype detection patterns.
9032b9ceb6
2022-08-13 10:26:12 +02:00
Mathias Fußenegger
02289ab898
fix(lsp): fix nil value error in get_group (#19735)
`server_capabilities` can be nil until the server is initialized.
Reproduced with:

    vim.lsp.stop_client(vim.lsp.start_client {
      cmd = { vim.v.progpath, '-es', '-u', 'NONE', '--headless' };
    })
2022-08-12 10:10:03 +02:00
Mathias Fußenegger
33b77eb728
fix(lsp): handle nil client in onexit callback (#19722)
Follow up to https://github.com/neovim/neovim/pull/19658
2022-08-11 19:21:57 +02:00
Mathias Fußenegger
996fc2256b
fix(lsp): avoid pipe leaks if lsp cmd isn't executable (#19717)
The `onexit` handler isn't called if `uv.spawn` doesn't return a handle.
2022-08-11 17:04:55 +02:00
Mathias Fußenegger
8b67f37798
fix(lsp): fix some type annotations in lsp.rpc (#19714) 2022-08-11 15:17:05 +02:00
Jonas Strittmatter
ff1266aaaa
vim-patch:9.0.0182: quarto files are not recognized (#19702)
Problem:    Quarto files are not recognized.
Solution:   Recognize quarto files by the extension. (Jonas Strittmatter,
            closes vim/vim#10880)
3a9687fb27
2022-08-10 13:44:57 +02:00
Mathias Fußenegger
bebfbfab3b
fix(lsp): handle multiple clients with incremental sync (#19658)
The change tracking used a single lines/lines_tmp table to track
changes to a buffer.

If multiple clients using incremental sync are connected to a buffer,
they both made changes to the same lines table. That resulted in an
inconsistent state.

This commit changes the didChange handling to group clients by
synchronization scheme and offset encoding.
This avoids computing the diff multiple times for clients using the
same scheme and resolves the lines/lines_tmp conflicts.

Fixes https://github.com/neovim/neovim/issues/19325
2022-08-09 22:20:40 +02:00
Christian Clason
a5e846b996
vim-patch:partial: 48c3f4e0bff7 (#19684)
vim-patch:partial:48c3f4e0bff7

Update runtime files
48c3f4e0bf

partially skip `options.txt` (needs 9.0.0138)
2022-08-09 10:43:28 +02:00
dundargoc
e6680ea7c3
docs(lua): add Lua 5.1 reference manual (#19663)
based on http://www.vim.org/scripts/script.php?script_id=1291
reformatted to match Nvim documentation style; removed irrelevant sections

Co-authored-by: dundargoc <gocundar@gmail.com>
Co-authored-by: Christian Clason <c.clason@uni-graz.at>
Co-authored-by: Lewis Russell <lewis6991@gmail.com>
2022-08-08 18:58:32 +02:00
Mathias Fußenegger
68c674af0f
feat(lsp): set formatexpr by default (#19677)
Follow up to https://github.com/neovim/neovim/pull/19003
2022-08-08 18:30:17 +02:00
Mathias Fußenegger
a46e6afb8b
fix(lsp): set end_col in formatexpr (#19676)
The last line was excluded from formatting via formatexpr because the
character in the params was set to 0 instead of the end of line.
2022-08-08 13:02:15 +02:00
Mathias Fußenegger
2d5fce2cdb
feat(lsp): disable exit_timeout by default (#19672)
The lsp client used to wait up to 500ms for a language server to
shutdown before sending a TERM signal.

The intention behind the 500ms grace period was to ensure the language
server exits to prevent stale processes, but it has the side-effect that
it can interrupt language-servers which are too slow to shutdown within
500ms. Language servers tend to write out index files or project files
on shutdown, and being interrupted during this process can cause
corruption of those files.

This changes the default to not wait at all, at the risk of leaving
stale processes around if the language server isn't well behaved.

An alternative would be to wait indefinitely, but that can cause neovim
to take several seconds to exit.
2022-08-08 12:34:37 +02:00
Cai.MY
85ad0e6b43
fix(lsp): avoid ^M character in hover window on Windows (#19640) 2022-08-05 15:23:01 +02:00
rhcher
7c997dbc5d
fix(lsp): prevent unexpected position jumps (#19370) 2022-08-03 21:44:33 +02:00
dundargoc
b8dcbcc732
docs: fix typos (#19588)
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: notomo <notomo.motono@gmail.com>
2022-08-03 09:47:16 +08:00
zeertzjq
0a049c322f
test: improve mapping tests and docs (#19619) 2022-08-02 11:13:22 +08:00
Mathias Fußenegger
e99de3f12f
fix(lsp): send didOpen if name changes on write (#19583)
`:saveas newName` changes the name of an existing buffer.
Due to the buffer re-use it skips the lsp attach phase and immediately
sends a `didSave` notification to the server.
Servers get confused about this, because they expect a `didOpen`
notification first.

Closes https://github.com/neovim/neovim/issues/18688
2022-08-01 22:32:53 +02:00
ii14
db6e93c48d
feat(api): add replace_keycodes to nvim_set_keymap (#19598) 2022-08-01 21:35:08 +08:00
LaurenceWarne
9f5d5aa3da
Use Strings instead of Tables in vim.filetype.matchregex Doc (#19604)
docs: use strings instead of tables in vim.filetype.matchregex doc
2022-08-01 06:45:43 -06:00
dundargoc
abc087f4c6
docs: fix typos (#19024)
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: Valery Viktorovsky <viktorovsky@gmail.com>
2022-07-31 16:46:38 +08:00
Mathias Fußenegger
b25abbf4b8
docs(lsp): use direct link to formattingOptions in format docs (#19558)
Also changes `@see` to `See` to avoid the break to a dedicated "See
also" block in the generated vimdoc
2022-07-28 19:41:30 +02:00
Mathias Fußenegger
98915f88b2
feat(lsp): add range option to code_action; deprecate range_code_action (#19551)
`code_action` gained extra functions (`filter` and `apply`) which
`range_code_action` didn't have.

To close this gap, this adds a `range` option to `code_action` and
deprecates `range_code_action`.

The option defaults to the current selection if in visual mode.
This allows users to setup a mapping like `vim.keymap.set({'v', 'n'},
'<a-CR>', vim.lsp.buf.code_action)`

`range_code_action` used to use the `<` and `>` markers to get the
_last_ selection which required using a `<Esc><Cmd>lua
vim.lsp.buf.range_code_action()<CR>` (note the `<ESC>`) mapping.
2022-07-28 19:19:07 +02:00
Mathias Fußenegger
f5d558c8ea
feat(lsp): provide feedback if server can't compute rename result (#19546)
Without some form of feedback a user cannot easily tell if the server is
still computing the result (which can take a while in large projects),
or whether the server couldn't compute the rename result.
2022-07-27 18:56:27 +02:00
Mathias Fußenegger
888f12858a
fix(lsp): set workspace.configuration capability (#19548)
Neovim implements `workspace/configuration`
It should set the capability accordingly.

From https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#clientCapabilities:

    /**
     * The client supports `workspace/configuration` requests.
     *
     * @since 3.6.0
     */
    configuration?: boolean;
2022-07-27 18:55:44 +02:00
Christian Clason
4c3104819b
vim-patch:9.0.0093: sway config files are recognized as i3config (#19545)
Problem:    Sway config files are recognized as i3config.
Solution:   Recognize swayconfig separately. (James Eapen, closes vim/vim#10672)
7abd1c6d8e
2022-07-27 18:11:59 +02:00
Gregory Anders
9b447c7ce5
vim-patch:9.0.0088: pattern for detecting bitbake files is not sufficient (#19547)
Problem:    Pattern for detecting bitbake files is not sufficient.
Solution:   Adjust the pattern. (Gregory Anders, closes vim/vim#10743)
30e212dac1
2022-07-27 10:06:09 -06:00
Christian Clason
7e939ddb87
vim-patch:9.0.0084: using "terraform" filetype for .tfvars file is bad (#19526)
Problem:    Using "terraform" filetype for .tfvars file is bad.
Solution:   use "terraform-vars", so that different completion and other
            mechanisms can be used. (Radek Simko, closes vim/vim#10755)
15b87b6610
2022-07-26 23:08:48 +02:00
Christian Clason
2a9c9371bc
vim-patch:9.0.0073: too many files recognized as bsdl (#19504)
Problem:    Too many files recognized as bsdl.
Solution:   Use pattern "*.bsd" instead of "*bsd". (Martin Tournoij,
            closes vim/vim#10783)
1b67f07f76
2022-07-26 14:16:46 +02:00
Dalius Dobravolskas
3ded2ab55a
feat(lsp): allow passing custom list handler to LSP functions that return lists (#19213)
Currently LSP allows only using loclist or quickfix list window. I
normally prefer to review all quickfix items without opening quickfix
window. This fix allows passing `on_list` option which allows full
control what to do with list.

Here is example how to use it with quick fix list:

```lua
local function on_list(options)
  vim.fn.setqflist({}, ' ', options)
  vim.api.nvim_command('cfirst')
end

local bufopts = { noremap=true, silent=true, buffer=bufnr }
vim.keymap.set('n', '<leader>ad', function() vim.lsp.buf.declaration{on_list=on_list} end, bufopts)
vim.keymap.set('n', '<leader>d', function() vim.lsp.buf.definition{on_list=on_list} end, bufopts)
vim.keymap.set('n', '<leader>ai', function() vim.lsp.buf.implementation{on_list=on_list} end, bufopts)
vim.keymap.set('n', '<leader>at', function() vim.lsp.buf.type_definition{on_list=on_list} end, bufopts)
vim.keymap.set('n', '<leader>af', function() vim.lsp.buf.references(nil, {on_list=on_list}) end, bufopts)
```

If you prefer loclist do something like this:

```lua
local function on_list(options)
  vim.fn.setloclist(0, {}, ' ', options)
  vim.api.nvim_command('lopen')
end
```

close #19182

Co-authored-by: Mathias Fußenegger <mfussenegger@users.noreply.github.com>
2022-07-25 23:02:51 +02:00
Lewis Russell
559ef3e903
feat(lua): allow vim.cmd to be indexed (#19238) 2022-07-20 12:29:24 +01:00
Javier Lopez
61302fb391
docs: fix vim.filetype.add by avoiding quotes (#19433)
* Problem

Quotes are special in doxygen, and should be escaped. *Sometimes* they
cause doc generation issues. Like in #17785

* Solution

Replace double quotes with single quotes
2022-07-19 09:12:10 -06:00
Raphael
776913e32e
fix: add group in autocmd api #19412
regression from PR #19283: custom close autocommands for the preview window were
not cleaned up after the window was closed.
2022-07-17 16:11:41 -07:00
ii14
9169fb8f07
fix(lua): double entries in :lua completion #19410
`:lua vim.ls<tab>` would list `lsp` twice.
2022-07-17 15:40:18 -07:00
ii14
13abe20b5f
refactor(lsp): use autocmd api (#19407)
* refactor(lsp): use autocmd api

* refactor(lsp): inline BufWritePost and VimLeavePre callbacks
2022-07-17 19:13:33 +02:00
Raphael
ff35d7a4b9
fix(lsp): move augroup define to if statement (#19406) 2022-07-17 19:11:05 +02:00
Gregory Anders
5ccdf6a88d
vim-patch:9.0.0055 (#19392)
vim-patch:9.0.0055: bitbake files are not detected

Problem:    Bitbake files are not detected.
Solution:   Add bitbake filetype detection by file name and contents. (Gregory
            Anders, closes vim/vim#10697)
fa49eb4827
2022-07-17 14:33:51 +02:00
matveyt
eb9b93b5e0
feat(defaults): mouse=nvi #19290
Problem:
Since right-click can now show a popup menu, we can provide messaging to
guide users who expect 'mouse' to be disabled by default. So 'mouse' can
now be enabled by default.

Solution:
Do it.
Closes #15521
2022-07-17 04:14:04 -07:00
ii14
f59c96903a refactor: use local api = vim.api 2022-07-15 18:26:47 +02:00
ii14
8bccefcb87 refactor: use npcall from vim.F 2022-07-15 17:55:00 +02:00
ii14
8a5c7e91f2 refactor(lsp): make the use of local aliases more consistent 2022-07-15 17:39:26 +02:00
Stephan Seitz
ddaef0618d
fix(treesitter): don't error when node argument of predicate is nil (#19355)
When the node mentioned in a predicate is not required for the query
then predicates putting restrictions on that node shouldn't run.

Fixes https://github.com/nvim-treesitter/nvim-treesitter/issues/2600
2022-07-14 12:18:03 +02:00
Nicolas Hillegeer
0f1b17788e
fix(lsp): account for initializing servers in vim.lsp.start (#19329)
Fixes #19326
2022-07-12 09:44:11 +02:00
Nicolas Hillegeer
034d28c705
fix(lsp): don't attach a client in lsp.start() if there is none (#19328)
vim.lsp.start_client() may fail (for example if the `cmd` is not
executable). It produces a nice error notification in this case. Passing
the `nil` value returned from an erroneous `vim.lsp.start_client()` call
into `vim.lsp.buf_attach_client()` causes a meaty param validate
exception message. Avoid this.
2022-07-11 19:37:01 -06:00
Rishikesh Vaishnav
ac10c0f418
fix(lsp): abort pending changes after flush when debouncing (#19314)
Issuing a server request triggers `changetracking.flush` so as to
make sure we're not operating on a stale state. This immediately
triggers notification of any pending changes (as a result of debouncing)
to the server. However, this happens in addition to the notification
that is waiting on the debounce delay. Because we `nil`
`buf_state.pending_change` when it is called, the fix is to
also check that this is non-`nil` when it is called and exit if it is,
as this being `nil` would mean that it originates from a pending change
that has already been flushed out.
2022-07-11 12:48:02 +02:00
Mathias Fußenegger
95c65a6b22
feat(lsp): defaults: tagfunc, omnifunc (#19003)
set `tagfunc` to `vim.lsp.tagfunc` and `omnifunc` to `vim.lsp.omnifunc` if empty when attaching a server
2022-07-10 17:26:43 +02:00
Christian Clason
2966cfe21f
fix(lsp): pcall nvim_del_augroup_by_name (#19302)
fixup for #19283
2022-07-10 11:19:26 +02:00
Christian Clason
d606c39a9c
vim-patch:9.0.0049: csv and tsv files are not recognized (#19300)
Problem:    Csv and tsv files are not recognized.
Solution:   Add patterns fo csv and tsv files. (Leandro Lourenci,
            closes vim/vim#10680)
99af91e582
2022-07-10 01:14:07 +02:00
Gregory Anders
782f726136
refactor: remove functions marked for deprecation in 0.8 (#19299) 2022-07-09 18:42:49 +02:00
Raphael
6b1a8f23d7
refactor(lua): replace vim.cmd use with API calls (#19283)
Signed-off-by: Raphael <glephunter@gmail.com>
2022-07-09 18:40:32 +02:00
Christian Clason
72877bb17d
feat(runtime)!: enable filetype.lua by default (#19216)
* revert to filetype.vim by setting `g:do_legacy_filetype`
* skip either filetype.lua or filetype.vim via `g:did_load_filetypes`

(Running both is no longer required and therefore no longer supported.)
2022-07-07 18:53:47 +02:00
Christian Clason
aa4f9c5341
refactor(lua): reformat with stylua 0.14.0 (#19264)
* reformat Lua runtime to make lint CI pass
* reduce max line length to 100
2022-07-07 18:27:18 +02:00
smjonas
f9683f2823 fix(filetype): remove call to vim.fn.resolve and pass filename to match function
For example on MacOS, /etc/hostname.file is symlinked to
/private/etc/hostname.file. We only care about the original file path though.
2022-07-06 16:25:51 +02:00
smjonas
f3c78a4465 fix(filetype): fix filetype patterns 2022-07-06 16:25:23 +02:00
smjonas
78300a1587 vim-patch:9.0.0042: missing change for filetype detection
Problem:    Missing change for filetype detection.
Solution:   Include change to detect guile from shebang line.
3244780379
2022-07-06 01:33:45 +02:00
smjonas
8b7399782e vim-patch:9.0.0041: a couple of filetype patterns do not have "*" before "/etc"
Problem:    A couple of filetype patterns do not have "*" before "/etc".
Solution:   Add the star. (Jonas Strittmatter, closes vim/vim#10662)
704988f0c3
2022-07-06 01:25:21 +02:00
Jonas Strittmatter
acb7a90281
refactor(runtime): port scripts.vim to lua (#18710) 2022-07-03 15:31:56 +02:00
Christian Clason
60604d6a99
vim-patch:9.0.0012: signature files not detected properly (#19172)
Problem:    Signature files not detected properly.
Solution:   Add a function to better detect signature files. (Doug Kearns)
cdbfc6dbab
2022-07-01 07:08:44 +02:00
Gregory Anders
3b1423bfa7
fix(filetype): update call sites of vim.filetype.match (#19171)
These were not updated in #18895.
2022-06-30 09:54:44 -06:00
L3MON4D3
6f6286e4f9
fix(lsp): small bugs in snippet-parser #18998
This fixes the following bugs:
`${1:else_text}` -> format with if_text: "else_text"
`${1:-else_text}` -> format with if_text: "else_text"
`${1:}` in `format` (eg. empty else_text) -> error.
`${1:}` (eg. empty placeholder) -> error.

Thanks hrsh7th :)
2022-06-29 09:53:49 -07:00
Christian Clason
1eb9624666
vim-patch:9.0.0006: not all Visual Basic files are recognized (#19153)
Problem:    Not all Visual Basic files are recognized.
Solution:   Change detection of *.cls files. (Doug Kearns)
8b5901e2f9
2022-06-29 18:43:56 +02:00
Christian Clason
ba583f8206
vim-patch:9.0.0005: hare files are not recognized (#19151)
Problem:    Hare files are not recognized.
Solution:   Add a filetype pattern. (Hugo Osvaldo Barrera, closes vim/vim#10630)
040674129f
2022-06-29 16:21:04 +02:00
0x74696d6d79
ee6b21e843
fix(vim.ui.input): accept nil or empty "opts" #19109
Fix #18143
2022-06-28 02:53:15 -07:00
Christian Clason
f2fa11708c
fix(filetype): check for non-nil match in detect.rules (#19129) 2022-06-27 20:43:37 +02:00
Gregory Anders
6f3508f8ed
refactor(filetype): allow vim.filetype.match to accept buf and filename (#19114)
This is necessary in cases where filetype detection acts recursively.
For example, when matching files that end with .bak, the "root" of
the filename is matched again against the same buffer (e.g. a buffer
named "foo.c.bak" will be matched again with the filename "foo.c", using
the same underlying buffer).
2022-06-27 10:03:43 +02:00
Gregory Anders
f3ce06cfa1
refactor(filetype)!: allow vim.filetype.match to use different strategies (#18895)
This enables vim.filetype.match to match based on a buffer (most
accurate) or simply a filename or file contents, which are less accurate
but may still be useful for some scenarios.

When matching based on a buffer, the buffer's name and contents are both
used to do full filetype matching. When using a filename, if the file
exists the file is loaded into a buffer and full filetype detection is
performed. If the file does not exist then filetype matching is only
performed against the filename itself. Content-based matching does the
equivalent of scripts.vim, and matches solely based on file contents
without any information from the name of the file itself (e.g. for
shebangs).

BREAKING CHANGE: use `vim.filetype.match({buf = bufnr})` instead 
of `vim.filetype.match(name, bufnr)`
2022-06-26 18:41:20 +02:00
Hazel Weakly
35e89bf903
fix(filetype.lua): always return a string in getlines function (#19080)
This re-introduces the fix that the filetype.lua refactor inadvertently reverted.
The fix ensures that in the case when end_lnum is omitted, a string is always returned.
2022-06-24 19:53:44 +02:00
Jonas Strittmatter
e3b51d5842
refactor(runtime): refactor filetype.lua (#18813)
Move some filetype detection functions to detect.lua,
sort patterns by detected filetype.
2022-06-21 11:29:52 -06:00
Gregory Anders
87a68b6a3a refactor: use nvim_{get,set}_option_value for vim.{b,w}o
`nvim_get_option_value` and `nvim_set_option_value` better handle
unsetting local options. For instance, this is currently not possible:

    vim.bo.tagfunc = nil

This does not work because 'tagfunc' is marked as "local to buffer" and
does not have a fallback global option. However, using :setlocal *does*
work as expected

    :setlocal tagfunc=

`nvim_set_option_value` behaves more like :set and :setlocal (by
design), so using these as the underlying API functions beneath vim.bo
and vim.wo makes those two tables act more like :setlocal. Note that
vim.o *already* uses `nvim_set_option_value` under the hood, so that
vim.o behaves like :set.
2022-06-20 09:16:21 -06:00
kevinhwang91
8780076a78 fix(treesitter): new iter if folded 2022-06-16 17:38:10 +02:00
notomo
0e8186bdd8
fix(lua): highlight.on_yank can close timer in twice #18976
Steps to reproduce:

1. setting `vim.highlight.on_yank`
   ```
   vim.api.nvim_create_autocmd({ "TextYankPost" }, {
     pattern = { "*" },
     callback = function()
       vim.highlight.on_yank({ timeout = 200 })
     end,
   })
   ```
2. repeat typing `yeye` ...
3. causes the following error.
   ```
   Error executing vim.schedule lua callback: vim/_editor.lua:0: handle 0x01e96970 is already closing
   stack traceback:
           [C]: in function 'close'
           vim/_editor.lua: in function ''
           vim/_editor.lua: in function <vim/_editor.lua:0>
   ```

📝 Test result before fix:

    [----------] Global test environment setup.
    [----------] Running tests from test/functional/lua/highlight_spec.lua
    [ RUN      ] vim.highlight.on_yank does not show errors even if buffer is wiped before timeout: 15.07 ms OK
    [ RUN      ] vim.highlight.on_yank does not show errors even if executed between timeout and clearing highlight: 15.07 ms ERR
    test/helpers.lua:73: Expected objects to be the same.
    Passed in:
    (string) 'Error executing vim.schedule lua callback: vim/_editor.lua:0: handle 0x02025260 is already closing
    stack traceback:
            [C]: in function 'close'
            vim/_editor.lua: in function ''
            vim/_editor.lua: in function <vim/_editor.lua:0>'
    Expected:
    (string) ''
2022-06-15 19:39:55 -07:00
dundargoc
6de7f32d52
docs: fix typos (#18866)
docs: fix typos and similarly insignificant changes

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: smjonas <jonas.strittmatter@gmx.de>
Co-authored-by: kanreki <32443233+kanreki@users.noreply.github.com>
2022-06-15 08:49:54 +08:00
rhcher
7f8f8d6cb7
feat(lsp): sort codelens if multiple item per line (#18951) 2022-06-13 19:31:48 +02:00
Gregory Anders
58323b1fe2
feat(filetype): remove side effects from vim.filetype.match (#18894)
Many filetypes from filetype.vim set buffer-local variables, meaning
vim.filetype.match cannot be used without side effects. Instead of
setting these buffer-local variables in the filetype detection functions
themselves, have vim.filetype.match return an optional function value
that, when called, sets these variables. This allows vim.filetype.match
to work without side effects.
2022-06-09 13:12:36 -06:00
mohsen
94181ad7dc
fix(diagnostic): check for negative column value (#18868) 2022-06-08 12:55:39 -06:00
Jonas Strittmatter
41a49dd9c8
refactor(runtime): port remaining patterns from filetype.vim to filetype.lua (#18814) 2022-06-06 09:25:33 -06:00
Mathias Fußenegger
e4df1c9b9e
fix(lsp): fix multi client handling in code action (#18869)
Fixes https://github.com/neovim/neovim/issues/18860
2022-06-05 16:43:32 +02:00
bfredl
545dc82c1b perf(tests): don't invoke nvim_get_all_options_info until needed
This call alone is responible of 40 000 000 out of 80 000 000
individual alloc/free calls in the test suite.
2022-06-05 00:11:57 +02:00
zeertzjq
9961a9702e
fix(lsp): set buflisted before switching to buffer (#18854) 2022-06-04 10:23:43 +02:00
Christian Clason
e6fa4cca24
vim-patch:8.2.5054: no good filetype for conf files similar to dosini (#18851)
Problem:    No good filetype for conf files similar to dosini.
Solution:   Add the confini filetype. (closes vim/vim#10510)
635f48010d
2022-06-04 09:49:01 +02:00
dundargoc
ff20d40321
docs: fix typos (#18269)
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: Dan Sully <dan+github@sully.org>
Co-authored-by: saher <msaher.shair@gmail.com>
Co-authored-by: Stephan Seitz <stephan.seitz@fau.de>
Co-authored-by: Benedikt Müller <d12bb@posteo.de>
Co-authored-by: Andrey Mishchenko <mishchea@gmail.com>
Co-authored-by: Famiu Haque <famiuhaque@protonmail.com>
Co-authored-by: Oliver Marriott <hello@omarriott.com>
2022-06-04 11:56:36 +08:00
Gregory Anders
86cc33a464
fix(filetype): fix typo in starsetf function (#18856) 2022-06-03 21:52:59 -06:00
Mathias Fußenegger
c6d747e6a5
feat(lsp): send didChangeConfiguration after init (#18847)
Most LSP servers require the notification to correctly load the
settings and for those who don't it doesn't cause any harm.

So far this is done in lspconfig, but with the addition of vim.lsp.start
it should be part of core.
2022-06-03 18:16:11 +02:00
Mathias Fußenegger
69774e3179
feat(lsp): add a start function (#18631)
A alternative/subset of https://github.com/neovim/neovim/pull/18506  that should be forward compatible with a potential project system.

Configuration of LSP clients (without lspconfig) now looks like this:

    vim.lsp.start({
       name = 'my-server-name',
       cmd = {'name-of-language-server-executable'},
       root_dir = vim.fs.dirname(vim.fs.find({'setup.py', 'pyproject.toml'}, { upward = true })[1]),
    })
2022-06-03 14:59:19 +02:00
Christian Clason
26966688aa
fix(treesitter): correct region for string parser (#18794)
fixes injections for string parsers after eab4d03a32
2022-06-02 17:35:16 +02:00
Wsevolod
d5651a4183
fix(lua): stop pending highlight.on_yank timer, if any (#18824)
When yanking another range while previous yank is still highlighted, the
pending timer could clear the highlight almost immediately (especially
when using larger `timeout`, i.e. 2000)
2022-06-02 09:49:57 +02:00
Fredrik Ekre
209824ce2c
fix(lsp): adjust offset encoding in lsp.buf.rename() (#18829)
Fix a bug in lsp.buf.rename() where the range returned by the server in
textDocument/prepareRename was interpreted as a byte range directly,
instead of taking the negotiated offset encoding into account. This
caused the placeholder value in vim.ui.input to be incorrect in some
cases, for example when non-ascii characters are used earlier on the
same line.
2022-06-01 18:56:18 +02:00
Javier Lopez
d837b6d50c
fix(checkhealth): skip vim.health #18816
Problem:
https://github.com/neovim/neovim/pull/18720#issuecomment-1142614996

The vim.health module is detected as a healthcheck, which produces spurious errors:

    vim: require("vim.health").check()
    ========================================================================
    - ERROR: Failed to run healthcheck for "vim" plugin. Exception:
      function health#check, line 20
      Vim(eval):E5108: Error executing lua [string "luaeval()"]:1: attempt to call field 'check' (a nil value)
      stack traceback:
      [string "luaeval()"]:1: in main chunk

Solution:
Skip vim.health when discovering healthchecks.
2022-06-01 07:10:10 -07:00
Gregory Anders
046b4ed461 feat(fs): add vim.fs.normalize() 2022-05-31 13:30:10 -06:00
Gregory Anders
f271d70661 feat(fs): add vim.fs.find()
This is a pure Lua implementation of the Vim findfile() and finddir()
functions without the special syntax.
2022-05-31 13:04:41 -06:00
Gregory Anders
2a62bec37c feat(fs): add vim.fs.dir()
This function is modeled after the path.dir() function from Penlight and
the luafilesystem module.
2022-05-31 13:04:41 -06:00
Gregory Anders
b740709431 feat(fs): add vim.fs.basename() 2022-05-31 13:04:41 -06:00
Gregory Anders
c5526a27c3 feat(fs): add vim.fs.dirname() 2022-05-31 13:04:41 -06:00
Gregory Anders
67cbaf58c4 feat(fs): add vim.fs.parents()
vim.fs.parents() is a Lua iterator that returns the next parent
directory of the given file or directory on each iteration.
2022-05-31 13:04:40 -06:00
Javier Lopez
e6652821bd
refactor(checkhealth)!: rename to vim.health, move logic to Lua #18720
- Complete function:
  There was lots of unnecessary C code for the complete function, therefore
  moving it to Lua and use all the plumbing we have in place to retrieve the
  results.
- Moving the module:
  It's important we keep nvim lua modules name spaced, avoids conflict with
  plugins, luarocks, etc.
2022-05-31 11:10:18 -07:00
Gregory Anders
5d840fa7e6
Merge pull request #18219 from kessejones/filetype-lua
feat(filetype): add more filetype patterns to Lua
2022-05-31 07:58:51 -06:00
Chris Kipp
1a20aed3fb
fix(lsp): include cancellable in progress message table (#18809)
Currently the `title`, `message` and `percentage` is stored for a
progress, but there is also an optional `cancellable` that comes in with
both the `WorkDoneProgressBegin` and also `WorkDoneProgressReport`. This
change also stores that value so that a plugin can access it when they
do a lookup in `client.messages`.
2022-05-31 13:19:45 +02:00
Christian Clason
b66e9e0baa feat(filetype): convert more patterns to filetype.lua 2022-05-30 20:32:35 -03:00
Lewis Russell
eab4d03a32
fix(treesitter): offset directive associates range with capture (#18276)
Previously the `offset!` directive populated the metadata in such a way
that the new range could be attributed to a specific capture. #14046
made it so the directive simply stored just the new range in the
metadata and information about what capture the range is based from is
lost.

This change reverts that whilst also correcting the docs.
2022-05-28 19:22:18 +02:00
Mathias Fußenegger
e8ada41b63
feat(lsp): turn rename filter into a predicate (#18745)
Same as https://github.com/neovim/neovim/pull/18458 but for rename
2022-05-26 12:28:50 +02:00
dundargoc
068fb748e1
vim-patch:8.2.5015: Hoon and Moonscript files are not recognized (#18747)
Problem:    Hoon and Moonscript files are not recognized.
Solution:   Add filetype patterns. (Goc Dundar, closes vim/vim#10478)
bf82df0dd4
2022-05-25 18:07:58 -06:00
Gregory Anders
8c4e62351f
refactor(lsp): remove redundant client cleanup (#18744)
The client state is cleaned up both in client.stop() as well as in the
client.on_exit() handler. Technically, the client has not actually
stopped until the on_exit handler is called, so we should just do this
cleanup there and remove it from client.stop().
2022-05-25 11:45:45 -06:00