vim-erlang / vim-erlang-compiler

Erlang syntax checking and compiler plugin for Vim
https://vim-erlang.github.io
56 stars 24 forks source link

Add a function to move cursor to next error #33

Closed zmstone closed 7 years ago

zmstone commented 7 years ago

Add a function to help move cursor to the next error. The users can add their key bindings or user-defined command to jump to the next error line for easier motion.

hcs42 commented 7 years ago

Does this differ from :lnext?

zmstone commented 7 years ago

No. Apparently I didn't know about lne and lp.

zmstone commented 7 years ago

@hcs42 :lnext skips over warnings, and echos 'No error' when there is only warning. I checked doc, there is no mentioning about a config to hide warnings etc.

Maybe there is another vim feature that I don't know of ?

hcs42 commented 7 years ago

It doesn't skip warnings for me, but I might know what is confusing.

E.g. I have this file and save it:

-module(x).
-export([]).

f() ->
    ok.

g() ->
    ok.

z() ->
    1

I get the problematic lines highlighted.

If I type :lopen, I can see the list of errors/warnings:

/home/hcs/_/2017_01_16/x.erl|11| syntax error before: 
/home/hcs/_/2017_01_16/x.erl|4 warning| function f/0 is unused
/home/hcs/_/2017_01_16/x.erl|7 warning| function g/0 is unused

Now my screen looks like this:

vim

:lfirst jumps to the first entry (which is the error in line 11), then :lnext jumps to the second entry (which is the warning in line 4).

So if there are both errors and warnings, the Erlang compiler will print all errors first and only then does it print the warnings.

Notes:

Does any of this explain what's happening on your machine? If not, could you describe how Vim behaves when saving the file above? (Maybe also add a screenshot?)

zmstone commented 7 years ago

Thanks for the very detailed info.

In my case: All warnings and errors are highlighted in the sidebar. and :lopen lists all errors and warnings. Only :lnext skips over the warning and echos 'No error' when there is only Warning

I'm using neovim 0.1.7, have not tried it in vim. I guess this is very likely a problem of neovim specific setting. ... or a neovim bug.

Thanks for your time.