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

internal/filesystem: Integrate spf13/afero #249

Merged
merged 2 commits into from
Jul 28, 2020
Merged

Conversation

radeksimko
Copy link
Member

This (slightly bigger) PR has a few motivating factors:

  1. It's becoming clear that the language server will need to read files not only from the memory (as maintained by language client via LSP), but also from the OS filesystem. A module in Terraform is represented by *.tf files in a directory and we can't expect that all relevant files in the directory are opened by the client.
    This complexity deserves a clearer separation between raw filesystem API and the "document API" (per LSP's naming convention) where document is a file which holds some additional metadata the language server needs to access to comply with the protocol.
  2. We will eventually need to integrate with at least some parts of the parser currently living in Terraform core and much of the parser there relies on afero.Fs, which makes it a natural choice for the language server as well.
  3. This sets a foundation which later allows us to add another layer (OS filesystem) in such a way that reading will be attempted from in-memory FS first and OS FS second, to comply with the LSP.
    Relevant WIP is in b46ec44 and https://github.com/hashicorp/terraform-config-inspect/pull/49/files

This is just an initial refactoring PR which integrates with afero's in-memory filesystem and should have no effect on the end-user.

Related:

@radeksimko radeksimko added this to the v0.6.0 milestone Jul 27, 2020
@radeksimko radeksimko requested a review from a team July 27, 2020 18:28
Copy link
Contributor

@appilon appilon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a doozy, but LGTM

@radeksimko radeksimko merged commit 7e25849 into master Jul 28, 2020
@radeksimko radeksimko deleted the f-filesystem-afero branch July 28, 2020 06:17
@ghost
Copy link

ghost commented Aug 27, 2020

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 context necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Aug 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants