184 lines
3.9 KiB
Markdown
184 lines
3.9 KiB
Markdown
# Prometeu VS Code Extension
|
|
|
|
VS Code bridge for Prometeu Studio.
|
|
|
|
This extension does **not** start the language server itself. It connects to the Prometeu Studio LSP server running locally.
|
|
|
|
```text
|
|
VS Code Extension
|
|
-> vscode-languageclient
|
|
-> TCP 127.0.0.1:7775
|
|
-> Prometeu Studio Java/LSP4J
|
|
```
|
|
|
|
## Requirements
|
|
|
|
* Node.js
|
|
* npm
|
|
* VS Code
|
|
* Prometeu Studio running with the embedded LSP server enabled
|
|
|
|
The Studio LSP server must be listening on:
|
|
|
|
```text
|
|
127.0.0.1:7775
|
|
```
|
|
|
|
## Install dependencies
|
|
|
|
From this directory:
|
|
|
|
```bash
|
|
npm install
|
|
```
|
|
|
|
## Compile
|
|
|
|
```bash
|
|
npm run compile
|
|
```
|
|
|
|
This generates:
|
|
|
|
```text
|
|
out/extension.js
|
|
```
|
|
|
|
## Run in development mode
|
|
|
|
Open this extension folder in VS Code:
|
|
|
|
```bash
|
|
code .
|
|
```
|
|
|
|
Press:
|
|
|
|
```text
|
|
F5
|
|
```
|
|
|
|
This opens a second VS Code window called **Extension Development Host**.
|
|
|
|
In that second window, open a Prometeu project and create/open a file like:
|
|
|
|
```text
|
|
main.pbs
|
|
```
|
|
|
|
or:
|
|
|
|
```text
|
|
main.barrel
|
|
```
|
|
|
|
Expected output in:
|
|
|
|
```text
|
|
View -> Output -> Prometeu LSP
|
|
```
|
|
|
|
```text
|
|
Prometeu VS Code extension activated.
|
|
Connecting to Prometeu Studio LSP at 127.0.0.1:7775...
|
|
TCP connection established with Prometeu Studio.
|
|
Prometeu Studio LSP client started.
|
|
[Info] Hello from Prometeu Studio LSP
|
|
```
|
|
|
|
## Run commands manually
|
|
|
|
In the Extension Development Host window:
|
|
|
|
```text
|
|
Cmd+Shift+P
|
|
Prometeu: Connect to Studio LSP
|
|
```
|
|
|
|
To restart the client:
|
|
|
|
```text
|
|
Cmd+Shift+P
|
|
Prometeu: Restart Studio LSP
|
|
```
|
|
|
|
## Package as VSIX
|
|
|
|
```bash
|
|
npm run compile
|
|
vsce package --allow-missing-repository
|
|
```
|
|
|
|
This creates a file like:
|
|
|
|
```text
|
|
prometeu-vscode-extension-0.0.1.vsix
|
|
```
|
|
|
|
## Install locally
|
|
|
|
```bash
|
|
code --install-extension prometeu-vscode-extension-0.0.1.vsix --force
|
|
```
|
|
|
|
Then open a Prometeu project normally:
|
|
|
|
```bash
|
|
code /path/to/prometeu-project
|
|
```
|
|
|
|
With Prometeu Studio running, opening `.pbs` or `.barrel` files should activate the extension and connect to the Studio LSP server.
|
|
|
|
## Configuration
|
|
|
|
Default settings:
|
|
|
|
```json
|
|
{
|
|
"prometeu.studio.host": "127.0.0.1",
|
|
"prometeu.studio.port": 7775
|
|
}
|
|
```
|
|
|
|
These can be changed in VS Code settings if needed.
|
|
|
|
## Current status
|
|
|
|
The extension currently provides only the minimal LSP client bridge:
|
|
|
|
* registers `.pbs`
|
|
* registers `.barrel`
|
|
* connects to Prometeu Studio over TCP
|
|
* starts a VS Code `LanguageClient`
|
|
* receives LSP messages from the Java/LSP4J server
|
|
|
|
The Studio remains the source of trut
|
|
|
|
## Reading SDK/core and libraries
|
|
|
|
F12 opens bundled SDK/core and admitted dependency declarations as read-only
|
|
`prometeu-source:` documents. Hover, continued F12 and semantic highlighting work
|
|
inside them. Files in the editable project keep normal `file:` editing. A library
|
|
under `.workspace` is still external. SDK/core are never copied to an editorial
|
|
folder or cache. Formatting, rename and code actions cannot change external sources;
|
|
a proposal touching both project and dependency files is refused in full.
|
|
|
|
An open external document keeps its source revision. Disconnect leaves its text
|
|
visible, with queries unavailable until reconnection and revalidation. If the
|
|
source changed, navigate again from the project to obtain new text and positions.
|
|
The status bar indicates when an active external source is unavailable.
|
|
|
|
Compile with `npm run compile` before running the extension. Development acceptance
|
|
can launch an isolated real VS Code host against the test LSP classpath:
|
|
|
|
```sh
|
|
PROMETEU_VSCODE_DEV_TEST=1 ./gradlew :prometeu-lsp:prometeu-lsp-v1:test --tests '*ExternalSourceDevelopmentHostTest' --console=plain
|
|
```
|
|
|
|
Run that Gradle command from the repository root. Set `PROMETEU_VSCODE_EXECUTABLE`
|
|
when VS Code is not installed at the default macOS application path. The test covers
|
|
read-only typing, declaration ranges, hover/F12, highlighting, dependency sources
|
|
with Unicode/CRLF, reconnection and normal project editing. It does not validate a
|
|
packaged Studio distribution or installed JAR. Dependencies must already exist on
|
|
disk; dependency management remains a separate product task.
|