feat: language server#24
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR implements a full Porch HCL language server and VSCode extension, adding syntax highlighting, snippets, LSP integration, and build/configuration updates.
- Introduces a VSCode extension (webpack, tsconfig, extension.ts, grammar, snippets)
- Implements an HCL parser and language server in Go (parser/hcl.go, lsp/server.go)
- Updates build scripts, docs, and release configuration for cross-compilation and packaging
Reviewed Changes
Copilot reviewed 23 out of 25 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/vscode-extension/webpack.config.js | Webpack config for bundling the extension |
| tools/vscode-extension/src/extension.ts | Registers language client, commands, and activation |
| tools/vscode-extension/package.json | Extension metadata, contributions, and activationEvents |
| tools/language-server/internal/parser/hcl.go | HCL parsing logic and diagnostics |
| tools/language-server/internal/lsp/server.go | LSP protocol handling (initialize, completion, hover) |
Files not reviewed (1)
- tools/vscode-extension/package-lock.json: Language not supported
Comments suppressed due to low confidence (2)
tools/vscode-extension/package.json:99
- Activation events are empty, so the extension won’t auto-activate for HCL files or commands. Add events like "onLanguage:porch-hcl" and command activations (e.g., "onCommand:porch-hcl.createFile") to ensure the extension loads when needed.
"activationEvents": [],
tools/language-server/internal/parser/hcl.go:58
- ParseDocument is a critical parsing entry point but lacks unit tests. Consider adding table-driven tests in parser/hcl_test.go to cover valid, invalid, and edge-case HCL inputs.
func ParseDocument(ctx context.Context, uri, content string) (*HCLDocument, error) {
| // Status bar item to show language server status | ||
| let statusBarItem: vscode.StatusBarItem; | ||
|
|
||
| function createStatusBarItem() { |
There was a problem hiding this comment.
The createStatusBarItem() helper is never called in activate(), so the status bar item isn’t registered. Consider invoking createStatusBarItem() inside activate() (and adding its return value to context.subscriptions) to show the server status.
| func ParseDocument(ctx context.Context, uri, content string) (*HCLDocument, error) { | ||
| file, diags := hclsyntax.ParseConfig([]byte(content), uri, hcl.Pos{Line: 1, Column: 1}) | ||
| if diags.HasErrors() { | ||
| log.Printf("HCL parsing errors for %s: %v", uri, diags) |
There was a problem hiding this comment.
Per logging guidelines, use the ctxlog package instead of the global log to emit structured logs with context. Inject context.Context and replace log.Printf with ctxlog.FromCtx(ctx).Info or .Error.
No description provided.