-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Errors when using ALEGetStatusLine() with airline #71
Comments
I tried to repeat this myself with vim-airline, but I haven't had any luck so far. I did install airline for the first time in the process, which seems pretty cool. @KabbAmine Do you want to have a look at this? I find the error there to be strange, as if something is deleting the function. |
@w0rp Yeah, I'll check it when I will be at home. |
@deathmaz Ok, tried with a minimal vimrc + ale + vim-airline and no issue so far. vim -Nu <(cat << EOF
set rtp+=~/.vim/plugs/ale
set rtp+=~/.vim/plugs/vim-airline/
set rtp+=~/.vim/plugs/vim-airline-themes/
filetype plugin indent on
syntax enable
set laststatus=2
let g:airline_section_error = '%{ALEGetStatusLine()}'
EOF) If the issue still occur, please provide a link to your configuration. |
I found the problem |
Ah, this is a configuration issue then. If you have only enabled ALE for those file types, the function won't exist for the other file types. You'll have to write an expression which checks if the function exists. This might do the trick, but I haven't tested it: let g:airline_section_error = '%{exists("ALEGetStatusLine") ? ALEGetStatusLine() : ""}' |
If I remember well, there is a specific syntax for conditions in airline API, just check the doc. There are plenty ways to solve your issue, choose the one you want:
function ALE() abort
return exists('*ALEGetStatusLine') ? ALEGetStatusLine() : ''
endfunction
let g:airline_section_error = '%{ALE()}'
|
Thank you guys for helping me with this! 👍 function ALE() abort
return exists('*ALEGetStatusLine') ? ALEGetStatusLine() : ''
endfunction
let g:airline_section_error = '%{ALE()}' |
@deathmaz Using airline helpers, it will look like: call airline#parts#define_function('ALE', 'ALEGetStatusLine')
call airline#parts#define_condition('ALE', 'exists("*ALEGetStatusLine")')
let g:airline_section_error = airline#section#create_right(['ALE']) @w0rp The code above should be included on the README (FAQ maybe?) |
Thanks! Sorry for bothering with not ale specific problems |
This could go in an FAQ. I'll probably put it in one eventually. Thanks for the info! |
That would be my bug. I echoed where we need to return. The function was renamed to |
Return in the statusline compatibility function, fixing #71
Great, thank you! |
It seems that `ALEGetStatusLine` became deprecated. Instead, I can use `lightline-ale`. See also: - dense-analysis/ale#71 (comment) - https://sinshutu-kibotu.hatenablog.jp/entry/2018/06/24/025319 - https://github.com/maximbaz/lightline-ale
I just ran into something similar and this fixed it for me |
Hi @w0rp, I may be wrong but I noticed that when i'm using ALEGetStatusLine() function with airline like this:
let g:airline_section_error = '%{ALEGetStatusLine()}'
then it works good for file types for which i have installed linters, but for other filetypes it throws errors:
I made a screencast with the actual behaviour https://asciinema.org/a/abbk4amukbzrvmgskyjesusd1
The text was updated successfully, but these errors were encountered: