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: when using module-dirs from project, make dirs absolute #1690

Merged
merged 1 commit into from
Jun 6, 2024

Conversation

wesbillman
Copy link
Collaborator

I noticed an issue where the LSP was not clearing the diagnostics correctly for modules when rebuilding.

It turned out that the module.Dir was only relative when loaded from the project toml vs. absolute when used with "." or ftl dev example/go. This change makes sure we set the absolute paths on the config.ModuleDirs and config.ExternalDirs when loading them from ftl-project.toml files.

Before this change the lsp would try to clear files with the following path. This would result in LSP errors never being cleared.

lsp: Clearing diagnostics for file:///examples/go/echo

This update, ensures that path is absolute

lsp: Clearing diagnostics for file:///Users/wesbillman/dev/ftl/examples/go/echo

@wesbillman wesbillman requested a review from alecthomas as a code owner June 6, 2024 21:01
@wesbillman wesbillman requested review from a team, matt2e and deniseli and removed request for a team June 6, 2024 21:01
@ftl-robot ftl-robot mentioned this pull request Jun 6, 2024
@wesbillman wesbillman merged commit 46b7c97 into main Jun 6, 2024
37 checks passed
@wesbillman wesbillman deleted the make-module-and-external-dirs-absolute branch June 6, 2024 21:15
@alecthomas
Copy link
Collaborator

@wesbillman I had to revert this because it was writing absolute paths back into the config file, so we'll need to come up with an alternate fix.

diff --git a/ftl-project.toml b/ftl-project.toml
index fd63b39f..7e2ba264 100644
--- a/ftl-project.toml
+++ b/ftl-project.toml
@@ -1,10 +1,11 @@
-module-dirs = ["examples/go"]
+module-dirs = ["/Users/alec/dev/ftl/examples/go"]
 external-dirs = []
 ftl-min-version = ""
 
 [global]

@matt2e matt2e added the approved Marks an already closed PR as approved label Jun 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Marks an already closed PR as approved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants