-
Notifications
You must be signed in to change notification settings - Fork 3
initial commit of language server code #48
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ef470c0
initial commit of language server code
gotwarlost 1ac2d1e
Update function-hcl-ls/internal/filesystem/inmem.go
gotwarlost 0e6b742
address copilot comments, fix bad copilot change
gotwarlost 23374b7
respond to more copilot comments
gotwarlost 567f840
Update function-hcl-ls/internal/features/crds/store/store_test.go
gotwarlost ecddf8f
more copilot comments
gotwarlost 93173a8
more copilot feedback
gotwarlost c21d870
add some docs that explains the code
gotwarlost 8e6c34c
more copilot feedback
gotwarlost 968ef87
copilot suggestion
gotwarlost File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| vendor/ | ||
| cover.out | ||
| spec.md | ||
| .claude/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| version: "2" | ||
| linters: | ||
| exclusions: | ||
| rules: | ||
| # exclude unused checks from protocol generated code. | ||
| - path: internal/langserver/protocol/ | ||
| linters: | ||
| - unused |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
|
|
||
| .PHONY: default | ||
| default: build test lint | ||
|
|
||
| .PHONY: build | ||
| build: | ||
| go install ./... | ||
|
|
||
| .PHONY: test | ||
| test: | ||
| go test ./... | ||
|
|
||
| .PHONY: fmt | ||
| fmt: | ||
| gofumpt -w . | ||
|
|
||
| .PHONY: lint | ||
| lint: | ||
| golangci-lint run |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| function-hcl-ls | ||
| --- | ||
|
|
||
| A language server implementation for function-hcl. | ||
|
|
||
| Provides the following features: | ||
|
|
||
| * Completion | ||
| * Hover descriptions | ||
| * Goto Declaration/ Find references | ||
| * Semantic tokens | ||
| * Validations | ||
|
|
||
| Completion requires provider CRDs to be set up such that the language server can find type definitions. | ||
|
|
||
| The exact mechanics of how to set this up along with IDE integration will be documented under | ||
| [the docs page](https://crossplane-contrib.github.io/function-hcl/) when the client code is added to the repo. | ||
|
|
||
| ## Standing on the shoulders of giants | ||
|
|
||
| This repo owes a lot to the [HCL language library](https://github.com/hashicorp/hcl-lang) and | ||
| the [Terraform language server](https://github.com/hashicorp/terraform-ls) implementation. | ||
|
|
||
| This repo contains code copied from the above repos and modified for use. Since function-hcl is different | ||
| enough from Terraform, the borrowed code did not work well for it but gave the authors a great starting | ||
| point. A lot of refactoring has been done on both these copied codebases to make the language server | ||
| work for function-hcl. | ||
|
|
||
| In addition, the `go.mod` replaces the [HCL dependency](https://github.com/hashicorp/hcl) | ||
| with a [fork](https://github.com/gotwarlost/hcl) because of a [critical fix](https://github.com/hashicorp/hcl/pull/785) | ||
| for a [known issue](https://github.com/hashicorp/hcl/issues/597) that is needed. | ||
|
|
||
| You cannot build this repo using `go install github.com/...` because of this. For source builds, you will need to clone | ||
| the repo and build it locally. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| module github.com/crossplane-contrib/function-hcl/function-hcl-ls | ||
|
|
||
| go 1.25.4 | ||
|
|
||
| require ( | ||
| github.com/apparentlymart/go-textseg v1.0.0 | ||
| github.com/bmatcuk/doublestar/v4 v4.9.1 | ||
| github.com/creachadair/jrpc2 v1.3.2 | ||
| github.com/crossplane-contrib/function-hcl v0.1.4-0.20260213150247-c08e518c903a | ||
| github.com/crossplane/crossplane-runtime/v2 v2.1.0 | ||
| github.com/crossplane/crossplane/v2 v2.1.3 | ||
| github.com/ghodss/yaml v1.0.0 | ||
| github.com/google/go-cmp v0.7.0 | ||
| github.com/google/go-containerregistry v0.20.6 | ||
| github.com/hashicorp/go-uuid v1.0.3 | ||
| github.com/hashicorp/go-version v1.7.0 | ||
| github.com/hashicorp/hcl/v2 v2.24.0 | ||
| github.com/pkg/errors v0.9.1 | ||
| github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 | ||
| github.com/spf13/cobra v1.9.1 | ||
| github.com/stretchr/testify v1.11.1 | ||
| github.com/zclconf/go-cty v1.17.0 | ||
| github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940 | ||
| k8s.io/api v0.34.2 | ||
| k8s.io/apiextensions-apiserver v0.34.2 | ||
| k8s.io/apimachinery v0.34.2 | ||
| ) | ||
|
|
||
| replace github.com/hashicorp/hcl/v2 => github.com/gotwarlost/hcl/v2 v2.0.0-20260210011329-0927384ef641 | ||
|
|
||
| require ( | ||
| dario.cat/mergo v1.0.2 // indirect | ||
| github.com/agext/levenshtein v1.2.3 // indirect | ||
| github.com/apparentlymart/go-cidr v1.1.0 // indirect | ||
| github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect | ||
| github.com/containerd/stargz-snapshotter/estargz v0.16.3 // indirect | ||
| github.com/creachadair/mds v0.25.1 // indirect | ||
| github.com/crossplane/crossplane-runtime v1.20.0 // indirect | ||
| github.com/crossplane/function-sdk-go v0.4.0 // indirect | ||
| github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect | ||
| github.com/docker/cli v28.2.2+incompatible // indirect | ||
| github.com/docker/distribution v2.8.3+incompatible // indirect | ||
| github.com/docker/docker-credential-helpers v0.9.3 // indirect | ||
| github.com/emicklei/go-restful/v3 v3.12.2 // indirect | ||
| github.com/evanphx/json-patch/v5 v5.9.11 // indirect | ||
| github.com/fxamacker/cbor/v2 v2.9.0 // indirect | ||
| github.com/go-logr/logr v1.4.3 // indirect | ||
| github.com/go-logr/zapr v1.3.0 // indirect | ||
| github.com/go-openapi/jsonpointer v0.21.0 // indirect | ||
| github.com/go-openapi/jsonreference v0.21.0 // indirect | ||
| github.com/go-openapi/swag v0.23.0 // indirect | ||
| github.com/gogo/protobuf v1.3.2 // indirect | ||
| github.com/google/gnostic-models v0.7.0 // indirect | ||
| github.com/google/uuid v1.6.0 // indirect | ||
| github.com/inconshreveable/mousetrap v1.1.0 // indirect | ||
| github.com/josharian/intern v1.0.0 // indirect | ||
| github.com/json-iterator/go v1.1.12 // indirect | ||
| github.com/klauspost/compress v1.18.0 // indirect | ||
| github.com/mailru/easyjson v0.7.7 // indirect | ||
| github.com/mattn/go-colorable v0.1.14 // indirect | ||
| github.com/mitchellh/go-homedir v1.1.0 // indirect | ||
| github.com/mitchellh/go-wordwrap v1.0.1 // indirect | ||
| github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect | ||
| github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect | ||
| github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect | ||
| github.com/onsi/ginkgo/v2 v2.23.3 // indirect | ||
| github.com/onsi/gomega v1.37.0 // indirect | ||
| github.com/opencontainers/go-digest v1.0.0 // indirect | ||
| github.com/opencontainers/image-spec v1.1.1 // indirect | ||
| github.com/sirupsen/logrus v1.9.3 // indirect | ||
| github.com/spf13/afero v1.12.0 // indirect | ||
| github.com/spf13/pflag v1.0.6 // indirect | ||
| github.com/vbatts/tar-split v0.12.1 // indirect | ||
| github.com/x448/float16 v0.8.4 // indirect | ||
| github.com/zclconf/go-cty-yaml v1.1.0 // indirect | ||
| go.opentelemetry.io/otel v1.38.0 // indirect | ||
| go.uber.org/multierr v1.11.0 // indirect | ||
| go.uber.org/zap v1.27.0 // indirect | ||
| go.yaml.in/yaml/v2 v2.4.2 // indirect | ||
| go.yaml.in/yaml/v3 v3.0.4 // indirect | ||
| golang.org/x/crypto v0.45.0 // indirect | ||
| golang.org/x/mod v0.30.0 // indirect | ||
| golang.org/x/net v0.47.0 // indirect | ||
| golang.org/x/oauth2 v0.30.0 // indirect | ||
| golang.org/x/sync v0.18.0 // indirect | ||
| golang.org/x/sys v0.38.0 // indirect | ||
| golang.org/x/term v0.37.0 // indirect | ||
| golang.org/x/text v0.31.0 // indirect | ||
| golang.org/x/time v0.11.0 // indirect | ||
| golang.org/x/tools v0.39.0 // indirect | ||
| google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb // indirect | ||
| google.golang.org/grpc v1.72.1 // indirect | ||
| google.golang.org/protobuf v1.36.6 // indirect | ||
| gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect | ||
| gopkg.in/inf.v0 v0.9.1 // indirect | ||
| gopkg.in/yaml.v2 v2.4.0 // indirect | ||
| gopkg.in/yaml.v3 v3.0.1 // indirect | ||
| k8s.io/client-go v0.34.2 // indirect | ||
| k8s.io/klog/v2 v2.130.1 // indirect | ||
| k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b // indirect | ||
| k8s.io/utils v0.0.0-20250604170112-4c0f3b243397 // indirect | ||
| sigs.k8s.io/controller-runtime v0.22.2 // indirect | ||
| sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect | ||
| sigs.k8s.io/randfill v1.0.0 // indirect | ||
| sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect | ||
| sigs.k8s.io/yaml v1.6.0 // indirect | ||
| ) | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.