Skip to content

LSP: Show diagnostics for all packages currently open when using path deps #4285

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

Open
jrstrunk opened this issue Feb 27, 2025 · 1 comment
Open
Labels
help wanted Contributions encouraged priority:medium

Comments

@jrstrunk
Copy link
Contributor

Hello! This is mainly an issue in monorepo-like setups, but when a breaking change is made in a Gleam project, it would be nice to have the LSP show diagnostics for any project in the current editor scope. Given this monorepo structure where the server project depends on types from the client project via a path dependency:

my_project
├── client
│   ├── gleam.toml
│   ├── manifest.toml
│   ├── src
│       └── client.gleam
└── server
    ├── gleam.toml
    ├── manifest.toml
    └── src
        └── server.gleam

If my editor opens to the my_project directory, I can see both projects simultaneously; however, I will only get LSP diagnostics for one project at a time (whichever one has the currently focused file). This is usually fine, but it becomes jarring when a breaking change is made in the client project and not warned about in the server project. Since the errors are only shown in the part of the codebase, it usually leads to me fixing all the errors in the client project, then running the project entry point in the server project, just to get another dump of errors in the console related to the change in the client project.

To fix this, I must navigate to a file in the server project and make a trivial edit to activate the LSP. After the edit, nice in-editor diagnostics in the server project will finally appear.

I used a simple, concrete example here, but this gets harder and more annoying to deal with given more projects in one repo.

@lpil lpil changed the title LSP: Show diagnostics for all projects in the editor's open root directory LSP: Show diagnostics for all packages currently open when using path deps Feb 27, 2025
@lpil
Copy link
Member

lpil commented Feb 27, 2025

Thank you.

When a package that is a path dep compiles successfully we can go on to compiling its dependants.

@lpil lpil added help wanted Contributions encouraged priority:medium labels Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Contributions encouraged priority:medium
Projects
None yet
Development

No branches or pull requests

2 participants