Commit Graph

1305 Commits

Author SHA1 Message Date
Amaan Qureshi
c9ac4e4877
vim-patch:9.0.1261: Elsa files are not recognized (#22047)
Problem: Elsa files are not recognized.
Solution: Add the name of Elsa files. (Amaan Qureshi)

2a99fe6c41
2023-01-29 20:19:07 +01:00
Christian Clason
8144deb098
vim-patch:9.0.1256: NetworkManager connection files are not recognized (#22038)
Problem:    NetworkManager connection files are not recognized.
Solution:   Add a pattern for NetworkManager connection files. (closes vim/vim#11893)

04e4f1d985

Co-authored-by: ObserverOfTime <chronobserver@disroot.org>
2023-01-29 10:39:20 +01:00
0xAdk
3c48d3c83f
fix(man.lua): open in current window if it's already a man page (#21987)
This matters when there are multiple man page windows open.
2023-01-25 22:39:25 +08:00
C.D. MacEachern
314d3ce1eb
docs(vim.fs): normalize Windows example was incorrect (#21966) 2023-01-25 06:45:30 +08:00
Lewis Russell
9166116c67
doc(lsp): format arguments to start_client() (#21980)
docs(lsp): format arguments to start_client()
2023-01-24 18:04:15 +00:00
Sean Dewar
bcdbf77537
fix(lsp): check method is supported when range formatting (#21970)
`vim.lsp.buf.format()` silently did nothing if no servers supported
`textDocument/rangeFormatting` when formatting with a range.

Issue found by `@hwrd:matrix.org` in the Matrix chat.
2023-01-24 07:15:43 +01:00
Arnout Engelen
cb757f2663
build: make generated source files reproducible #21586
Problem:
Build is not reproducible, because generated source files (.c/.h/) are not
deterministic, mostly because Lua pairs() is unordered by design (for security).

https://github.com/LuaJIT/LuaJIT/issues/626#issuecomment-707005671
https://www.lua.org/manual/5.1/manual.html#pdf-next
> The order in which the indices are enumerated is not specified [...]
>
>> The hardening of the VM deliberately randomizes string hashes. This in
>> turn randomizes the iteration order of tables with string keys.

Solution:
- Update the code generation scripts to be deterministic.
    - That is only a partial solution: the exported function
      (funcs_metadata.generated.h) and ui event
      (ui_events_metadata.generated.h) metadata have some mpack'ed
      tables, which are not serialized deterministically.
    - As a workaround, introduce `PRG_GEN_LUA` cmake setting, so you can
      inject a modified build of luajit (with LUAJIT_SECURITY_PRN=0)
      that preserves table order.
    - Longer-term we should change the mpack'ed data structure so it no
      longer uses tables keyed by strings.

Closes #20124

Co-Authored-By: dundargoc <gocdundar@gmail.com>
Co-Authored-By: Arnout Engelen <arnout@bzzt.net>
2023-01-23 01:26:46 -08:00
Amaan Qureshi
1b642648f6
vim-patch:9.0.1230: Apache Thrift files are not recognized (#21955)
Problem:    Apache thrift files are not recognized.
Solution:   Add a pattern for thrift files. (Amaan Qureshi, closes vim/vim#11859)

f3da4c8427
2023-01-23 07:08:08 +08:00
Mathias Fußenegger
8e52d8a394
fix(lsp): assert workspace/applyEdit receives params (#21945)
According to the specification `workspace/applyEdit` must be called with
`ApplyWorkspaceEditParams`.

So far the client just returned, which could lead to a misleading error
on the server side because `workspace/applyEdit` must respond with a
`ApplyWorkspaceEditResult`.

This adds an assertion to clarify that the server is violating the
specification.

See https://github.com/neovim/neovim/issues/21925
2023-01-22 18:54:09 +01:00
Amaan Qureshi
80bede1dfc
vim-patch:9.0.1229: Cap'n Proto files are not recognized (#21950)
Problem:    Cap'n Proto files are not recognized.
Solution:   Add a pattern and the "capnp" filetype. (Amaan Qureshi,
            closes vim/vim#11862)

040e795e8d
2023-01-22 22:08:33 +08:00
kishii
7ef5e363d3
feat(lsp): add triggerKind option for vim.lsp.buf.code_action (#21905) 2023-01-21 08:22:34 +01:00
Raphael
d8d39344e3
fix(lsp): fix removed param value in add_workspace_folder (#21915) 2023-01-20 07:59:31 +01:00
Lewis Russell
20b7be2d10
fix(treesitter): really restore syntax
- also unset b:ts_highlight on stop()

Fixes: #21836
2023-01-17 16:56:23 +00:00
Sean Dewar
7e24c45221
feat(health): detect tmux RGB support via client_termfeatures
Problem: On tmux v3.2+, the `terminal-features` option may be used to enable RGB
capabilities over `terminal-overrides`. However, `show-messages` cannot be used
to detect if RGB capabilities are enabled using `terminal-features`.

Solution: Try to use `display-message -p #{client_termfeatures}` instead.
The returned features include "RGB" if either "RGB" is set in
`terminal-features`, or if "Tc" or "RGB" is set in `terminal-overrides` (as
before).
Nothing is returned by tmux versions older than v3.2, so fallback to checking
`show-messages` in that case.

Also, un-Vimscriptify the previous logic a bit, and change the error message to
point to using the `terminal-features` option instead for newer tmux versions.
2023-01-16 15:30:57 +00:00
Sean Dewar
60df0c0651
fix(health): fix tmux_esc_time comparison
Regression from the health.vim to .lua changes.

Unlike Vim script, Lua does not implicitly convert strings to numbers, so this
comparison threw an error.
2023-01-16 14:26:29 +00:00
Ching Pei Yang
ef89f9fd46
docs: treesitter.add_directive, add_predicate #21206 2023-01-16 04:39:19 -08:00
TJ DeVries
307efe4906
health: migrate to Lua #21661
* refactor: remove all vimscript from nvim/health
* fixup: previous method broke if you had a folder named 'x-lua'
2023-01-16 01:55:24 -08:00
Naru
34b973b1d9
docs(lua): use luaref tag instead of www.lua.org #21813 2023-01-15 13:32:23 -08:00
dundargoc
c752c85363
refactor: format with stylua (#21821) 2023-01-15 16:00:23 +01:00
Christian Clason
fd3d30a22c
vim-patch:9.0.1191: some Bazel files are not recognized (#21784)
Problem:    Some Bazel files are not recognized.
Solution:   Add an extra Bazel pattern. (Keith Smily, closes vim/vim#11807)

3213952966

Co-authored-by: Keith Smiley <keithbsmiley@gmail.com>
2023-01-13 17:27:35 +01:00
Raphael
572cd8031d
feat(diagnostic): vim.diagnostic.is_disabled() #21527 2023-01-12 08:57:39 -08:00
Chris Kipp
443bbfd59e
docs(lsp): fix type annotation on convert_input_to_markdown_lines (#21772)
This small changes just ensures that if you're using `convert_input_to_markdown_lines`
without `contents` you don't get a warning (when using something like neodev) that
there is an expected second param, since it can be nil.
2023-01-12 15:51:19 +01:00
Christian Clason
2aabe9b858
vim-patch:9.0.1182: go checksum files are not recognized (#21758)
Problem:    go checksum files are not recognized.
Solution:   Add the name of go checksum files. (Amaan Qureshi, closes vim/vim#11803)

043d7b2c84

Co-authored-by: Amaan Q <amaanq12@gmail.com>
2023-01-12 09:21:58 +01:00
jdrouhard
143d3f1f32
fix(lsp): revert semantic token gravity change from #21574 (#21763) 2023-01-12 07:13:52 +01:00
Chris Kipp
a37c686d21
docs(lsp): update buf_notify and rpc.notify params types (#21753)
Small, but I was getting warnings about my usage of
`vim.lsp.buf_notify(bufnr, method, {example = example})` since the docs
say that `params` must be a string, however this can really be anything
when it's passed to `rpc.notify` since we just end up calling
`vim.json.encode(payload)` on it. This fixes the docs in those two
places and regenerates them.
2023-01-11 20:17:10 +01:00
Christian Clason
8c5c2136fe
vim-patch:9.0.1176: smithy files are not recognized (#21751)
Problem:    smithy files are not recognized.
Solution:   Add a pattern for Smithy files. (Chris Kipp, closes vim/vim#11804)

f68cddabff

Co-authored-by: Chris Kipp <ckipp@pm.me>
2023-01-11 17:15:54 +01:00
Amaan Qureshi
ea2658e1f7
vim-patch:9.0.1174: smali files are not recognized (#21734)
Problem: Smali files are not recognized.
Solution: Add a pattern for Smali files. (Amaan Qureshi, closes vim/vim#11801)
2023-01-10 22:29:25 +01:00
Sebastian Lyng Johansen
870ca1de52
feat(float): open float relative to mouse #21531
Problem:
No easy way to position a LSP hover window relative to mouse.

Solution:
Introduce another option to the `relative` key in `nvim_open_win()`.

With this PR it should be possible to override the handler and do something
similar to this https://github.com/neovim/neovim/pull/19481#issuecomment-1193248674
to have hover information displayed from the mouse.

Test case:

    ```lua
    local util = require('vim.lsp.util')

    local function make_position_param(window, offset_encoding)
        window = window or 0
        local buf = vim.api.nvim_win_get_buf(window)
        local row, col

        local mouse = vim.fn.getmousepos()
        row = mouse.line
        col = mouse.column

        offset_encoding = offset_encoding or util._get_offset_encoding(buf)
        row = row - 1
        local line = vim.api.nvim_buf_get_lines(buf, row, row + 1, true)[1]
        if not line then
            return { line = 0, character = 0 }
        end
        if #line < col then
            return { line = 0, character = 0 }
        end

        col = util._str_utfindex_enc(line, col, offset_encoding)

        return { line = row, character = col }
    end

    local make_params = function(window, offset_encoding)
        window = window or 0
        local buf = vim.api.nvim_win_get_buf(window)
        offset_encoding = offset_encoding or util._get_offset_encoding(buf)
        return {
            textDocument = util.make_text_document_params(buf),
            position = make_position_param(window, offset_encoding),
        }
    end

    local hover_timer = nil
    vim.o.mousemoveevent = true

    vim.keymap.set({ '', 'i' }, '<MouseMove>', function()
        if hover_timer then
            hover_timer:close()
        end
        hover_timer = vim.defer_fn(function()
            hover_timer = nil
            local params = make_params()
            vim.lsp.buf_request(
                0,
                'textDocument/hover',
                params,
                vim.lsp.with(vim.lsp.handlers.hover, {
                    silent = true,
                    focusable = false,
                    relative = 'mouse',
                })
            )
        end, 500)
        return '<MouseMove>'
    end, { expr = true })
    ```
2023-01-10 02:22:41 -08:00
TJ DeVries
904c13e6b5
dist: transpile cfilter.vim => cfilter.lua #21662
Vim has changed cfilter.vim from vimscript to vim9script.
Nvim supports only vimscript, not vim9script.
2023-01-08 12:31:38 -08:00
Mathias Fußenegger
d1b3611f03
feat(lsp): show active clients in :checkhealth vim.lsp (#21670)
For users using vim.lsp.start it can be useful to get an
overview of active client that is less verbose than a full `:lua
=vim.lsp.get_active_clients()`
2023-01-08 09:23:08 +01:00
jdrouhard
0b136a14dc
fix(lsp): partially revert semantic token gravity change from #21574 (#21680) 2023-01-08 07:43:15 +01:00
f7ad46e69e
fix(lsp): correct callHierarchy capability to fix lsp.buf.incoming_calls() (#21665)
Co-authored-by: maozhongzhou <maozhongzhou@wps.cn>
2023-01-06 15:26:31 +01:00
TJ DeVries
39d70fcafd
dist: generated version of ccomplete.vim (#21623)
This is the first PR featuring a conversion of an upstream vim9script file
into a Lua file.

The generated file can be found in `runtime/autoload/ccomplete.vim` in
the vim repository. Below is a limited history of the changes of that file
at the time of conversion.

```
❯ git log --format=oneline runtime/autoload/ccomplete.vim
c4573eb12dba6a062af28ee0b8938d1521934ce4 Update runtime files
a4d131d11052cafcc5baad2273ef48e0dd4d09c5 Update runtime files
4466ad6baa22485abb1147aca3340cced4778a66 Update runtime files
d1caa941d876181aae0ebebc6ea954045bf0da24 Update runtime files
20aac6c1126988339611576d425965a25a777658 Update runtime files.
30b658179962cc3c9f0a98f071b36b09a36c2b94 Updated runtime files.
b6b046b281fac168a78b3eafdea9274bef06882f Updated runtime files.
00a927d62b68a3523cb1c4f9aa3f7683345c8182 Updated runtime files.
8c8de839325eda0bed68917d18179d2003b344d1 (tag: v7.2a) updated for version 7.2a
...
```

The file runtime/lua/_vim9script.lua only needs to be updated when vim9jit is updated
(for any bug fixes or new features, like implementing class and interface, the latest in vim9script).

Further PRs will improve the DX of generated the converted lua and
tracking which files in the neovim's code base have been generated.
2023-01-05 11:00:32 -05:00
notomo
e35b9020b1
docs(lua): adjust some type annotations 2023-01-04 11:48:41 +00:00
dundargoc
936e191fef
docs: fix typos (#21427)
Co-authored-by: Gustavo Sampaio <gbritosampaio@gmail.com>
Co-authored-by: C.D. MacEachern <craig.daniel.maceachern@gmail.com>
Co-authored-by: Sean Dewar <seandewar@users.noreply.github.com>
Co-authored-by: Tomas Nemec <nemi@skaut.cz>
2023-01-04 07:38:48 +08:00
Gregory Anders
d56c603caf
Merge pull request #21633 from gpanders/editorconfig
Builtin EditorConfig support
2023-01-03 11:38:20 -07:00
Gregory Anders
d6510eec4f feat(editorconfig): add editorconfig syntax file
This is intentionally _not_ copied from Vim because our syntax file
makes use of Lua to dynamically generate a list of valid EditorConfig
properties. This requires the builtin editorconfig module, which Vim
does not have.
2023-01-03 10:28:55 -07:00
Gregory Anders
ab9a2c4925 feat(editorconfig): add builtin EditorConfig support 2023-01-03 10:28:55 -07:00
Eric Haynes
1b3c255f60
fix(fs): duplicate path separator #21509
Fixes #21497
2023-01-03 09:24:14 -08:00
Gregory Anders
5eed3e741b
fix(diagnostic): revert notification on missing diagnostics (#21632)
This reverts a change introduced in
4ace9e7e41.
2023-01-03 08:20:20 -07:00
Christian Segundo
5b22b32e50
fix(lsp): change vim.lsp.get_active_clients.filter name annotation to string (#21624) 2023-01-03 13:44:44 +01:00
Raphael
7b76a3e799
refactor(diagnostic): DRY for loop #21521
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2023-01-03 02:07:27 -08:00
Christian Clason
dfb840970c docs(lua): fix treesitter parsing errors 2023-01-01 15:05:21 +01:00
zeertzjq
83e8723864
Merge pull request #21597 from gi1242/tex-ft-detection
fix(filetype): make .tex filetype detection match Vim
2023-01-01 21:45:12 +08:00
Gautam Iyer
85b7c8b004 fix(filetype): correctly detect tex files
Fixes Issue #21594.
2022-12-31 20:54:01 -05:00
Mathias Fußenegger
6ba34e21fe
feat(lsp): add function to clear codelens (#21504)
Currently once you retrieve the lenses you're pretty much stuck with
them as saving new lenses is additive.

Adding a dedicated method to reset lenses allows users to toggle lenses
on/off which can be useful for language servers where they are noisy or
expensive and you only want to see them temporary.
2022-12-31 16:16:21 +01:00
李晓辉
4ace9e7e41
feat(diagnostic): don't open quickfix/loclist if no diagnostics #21397 2022-12-30 10:23:54 -08:00
Raphael
f62c30ad0d
fix(lsp): fix nil client access in get_active_clients (#21524)
Fixes https://github.com/neovim/neovim/issues/21523
2022-12-30 16:42:18 +01:00
jdrouhard
469f985923
fix(lsp): adjust gravity of semantic tokens extmarks (#21574)
Fixes #21543

This should provide a better user experience when appending or prepending text to a word that has a semantic token extmark. More often than not, the appended/prepended text to the word will end up becoming part of the token anyway, so just use that extmark as the user types.
2022-12-30 16:40:23 +01:00
Christian Clason
3b9b43063c
vim-patch:9.0.1106: not all postfix files are recognized (#21568)
Problem:    Not all postfix files are recognized.
Solution:   Recognize main.cf.proto files. (closes vim/vim#11732)

09ce0b8e11

Co-authored-by: KodeToad <3880336+KodeToad@users.noreply.github.com>
2022-12-28 11:42:02 +01:00