Coder Social home page Coder Social logo

Comments (15)

TomLXXVI avatar TomLXXVI commented on June 1, 2024 2

The first line of each code cell in my notebooks is now underlined with a curly line. When hovering over it, the message appears that there are too many blank lines. See this screenshot:
screenshot2

from jupyterlab-lsp.

TomLXXVI avatar TomLXXVI commented on June 1, 2024 1

screenshot

from jupyterlab-lsp.

krassowski avatar krassowski commented on June 1, 2024

There is no python-markdown server, I but apparently the UI might be confusing there. More likely it is suggesting installation of a Markdown server. Can you post a screenshot?

from jupyterlab-lsp.

krassowski avatar krassowski commented on June 1, 2024

There above it says that Markdown is missing ;) It says python-markdown in the tooltip because a markdown document is embedded in a Python notebook.

Though I guess the statusbar item should be less verbose.

from jupyterlab-lsp.

TomLXXVI avatar TomLXXVI commented on June 1, 2024

In earlier versions there was no message saying that a markdown server was missing. Also, now the python lsp server complains that there are too many blank lines between code lines. I suppose this is because it doesn't see the markdown cells?

from jupyterlab-lsp.

krassowski avatar krassowski commented on June 1, 2024

In earlier versions there was no message saying that a markdown server was missing

Oh yeah, this is a new feature since JupyterLab 4+ compatible versions. Previously there was no support for Markdown cells. Now you can get syntax errors, grammar checks etc when you have a suitable server installed.

Also, now the python lsp server complains that there are too many blank lines between code lines. I suppose this is because it doesn't see the markdown cells?

No, that would be unrelated. Can you post a specific example?

from jupyterlab-lsp.

grzegorz700 avatar grzegorz700 commented on June 1, 2024

The first line of each code cell in my notebooks is now underlined with a curly line. When hovering over it, the message appears that there are too many blank lines. See this screenshot: screenshot2

The above error is discussed in the other issue, #1054 . Very irritating code highlighting.

from jupyterlab-lsp.

echarles avatar echarles commented on June 1, 2024

Now you can get syntax errors, grammar checks etc when you have a suitable server installed.

Is there such a LSP server for markdown? On https://jupyterlab-lsp.readthedocs.io/en/latest/Language%20Servers.html it is suggested to use unified-language-server, installable as dev dependcy with npm/yarn. This would mean a rebuild of jupyterlab, right? Any other solution (the ideal would be a python markdown lsp sever).

from jupyterlab-lsp.

echarles avatar echarles commented on June 1, 2024

@krassowski Just read on the doc

If you wish to install these someplace else, you may need to specify where you install them with extra_node_roots.

I have added that trait to my server --LanguageServerManagerAPI.extra_node_roots=<absolute_path> with various variant of the absolute path (the folder where node_module is, the node_module folder, the unified-language-server folder) without luck.

from jupyterlab-lsp.

krassowski avatar krassowski commented on June 1, 2024

Is there such a LSP server for markdown?

@echarles yes, unified-language-server works for markdown. There are probably other Markdown language servers, we should have a look to see if there is a good one which does not require Node.js (there was not one back when I looked few years ago).

This would mean a rebuild of jupyterlab, right?

No, this is not required.

various variant of the absolute path (the folder where node_module is, the node_module folder, the unified-language-server folder) without luck.

It might be that a new version of unified-language-server does not work. On CI we are testing "^0.3.0". In general the heuristic search for npm servers is defined here:

def find_node_module(self, *path_frag):
"""look through the node_module roots to find the given node module"""
all_roots = self.extra_node_roots + self.node_roots
found = None
for candidate_root in all_roots:
candidate = pathlib.Path(candidate_root, "node_modules", *path_frag)
self.log.debug("Checking for %s", candidate)
if candidate.exists():
found = str(candidate)
break
if found is None: # pragma: no cover
self.log.debug(
"{} not found in node_modules of {}".format(
pathlib.Path(*path_frag), all_roots
)
)
return found

so running with --debug you should see which paths get checked. For unified-language-server it searches for:

class UnifiedLanguageServer(NodeModuleSpec):
node_module = key = "unified-language-server"
script = ["src", "server.js"]
args = ["--parser=remark-parse", "--stdio"]

from jupyterlab-lsp.

echarles avatar echarles commented on June 1, 2024

we should have a look to see if there is a good one which does not require Node.js (there was not one back when I looked few years ago).

I quickly looks for python ones but did not find. @fcollonval pointed me to the vscode (nodejs) one https://github.com/microsoft/vscode/tree/main/extensions/markdown-language-features/server which would require additional config as documented on https://jupyterlab-lsp.readthedocs.io/en/latest/Configuring.html#language-servers

. On CI we are testing "^0.3.0". In...
so running with --debug you should see which paths get checked. For unified-language-server it searches for

Pinning and pointing to the folder above the node_modules made it work but clicking on TAB in a markdown cell or document does nothing...

Screenshot from 2024-05-15 10-43-02

Screenshot from 2024-05-15 10-42-48

from jupyterlab-lsp.

echarles avatar echarles commented on June 1, 2024

When I click on TAB in a Markdown content, I see the following log, but nothing shows up (btw the LSP autocomplete for python works fine).

[D 2024-05-15 10:49:48.393 ServerApp] [unified-language-server] Handling a message

from jupyterlab-lsp.

krassowski avatar krassowski commented on June 1, 2024

When I click on TAB in a Markdown content

Not every language serer implements Tab completion. unified-language-server implements spell checking via linting (textDocument/publishDiagnostics), and two requests which jupyterlab-lsp does not yet support (textDocument/codeAction and textDocument/formatting - although I had code actions running locally) - the list of what they implement is here: https://github.com/unifiedjs/unified-language-server?tab=readme-ov-file#requests

from jupyterlab-lsp.

krassowski avatar krassowski commented on June 1, 2024

The VScode one does implement completions but only for links as per https://github.com/microsoft/vscode/tree/main/extensions/markdown-language-features/server#server-capabilities

from jupyterlab-lsp.

echarles avatar echarles commented on June 1, 2024

Thx a lot @krassowski for the explanation. I get indeed spell check working and may try later the vscode one for completion.

Screenshot from 2024-05-15 11-09-55

from jupyterlab-lsp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.