diff --git a/examples/fountain-extension/package-lock.json b/examples/fountain-extension/package-lock.json index 2106689a..bdf6386f 100644 --- a/examples/fountain-extension/package-lock.json +++ b/examples/fountain-extension/package-lock.json @@ -983,9 +983,9 @@ } }, "node_modules/minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dependencies": { "brace-expansion": "^1.1.7" }, @@ -2413,9 +2413,9 @@ "dev": true }, "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "requires": { "brace-expansion": "^1.1.7" } diff --git a/examples/fountain-extension/src/server.py b/examples/fountain-extension/src/server.py index 646e02c2..94e07183 100644 --- a/examples/fountain-extension/src/server.py +++ b/examples/fountain-extension/src/server.py @@ -3,12 +3,7 @@ from lsprotocol.types import TEXT_DOCUMENT_COMPLETION from lsprotocol.types import (CompletionItem, CompletionParams, CompletionList, CompletionOptions) -# The following imports are required for the glue code in 'server.ts' -import json -from pygls.protocol import deserialize_message - server = LanguageServer("foutain-language-server", "v0.1") -server.start_pyodide() CHARACTER = re.compile(r"^[A-Z][A-Z ]+$", re.MULTILINE) diff --git a/examples/fountain-extension/src/server.ts b/examples/fountain-extension/src/server.ts index 6c9e3357..256f716d 100644 --- a/examples/fountain-extension/src/server.ts +++ b/examples/fountain-extension/src/server.ts @@ -1,4 +1,4 @@ -importScripts("https://cdn.jsdelivr.net/pyodide/v0.20.0/full/pyodide.js") +importScripts("https://cdn.jsdelivr.net/pyodide/v0.21.3/full/pyodide.js") /* @ts-ignore */ import * as languageServer from "./server.py"; @@ -19,17 +19,19 @@ async function initPyodide() { /* @ts-ignore */ let pyodide = await loadPyodide({ - indexURL: "https://cdn.jsdelivr.net/pyodide/v0.20.0/full/" + indexURL: "https://cdn.jsdelivr.net/pyodide/v0.21.3/full/" }) console.log("Installing dependencies.") await pyodide.loadPackage(["micropip"]) await pyodide.runPythonAsync(` + import json import sys import micropip + await micropip.install('pygls') - # Uncomment to use a local build of pygls + # Uncomment to use a local build of pygls -- see README for details. # await micropip.install('https://xxx.loca.lt/out/pygls--py3-none-any.whl') `) @@ -37,7 +39,11 @@ async function initPyodide() { // Patch stdout to redirect the output. pyodide.globals.get('sys').stdout.write = patchedStdout - await pyodide.runPythonAsync(languageServer) + await pyodide.runPythonAsync(` +${languageServer} + +server.start_pyodide() +`) return pyodide } @@ -55,7 +61,7 @@ onmessage = async (event) => { await pyodide.runPythonAsync(` from js import client_message - message = json.loads(client_message, object_hook=deserialize_message) + message = json.loads(client_message, object_hook=server.lsp._deserialize_message) server.lsp._procedure_handler(message) `) }