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

Activate Jupyterlab-lsp within my extension

Open fcxjlsw05 opened this issue 2 years ago • 3 comments

I am currently building an extension which includes components hosting code mirror editor (@jupyterlab/codemirror). 7hNUvKhonTGGbLJ According to the doc https://github.com/jupyter-lsp/jupyterlab-lsp/blob/master/docs/Extending.ipynb, I thought jupyterlap-lsp should be supported by default. But it turns out not. If I press tab outside my extension(just open the file in document widget), jupyterlab-lsp is activated GzSgQDzFHnD38Qg

Reading through the document, I don't find a solution how to integrate jupyterlab-lsp with my extension.

Any hint what I should do here?

fcxjlsw05 avatar Mar 09 '22 01:03 fcxjlsw05

This would be... Not very easy today. You'd need to mirror the adapter machinery for Editor or Notebook from this repo.

It's a bit of a yak shave: we'd probably want to demonstrate this with another core widget, e.g. the settings JSON editor, but would want in-browser language servers.

bollwyvl avatar Mar 09 '22 01:03 bollwyvl

Thanks for the interest!

If your widget implements IDocumentWidget<FileEditor> interface, and you have a tracker implementing IWidgetTracker<IDocumentWidget<FileEditor>> interface you could re-use the registration code linked below:

https://github.com/jupyter-lsp/jupyterlab-lsp/blob/0cff6b9cd7dab4d44f877cf7bacc91bf72c6ec4e/packages/jupyterlab-lsp/src/adapters/file_editor/index.ts#L1-L43

I think we do not export FileEditorAdapter, but we can include it in the roadmap for the 4.0 version (https://github.com/jupyter-lsp/jupyterlab-lsp/issues/742). The interface of ILSPAdapterManager will likely be subject to some changes in 4.0 too.

krassowski avatar Mar 09 '22 01:03 krassowski

Thanks for quick response! It will be great if we could get it work soon. I will seek a work-around for now

fcxjlsw05 avatar Mar 09 '22 18:03 fcxjlsw05