neomake / neomake

Asynchronous linting and make framework for Neovim/Vim
MIT License
2.66k stars 368 forks source link

run makers constantly after location list opened #2201

Closed dbarrosop closed 5 years ago

dbarrosop commented 5 years ago

Expected behavior

Run makers according to my configuration.

Steps to reproduce

After updating neomake I started noticing this strange behavior where the following events happen (this didn't happen prior to the update):

  1. I have neomake to run only when I write the file: call neomake#configure#automake('w'). I can confirm the configuration with NeomakeInfo:
g:neomake: {
  'automake': {
    'ignore_filetypes': [
      'startify',
    ],
    'events': {
      'BufWritePost': {
        'delay': 0,
      },
    },
  },
}
  1. When I start neovim everything works as expected, I can change the buffer, save, etc. and the makers are triggered on save only. I can verify on the logs that the makers are triggered only on BufWritePost. However, once the makers trigger the location list, neomake starts running the makers on TextChanged as well. I can verify that on the logs with the following line:
10:35:25 [D      ] [-.-:1:1] automake: Buffer was changed (TextChanged), restarting make: 3.

Output from (verbose) NeomakeInfo

Neomake debug information

Async support: 1 Current filetype: python Windows: 0 [shell, shellcmdflag, shellslash]:['/bin/zsh', '-c', 0]

Enabled makers

For the current filetype ("python", used with :Neomake):

For the project (used with :Neomake!):

Default maker settings:

Settings
New-style (dict, overrides old-style)
g:neomake: {
  'automake': {
    'ignore_filetypes': [
      'startify',
    ],
    'events': {
      'BufWritePost': {
        'delay': 0,
      },
    },
  },
}
b:neomake: unset
Old-style
g:neomake_ctags_maker = {'postprocess': function('PostprocessLintMaker'), 'args': ['-R', '--extra=+f', '--exclude=napalm_yang/models', '--exclude=vendor', '--exclude=.glide', '--exclude=.tox', '--exclude=*/modernizr.min.js', '.'], 'exe': 'ctags', 'append_file': 0}
g:neomake_open_list = 2
g:neomake_place_signs = 1
g:neomake_python_enabled_makers = ['python', 'pylama', 'mypy']
g:neomake_python_pylama_maker = {'postprocess': function('neomake#makers#ft#python#PylamaEntryProcess'), 'errorformat': '%f:%l:%c: [%t] %m', 'args': ['--format', 'parsable']}

makeprg=make

:version

NVIM v0.3.1
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/local/Homebrew/Library/Homebrew/shims/mac/super/clang -Wconversion -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -I/tmp/neovim-20180831-45030-1c6df1y/neovim-0.3.1/build/config -I/tmp/neovim-20180831-45030-1c6df1y/neovim-0.3.1/src -I/usr/local/include -I/usr/local/opt/gettext/include -I/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include -I/tmp/neovim-20180831-45030-1c6df1y/neovim-0.3.1/build/src/nvim/auto -I/tmp/neovim-20180831-45030-1c6df1y/neovim-0.3.1/build/include
Compiled by brew@Mojave.local

Features: +acl +iconv +jemalloc +tui 
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/Cellar/neovim/0.3.1/share/nvim"

Run :checkhealth for more info

:messages

Already well formatted, good job. (took 0.0065s)
"napalm_yang_validator/validator.py" 10L, 250C written
Already well formatted, good job. (took 0.0060s)
"napalm_yang_validator/validator.py" 10L, 250C written
Already well formatted, good job. (took 0.0066s)
"napalm_yang_validator/validator.py" 10L, 250C written
Cannot parse: 10:0:             root.parse_config(profile, native)
"napalm_yang_validator/validator.py" 10L, 254C written
Already well formatted, good job. (took 0.0057s)
"napalm_yang_validator/validator.py" 10L, 250C written
Copied Neomake info to clipboard ("+).
Cannot parse: 10:0:             root.parse_config(profile, native)
"napalm_yang_validator/validator.py" 10L, 254C written
dbarrosop commented 5 years ago

Also, if I try to configure to run neomake on "TextChanged" with a delay, the option seems to be ignored (or at least it's run nonetheless immediately)

dbarrosop commented 5 years ago

Reverting to "Dec 13, 2018" seems to fix the issue.

blueyed commented 5 years ago

I've refactored list processing recently, and just fixed two issues with it. I still plan to improve/fix "re-use list with automake".

So please first try current master, and if it still fails, please consider git-bisecting it to a specific commit.

Also please provide the actual debug log.

(will investigate later, but any additional info would help me already)

blueyed commented 5 years ago

automake: Buffer was changed (TextChanged), restarting make: 3.

Looks like this autocommand might not be cleared properly - it is meant to abort the make from BufWritePost in case you edit/change the file while the buffer is running.

What is :au TextChanged and :au TextChangedI when this happens?

blueyed commented 5 years ago

Could reproduce it, will hopefully push a fix shortly.

blueyed commented 5 years ago

The problem is that the make info gets not cleaned properly (w:neomake_make_ids is not cleaned). It is not really easy to reproduce, but have an idea about how to fix it.

blueyed commented 5 years ago

Figured it out finally. It was related to make info not properly cleaned on cancellation with serialized jobs (the python maker is one of those).

2208 should fix it.

blueyed commented 5 years ago

Thanks for the report, that was a tricky one.

dbarrosop commented 5 years ago

Thanks to you for the quick response and the fix :)