-
Notifications
You must be signed in to change notification settings - Fork 23
Feat/vscode enhance #199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Feat/vscode enhance #199
Conversation
|
Thanks @Patotking12 ! Could you please run rustfmt and eslint, see the CI jobs |
|
Done! Fixed the eslint issue. CI should pass now. @delta1 |
vscode/src/compile.ts
Outdated
| } | ||
|
|
||
| throw new Error( | ||
| "simc compiler not found. Install it with: cargo install --path . " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to leave a link to SimplicityHL readme, because cargo install --path . don't do anything on it's own
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to link to the README instead
lsp/src/backend.rs
Outdated
| if !value_str.starts_with("0x") { | ||
| if let Some(pos) = find_value_position(text, name, "value") { | ||
| diagnostics.push(Diagnostic::new_simple( | ||
| Range::new(pos, pos), | ||
| format!("Witness '{}' value must start with '0x' (hex format)", name), | ||
| )); | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The witness is not required to be a hex number
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, totally slipped my mind to remove that
The witness validation was added as a basic example to show we can validate .wit files in real-time (checking JSON structure, required fields)
| ) | ||
| } | ||
|
|
||
| /// Validate a witness (.wit) file and return diagnostics. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice if the functions below could be moved into utils.rs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good suggestion, moved the helper functions to utils.rs for better organization
Also moved the related tests to utils.rs since the functions they test now live there
| // Parse simc error output into VSCode diagnostics. | ||
| // Error format: | ||
| // | | ||
| // 1 | let a1: List<u32, 5> = None; | ||
| // | ^^^^^^ Expected a power of two... | ||
| public parseErrors(output: string): vscode.Diagnostic[] { | ||
| const diagnostics: vscode.Diagnostic[] = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we already have diagnostics via LSP?
The language server output matches simc, so it's essentially showing the same problem twice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The compiler diagnostics are intentional, they show the actual simc output when you run a build command
The LSP provides real-time feedback while editing, but the compiler is the source of truth
There is some overlap when both report the same error, but the compiler output is useful for the build workflow as it shows exactly what simc says. Happy to remove if you think it's too redundant
|
I don't think we need to add more examples to |
Added build integration to the VSCode extension with a task provider that runs simc, parses compiler errors into diagnostics, and shows a status bar with the Simfony version.
Also added code snippets for common patterns and custom file icons for .simf and .wit files.
On the LSP side, implemented document symbols for the outline view, signature help for function parameter hints, semantic tokens for AST-based highlighting of functions and namespaces, and witness file validation that checks types and reports missing or extra fields in real-time.