jupyterlab-lsp icon indicating copy to clipboard operation
jupyterlab-lsp copied to clipboard

Clarify whether formatting is supposed to work in README

Open StefanBrand opened this issue 3 years ago • 3 comments

What I am trying to do...

Format using python-lsp-black

How the project might keep the docs accurate...

After searching around for a while, I just found the relevant line in the Roadmap. I would have rather expected the information that formatting does not work in a known issues section in the README.

My confusion was that the docs link to python-lsp-server, which mentions the python-lsp-black formatter, and formatting in general.


PS.: Up to now we have been using

!pip install -q nb_black
%load_ext lab_black

It formats cells after they have been executed.

StefanBrand avatar Jun 22 '21 15:06 StefanBrand

We do not support formatting yet, but this is on the roadmap. This not "broken" per see - just not implemented yet - which is valid behaviour for an LSP client ;) However this is a good point that we could have a list of features that are implemented or not implemented. We do have a list of implemented features in the readme but it does not list things which are not there yet. Maybe something like: https://github.com/REditorSupport/languageserver#services-implemented (but for client, not server).

krassowski avatar Jun 22 '21 15:06 krassowski

By the way the blocker to implementing it is re-writing the refactoring algorithm to handle multi-line edits, which needs to use cell markers as documented in https://github.com/krassowski/jupyterlab-lsp/issues/467 to keep track of the cell positions; this would be an opt-in for specific languages because it requires us to know what is a valid line comment for specific language.

krassowski avatar Jun 22 '21 15:06 krassowski

@StefanBrand Another alternative; https://github.com/ryantam626/jupyterlab_code_formatter adds a command button - it doesn't use the language server I don't believe but achieves the same effect and supports a few different formatters (black, isort, ...)

@krassowski Yeah I was also confused by this

Greedquest avatar Dec 01 '21 21:12 Greedquest