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

Consider modifying ALE integration to use FindExecutable #14

Open
oatkiller opened this issue Apr 9, 2019 · 5 comments
Open

Consider modifying ALE integration to use FindExecutable #14

oatkiller opened this issue Apr 9, 2019 · 5 comments

Comments

@oatkiller
Copy link

Thanks for making this tool
I'm using gqlint with a local installation (in my current JS project)
ALE is not able to find the executable, as the ALE integration expects gqlint to be available on the path.
Would you consider allowing a change to the ALE integration to use ale#node#FindExecutable
Other linters that are installed using npm frequently do this.
Here are a few links showing configurations using ale#node#FindExecutable

And here is the relevant source code:
https://github.com/w0rp/ale/blob/master/autoload/ale/node.vim#L10

In the mean time, I'm going to try modifying the plugin locally w/ that code to see if it works as I expect. Thanks

@oatkiller
Copy link
Author

I tried locally replacing this file: "https://github.com/w0rp/ale/blob/883978ece93bd19250d6d7e8b9659b48f23522e2/ale_linters/graphql/gqlint.vim"
w/ the below:

" Author: Michiel Westerbeek <[email protected]>
" Description: Linter for GraphQL Schemas

call ale#Set('graphql_gqlint_executable', 'gqlint')
call ale#Set('graphql_gqlint_use_global', get(g:, 'ale_use_global_executables', 0))

function! ale_linters#graphql#gqlint#GetCommand(buffer) abort
    return ale#path#BufferCdString(a:buffer)
    \   . '%e'
    \   . ' --reporter=simple %t'
endfunction

call ale#linter#Define('graphql', {
\   'name': 'gqlint',
\   'executable': {b -> ale#node#FindExecutable(b, 'graphql_gqlint', [
\       'node_modules/.bin/gqlint',
\   ])},
\   'command': function('ale_linters#graphql#gqlint#GetCommand'),
\   'callback': 'ale#handlers#unix#HandleAsWarning',
\})

That worked for my use case

@happylinks
Copy link
Owner

Hey, thanks for investigating!
Feel free to create a PR and I’ll test it and merge it :)

Also, curious what rules you are using with gqlint! Is it working nicely for your project?

@aphecetche
Copy link

@oatkiller @happylinks I realize this is an old issue but I'm facing the same one. I'd be ready to make a pull request, but I'm not so sure exactly how/where : to this repo or to ale directly ? How are linters imported into ale repo ?
Thanks,

@happylinks
Copy link
Owner

Probably both repo's, the file in this repo is mostly just to keep track of the latest code in the ale repo.
To be honest, I don't use this repo anymore (not using graphql for my current project). But I can merge and test any PRs.

@aphecetche
Copy link

ok, just for the record, in the end I won't actually make any PR as I moved from ALE to CoC and so far I'm happy with it.
Thanks anyway

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

No branches or pull requests

3 participants