Ale: Possible issue with python lint: delay and loss respond

Created on 17 May 2017  Â·  7Comments  Â·  Source: dense-analysis/ale

I met a problem which is caused by ale with vim sticking here and losing respond when editing a python script on macOS. I suspect that the cause of this problem is finding the linter that available. I am sorry that I didn't get enough clue. To be honest it is very troublesome to deal with that case.

I just installed flake8 to enable it. Every time opens, vim lose respond for a long time.
The relevant settings list below:

Current Filetype: python
Available Linters: ['flake8', 'mypy', 'pylint']
Enabled Linters: ['flake8’, ‘mypy, ‘pylint’]
Linter Variables:
let g:ale_python_flake8_executable = '/usr/local/bin/python3'
let g:ale_python_flake8_options = '-m flake8'
let g:ale_python_flake8_use_global = 0

After defining the linter manually, the problem solved.

Current Filetype: python
Available Linters: ['flake8', 'mypy', 'pylint']
Enabled Linters: ['flake8']
Linter Variables:

let g:ale_python_flake8_executable = '/usr/local/bin/python3'
let g:ale_python_flake8_options = '-m flake8'
let g:ale_python_flake8_use_global = 0


Maybe it is because ale have to search for the linter and try every possible available instance then invoke it and this operation block vim down. Nevertheless, I didn't find any instruction about this problem in manuals. Is it a problem a feature should be written in the docs? Thanks for your attention.

bug

Most helpful comment

Thanks for the log!

15 20.268069 let l:matches = globpath(l:path, '*/bin/activate', 0, 1)

There's the issue.

All 7 comments

Could you run the profiler and send me the log? See instructions here: http://stackoverflow.com/a/12216578/1836507

Thanks for the log!

15 20.268069 let l:matches = globpath(l:path, '*/bin/activate', 0, 1)

There's the issue.

https://paste.pound-python.org/show/C9922CQLgEFh86lItwAB/
Thanks @zhou13 !
Maybe the problem point looks similar, and that profile should work.

FUNCTION  ale#python#FindVirtualenv()
Called 6 times
Total time:  10.158728
 Self time:  10.156653

count  total (s)   self (s)
   63   0.002843   0.000768     for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h'))
   57             10.154937         let l:matches = globpath(l:path, '*/bin/activate', 0, 1)

   57              0.000296         if !empty(l:matches)
                                        return fnamemodify(l:matches[-1], ':h:h')
                                    endif
   57              0.000084     endfor

    6              0.000015     return ''


Seems like this is the same error

It looks like path globbing will cause some problems, so I just pushed a commit to switch to using a configurable list of directory names for detecting virtualenv paths instead. See :help g:ale_virtualenv_dir_names. The option can be set to an empty List to disable the path searching globally.

This should have been fixed now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lervag picture lervag  Â·  3Comments

aressler38 picture aressler38  Â·  3Comments

garand picture garand  Â·  4Comments

trevordmiller picture trevordmiller  Â·  3Comments

trevordmiller picture trevordmiller  Â·  4Comments