<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rneovim.git/runtime/lua/vim/lsp, branch 20230125_mix</title>
<subtitle>Neovim fork with Rahm's personal hacks.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.josher.dev/cgit/rneovim.git/'/>
<entry>
<title>fix(semantic_tokens.lua): Fix nil tokens/data in semantic_tokens.lua</title>
<updated>2023-01-26T19:05:59+00:00</updated>
<author>
<name>Josh Rahm</name>
<email>rahm@google.com</email>
</author>
<published>2023-01-19T19:37:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.josher.dev/cgit/rneovim.git/commit/?id=8896b7ea0d98be33d07ae33fbd4bec47c9520f64'/>
<id>8896b7ea0d98be33d07ae33fbd4bec47c9520f64</id>
<content type='text'>
Some (poorly-implemented) LSPs can return an empty JSON object in
LSP responses, which could cause tokens to be nil, which would eventually
cause an error and a bad UI experience. This fix makes sure that the
tokens variable is always set to a non-nil value.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Some (poorly-implemented) LSPs can return an empty JSON object in
LSP responses, which could cause tokens to be nil, which would eventually
cause an error and a bad UI experience. This fix makes sure that the
tokens variable is always set to a non-nil value.
</pre>
</div>
</content>
</entry>
<entry>
<title>fix(lsp): check method is supported when range formatting (#21970)</title>
<updated>2023-01-24T06:15:43+00:00</updated>
<author>
<name>Sean Dewar</name>
<email>seandewar@users.noreply.github.com</email>
</author>
<published>2023-01-24T06:15:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.josher.dev/cgit/rneovim.git/commit/?id=bcdbf77537cec4567a334a39fd5965a3f5668a1a'/>
<id>bcdbf77537cec4567a334a39fd5965a3f5668a1a</id>
<content type='text'>
`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.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
`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.</pre>
</div>
</content>
</entry>
<entry>
<title>fix(lsp): assert workspace/applyEdit receives params (#21945)</title>
<updated>2023-01-22T17:54:09+00:00</updated>
<author>
<name>Mathias Fußenegger</name>
<email>mfussenegger@users.noreply.github.com</email>
</author>
<published>2023-01-22T17:54:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.josher.dev/cgit/rneovim.git/commit/?id=8e52d8a394799ede43ae5e80574f12dede9bc13e'/>
<id>8e52d8a394799ede43ae5e80574f12dede9bc13e</id>
<content type='text'>
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</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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</pre>
</div>
</content>
</entry>
<entry>
<title>feat(lsp): add triggerKind option for vim.lsp.buf.code_action (#21905)</title>
<updated>2023-01-21T07:22:34+00:00</updated>
<author>
<name>kishii</name>
<email>24446852+zhoudaxia2016@users.noreply.github.com</email>
</author>
<published>2023-01-21T07:22:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.josher.dev/cgit/rneovim.git/commit/?id=7ef5e363d360f86c5d8d403e90ed256f4de798ec'/>
<id>7ef5e363d360f86c5d8d403e90ed256f4de798ec</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>fix(lsp): fix `removed` param value in add_workspace_folder (#21915)</title>
<updated>2023-01-20T06:59:31+00:00</updated>
<author>
<name>Raphael</name>
<email>glephunter@gmail.com</email>
</author>
<published>2023-01-20T06:59:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.josher.dev/cgit/rneovim.git/commit/?id=d8d39344e38d27acccbab268bef19034ef7cd579'/>
<id>d8d39344e38d27acccbab268bef19034ef7cd579</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>docs(lsp): fix type annotation on convert_input_to_markdown_lines (#21772)</title>
<updated>2023-01-12T14:51:19+00:00</updated>
<author>
<name>Chris Kipp</name>
<email>ckipp@pm.me</email>
</author>
<published>2023-01-12T14:51:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.josher.dev/cgit/rneovim.git/commit/?id=443bbfd59e2818aeee72d2ed77af1cb24617e46f'/>
<id>443bbfd59e2818aeee72d2ed77af1cb24617e46f</id>
<content type='text'>
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.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.</pre>
</div>
</content>
</entry>
<entry>
<title>fix(lsp): revert semantic token gravity change from #21574 (#21763)</title>
<updated>2023-01-12T06:13:52+00:00</updated>
<author>
<name>jdrouhard</name>
<email>john@drouhard.dev</email>
</author>
<published>2023-01-12T06:13:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.josher.dev/cgit/rneovim.git/commit/?id=143d3f1f3224bca02bfef7df0932b9d7524a3ff2'/>
<id>143d3f1f3224bca02bfef7df0932b9d7524a3ff2</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>docs(lsp): update buf_notify and rpc.notify params types (#21753)</title>
<updated>2023-01-11T19:17:10+00:00</updated>
<author>
<name>Chris Kipp</name>
<email>ckipp@pm.me</email>
</author>
<published>2023-01-11T19:17:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.josher.dev/cgit/rneovim.git/commit/?id=a37c686d21c1ad4e50f455e989642d38435d41ba'/>
<id>a37c686d21c1ad4e50f455e989642d38435d41ba</id>
<content type='text'>
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.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.</pre>
</div>
</content>
</entry>
<entry>
<title>feat(float): open float relative to mouse #21531</title>
<updated>2023-01-10T10:22:41+00:00</updated>
<author>
<name>Sebastian Lyng Johansen</name>
<email>seblyng98@gmail.com</email>
</author>
<published>2023-01-10T10:22:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.josher.dev/cgit/rneovim.git/commit/?id=870ca1de52b240926b88f01afa697cd9b119bdac'/>
<id>870ca1de52b240926b88f01afa697cd9b119bdac</id>
<content type='text'>
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 &lt; 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' }, '&lt;MouseMove&gt;', 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 '&lt;MouseMove&gt;'
    end, { expr = true })
    ```</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &lt; 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' }, '&lt;MouseMove&gt;', 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 '&lt;MouseMove&gt;'
    end, { expr = true })
    ```</pre>
</div>
</content>
</entry>
<entry>
<title>feat(lsp): show active clients in :checkhealth vim.lsp (#21670)</title>
<updated>2023-01-08T08:23:08+00:00</updated>
<author>
<name>Mathias Fußenegger</name>
<email>mfussenegger@users.noreply.github.com</email>
</author>
<published>2023-01-08T08:23:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.josher.dev/cgit/rneovim.git/commit/?id=d1b3611f03625467500195b38d3c4646a7bc81db'/>
<id>d1b3611f03625467500195b38d3c4646a7bc81db</id>
<content type='text'>
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()`</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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()`</pre>
</div>
</content>
</entry>
</feed>
