I just started configuring Vim as an IDE, and the first file I launched into was one that happened to use a Virtual Environment.
In my .vimrc, I added ale as my lint engine, and coc as my autocomplete (intellisense) engine. So I entered, and saw there were errors. I exited vim, and then sourced my virtual environment and entered again, and there were still errors. For some reason, though, they were all at the imports.
I've tried:
let g:ale_virtualenv_dir_names = ['env']
in my .vimrcI setup ale's linters and fixers as the following
" ALE vars
let g:ale_disable_lsp = 1
let g:ale_linters = {
\ 'python': ['flake8'],
\ 'javascript': ['eslint'],
\}
let g:ale_fixers = {
\ 'python': ['black'],
\}
let g:ale_fix_on_save = 1
let g:ale_sign_warning = '-!'
let g:ale_virtualenv_dir_names = ['env']
but it still throws the errors
How do I make it warn using my Virtual Environment?
I seem to have fixed it. EDIT: I DID NOT FIX IT
In my .vimrc file, I just needed to indent this code block.
let g:ale_fixers = {
\ 'python': ['black'],
\}
It must have made vim and ale confused and threw errors, especially since I put that before my g:virtualenv_dir_names
variable.
It was all to do with my virtual environments, for some reason. If anyone can explain this to me, I'll be thankful.
I needed to rm -dr
my virtual environment I had before, and then remake and reinstall it.
Hope this helps some of you!