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

fix: module dir paths and lsp error unwrapping #1705

Merged
merged 1 commit into from
Jun 7, 2024

Conversation

wesbillman
Copy link
Collaborator

This fixes clearing of errors from the lsp when modules are being rebuilt and improves duplication of errors (thanks @worstell!!)

Screenshot 2024-06-07 at 11 51 17 AM

@wesbillman wesbillman requested a review from alecthomas as a code owner June 7, 2024 19:30
@wesbillman wesbillman requested review from a team, deniseli and worstell and removed request for a team June 7, 2024 19:30
@ftl-robot ftl-robot mentioned this pull request Jun 7, 2024
}

return []string{"."}
Copy link
Contributor

Choose a reason for hiding this comment

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

Since "." is not an absolute path, do you want to update that to be absolute in this function as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah good question! Maybe we should just add this absolute path when parsing/merge if there's nothing in the toml file. Then this would just return the absModuleDirs instead of "."

Copy link
Contributor

Choose a reason for hiding this comment

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

That makes sense to me :)

@@ -78,9 +78,12 @@ func (s *Server) post(err error) {
errUnspecified := []error{}

// Deduplicate and associate by filename.
for _, err := range ftlErrors.DeduplicateErrors(ftlErrors.UnwrapAll(err)) {
for _, e := range ftlErrors.DeduplicateErrors(ftlErrors.UnwrapAll(err)) {
if !ftlErrors.Innermost(e) {
Copy link
Contributor

Choose a reason for hiding this comment

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

niiiiice :D

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

All @worstell here 😂

@wesbillman wesbillman force-pushed the fix-module-paths-and-lsp-errors branch from 859a64e to b5b946d Compare June 7, 2024 20:04
@@ -32,16 +32,12 @@ type Config struct {
ExternalDirs []string `toml:"external-dirs"`
Commands Commands `toml:"commands"`
FTLMinVersion string `toml:"ftl-min-version"`
absModuleDirs []string
Copy link
Collaborator

Choose a reason for hiding this comment

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

This feels a bit gross, but I don't have any better ideas.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I had exactly the same feeling. I'm also not 100% sure how we want the abs paths to be computed given that it's possible reference multiple ftl-project.toml files, but those files could be at different paths. Which, is what led me to this approach so that at least the modules will be relative to the ftl-project.toml file.

Definitely feels like this will need more thought in the future though.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, and also the working directory of the process could change after construction, so we can't rely on dynamically making them absolute. It seems like the best solution.

@wesbillman wesbillman merged commit 597b28a into main Jun 7, 2024
37 checks passed
@wesbillman wesbillman deleted the fix-module-paths-and-lsp-errors branch June 7, 2024 20:56
@alecthomas
Copy link
Collaborator

Unrelated but why is that error duplicated three times? Can we fix that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants