Skip to content
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

walker: Decouple WalkFunc to reduce walker dependencies #881

Closed
Tracked by #724
radeksimko opened this issue Apr 20, 2022 · 4 comments · Fixed by #981
Closed
Tracked by #724

walker: Decouple WalkFunc to reduce walker dependencies #881

radeksimko opened this issue Apr 20, 2022 · 4 comments · Fixed by #981
Assignees
Milestone

Comments

@radeksimko
Copy link
Member

Currently the module walker/indexer has many dependencies:

func NewWalker(fs ReadOnlyFS, ps PathStore, ms *state.ModuleStore, pss *state.ProviderSchemaStore, js job.JobStore, tfExec exec.ExecutorFactory) *Walker {
return &Walker{
pathStore: ps,
fs: fs,
modStore: ms,
jobStore: js,
schemaStore: pss,
tfExecFactory: tfExec,
logger: discardLogger,
ignoreDirectoryNames: skipDirNames,
}
}

This makes it harder to change anything that involves the walker and harder to test.

We can extract the logic which happens when a module is found as WalkFunc and have that function alone depend on Job Scheduler etc.

// TODO: decouple into its own function and pass as WalkFunc to NewWalker
// this could reduce the amount of args in NewWalker

@radeksimko
Copy link
Member Author

https://github.com/hashicorp/terraform-ls/compare/f-walker-refactoring represents a very rough idea of how this could be implemented, but it still needs some further thinking about watcher-related indexing logic, which is likely to change as part of #867 - specifically in the sense that walker should no longer need to be explicitly adding each walked path to the watcher as LSP-based watching supports wildcards.

With that in mind I'm putting this on hold until #790 is finally reviewed & merged and revisit with #867 in mind.

@radeksimko radeksimko added this to the v0.29.0 milestone Jun 9, 2022
@radeksimko
Copy link
Member Author

Currently blocked by #953

@radeksimko
Copy link
Member Author

Also it would be best to first finish & merge #924

@github-actions
Copy link

github-actions bot commented Aug 1, 2022

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant