Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

fix: github lsp build script, language server path (#5081)

Akshay Agrawal04a82245b066
diff --git a/lsp/index.ts b/lsp/index.ts
index 35d2a26d5a..c82d8baa8f 100644
--- a/lsp/index.ts
+++ b/lsp/index.ts
@@ -44,12 +44,7 @@ const Logger = {
};
// Adapted from https://github.com/wylieconlon/jsonrpc-ws-proxy
-const COPILOT_LSP_PATH = path.join(
- __dirname,
- "copilot",
- "dist",
- "language-server.js",
-);
+const COPILOT_LSP_PATH = path.join(__dirname, "copilot", "language-server.js");
if (!fsSync.existsSync(COPILOT_LSP_PATH)) {
Logger.error("Compilation artifact does not exist. Exiting.");
process.exit(1);
diff --git a/scripts/buildlsp.sh b/scripts/buildlsp.sh
index ad4be529d9..28ecd230be 100755
--- a/scripts/buildlsp.sh
+++ b/scripts/buildlsp.sh
@@ -1,18 +1,30 @@
#!/bin/sh
+#
+# Builds the copilot lsp, then copies the generated dist/ folder to
+# marimo/_lsp/copilot
+
+# This script should fail if any intermediate step fails
+set -e
cd lsp
if pnpm build; then
echo "Removing old lsp files..."
rm -rf ../marimo/_lsp/
echo "Copying new lsp files..."
- mkdir ../marimo/_lsp
+ mkdir -p ../marimo/_lsp
cp dist/index.cjs ../marimo/_lsp/
# There seems to be a discrepancy between CI and mac for pnpm builds
if [ -d dist/copilot ]; then
+ echo "Copying dist/copilot to _lsp/copilot"
cp -R dist/copilot ../marimo/_lsp/copilot
+ elif [ -d dist/dist ]; then
+ echo "Copying contents of dist/dist/. to _lsp/copilot"
+ cp -R dist/dist/. ../marimo/_lsp/copilot/
else
- mkdir ../marimo/_lsp
- cp -R dist ../marimo/_lsp/copilot
+ echo "Copying the contents of dist/. to _lsp/copilot"
+ # Do NOT place dist as a subdirectory in copilot/, just copy its contents;
+ # the period after dist/ is important here.
+ cp -R dist/. ../marimo/_lsp/copilot/
fi
echo "Compilation succeeded.\n"
else