I have extended vscode with an extension #23
|
|
@ -6,7 +6,7 @@ Language support for Shrimp in VSCode. This README is for probablycorey and defu
|
|||
|
||||
- Syntax highlighting and semantic tokens
|
||||
- Language server with error diagnostics
|
||||
- Commands: "Show Parse Tree" (Alt+K Alt+I) and "Show Bytecode" (Alt+K Alt+,)
|
||||
- Commands: "Show Parse Tree" (Alt+K Alt+I), "Show Bytecode" (Alt+K Alt+,), and "Run File" (Cmd+R)
|
||||
- `.sh` file association
|
||||
|
||||
## Development Workflow
|
||||
|
|
@ -45,5 +45,5 @@ Both compile to their respective `dist/` folders.
|
|||
**Other features:**
|
||||
|
||||
- [ ] Better syntax coloring
|
||||
- [ ] Run shortcut - command to execute the current Shrimp file
|
||||
- [ ] REPL integration
|
||||
- [ ] Bundle shrimp binary with extension (currently uses `shrimp.binaryPath` setting)
|
||||
|
|
|
|||
|
|
@ -69,6 +69,32 @@ export function activate(context: vscode.ExtensionContext) {
|
|||
await vscode.window.showTextDocument(doc, { preview: false })
|
||||
})
|
||||
)
|
||||
|
||||
// Command: Run File
|
||||
context.subscriptions.push(
|
||||
vscode.commands.registerCommand('shrimp.run', async () => {
|
||||
const editor = vscode.window.activeTextEditor
|
||||
if (!editor || editor.document.languageId !== 'shrimp') {
|
||||
vscode.window.showErrorMessage('No active Shrimp file')
|
||||
return
|
||||
}
|
||||
|
||||
// Auto-save before running
|
||||
await editor.document.save()
|
||||
|
||||
// Get binary path from settings
|
||||
const config = vscode.workspace.getConfiguration('shrimp')
|
||||
const binaryPath = config.get<string>('binaryPath', 'shrimp')
|
||||
|
||||
// Get the file path
|
||||
const filePath = editor.document.uri.fsPath
|
||||
|
||||
// Create or show terminal
|
||||
const terminal = vscode.window.createTerminal('Shrimp')
|
||||
terminal.show()
|
||||
terminal.sendText(`${binaryPath} "${filePath}"`)
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
export function deactivate() {}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,16 @@
|
|||
"editor.semanticHighlighting.enabled": true
|
||||
}
|
||||
},
|
||||
"configuration": {
|
||||
"title": "Shrimp",
|
||||
"properties": {
|
||||
"shrimp.binaryPath": {
|
||||
"type": "string",
|
||||
"default": "shrimp",
|
||||
"description": "Path to the shrimp binary"
|
||||
}
|
||||
}
|
||||
},
|
||||
"commands": [
|
||||
{
|
||||
"command": "shrimp.showParseTree",
|
||||
|
|
@ -37,6 +47,10 @@
|
|||
{
|
||||
"command": "shrimp.showBytecode",
|
||||
"title": "Shrimp: Show Bytecode"
|
||||
},
|
||||
{
|
||||
"command": "shrimp.run",
|
||||
"title": "Shrimp: Run File"
|
||||
}
|
||||
],
|
||||
"keybindings": [
|
||||
|
|
@ -49,6 +63,11 @@
|
|||
"command": "shrimp.showBytecode",
|
||||
"key": "alt+k alt+,",
|
||||
"when": "editorLangId == shrimp"
|
||||
},
|
||||
{
|
||||
"command": "shrimp.run",
|
||||
"key": "cmd+r",
|
||||
"when": "editorLangId == shrimp"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user