vim-lsc icon indicating copy to clipboard operation
vim-lsc copied to clipboard

jump-to-definition and .swp files

Open sigmundch opened this issue 6 years ago • 3 comments

Consider you have 2 vim instances open one on a.dart and one on b.dart. If a.dart has a reference to a symbol in b.dart and you jump to definition, you first hit a dialog mentioning that a .swp file already exists and asking about whether to enter in read-only mode or do something else.

One you bypass the dialog (say, enter in readonly mode), the jump completes to the top of the file instead of the actual symbol.

Is there a way to make the jump eventually reach the correct location after the dialog?

sigmundch avatar Feb 12 '19 17:02 sigmundch

I can't find a good solution here. The error surfaces here: https://github.com/natebosch/vim-lsc/blob/9616bcb14c0128a6722806dafe2b6f325fa0c26f/autoload/lsc/reference.vim#L107

I can catch the specific error, but I'm not sure how to smoothly handle it. I'm not aware of any way to know when the dialog has gotten input...

    try
      exec a:mods cmd fnameescape(relative_path)
    catch /^Vim\%((\a\+)\)\=:E325/
      " now what?
    endtry

natebosch avatar Apr 29 '19 23:04 natebosch

Also, for some reason after I hit e to edit the file anyway it seems to get into a bad state, the buffer it opens is blank...

natebosch avatar Apr 29 '19 23:04 natebosch

Mmm... if you trap the error, is that before or after a dialog is shown to the user?

If it is before, what about reverting to use :view if :edit had the error, then logging a warning to indicate why you opened in read-only mode?

sigmundch avatar Apr 29 '19 23:04 sigmundch