Skip to content

Add PyLS linter#1097

Merged
w0rp merged 5 commits into
dense-analysis:masterfrom
aurieh:master
Nov 8, 2017
Merged

Add PyLS linter#1097
w0rp merged 5 commits into
dense-analysis:masterfrom
aurieh:master

Conversation

@aurieh

@aurieh aurieh commented Nov 8, 2017

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread ale_linters/python/pyls.vim Outdated

function! ale_linters#python#pyls#GetProjectRoot(buffer) abort
" Start with more generic files
for l:possible_filename in ['setup.cfg', 'tox.ini', 'flake8.cfg', 'pycodestyle.cfg']

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend using ale#python#FindProjectRoot here, and you could maybe modify that function so it will look for other configuration files. Then the behavior of searching for Python project roots will be consistent everywhere.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PyLS only checks for that set of files

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could probably use python#FindProjectRoot, but it wouldn't be accurate

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend it. One important difference is that it uses a bread-first search for configuration files instead of depth-first search, so foo/bar/baz/tox.ini will be preferred over foo/setup.cfg.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's a good point. Some people have multiple per-module configs.
I'll just add more filenames to python#FindProjectRoot.

Add more config types to ale#python#FindProjectRoot
\ 'lsp': 'stdio',
\ 'executable_callback': 'ale_linters#python#pyls#GetExecutable',
\ 'command_callback': 'ale_linters#python#pyls#GetExecutable',
\ 'language_callback': 'ale_linters#python#pyls#GetLanguage',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add support at some point for just writing 'language': 'python'. I can see that coming up quite a bit.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that would be nice. Is there anything else I should do?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah, it's fine.

" Author: aurieh <me@aurieh.me>
" Description: A language server for Python

call ale#Set('python_pyls_executable', 'pyls')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just noticed one thing missing, could you add a documentation entry for this new option?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh sure, one second.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On that note, is there a vim plugin that helps with doc file alignment? Doing it by hand is kinda confusing.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a fixer for it. See :ALEFixSuggest when editing a help file.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh that's really cool, thanks for letting me know.

Comment thread doc/ale-python.txt Outdated
Type: |String|
Default: `pyls`

See |ale-intergrations-local-executables|

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

woops, that's a typo, Imma rebase this

@w0rp w0rp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, looks good.

@w0rp w0rp merged commit 8a4cf92 into dense-analysis:master Nov 8, 2017
@w0rp

w0rp commented Nov 8, 2017

Copy link
Copy Markdown
Member

Cheers! 🍻

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

Successfully merging this pull request may close these issues.

2 participants