Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

vim-go uses location lists now #1650

Closed
nothingelsematters7 opened this issue Dec 28, 2015 · 12 comments
Closed

vim-go uses location lists now #1650

nothingelsematters7 opened this issue Dec 28, 2015 · 12 comments

Comments

@nothingelsematters7
Copy link

As mentioned in 7.10. section of documentation

The "vim-go" Vim plugin (https://github.com/fatih/vim-go) uses |quickfix|
lists, and thus doesn't conflict with syntastic (which uses |location-list|
lists).

It uses Location lists now, so it needs to be resolved somehow.

@lcd047
Copy link
Collaborator

lcd047 commented Dec 28, 2015

Right, and there's no way to turn that off. grumble

Ok, I updated the manual in 91814d6. However, I'm not sure setting g:go_fmt_fail_silently the way I recommend there is actually enough to keep vim-go from trampling over syntastic's loclists. I'm not using vim-go, so I can't really check. Reports either way from people using both syntastic and the latest versions of vim-go would be highly appreciated.

@nothingelsematters7
Copy link
Author

Actually when using vim-go and Syntastic I cannot view any Location Lists that vim-go opens when using it without Syntastic. g:go_fmt_fail_silently seems not to solve problem at all.

@lcd047
Copy link
Collaborator

lcd047 commented Dec 28, 2015

What happens if you set g:go_fmt_fail_silently to 1?

@nothingelsematters7
Copy link
Author

Location list doesn't open.
But there are error indicators on the left side of window

@nothingelsematters7
Copy link
Author

The same happens when g:go_fmt_fail_silently is set to 0

@lcd047
Copy link
Collaborator

lcd047 commented Dec 28, 2015

Then perhaps it's time to ask vim-go maintainers to play nicer? A feature that can't be turned off is a bug.

@nothingelsematters7
Copy link
Author

@fatih what do you think about?

@fatih
Copy link

fatih commented Jan 3, 2016

I don't know what play nicer means @lcd047 :) g:go_fmt_fail_silently does exactly what it says, it doesn't open any location list if there is any kind of error while saving the file via :GoFmt, either explicit either via autosave trigger. What exactly is the problem here?

@lcd047
Copy link
Collaborator

lcd047 commented Jan 4, 2016

@fatih "Play nicer" means vim-go not assuming it has exclusive control over location lists. Syntastic has such a mode: if you set g:syntastic_always_populate_loc_list and g:syntastic_auto_loc_list to 0, it would save and restore old location lists. Sadly, there is no way to have both vim-go and syntastic use loclists without sacrificing functionality.

@fatih
Copy link

fatih commented Jan 5, 2016

it would save and restore old location lists.

Can you please expand this. What do you mean by old location lists? The same can be applied to syntastic too. Btw, I've abstracted all my list operations and I'm easily able to disable/change it to quickfix and do many other things. I'm just trying to learn what still the problem is.

@lcd047
Copy link
Collaborator

lcd047 commented Jan 8, 2016

What do you mean by old location lists?

@fatih There's actually a stack of location lists (and quickfix lists). Syntastic does something like this when it runs a checker (simplified):

lgetexpr some_lines
let local_loclist = deepcopy(getloclist(0))
lolder

It then uses the local copy local_loclist until a checker is run again. If g:syntastic_always_populate_loc_list is set to 0 and the user doesn't run :Errors to open the error window, that's all there is to it, the loclist is all yours to play with.

However, if g:syntastic_always_populate_loc_list is set to 1, or if the user runs :Errors, there's also some later call to setloclist(0, local_loclist), because lopen works with the current location list. Basically, syntastic expects the location list not to change under its feet after that.

This is further complicated by the fact that Vim API has no function to get the window owner of a location list. Syntastic tries to work around this by calling getloclist(0) for all windows and comparing the result with the loclist for the current error window. It needs to do that when it decides whether to close the error window automatically.

The same can be applied to syntastic too.

With vim-go using location lists, there is a mutual exclusion: either syntastic or vim-go needs to leave alone location lists. As I said above, if g:syntastic_always_populate_loc_list is set to 0, location lists are yours for the taking, at the price of users not being able to use error windows in syntastic. It would be nice if vim-go would have a similar way to leave location lists to syntastic.

Btw, I've abstracted all my list operations and I'm easily able to disable/change it to quickfix and do many other things.

For what it's worth, syntastic can't do the same because of the logic around automatic closing of the error window. That can't be made robust because of limitations in Vim's API. Automatic opening and closing the error window is by far the most messy feature of syntastic. Removing it would solve most known bugs, but it's of course way too late to do that now.

I'm just trying to learn what still the problem is.

I can't seem to reproduce the problem with the latest syntastic (17a4c01) and the latest vim-go (eec4e3e). Perhaps @nothingelsematters7 can describe in more detail what still doesn't work.

@lcd047
Copy link
Collaborator

lcd047 commented Jan 26, 2016

I take it the problem is solved then? Feel free to reopen this if it isn't.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants