initial commit of language server code#48
Conversation
Signed-off-by: gotwarlost <krishnan.anantheswaran@elastic.co>
There was a problem hiding this comment.
Pull request overview
Initial open-source import of the internal function-hcl language server, packaging core LSP features (completion, hover, semantic tokens, folding, CRD-backed schemas) into a monorepo module.
Changes:
- Added schema lookup and utilities for the function-hcl DSL, including dynamic schema integration.
- Implemented decoder features: completion/hover/signature help, semantic tokens, folding ranges, and document symbols.
- Introduced module + CRD discovery/state tracking infrastructure (filesystem overlays, event bus, stores) and CLI commands.
Reviewed changes
Copilot reviewed 98 out of 240 changed files in this pull request and generated 15 comments.
Show a summary per file
| File | Description |
|---|---|
| function-hcl-ls/internal/funchcl/schema/lookup.go | Standard + dynamic schema lookup for blocks/attributes and dependent body schemas. |
| function-hcl-ls/internal/funchcl/schema/api.go | Public schema APIs and helpers (status/apiVersion/kind filtering). |
| function-hcl-ls/internal/funchcl/doc.go | Package documentation for funchcl container. |
| function-hcl-ls/internal/funchcl/decoder/symbols/symbol_test.go | Interface conformance tests for symbol implementations. |
| function-hcl-ls/internal/funchcl/decoder/symbols/symbol.go | Symbol model types for document/workspace symbols. |
| function-hcl-ls/internal/funchcl/decoder/symbols/collect.go | Symbol collection from HCL syntax trees. |
| function-hcl-ls/internal/funchcl/decoder/symbols/api.go | Public API for file/workspace symbol queries. |
| function-hcl-ls/internal/funchcl/decoder/semtok/walk.go | Semantic token walker for HCL syntax trees. |
| function-hcl-ls/internal/funchcl/decoder/semtok/api.go | Public API for semantic token extraction. |
| function-hcl-ls/internal/funchcl/decoder/folding/folding_test.go | Tests for folding range collection logic. |
| function-hcl-ls/internal/funchcl/decoder/folding/folding.go | Folding range support optimized for lsp4ij/IntelliJ. |
| function-hcl-ls/internal/funchcl/decoder/decoderutils/utils.go | Shared helpers for template/string literal detection. |
| function-hcl-ls/internal/funchcl/decoder/context.go | Context interfaces for decoder operations (completion/hover/etc). |
| function-hcl-ls/internal/funchcl/decoder/completion/testdata/schemas/xrd.yaml | Test schema fixture for completion/hover behavior. |
| function-hcl-ls/internal/funchcl/decoder/completion/testdata/.xrd.yaml | Test XRD metadata fixture for completion context. |
| function-hcl-ls/internal/funchcl/decoder/completion/signature_test.go | Tests for function signature help at a cursor position. |
| function-hcl-ls/internal/funchcl/decoder/completion/signature.go | Signature help determination for function calls and active parameter. |
| function-hcl-ls/internal/funchcl/decoder/completion/schema-utils.go | Type/schema inference utilities used by hover/completion. |
| function-hcl-ls/internal/funchcl/decoder/completion/scaffold_test.go | Integration-style scaffold for completion tests with real module wiring. |
| function-hcl-ls/internal/funchcl/decoder/completion/hover.go | Hover entrypoints and block/label/attribute hover logic. |
| function-hcl-ls/internal/funchcl/decoder/completion/hover-expr.go | Expression hover logic and schema inference traversal. |
| function-hcl-ls/internal/funchcl/decoder/completion/helpers.go | Shared helpers for token ranges, byte access, snippets, and positioning. |
| function-hcl-ls/internal/funchcl/decoder/completion/expr-completion.go | Expression completion engine and dispatch by expression kind. |
| function-hcl-ls/internal/funchcl/decoder/completion/expr-completion-template.go | Template expression completion behavior. |
| function-hcl-ls/internal/funchcl/decoder/completion/expr-completion-ref.go | Reference completion for traversals into the target schema. |
| function-hcl-ls/internal/funchcl/decoder/completion/expr-completion-object.go | Object constructor completion (keys/values, recovery, edit ranges). |
| function-hcl-ls/internal/funchcl/decoder/completion/expr-completion-function.go | Function completion including namespaced recovery in syntax errors. |
| function-hcl-ls/internal/funchcl/decoder/completion/errors.go | Completion-related error types for consistent reporting. |
| function-hcl-ls/internal/funchcl/decoder/completion/completion_expr_test.go | Tests covering expression completion cases. |
| function-hcl-ls/internal/funchcl/decoder/completion/completion.go | Completion entrypoint routing and schema-aware body traversal. |
| function-hcl-ls/internal/funchcl/decoder/completion/api.go | Public API for completion and hover, behavior-controlled limits. |
| function-hcl-ls/internal/funchcl/decoder/behavior.go | Singleton language-server behavior flags (completion, folding, etc). |
| function-hcl-ls/internal/filesystem/os_fs.go | OS filesystem wrapper for the overlay FS abstraction. |
| function-hcl-ls/internal/filesystem/inmem.go | In-memory file and fileinfo/direntry types backing document overlays. |
| function-hcl-ls/internal/filesystem/filesystem.go | Two-layer FS overlay (document store preferred, OS fallback). |
| function-hcl-ls/internal/filesystem/document.go | Adapters from Document to fs.File/fs.FileInfo/fs.DirEntry. |
| function-hcl-ls/internal/features/modules/testdata/valid-mod-files/resources.tf | Module parsing test fixture (valid). |
| function-hcl-ls/internal/features/modules/testdata/valid-mod-files-with-extra-items/main.tf | Module parsing fixture with nested blocks and extra items. |
| function-hcl-ls/internal/features/modules/testdata/valid-mod-files-with-extra-items/.hidden.tf | Module parsing fixture ensuring hidden files behavior. |
| function-hcl-ls/internal/features/modules/testdata/invalid-mod-files/missing-brace.tf | Module parsing fixture (syntax error). |
| function-hcl-ls/internal/features/modules/testdata/invalid-mod-files/incomplete-block.tf | Module parsing fixture (incomplete content). |
| function-hcl-ls/internal/features/modules/testdata/invalid-links/resources.tf | Fixture for invalid file link scenarios. |
| function-hcl-ls/internal/features/modules/testdata/invalid-links/invalid.tf | Fixture for invalid file link scenarios. |
| function-hcl-ls/internal/features/modules/store/store.go | Module store for parsed files, diags, targets, and XRD metadata. |
| function-hcl-ls/internal/features/modules/parser.go | Module parser + derived target/reference computation hook-up. |
| function-hcl-ls/internal/features/modules/hooks.go | Completion hooks for apiVersion/kind from dynamic schema sets. |
| function-hcl-ls/internal/features/modules/events.go | Event-driven module parsing and diagnostics publishing. |
| function-hcl-ls/internal/features/modules/ctx.go | Path + completion contexts used by decoder features. |
| function-hcl-ls/internal/features/modules/api.go | Public modules feature API and dependency interfaces. |
| function-hcl-ls/internal/features/doc.go | Features package documentation. |
| function-hcl-ls/internal/features/crds/store/store_test.go | Tests for CRD store source discovery and callback behavior. |
| function-hcl-ls/internal/features/crds/store/store.go | CRD source discovery and schema propagation across sources/files. |
| function-hcl-ls/internal/features/crds/store/source-store.go | In-memory store for CRD source metadata and derived schemas. |
| function-hcl-ls/internal/features/crds/store/file-store.go | CRD file cache with checksum tracking and schema loading. |
| function-hcl-ls/internal/features/crds/store/api.go | Public CRD store API and change processing hooks. |
| function-hcl-ls/internal/features/crds/events.go | CRD feature event processing and filesystem-change reactions. |
| function-hcl-ls/internal/features/crds/cache.go | Offline CRD download/cache generation logic for package images. |
| function-hcl-ls/internal/features/crds/api.go | Public CRD feature API and wiring to publish “no sources” events. |
| function-hcl-ls/internal/eventbus/bus.go | Generic typed pub-sub topic implementation. |
| function-hcl-ls/internal/eventbus/api.go | Event bus APIs for open/edit/watch/diagnostics/no-sources topics. |
| function-hcl-ls/internal/document/store/store.go | In-memory document store tracking open docs and versions. |
| function-hcl-ls/internal/document/source/source.go | Source line splitting + range scanning for position conversions. |
| function-hcl-ls/internal/document/range.go | LSP-style range/position representation. |
| function-hcl-ls/internal/document/position.go | LSP position to byte-offset conversion (UTF-16 based). |
| function-hcl-ls/internal/document/handle_test.go | Tests for URI/path handle conversions. |
| function-hcl-ls/internal/document/handle.go | Document handle/dir handle helpers for URIs and filesystem paths. |
| function-hcl-ls/internal/document/errors.go | Document error types and helpers (not found, invalid pos). |
| function-hcl-ls/internal/document/document.go | Document model for open file content and derived line info. |
| function-hcl-ls/internal/document/dir_handle_test.go | Tests for dir handle normalization. |
| function-hcl-ls/internal/document/dir_handle.go | Directory handle normalization and URI/path conversion. |
| function-hcl-ls/internal/document/diff/diff.go | Diff-to-change conversion for document edits. |
| function-hcl-ls/internal/document/change_test.go | Tests for applying full and ranged document changes. |
| function-hcl-ls/internal/document/change.go | Apply LSP changes to the stored document content. |
| function-hcl-ls/internal/cmd/version.go | CLI command to print version/build metadata (json/text). |
| function-hcl-ls/internal/cmd/serve.go | CLI command to run the language server (stdio/TCP + profiling). |
| function-hcl-ls/internal/cmd/download-crds.go | CLI command to download CRDs using offline source definitions. |
| function-hcl-ls/internal/cmd/ast.go | CLI command to print AST node types and source excerpts. |
| function-hcl-ls/go.mod | Module definition + dependencies for the new language server module. |
| function-hcl-ls/README.md | High-level language server feature overview and build notes. |
| function-hcl-ls/Makefile | Build/test/lint targets for the module. |
| function-hcl-ls/.golangci.yml | Lint configuration with generated-code exclusions. |
| function-hcl-ls/.gitignore | Module-level ignore rules. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
function-hcl-ls/internal/funchcl/decoder/completion/expr-completion-function.go
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Krishnan Anantheswaran <krishnan.anantheswaran@elastic.co>
Signed-off-by: gotwarlost <krishnan.anantheswaran@elastic.co>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 98 out of 240 changed files in this pull request and generated 9 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
function-hcl-ls/internal/funchcl/decoder/completion/expr-completion-object.go
Show resolved
Hide resolved
function-hcl-ls/internal/funchcl/decoder/completion/scaffold_test.go
Outdated
Show resolved
Hide resolved
Signed-off-by: gotwarlost <krishnan.anantheswaran@elastic.co>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 98 out of 240 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Krishnan Anantheswaran <krishnan.anantheswaran@elastic.co>
Signed-off-by: gotwarlost <krishnan.anantheswaran@elastic.co>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 98 out of 240 changed files in this pull request and generated 7 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 98 out of 240 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: gotwarlost <krishnan.anantheswaran@elastic.co>
Signed-off-by: gotwarlost <krishnan.anantheswaran@elastic.co>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 98 out of 241 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: gotwarlost <krishnan.anantheswaran@elastic.co>
ydubreuil
left a comment
There was a problem hiding this comment.
This is an incredible new addition for function-hcl!
Approving as I've been using the LSP internally at Elastic already.
Take the tip of the internal language server code and open source it as a monorepo module.