1

I'm using flake8 to check my code with ale plugin. I found a way to make it work with Python 3, but it seems it does not recognize Cython file (.pyx) even if we set as follows.

let g:ale_linters = {
\   'cython': ['flake8']
\}

I also tried

let g:ale_command_wrapper = "source activate py36; %* --filetype=*.py,*.pyx "

Is there any way to set it?

  • Flake8 isn't supported for PyRex/Cython files. See :help ale or the README which lists all the supported linters. You'll have to make a PR to Ale to add it (which is actually pretty easy to do!) – Martin Tournoij Aug 22 '18 at 11:03
0

I have never worked on cython, so really don't know if it has a different syntax or something. If the syntax is the same as python, it should be as easy as telling vim to interpret the cython file as a normal python file:

:set filetype=python

Also, instead of setting the filetype on each file, you can define an autocommand in your vimrc as follows:

autocommand BufEnter *.pyx setlocal filetype=python
  • Thanks for your comment. Yes, Cython has slightly different syntax from normal Python, and the problem is my syntax highlighter recognizes *.pyx (pyrex) files. If I change the filetype, it works for ALE but highlighting is gone. – user2978524 Aug 19 '18 at 10:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.