Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 0 additions & 34 deletions function-hcl-ls/internal/cmd/download-crds.go

This file was deleted.

6 changes: 0 additions & 6 deletions function-hcl-ls/internal/features/crds/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ type CRDs struct {
schemas atomic.Pointer[resource.Schemas]
}

// Download processes the offline source definition and downloads a list
// of images on to the filesystem.
func Download(sourcesFile string, deleteCache bool) error {
return downloadCRDs(sourcesFile, deleteCache)
}

// New creates an instance of the CRD discovery feature.
func New(c Config) *CRDs {
ret := &CRDs{
Expand Down
151 changes: 0 additions & 151 deletions function-hcl-ls/internal/features/crds/cache.go

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
// sourceInfo tracks the set of files and the schema for a single CRD source
type sourceInfo struct {
sourcePath string
source *types.CRDSourceRuntime
source *types.CRDSource
expandedFiles map[string]bool
schema *resource.Schemas
}
Expand Down
14 changes: 6 additions & 8 deletions function-hcl-ls/internal/features/crds/store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,9 @@ func (s *Store) getSourceInfo(dir string) (ret types.CRDSource, _ error) {
return ret, fmt.Errorf("load source store at %s: no sources file or default directory", filePath)
}
return types.CRDSource{
Runtime: types.CRDSourceRuntime{
Scope: types.ScopeBoth,
Paths: []string{
filepath.Join(types.DefaultSourcesDir, "*.yaml"),
},
Scope: types.ScopeBoth,
Paths: []string{
filepath.Join(types.DefaultSourcesDir, "*.yaml"),
},
}, nil
}
Expand All @@ -135,7 +133,7 @@ func (s *Store) loadSourceStoreAt(dir string) error {
return err
}
foundFiles := map[string]bool{}
for _, p := range src.Runtime.Paths {
for _, p := range src.Paths {
var pattern string
if filepath.IsAbs(p) {
pattern = p
Expand Down Expand Up @@ -168,13 +166,13 @@ func (s *Store) loadSourceStoreAt(dir string) error {
if ss == nil { // never before seen
ss = &sourceInfo{
sourcePath: dir,
source: &src.Runtime,
source: &src,
expandedFiles: foundFiles,
schema: emptySchema,
}
} else {
// but leave the last known schema for this one alone
ss.source = &src.Runtime
ss.source = &src
ss.expandedFiles = foundFiles
}
s.sources.put(ss)
Expand Down
1 change: 0 additions & 1 deletion function-hcl-ls/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ func main() {
cmd.Version = VersionString()
cmd.AddServeCommand(root)
cmd.AddVersionCommand(root)
cmd.AddDownloadCRDsCommand(root)
cmd.AddDumpASTCommand(root)

if err := root.Execute(); err != nil {
Expand Down
2 changes: 0 additions & 2 deletions function-hcl-ls/mise.toml

This file was deleted.

18 changes: 2 additions & 16 deletions function-hcl-ls/types/v1/crd-source.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,8 @@ const (
ScopeBoth Scope = resource.ScopeBoth
)

// CRDSourceRuntime is used by the language server at runtime to
// load schemas from filesystem paths.
type CRDSourceRuntime struct {
Scope Scope `json:"scope,omitempty"`
Paths []string `json:"paths"`
}

// CRDSourceOffline is the section used by tooling to download
// CRDs from remote packages to the local filesystem.
type CRDSourceOffline struct {
CacheDir string `json:"cache-dir"`
Images []string `json:"images"`
}

// CRDSource provides a source for loading CRDs.
type CRDSource struct {
Runtime CRDSourceRuntime `json:"runtime"`
Offline CRDSourceOffline `json:"offline"`
Scope Scope `json:"scope,omitempty"`
Paths []string `json:"paths"`
}
Loading
Loading