Giter Site home page Giter Site logo

Inlay hints about lsp-bridge HOT 8 CLOSED

milanjovanovic avatar milanjovanovic commented on August 22, 2024
Inlay hints

from lsp-bridge.

Comments (8)

manateelazycat avatar manateelazycat commented on August 22, 2024

Inlay hint running in lsp-bridge-monitor-post-command function, maybe we need submit a inlay hint request to LSP server once we open some file.

from lsp-bridge.

milanjovanovic avatar milanjovanovic commented on August 22, 2024

I'm not talking about hints after opening file, I'm fine with current behaviour when opening new file.
This is already in open file that is already showing hints in the buffer, then I start typing new function for example:

pre_kl

So, it's not showing hints until I do C-k (kill-line).
After C-k

post_kl

I can't figure out what is causing this behaviour because sometimes it does work ok (showing hints after Ret).
I'm trying to figure it out by myself but no luck for now, I would appreciate guidance where to look.
Thanks.

from lsp-bridge.

manateelazycat avatar manateelazycat commented on August 22, 2024

Reference links:

I recommend that you first enable the option lsp-bridge-enable-log, then observe the return log of *lsp-bridge*. From my experience, there are only two reasons:

  1. The lsp server returned an inlay hint message, and we have not fully parsed it.
  2. The lsp-bridge-inlay-hint function is not sending enough; we need to increase the frequency of sending. Currently, inlay hint requests are only sent after modifying the code or scrolling the window.

Note that the lsp-bridge-enable-log option will affect performance. Please turn it off after debugging to avoid affecting your normal use.

from lsp-bridge.

milanjovanovic avatar milanjovanovic commented on August 22, 2024

I'm seeing that LSP-BRIDGE-INLAY-HINT--RENDER is not being called (when I edit file or press RET) until I do 'kill-line'.

LSP-BRIDGE-INLAY-HINT is being called all the time though.

What I'm seeing in project that doesn't work when I press RET is:

Recv message (error): { "jsonrpc": "2.0", "id": 30617, "error": { "code": -32801, "message": "content modified" } }

In project that works I get LSP-BRIDGE-INLAY-HINT--RENDER call all the time and no lsp-server errors like this.

from lsp-bridge.

milanjovanovic avatar milanjovanovic commented on August 22, 2024

This is from log, every time before the error I see this sequence, I don't know much about lsp protocol but it looks like second "didChange" call is invalidating "inlayHint" request ?

--- [17:07:55.093370] Send textDocument/inlayHint request (11744) to 'rust-analyzer' for project rsbom
--- [17:07:55.096867] Send textDocument/didChange notification to 'rust-analyzer' for project rsbom

Recv message (error):
{
"jsonrpc": "2.0",
"id": 11744,
"error": {
"code": -32801,
"message": "content modified"
}
}

from lsp-bridge.

milanjovanovic avatar milanjovanovic commented on August 22, 2024

This looks like some kind of race condition with LSP-BRIDGE-MONITOR-POST-COMMAND and LSP-BRIDGE-MONITOR-AFTER-CHANGE.
When I insert 50ms sleep in LSP-BRIDGE-MONITOR-POST-COMMAND it does work.

from lsp-bridge.

manateelazycat avatar manateelazycat commented on August 22, 2024

@milanjovanovic Thanks for the detailed research. I have pushed the patch dfabfc8 to fix this problem. Please update and try again. ;)

from lsp-bridge.

manateelazycat avatar manateelazycat commented on August 22, 2024

Please re-open this issue if update newest version still have problem.

from lsp-bridge.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.