Skip to content
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

Remove/replace check for 'set_balloons' in ale#balloon#MessageForPos #2697

Open
tsony-tsonev opened this issue Aug 13, 2019 · 2 comments
Open

Comments

@tsony-tsonev
Copy link

These days many projects support balloons which is awesome, but they are all overriding the set balloonexpr=...
for example:
vim-go - go#tool#DescribeBalloon()
ale - ale#balloon#Expr()
also I have my own custom balloon logic for previewing folds.

It would be nice if ale#balloon#MessageForPos can return messages without checking
let g:ale_set_balloons = 1 because it will override the set balloonexpr=... (maybe some other variable can be introduced)

This way we'll be able to write our own balloonexpr func and choose when to show contents of folds, when linter warnings and when golang definitons.

@tsony-tsonev
Copy link
Author

The following work around works but it is quite ugly:

    let l:loclist = get(g:ale_buffer_info, v:beval_bufnr, {'loclist': []}).loclist
    let l:index = ale#util#BinarySearch(l:loclist, v:beval_bufnr, v:beval_lnum, v:beval_col)

     if l:index >= 0
         return l:loclist[l:index].text
     endif

basically the same thing from the method just replacing a:bufnr, a:lnum, a:col with v:beval_bufnr, v:beval_lnum, v:beval_col

@w0rp
Copy link
Member

w0rp commented Aug 23, 2019

Avoiding breaking changes is always my top priority. I think the general idea here is good. I'm happy to document ale#balloon#MessageForPos(bufnr, lnum, col) as a public part of ALE's API. I think we should preserve the existing behaviour and support the new use case by implementing support for setting g:ale_set_balloons to a value like 'custom_balloonexpr', or whatever String makes sense.

It's important that users be able to disable balloons while ALE is running, without resetting balloonexpr, by setting g:ale_set_balloons or b:ale_set_balloons to 0, primarily for supporting the buffer variable version with ftplugin file settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants