add vscode extension from tip of internal codebase#51
Conversation
This also includes fixes for suggestions by copilot and claude in a different PR Signed-off-by: gotwarlost <krishnan.anantheswaran@elastic.co>
There was a problem hiding this comment.
Pull request overview
Adds a VS Code extension (language config + syntax highlighting + LSP client) for the function-hcl DSL, and updates the release workflow to build and publish platform-specific VSIX packages that bundle the language server binary.
Changes:
- Introduces a new
vscode/extension project with HCL TextMate grammar, language configuration, and an LSP client that launchesfunction-hcl-ls. - Adds build tooling (esbuild bundling + binary download/extract script) and contributor docs for local dev/testing/packaging.
- Extends the GitHub release workflow to produce and publish VS Code Marketplace artifacts per target platform.
Reviewed changes
Copilot reviewed 21 out of 22 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| vscode/tsconfig.json | TypeScript compiler configuration for the extension project. |
| vscode/test-files/secret.hcl | Sample HCL fixture file for local/manual testing. |
| vscode/syntaxes/hcl.tmGrammar.json | TextMate grammar for HCL syntax highlighting. |
| vscode/src/test/extension.test.ts | Mocha-based extension test scaffold. |
| vscode/src/languageServer.ts | Helper to locate the bundled language server binary. |
| vscode/src/extension.ts | Extension activation + LanguageClient startup and server path resolution. |
| vscode/package.json | Extension manifest, scripts, deps, and settings contribution points. |
| vscode/language-configuration.json | Editor behaviors for HCL (comments/brackets/folding). |
| vscode/eslint.config.mjs | ESLint configuration for TypeScript sources. |
| vscode/esbuild.js | Bundles the extension into dist/extension.js. |
| vscode/build/downloadServer.mjs | Downloads/extracts function-hcl-ls into vscode/bin/. |
| vscode/README.md | High-level extension overview and licensing attribution. |
| vscode/HACKING.md | Dev/build/test/publish instructions for contributors. |
| vscode/.vscodeignore | Packaging excludes for the VSIX. |
| vscode/.vscode/tasks.json | VS Code tasks for build/watch using npm scripts. |
| vscode/.vscode/settings.json | Workspace settings for the extension project. |
| vscode/.vscode/launch.json | Launch configuration for Extension Development Host debugging. |
| vscode/.vscode/extensions.json | Recommended VS Code extensions for contributors. |
| vscode/.vscode-test.mjs | @vscode/test-cli test runner config. |
| vscode/.gitignore | Ignores build outputs and downloaded binaries for the extension project. |
| .github/workflows/release.yaml | Builds tarballs + VSIX per target and publishes VSIX to Marketplace during releases. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: gotwarlost <krishnan.anantheswaran@elastic.co>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 21 out of 22 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: gotwarlost <krishnan.anantheswaran@elastic.co>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 23 out of 24 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 23 out of 24 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - name: Create archive checksums | ||
| run: | | ||
| cd dist | ||
| shasum -a 256 *.tar.gz > checksums.txt | ||
|
|
There was a problem hiding this comment.
cd dist here assumes the dist/ directory exists, but the workflow never creates it (and the earlier go build -o ../dist/... outputs won’t create parent directories). Add a mkdir -p dist step early in the build job (before any build output is written) to avoid failures on a fresh runner.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 23 out of 24 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - name: Upload dist artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: dist | ||
| path: dist/ | ||
| retention-days: 1 |
There was a problem hiding this comment.
This job uploads dist/ as an artifact, but the workflow never creates the dist/ directory explicitly. If the earlier build steps don't create it (e.g., due to a failure before any output is written), actions/upload-artifact will error on a missing path. Consider adding an explicit mkdir -p dist (and/or if-no-files-found: error) before uploading to make failures clearer and avoid missing-path errors.
| async function downloadFile(url, targetPath) { | ||
| const response = await fetch(url); | ||
| if (!response.ok) { | ||
| throw new Error(`HTTP ${response.status}: ${response.statusText}`); | ||
| } | ||
| const fileStream = createWriteStream(targetPath); | ||
| await pipeline(response.body, fileStream); | ||
| } |
There was a problem hiding this comment.
In Node's built-in fetch, response.body is a Web ReadableStream, but stream/promises.pipeline expects Node streams; this can throw at runtime. Convert the body to a Node stream (e.g., via Readable.fromWeb(response.body)) before piping, or use await response.arrayBuffer()/fs.writeFile to write the file.
This also includes fixes for suggestions by copilot and claude in a different PR