neomake / neomake Goto Github PK
View Code? Open in Web Editor NEWAsynchronous linting and make framework for Neovim/Vim
License: MIT License
Asynchronous linting and make framework for Neovim/Vim
License: MIT License
Hi, I'm having some issue with the Go maker which I think might be related to the recent changes to :Neomake
vs :Neomake!
.
Because Go is compiled and they way stuff are "namespaced" using the :Neomake
command doesn't make sense. But using :Neomake!
never produces any errors.
Consider this project:
main.go
package main
func main() {
baz()
}
This produces a compile error because the function baz()
isn't available in the package main
. And running go build
from the terminal shows this:
$ go build
# github.com/renstrom/go-maker
./main.go:4: undefined: baz
And there doesn't seem to be anything wrong with the errorformat
either because running :Neomake
on the main.go
file will correctly tag baz()
as undefined. So I'm not really sure what's going on here.
I don't know exactly what is slow, so I'll just write what I did so that it will be easy to reproduce later:
let g:neomake_c_nvimlint_maker = {
\ 'exe': './clint.py',
\ 'errorformat': '%f:%l: %m [%n]'
\ }
Then edit eval.c and run :Neomake nvimlint
. It gave over 900 results for me and the file is close to 20000 loc. It seems like when I disabled placing of signs with let g:neomake_place_signs = 0
that it helped a lot. I'm not sure if that's because the file is too large or if my sign placing routine is just too slow for 900 entries.
One idea: Only process the results that are correspond with the visible part of the buffer.
I tried :silent Neomake
but it still shows things like Neomake: jshint complete
.
I set my makeprg set to echo\ %
and running :make
works just fine and I can see it execute echo path/to/file
and :copen
shows path/to/file
, but when I run :Neomake!
it doesn't appear to find the file. and :copen
shows %
.
So it appears that the %
is not being expanded but is being treated literally. Is there something simple I'm missing?
I get the following error now. See neovim/neovim#2247
Error detected while processing path/to/neomake/plugin/neomake.vim:
line 31:
E216: No such group or event: JobActivity neomake* call neomake#MakeHandler()
When the option g:neomake_make_modified is set to 1 Neomake causes an error because it tries to invoke a function without the keyword call before, so vim understands it as a command.
The call keyword should be placed before the function invocation.
The line 212 of the file autoload/neomake.vim causes the error:
neomake#utils#LoudMessage('Neomake: wrote temp file '.makepath)
For me putting a call before the line solved the problem
call neomake#utils#LoudMessage('Neomake: wrote temp file '.makepath)
I'm using at least one command that I think windows won't have, which
. There may be other areas where this doesn't work on Windows. I probably won't fix this unless I end up getting a windows machine myself and/or enough people request it.
Particularly when I do :lopen
, sometimes a subsequent JobActivity
handler call will switch my file buffer into the loclist buffer. It has to do with the code in the handler that briefly switches back to the original window/buffer you were on when you invoked neomake to process the task.
One potential solution is to only perform this work if the user is in the same window/buffer as they were when they invoked neomake. If they leave that window/buffer, defer the work until they return. Otherwise, we'll just have to make the current switching mechanism more robust.
a lot of people use C
As evoked in issue #21 all checkers get run when Neomake is launched on a file. In syntastic, the checker n + 1
is only run when the checker n
reports no problem. This is a behaviour I quite enjoy since it give reports by "layers" of problems. Ideally this behaviour would be configurable (once more I wish I could offer you a PR).
This has a unsettling consequence on the items of the loclist: they appear runner after runner. Having <tab>
bound as :lnext
, I expect to go from one issue to another by repeatedly 'tabbing', but many issues shown in the margin will be skipped because they come from a later checker. 'tabbing' will wrap multiple times around the file: once for each checker. This seems kind of strange to me.
Here are the possibilities I see:
Suppose I am editing a bash file and doesn't have shellcheck (the default enabled checker for shell script files), Neomake will warn me every time I save a file (because I've settled a autocommand for that because it's very convenient and maybe should be the default setting).
What about doing nothing when calling Neomake, and if the user wants to know what checkers are available and what checkers are enabled a command named, maybe NeomakeInfo (pretty much like SyntasticInfo) could be called.
This way we can have the convenience to run the checkers automatically and there is no need to setup only to checkers available on a giving machine.
By not running the checkers if none are available and providing this function, I think would be more customization friendly.
What about this?
You can see what changed here. Will probably merge this weekend.
would be nice.
In the simple case, it might be something like
let g:neomake_javascript_jshint_maker = {
\ 'args': ['--verbose'],
\ 'errorformat': '%A%f: line %l\, col %v\, %m \(%t%*\d\)',
\ 'gutter_symbol': '✖',
\ }
let g:neomake_javascript_enabled_makers = ['jshint']
and it'd be shown on lines corresponding to the %l
in the errors.
Some makers produce lowercase "w" and "e" in their error messages (at lease gcc and clang on my machine), and they are not counted in statusline.
According to README.md you can call makers manually via
``:Neomake makername`, but nvim gives the have "trailing characters" errors.
This happens with the clang makers. Should fix at the same time as #46.
Since makers operate on the current buffer and makeprgs potentially operate on the whole project, there should be a way to use both. Currently configuring makers for a filetype will cause neomake to ignore the makeprg.
The file autoload/neomake.vim
contains utf-8 characters so you have to declare the encoding: scriptencoding utf-8
.
After running Neomake in a Python file with the location list open, the following error message is displayed:
Error detected while processing function <SNR>23_NeomakeCommand..neomake#GetEnabledMakers:
line 19:
E121: Undefined variable: default_makers
E116: Invalid arguments for function neomake#utils#AvailableMakers(ft, default_makers)
E15: Invalid expression: neomake#utils#AvailableMakers(ft, default_makers)
Error detected while processing function <SNR>23_NeomakeCommand:
line 2:
E171: Missing :endif
Running the command with the location list closed works as expected.
Error detected while processing function <SNR>183_NeomakeCommand..neomake#Make..neomake#MakeJob..<SNR>184_JobStart:
line 13:
E474: Invalid argument
#43 brought this up. Currently filetype makers are found in autoload/neomake/makers/{filetype}.vim. This is nice because we can have makers for many different filetypes that get loaded on demand as more filetypes are used. Possibly we need to put these in autoload/neomake/filetype_makers/{filetype}.vim. Then we can have non-filetype makers in autoload/neomake/makers/{tool}.vim.
Sometimes it will display the warning sign when there is also an error on that line, depending on which message gets there first.
I am currently working on a Ruby file (checkers : mri + rubocop on JRuby). If I call :Neomake
on this file, I get the error:
Error detected while processing function neomake#ProcessCurrentBuffer..<SNR>125_ProcessJobOutput..<SNR>125_AddExprCallback:
line 38:
E885: Not possible to change sign neomake_err
I then get this error every time I enter the window displaying my buffer. If I restart Vim (without loading a session), and call :Neomake
again, I get the exact same error.
The corresponding part of the logfile generated by neomake:
2015-03-13T21:45:32+0100 Log level 2: Neomake: Starting: ruby -c -T1 -w lib/remotebox/core/world.rb
2015-03-13T21:45:32+0100 Log level 2: Neomake: Starting: rubocop --format emacs lib/remotebox/core/world.rb
2015-03-13T21:45:36+0100 Log level 3: Neomake: mri stderr: SyntaxError in lib/remotebox/core/world.rb:73: syntax error, unexpected kRESCUE
2015-03-13T21:45:36+0100 Log level 3: Neomake: mri stderr: rescue UnsupportedSystem => e
2015-03-13T21:45:36+0100 Log level 3: Neomake: mri stderr: ^
2015-03-13T21:45:36+0100 Log level 3: Neomake: mri stderr done.
2015-03-13T21:45:36+0100 Log level 3: Neomake: mri processing 3 lines of output
2015-03-13T21:45:36+0100 Log level 3: Neomake: executing: sign place buffer=5
2015-03-13T21:45:36+0100 Log level 3: Neomake: mri stderr:
2015-03-13T21:45:36+0100 Log level 3: Neomake: mri stderr:
2015-03-13T21:45:36+0100 Log level 3: Neomake: mri stderr done.
2015-03-13T21:45:36+0100 Log level 3: Neomake: mri processing 2 lines of output
2015-03-13T21:45:36+0100 Log level 1: Neomake: mri complete
2015-03-13T21:45:41+0100 Log level 3: Neomake: rubocop stdout: /media/docs/projects/remotebox/lib/remotebox/core/world.rb:73:9: E: unexpected token kRESCUE
2015-03-13T21:45:41+0100 Log level 3: Neomake: rubocop stdout:
2015-03-13T21:45:41+0100 Log level 3: Neomake: rubocop stdout done.
2015-03-13T21:45:41+0100 Log level 3: Neomake: rubocop processing 2 lines of output
2015-03-13T21:45:41+0100 Log level 3: Neomake: executing: sign place buffer=4
2015-03-13T21:49:01+0100 Log level 1: Neomake: rubocop complete
2015-03-13T21:49:04+0100 Log level 3: Neomake: rubocop processing 2 lines of output
2015-03-13T21:49:04+0100 Log level 3: Neomake: executing: sign place buffer=4
2015-03-13T21:49:04+0100 Log level 3: Neomake: rubocop processing 2 lines of output
2015-03-13T21:49:04+0100 Log level 3: Neomake: executing: sign place buffer=4
I am using gitgutter which places signs in the gutter before :Neomake
is called, see:
gitgutter had already set signs in front of the lines where neomake should have placed signs. Neomake manages to place an error sign on a line where gitgutter did not place a sign.
Unfortunately I can not share the whole file I am working on.
Using the latest master to date: 1d45725, on Neovim neovim/neovim@032c200
as with other variables (e.g g:neomake_python_pep8_make) I have to provide a full dictionary (e.g. {'args': ['--ignore', 'E501,E512]}, I cannot simply write let g:neomake_python_pep8_make_args = ['--ignore', 'E501E512'] akin to what's available (and very convenient) in Syntastic.
IIRC, syntastic has a utility function that will construct a dictionary from a group of similarly-named global vars. Perhaps it would be good to make a similar function to allow for this configuration style.
We would have to do this after all the jobs run, which could be a little odd if you start using :lnext
or :cnext
before the sort happens. Perhaps it might be best to empty the loclist after each job data handler (but keep the signs in place) and only leave the loclist populated once the sort is complete, so that the error navigation works more consistently.
This is good for checkers that don't output sorted error messages (e.g. pylint) or if you want to sort the results of multiple concurrent checkers. See #22.
Currently if a maker is in the list of enabled makers, we'll try to run it regardless of whether it is installed. This would result in an error for users who don't configure the list of enabled makers from the default, but don't have one or more of the makers installed. Instead, we should quietly ignore uninstalled makers.
I am trying to create a new maker for python that doesn't complain about tabs in the whitespace. I have used the following snippet, based on the readme, but I am being met with errors.
let g:neomake_pep8alt_maker = {
\ 'exe': 'pep8',
\ 'args': ['--ignore=W191'],
\ 'errorformat': '%f:%l:%c: %m',
\ }
let g:neomake_python_enabled_makers = ['pep8alt', 'pylint']
When I run :Neomake
from a python file, I get the error:
command not found: pep8alt
What is going on here? Has the maker API changed since the readme was written, or did I just miss something?
Hi,
Maybe I'm missing a clever way to do it but currently I have the following in my rc file:
nnoremap <Tab> :lnext<CR>
nnoremap <S-Tab>: lprev<CR>
It works fine enough when there are 2+ errors: first will bring me to the second error and I can navigate them all with or +. However this won't work when there is a single error, for we're initially on the first location (in the loc list, even if the culprit line is not displayed); and I find this behaviour highly annoying.
Am I missing a simple way to improve my workflow, or is that a real feature request?
Using nvim in iterm with solarized as the color scheme for both nvim and the terminal.
first it displays a long list of signs and then displays the following error
Error detected while processing function neomake#MakeHandler..<SNR>93_LaddrCallback:
line 6:
E121: Undefined variable: b:neomake_loclist_nr
Press ENTER or type command to continue
Error detected while processing function neomake#MakeHandler..<SNR>93_LaddrCallback:
line 6:
E15: Invalid expression: b:neomake_loclist_nr < len(loclist)
#43 brought this up
In some languages, the file name (and directory structure) is significant. For instance, Java requires the class "org.company.MyClass" to be defined in a file at org/company/MyClass.java
. The same goes for Haskell (ghc-mod will refuse to check a file whose name does not end in .hs
or .lhs
, and I am pretty sure that messing with the Haskell naming conventions will break some tools), Python, and probably a lot of other languages.
When g:neomake_make_modified
is set to 1, the name of the file that is actually checked does not (and can not) follow these rules, and thus the "run make on modified buffers" feature will simply not work. I verified this with the ghc-mod checker for Haskell, that simply outputs to stderr ghc-mod: target src/Test.hs.1605.neomake.tmp is not a module name or a source file
.
I can foresee other sources of issues: checkers that can only check a whole project at once, issues if :Neomake
and :Neomake!
were to be run concurrently...
I see two options:
Thoughts ?
Is there any possibility of running a check without saving the file? In other words, :Neomake runs the checks on the current buffer in its current state, rather than the last write?
I understand what I am asking for might not be feasible and that the file needs to be saved before it is checked depending on the checker: but maybe a possibility to specify a directory where a temporary file could be copied with the current buffer state, then deleted, and any errors reported in the buffer worked on.
This would be very useful since it would enable me to Neomake the buffer every time I, for example, enter the normal mode, without at the same time seting the buffer to autowrite every time I enter the normal mode.
Signs can be destructive (they will destroy an existing sign for a line before placing one). This should be configurable. Additionally, some people may not want any signs. Also, some people may want to modify the sign text.
Coming from Syntastic, I miss these options:
syntastic_auto_loc_list
- pop open the loc list if any errors existsyntastic_loc_list_height
- control the max height of the loc listsyntastic_check_on_wq
- this prevents a checking delay when trying to quitI would love it if these could be added, or maybe there is a way to achieve all
this already?
Most of the time it cleans them up, but sometimes leaves them around. Probably need a good way to log errors to a file before tracking this down.
Neomake | Syntastic |
---|---|
Font used: terminus
Neomake's marks (defined in autoload/neomake.vim
) are less visible (monochrome), and not well-supported by all fonts & font configs: here they are too small and not centred.
I'd rather have Syntastic-style marks
I wish I could contribute a PR but my vim script skills are non-existent.
I suspect that multiline error messages will not work currently. We may need to join all lines back into a string with newlines before we feed it to the location/quickfix list. We may also need to gather all errors until the job completes before we populate the list for some checkers.
Thanks a lot for doing this, Syntastic's synchronous checking is what made me switch to neovim...
I'm trying to get haskell checking working with ghc-mod
and hlint
. Adapting the Synastic checkers mostly works, but some error messages are missing or end up looking funky.
Here's a sample file:
module Main where
main = return ()
-- | no type binding
toplevel n = n
-- | eta reduce
etared s l = map s l
-- | why not concat map
cm t r = concat $ map t r
The makers:
let g:neomake_haskell_ghcmod_maker = {
\ 'exe': 'ghc-mod',
\ 'args': ['check'],
\ 'errorformat':
\ '%-G%\s%#,' .
\ '%f:%l:%c:%trror: %m,' .
\ '%f:%l:%c:%tarning: %m,'.
\ '%f:%l:%c: %trror: %m,' .
\ '%f:%l:%c: %tarning: %m,' .
\ '%f:%l:%c:%m,' .
\ '%E%f:%l:%c:,' .
\ '%Z%m'
\ }
let g:neomake_haskell_hlint_maker = {
\ 'errorformat':
\ '%E%f:%l:%v: Error: %m,' .
\ '%W%f:%l:%v: Warning: %m,' .
\ '%C%m'
\ }
let g:neomake_haskell_enabled_makers = ['ghcmod', 'hlint']
The checker's output:
$ ghc-mod check test.hs [14:44:29]
test.hs:3:1:Warning: Top-level binding with no type signature: main :: IO ()
test.hs:6:1:Warning: Top-level binding with no type signature: toplevel :: forall t. t -> t
test.hs:9:1:Warning: Top-level binding with no type signature: etared :: forall a b. (a -> b) -> [a] -> [b]
test.hs:12:1:Warning: Top-level binding with no type signature: cm :: forall a a1. (a1 -> [a]) -> [a1] -> [a]
$ hlint test.hs [14:44:32]
test.hs:9:1: Error: Eta reduce
Found:
etared s l = map s l
Why not:
etared = map
test.hs:12:10: Error: Use concatMap
Found:
concat $ map t r
Why not:
concatMap t r
2 suggestions
and finally the location list after running Neomake:
test.hs|9 col 1 error| Eta reduce Found: etared s l = map s l Why not: etared = map
||
test.hs|12 col 10 error| Use concatMap Found: concat $ map t r Why not: concatMap t r
||
|| 2 suggestions
test.hs|3 col 1 warning| Top-level binding with no type signature: main :: IO ()
test.hs|6 col 1 warning| Top-level binding with no type signature:
test.hs|9 col 1 warning| Top-level binding with no type signature:
test.hs|12 col 1 warning| Top-level binding with no type signature:
You can see extra lines , and the "2 suggestions" from HLint's output, while everything after ghc-mod's first suggestion is dropped.
A solution or pointers on how to proceed would be great.
If the neomake_open_list option is disabled it's impossible to see whether there are any errors or warnings in a big file.
So, this is definitely not a bug but rather a request that mimics a bit how :Dispatch works.
You've done a great job and a lot of groundwork for executing arbitrary shell commands and tracking and displaying the results with jobs. In one of my plugins I've been trying to do something similar and I'm ending up writing a lot of the same stuff you have already done.
It would be great to do something like :Neomake do foo bar
and have it work the same way :! do foo bar
or :Dispatch do foo bar
do.
If this is something you're open to I can give it a shot myself instead of doing it in my plugin.
I am trying to use the plugin with pylint checkers and I have some problems.
I am trying to schedule a checker job each time I save my file.
Since I am working on huge python files, it takes 10 second for pylint to do the job. (100% CPU from pylint while working)
If in I do in 1 second:
:w
:w
:w
:w
It will launch and run 4 jobs (4 pylint running => 4 * 100% CPU)
Since I set neomake_serialize to 1 I expected to have only one job running.
Here is my vimrc
let g:neomake_python_enable_makers = ['pylint']
let g:ycm_show_diagnostics_ui = 1
let g:neomake_open_list=1
let g:neomake_serialize_abort_on_error=1
let g:neomake_serialize=1
autocmd BufWritePost *.py :Neomake pylint
Moreover, I was wondering if it was possible to cancel a job when a new job start.
My use case would be:
:w => start pylint (job1)
make some changes
:w => cancel job1 and start pylint (job2)
Maybe I should create an issue for that?
I don't have clear steps to repro this, but it definitely happens to me.
Quoting @Tranquility in #25:
Currently it displays the header line of the ouput as first item in the loclist(|| path,lineNumber,lineNumberEnd,level,message). Syntastic probably does something clever to get rid of this line? Otherwise it works as expected.
When using Syntastic the error message is displayed in the statusbar when the cursor is placed where the error is in the file.
Is it possible to do this with Neomake?
The docs on the difference between g:neomake_<maker>_maker
and g:neomake_<filetype>_<maker>_maker
could be a little easier to scan. Particularly, there should probably be tags at the top to show the reader that both of those configuration styles will be introduced and explained.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.