-
Notifications
You must be signed in to change notification settings - Fork 9
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
Prefer black over other formatter plugins #5
Conversation
Thanks for the PR! I did a bit of research into Definition of hooks in Documentation of Documentation of >>> import logging
>>> logging.basicConfig(level=logging.INFO)
>>> from pyls.config.config import Config
>>> Config('.', {})
WARNING:pyls.config.config:Failed to load pyls entry point 'autopep8': No module named 'autopep8'
WARNING:pyls.config.config:Failed to load pyls entry point 'mccabe': No module named 'mccabe'
WARNING:pyls.config.config:Failed to load pyls entry point 'pycodestyle': No module named 'pycodestyle'
WARNING:pyls.config.config:Failed to load pyls entry point 'pydocstyle': No module named 'pydocstyle'
WARNING:pyls.config.config:Failed to load pyls entry point 'pyflakes': No module named 'pyflakes'
WARNING:pyls.config.config:Failed to load pyls entry point 'rope_completion': No module named 'rope'
WARNING:pyls.config.config:Failed to load pyls entry point 'rope_rename': No module named 'rope'
WARNING:pyls.config.config:Failed to load pyls entry point 'yapf': No module named 'yapf'
INFO:pyls.config.config:Loaded pyls plugin jedi_completion from <module 'pyls.plugins.jedi_completion' from '/Users/rupert/.virtualenvs/pyls/lib/python3.6/site-packages/pyls/plugins/jedi_completion.py'>
INFO:pyls.config.config:Loaded pyls plugin jedi_definition from <module 'pyls.plugins.definition' from '/Users/rupert/.virtualenvs/pyls/lib/python3.6/site-packages/pyls/plugins/definition.py'>
INFO:pyls.config.config:Loaded pyls plugin jedi_highlight from <module 'pyls.plugins.highlight' from '/Users/rupert/.virtualenvs/pyls/lib/python3.6/site-packages/pyls/plugins/highlight.py'>
INFO:pyls.config.config:Loaded pyls plugin jedi_hover from <module 'pyls.plugins.hover' from '/Users/rupert/.virtualenvs/pyls/lib/python3.6/site-packages/pyls/plugins/hover.py'>
INFO:pyls.config.config:Loaded pyls plugin jedi_references from <module 'pyls.plugins.references' from '/Users/rupert/.virtualenvs/pyls/lib/python3.6/site-packages/pyls/plugins/references.py'>
INFO:pyls.config.config:Loaded pyls plugin jedi_signature_help from <module 'pyls.plugins.signature' from '/Users/rupert/.virtualenvs/pyls/lib/python3.6/site-packages/pyls/plugins/signature.py'>
INFO:pyls.config.config:Loaded pyls plugin jedi_symbols from <module 'pyls.plugins.symbols' from '/Users/rupert/.virtualenvs/pyls/lib/python3.6/site-packages/pyls/plugins/symbols.py'>
INFO:pyls.config.config:Loaded pyls plugin pyls_mypy from <module 'pyls_mypy.plugin' from '/Users/rupert/.virtualenvs/pyls/lib/python3.6/site-packages/pyls_mypy/plugin.py'>
INFO:pyls.config.config:Loaded pyls plugin pyls_isort from <module 'pyls_isort.plugin' from '/Users/rupert/.virtualenvs/pyls/lib/python3.6/site-packages/pyls_isort/plugin.py'>
INFO:pyls.config.config:Loaded pyls plugin pyls_black from <module 'pyls_black.plugin' from '/Users/rupert/.virtualenvs/pyls/lib/python3.6/site-packages/pyls_black/plugin.py'>
INFO:pyls.config.config:Disabled plugins: []
<pyls.config.config.Config object at 0x10e9835f8> Since |
That log looks like pyls_black gets loaded last (which may be completely coincidental). If I'm understanding the documentation correctly, that means the hooks that are created here would come first before the others. Anyway, thanks for merging! |
Yes that seems to be the case. I hadn't noticed that the plugins weren't quite alphabetically sorted (from
🤷♂️ |
This adds the tryfirst=True hookimpl argument, similarly to the builtin autopep8 plugin to (try to) ensure black is attempted before other formatters.