I have extended vscode with an extension #23
3
vscode-extension/.vscode/launch.json
vendored
3
vscode-extension/.vscode/launch.json
vendored
|
|
@ -6,7 +6,8 @@
|
|||
"type": "extensionHost",
|
||||
"request": "launch",
|
||||
"args": [
|
||||
"--extensionDevelopmentPath=${workspaceFolder}"
|
||||
"--extensionDevelopmentPath=${workspaceFolder}",
|
||||
"--profile=Shrimp Dev"
|
||||
],
|
||||
"outFiles": [
|
||||
"${workspaceFolder}/client/dist/**/*.js",
|
||||
|
|
|
|||
12
vscode-extension/.vscode/tasks.json
vendored
12
vscode-extension/.vscode/tasks.json
vendored
|
|
@ -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
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
49
vscode-extension/README.md
Normal file
49
vscode-extension/README.md
Normal 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
|
||||
13
vscode-extension/example.sh
Normal file
13
vscode-extension/example.sh
Normal 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)'
|
||||
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user