diff --git a/pylsp/plugins/autopep8_format.py b/pylsp/plugins/autopep8_format.py index f62443f6..192174c8 100644 --- a/pylsp/plugins/autopep8_format.py +++ b/pylsp/plugins/autopep8_format.py @@ -9,13 +9,13 @@ log = logging.getLogger(__name__) -@hookimpl(tryfirst=True) # Prefer autopep8 over YAPF +@hookimpl def pylsp_format_document(config, document): log.info("Formatting document %s with autopep8", document) return _format(config, document) -@hookimpl(tryfirst=True) # Prefer autopep8 over YAPF +@hookimpl def pylsp_format_range(config, document, range): # pylint: disable=redefined-builtin log.info("Formatting document %s in range %s with autopep8", document, range) diff --git a/pylsp/plugins/yapf_format.py b/pylsp/plugins/yapf_format.py index 6728007b..22a9334a 100644 --- a/pylsp/plugins/yapf_format.py +++ b/pylsp/plugins/yapf_format.py @@ -10,12 +10,12 @@ log = logging.getLogger(__name__) -@hookimpl +@hookimpl(tryfirst=True) # Prefer YAPF over autopep8 def pylsp_format_document(document): return _format(document) -@hookimpl +@hookimpl(tryfirst=True) # Prefer YAPF over autopep8 def pylsp_format_range(document, range): # pylint: disable=redefined-builtin # First we 'round' the range up/down to full lines only range['start']['character'] = 0