<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rneovim.git/runtime/lua/vim/lsp/util.lua, branch usermarks</title>
<subtitle>Neovim fork with Rahm's personal hacks.</subtitle>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/'/>
<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='http://git.josher.dev/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>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='http://git.josher.dev/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>docs(lua): adjust some type annotations</title>
<updated>2023-01-04T11:48:41+00:00</updated>
<author>
<name>notomo</name>
<email>notomo.motono@gmail.com</email>
</author>
<published>2023-01-04T11:48:41+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=e35b9020b16985eee26e942f9a3f6b045bc3809b'/>
<id>e35b9020b16985eee26e942f9a3f6b045bc3809b</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 get_active_clients bufnr parameter (#21366)</title>
<updated>2022-12-09T21:02:04+00:00</updated>
<author>
<name>Mathias Fußenegger</name>
<email>mfussenegger@users.noreply.github.com</email>
</author>
<published>2022-12-09T21:02:04+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=8b84a10db76ef2bd15bbd3c06ae2d5dfaadc1482'/>
<id>8b84a10db76ef2bd15bbd3c06ae2d5dfaadc1482</id>
<content type='text'>
Follow up to https://github.com/neovim/neovim/pull/21337</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Follow up to https://github.com/neovim/neovim/pull/21337</pre>
</div>
</content>
</entry>
<entry>
<title>refactor(lsp): remove deprecated vim.lsp.buf_get_clients calls (#21337)</title>
<updated>2022-12-08T12:28:28+00:00</updated>
<author>
<name>Raphael</name>
<email>glephunter@gmail.com</email>
</author>
<published>2022-12-08T12:28:28+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=50ffb8d7f4d9e1b080efbf5eb04595f0399db9e5'/>
<id>50ffb8d7f4d9e1b080efbf5eb04595f0399db9e5</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): render &lt;pre&gt;{lang} code blocks and set separator default to false (#21271)</title>
<updated>2022-12-03T12:51:57+00:00</updated>
<author>
<name>Folke Lemaitre</name>
<email>folke.lemaitre@gmail.com</email>
</author>
<published>2022-12-03T12:51:57+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=c768b578faba671beab435954dc4e5a321c94728'/>
<id>c768b578faba671beab435954dc4e5a321c94728</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>docs: fix typos (#21196)</title>
<updated>2022-11-29T01:45:48+00:00</updated>
<author>
<name>dundargoc</name>
<email>33953936+dundargoc@users.noreply.github.com</email>
</author>
<published>2022-11-29T01:45:48+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=615f124003376c007442319b31a172360796974c'/>
<id>615f124003376c007442319b31a172360796974c</id>
<content type='text'>
Co-authored-by: zeertzjq &lt;zeertzjq@outlook.com&gt;
Co-authored-by: Raphael &lt;glephunter@gmail.com&gt;
Co-authored-by: Gregory Anders &lt;greg@gpanders.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Co-authored-by: zeertzjq &lt;zeertzjq@outlook.com&gt;
Co-authored-by: Raphael &lt;glephunter@gmail.com&gt;
Co-authored-by: Gregory Anders &lt;greg@gpanders.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>feat(lsp): support set title in lsp relate floatwindow (#21110)</title>
<updated>2022-11-21T10:06:14+00:00</updated>
<author>
<name>Raphael</name>
<email>glephunter@gmail.com</email>
</author>
<published>2022-11-21T10:06:14+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=2bb244af314e80afbab30b4db4490c8dae894b85'/>
<id>2bb244af314e80afbab30b4db4490c8dae894b85</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>fix(lua): properly configure luacheck and remove `local vim = ...` lines (#20551)</title>
<updated>2022-10-09T10:40:56+00:00</updated>
<author>
<name>Folke Lemaitre</name>
<email>folke.lemaitre@gmail.com</email>
</author>
<published>2022-10-09T10:40:56+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=8c2226fc30931690186390d86f963cd43e6947ef'/>
<id>8c2226fc30931690186390d86f963cd43e6947ef</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>feat(lsp): support window/showDocument (#19977)</title>
<updated>2022-10-08T08:22:25+00:00</updated>
<author>
<name>lvimuser</name>
<email>109605931+lvimuser@users.noreply.github.com</email>
</author>
<published>2022-10-08T08:22:25+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=0773a9ee3a21db54cd6b2376dd2e087bc09d5ea1'/>
<id>0773a9ee3a21db54cd6b2376dd2e087bc09d5ea1</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
