Skip to content

feat: language server#24

Open
matt-FFFFFF wants to merge 2 commits into
mainfrom
feat/ls
Open

feat: language server#24
matt-FFFFFF wants to merge 2 commits into
mainfrom
feat/ls

Conversation

@matt-FFFFFF
Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings July 6, 2025 16:51
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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() {
Copy link

Copilot AI Jul 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
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)
Copy link

Copilot AI Jul 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot generated this review using guidance from repository custom instructions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants