This commit is contained in:
Corey Johnson 2025-11-04 15:52:39 -08:00
parent f3c6f2c032
commit b651ff9583
5 changed files with 67 additions and 15 deletions

View File

@ -6,7 +6,8 @@
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
"--extensionDevelopmentPath=${workspaceFolder}",
"--profile=Shrimp Dev"
],
"outFiles": [
"${workspaceFolder}/client/dist/**/*.js",

View File

@ -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
}
]
}

View File

@ -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

View File

@ -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)'

View File

@ -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",