Git Product home page Git Product logo

Comments (3)

4imothy avatar 4imothy commented on September 24, 2024

It seems to be something with when a swap file is written. When I set

set updatetime=0

The float doesn't disappear until I write the file to disk. I think when I write the file to disk that is when the swap file is written as well.

I tried writing to disk with the default update time and the floating window stayed active, apart from a flicker. So I think it is something with writing a swap file and not the buffer's file.

from vim-lsp.

basharh avatar basharh commented on September 24, 2024

I was facing the same issue. Seems like this may be related to the CursorHold autocommand which fires after updatetime milliseconds. From the vim-lsp code this seems to be by design:

\ lsp#callbag#fromEvent(['CursorMoved', 'CursorHold']),

:help updatetime

'updatetime' 'ut'	number	(default 4000)
			global
	If this many milliseconds nothing is typed the swap file will be
	written to disk (see |crash-recovery|).  Also used for the
	|CursorHold| autocommand event.

Removing CursorHold from the line above did not solve the issue but there are other calls to CursorHold that might be removing floats

from vim-lsp.

ilya-bobyr avatar ilya-bobyr commented on September 24, 2024

Somehow, my Vim seems to be also generating a CursorMove event along with the CursorHold event.
So just the removal of the CursorHold from the list was not enough.

While trying to fix this exact issue I've changed a few things in this area, ultimately adding a configuration option to disable the "hide on CursorHold" behavior:

let g:lsp_diagnostics_float_hide_on_cursor_hold = 0

The first change in the series is posted for review.
If you want to get this functionality before the review process is done, you can apply this to your .vimrc:

- Plug 'prabirshrestha/vim-lsp'
+ Plug 'ilya-bobyr/vim-lsp'
+ let g:lsp_diagnostics_float_hide_on_cursor_hold = 0

Or, maybe, be even more precise with the exact change you want:

- Plug 'prabirshrestha/vim-lsp'
+ Plug 'ilya-bobyr/vim-lsp', { 'commit': '61e72298180f7937cf5c141e6482ab9cbc64f3b9' }
+ let g:lsp_diagnostics_float_hide_on_cursor_hold = 0

It would also be nice to get someone else to try my changes.
The event processing logic is somewhat tricky.
While it does seem to work for me, there is a chance I broke an existing behavior others rely on.

from vim-lsp.

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.