From b651ff958364ccbfcd006f0f5ec6ca2176037f6c Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Tue, 4 Nov 2025 15:52:39 -0800 Subject: [PATCH] cool --- vscode-extension/.vscode/launch.json | 3 +- vscode-extension/.vscode/tasks.json | 12 ------- vscode-extension/README.md | 49 ++++++++++++++++++++++++++++ vscode-extension/example.sh | 13 ++++++++ vscode-extension/package.json | 5 +-- 5 files changed, 67 insertions(+), 15 deletions(-) create mode 100644 vscode-extension/README.md create mode 100644 vscode-extension/example.sh diff --git a/vscode-extension/.vscode/launch.json b/vscode-extension/.vscode/launch.json index 92a7d04..b3decc9 100644 --- a/vscode-extension/.vscode/launch.json +++ b/vscode-extension/.vscode/launch.json @@ -6,7 +6,8 @@ "type": "extensionHost", "request": "launch", "args": [ - "--extensionDevelopmentPath=${workspaceFolder}" + "--extensionDevelopmentPath=${workspaceFolder}", + "--profile=Shrimp Dev" ], "outFiles": [ "${workspaceFolder}/client/dist/**/*.js", diff --git a/vscode-extension/.vscode/tasks.json b/vscode-extension/.vscode/tasks.json index cca534f..f1998c2 100644 --- a/vscode-extension/.vscode/tasks.json +++ b/vscode-extension/.vscode/tasks.json @@ -14,17 +14,5 @@ "kind": "build", "isDefault": true } - }, - { - "type": "shell", - "label": "bun: watch", - "command": "bun", - "args": ["run", "watch"], - "options": { - "cwd": "${workspaceFolder}" - }, - "problemMatcher": "$tsc-watch", - "isBackground": true } - ] } diff --git a/vscode-extension/README.md b/vscode-extension/README.md new file mode 100644 index 0000000..9c87c8e --- /dev/null +++ b/vscode-extension/README.md @@ -0,0 +1,49 @@ +# Shrimp VSCode Extension + +Language support for Shrimp in VSCode. This README is for probablycorey and defunkt. + +**What it provides:** + +- Syntax highlighting and semantic tokens +- Language server with error diagnostics +- Commands: "Show Parse Tree" (Alt+K Alt+I) and "Show Bytecode" (Alt+K Alt+,) +- `.sh` file association + +## Development Workflow + +**Developing the extension:** + +1. Open `vscode-extension/` in VSCode +2. Run `bun run watch` in a terminal (keeps it compiling as you make changes) +3. Use **Run > Start Debugging** to launch Extension Development Host +4. Make changes to the code +5. Press **Cmd+R** (or Ctrl+R) in the Extension Development Host window to reload +6. Repeat steps 4-5 + +The `.vscode/launch.json` is configured to compile before launching and use a separate "Shrimp Dev" profile. This means you can have the extension installed in your main VSCode while developing without conflicts. + +**Installing for daily use:** + +Run `bun run build-and-install` to build a VSIX and install it in your current VSCode profile. This lets you use the extension when working on Shrimp scripts outside of development mode. + +## Project Structure + +The extension has two parts: a **client** (`client/src/extension.ts`) that registers commands and starts the language server, and a **server** (`server/src/`) that implements the Language Server Protocol for diagnostics and semantic highlighting. + +Both compile to their respective `dist/` folders. + +## Next Steps + +**Autocomplete:** + +- [ ] Identifiers in scope +- [ ] Globals from the prelude (including native functions) +- [ ] Imports +- [ ] Dot-get properties +- [ ] Function argument completion + +**Other features:** + +- [ ] Better syntax coloring +- [ ] Run shortcut - command to execute the current Shrimp file +- [ ] REPL integration diff --git a/vscode-extension/example.sh b/vscode-extension/example.sh new file mode 100644 index 0000000..41e61ba --- /dev/null +++ b/vscode-extension/example.sh @@ -0,0 +1,13 @@ +# This just has some stuff I use to make sure the extension is working! + +like-a-function = do x y z: + echo 'This is a function with parameters: $x, $y, $z' +end + +value = if true: + 'This is true!' +else: + 'This is false!' +end + +echo 'value is $(value)' \ No newline at end of file diff --git a/vscode-extension/package.json b/vscode-extension/package.json index 0dfdac0..e0f53ea 100644 --- a/vscode-extension/package.json +++ b/vscode-extension/package.json @@ -63,10 +63,11 @@ "vscode:prepublish": "bun run package", "compile": "bun run compile:client && bun run compile:server", "compile:client": "bun build client/src/extension.ts --outdir client/dist --target node --format cjs --external vscode", - "compile:server": "bun build server/src/server.ts --outdir server/dist --target node --format cjs --external vscode-languageserver --external vscode-languageserver-textdocument", + "compile:server": "bun build server/src/server.ts --outdir server/dist --target node --format cjs", "watch": "bun run compile:client --watch", "package": "bun run compile:client --minify && bun run compile:server --minify", - "check-types": "tsc --noEmit" + "check-types": "tsc --noEmit", + "build-and-install": "bun run package && bunx @vscode/vsce package --allow-missing-repository && code --install-extension shrimp-*.vsix" }, "dependencies": { "vscode-languageclient": "^9.0.1",