Skip to content
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

Fixed broken Julia LSP support + fixed broken MarkDown LSP support #1101

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions atest/suites/07_Configuration.robot
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ Markdown
Settings Should Change Editor Diagnostics
... Markdown
... example.md
... unified-language-server
... {"unified-language-server":{"remark-parse":{"plugins":[["#remark-retext","#parse-latin"],["#retext-spell","#dictionary-en"]]}}}
... vscode-markdown-languageserver
... {"vscode-markdown-languageserver":{}}
... `Color` is misspelt
... `Colour` is misspelt

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
"sql-language-server": "^1.2.1",
"typescript": "~5.0.3",
"typescript-language-server": "^4.3.3",
"unified-language-server": "^0.3.0",
"vscode-css-languageserver-bin": "^1.4.0",
"vscode-html-languageserver-bin": "^1.4.0",
"vscode-json-languageserver-bin": "^1.0.1",
"vscode-json-languageservice": "^4.1.8",
"vscode-markdown-languageserver": "^0.5.0-alpha.8",
"yaml-language-server": "^1.0.0",
"yarn-berry-deduplicate": "^6.1.1"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/jupyterlab-lsp/src/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export type TLanguageServerId =
| 'bash-language-server'
| 'dockerfile-language-server-nodejs'
| 'javascript-typescript-langserver'
| 'unified-language-server'
| 'vscode-markdown-languageserver'
| 'vscode-css-languageserver-bin'
| 'vscode-html-languageserver-bin'
| 'vscode-json-languageserver-bin'
Expand Down
5 changes: 3 additions & 2 deletions python_packages/jupyter_lsp/jupyter_lsp/specs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from .sql_language_server import SQLLanguageServer
from .texlab import Texlab
from .typescript_language_server import TypescriptLanguageServer
from .unified_language_server import UnifiedLanguageServer
from .vscode_markdown_languageserver import VSCodeMarkdownLanguageServer
from .vscode_css_languageserver import VSCodeCSSLanguageServer
from .vscode_html_languageserver import VSCodeHTMLLanguageServer
from .vscode_json_languageserver import VSCodeJSONLanguageServer
Expand All @@ -28,7 +28,8 @@
jedi = JediLanguageServer()
json = VSCodeJSONLanguageServer()
julia = JuliaLanguageServer()
md = UnifiedLanguageServer()
md = VSCodeMarkdownLanguageServer()

py_palantir = PalantirPythonLanguageServer()
py_lsp_server = PythonLSPServer()
pyright = PyrightLanguageServer()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

class BashLanguageServer(NodeModuleSpec):
node_module = key = "bash-language-server"
script = ["out", "cli.js"]
script = [["out", "cli.js"]]
fallback_script = ["bin", "main.js"]
args = ["start"]
languages = ["bash", "sh"]
Expand All @@ -25,7 +25,7 @@ class BashLanguageServer(NodeModuleSpec):
)

def solve(self, mgr: LanguageServerManagerAPI):
new_path = mgr.find_node_module(self.node_module, *self.script)
new_path = mgr.find_node_module(self.node_module, self.script)
if new_path:
return new_path
return mgr.find_node_module(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class DockerfileLanguageServerNodeJS(NodeModuleSpec):
node_module = key = "dockerfile-language-server-nodejs"
script = ["lib", "server.js"]
script = [["lib", "server.js"]]
args = ["--stdio"]
languages = ["dockerfile"]
spec = dict(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class JavascriptTypescriptLanguageServer(NodeModuleSpec):
node_module = key = "javascript-typescript-langserver"
script = ["lib", "language-server-stdio.js"]
script = [["lib", "language-server-stdio.js"]]
languages = [
"javascript",
"jsx",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from .config import load_config_schema
from .utils import ShellSpec

import os

class JuliaLanguageServer(ShellSpec):
key = "julia-language-server"
Expand All @@ -10,9 +10,10 @@ class JuliaLanguageServer(ShellSpec):
"--project=.",
"-e",
"using LanguageServer, LanguageServer.SymbolServer; runserver()",
".",
os.getcwd()
]
is_installed_args = [
"--project=.",
"-e",
'print(if (Base.find_package("LanguageServer") === nothing) "" else "yes" end)',
]
Expand Down
2 changes: 1 addition & 1 deletion python_packages/jupyter_lsp/jupyter_lsp/specs/pyright.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class PyrightLanguageServer(NodeModuleSpec):
node_module = key = "pyright"
script = ["langserver.index.js"]
script = [["langserver.index.js"]]
args = ["--stdio"]
languages = ["python"]
spec = dict(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class SQLLanguageServer(NodeModuleSpec):
"""Supports mysql, postgres and sqlite3"""

node_module = key = "sql-language-server"
script = ["dist", "bin", "cli.js"]
script = [["dist", "bin", "cli.js"]]
languages = [
"sql",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class TypescriptLanguageServer(NodeModuleSpec):
node_module = key = "typescript-language-server"
script = ["lib", "cli.mjs"]
script = [["lib", "cli.mjs"]]
args = ["--stdio"]
languages = [
"javascript",
Expand Down
2 changes: 1 addition & 1 deletion python_packages/jupyter_lsp/jupyter_lsp/specs/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def is_installed(self, mgr: LanguageServerManagerAPI) -> bool:
return bool(node_module)

def solve(self, mgr: LanguageServerManagerAPI):
return mgr.find_node_module(self.node_module, *self.script)
return mgr.find_node_module(self.node_module, self.script)

def __call__(self, mgr: LanguageServerManagerAPI) -> KeyedLanguageServerSpecs:
node_module = self.solve(mgr)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class VSCodeCSSLanguageServer(NodeModuleSpec):
node_module = key = "vscode-css-languageserver-bin"
script = ["cssServerMain.js"]
script = [["cssServerMain.js"]]
args = ["--stdio"]
languages = ["css", "less", "scss"]
spec = dict(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class VSCodeHTMLLanguageServer(NodeModuleSpec):
node_module = key = "vscode-html-languageserver-bin"
script = ["htmlServerMain.js"]
script = [["htmlServerMain.js"]]
args = ["--stdio"]
languages = ["html"]
spec = dict(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class VSCodeJSONLanguageServer(NodeModuleSpec):
node_module = key = "vscode-json-languageserver-bin"
script = ["jsonServerMain.js"]
script = [["jsonServerMain.js"]]
args = ["--stdio"]
languages = ["json"]
spec = dict(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
from .utils import NodeModuleSpec


class UnifiedLanguageServer(NodeModuleSpec):
node_module = key = "unified-language-server"
script = ["src", "server.js"]
args = ["--parser=remark-parse", "--stdio"]
class VSCodeMarkdownLanguageServer(NodeModuleSpec):
node_module = key = "vscode-markdown-languageserver"
script = [["dist","node","workerMain.js"]]
args = ["--stdio"]
languages = ["markdown", "ipythongfm", "gfm"]
spec = dict(
display_name=key,
mime_types=["text/x-gfm", "text/x-ipythongfm", "text/x-markdown"],
urls=dict(
home="https://github.com/unifiedjs/{}".format(key),
issues="https://github.com/unifiedjs/{}/issues".format(key),
home="https://github.com/microsoft/{}".format(key),
issues="https://github.com/microsoft/{}/issues".format(key),
),
install=dict(
npm="npm install --save-dev {}".format(key),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class YAMLLanguageServer(NodeModuleSpec):
node_module = key = "yaml-language-server"
script = ["bin", key]
script = [["bin", key]]
args = ["--stdio"]
languages = ["yaml"]
spec = dict(
Expand Down
2 changes: 1 addition & 1 deletion python_packages/jupyter_lsp/jupyter_lsp/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
"dockerfile-language-server-nodejs",
"typescript-language-server",
"pylsp",
"unified-language-server",
"sql-language-server",
"vscode-markdown-languageserver",
"vscode-css-languageserver-bin",
"vscode-html-languageserver-bin",
"vscode-json-languageserver-bin",
Expand Down
15 changes: 8 additions & 7 deletions python_packages/jupyter_lsp/jupyter_lsp/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,17 +213,18 @@ class LanguageServerManagerAPI(LoggingConfigurable, HasListeners):
help=_("additional absolute paths to seek node_modules first"),
).tag(config=True)

def find_node_module(self, *path_frag):
def find_node_module(self, node_module, alternatives):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this constitutes a breaking change as language specs inheriting from NodeModuleSpec will no longer work. One way to add it in backward compatible way would be to add a new method with new signature and make the old method call the new one.

"""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
for path_frag in alternatives:
for candidate_root in all_roots:
candidate = pathlib.Path(candidate_root, "node_modules", node_module, *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(
Expand Down
2 changes: 1 addition & 1 deletion python_packages/jupyter_lsp/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jupyter_lsp_spec_v1 =
texlab = jupyter_lsp.specs:tex
typescript-language-server = jupyter_lsp.specs:ts
sql-language-server = jupyter_lsp.specs:sql
unified-language-server = jupyter_lsp.specs:md
vscode-markdown-languageserver = jupyter_lsp.specs:md
vscode-css-languageserver-bin = jupyter_lsp.specs:css
vscode-html-languageserver-bin = jupyter_lsp.specs:html
vscode-json-languageserver-bin = jupyter_lsp.specs:json
Expand Down
Loading
Loading