This is an archive of the discontinued LLVM Phabricator instance.

[mlir-vscode] Fix processing of files not within the workspace
ClosedPublic

Authored by rriddle on Apr 5 2022, 11:14 PM.

Details

Summary

In a previous commit we added proper support for separate configurations
per workspace folder, but that effectively broke support for processing out-of-workspace
files. Given how useful this is (e.g. when iterating on a test case in /tmp), this
commit refactors server creation to support this again. We support this case using
a "fallback" server that specifically handles files not within the workspace. This uses
the configuration settings for the current workspace itself (not the specific folder).

Diff Detail

Event Timeline

rriddle created this revision.Apr 5 2022, 11:14 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 5 2022, 11:14 PM
rriddle requested review of this revision.Apr 5 2022, 11:14 PM
rriddle edited the summary of this revision. (Show Details)Apr 5 2022, 11:15 PM
rriddle added reviewers: jpienaar, silvas.
jpienaar added inline comments.Apr 6 2022, 8:02 AM
mlir/utils/vscode/src/mlirContext.ts
132

And all of this is required as we can have different dialects linked into different LSPs? (so PDLL doesn't need this?). And so to avoid requiering custom concatted LSP servers with deps, one can have one per workspace? (well probably that doesn't completetly avoid it as a user could still be using the union of the dialects in some client). It made sense when you added this, but now I'm wondering benefit vs implementation cost.

rriddle added inline comments.Apr 6 2022, 9:40 AM
mlir/utils/vscode/src/mlirContext.ts
132

It's not just about concatted server deps, it also applies to the the version of LLVM that is checked out. The way that my workspace is structured (and I assume I'm not alone) is that I have a workspace folder for the different projects I develop (e.g. one for LLVM, one for Modular AI, etc.). Not all of these have an overlap of deps (Modular doesn't register the MLIR test dialect for example), and not all have the same version (i.e. git checkout) of every dialect. I've also been bitten by PDLL the same way, where the checkout of LLVM has a different version of PDLL than the one I have in other projects. If we don't allow multiple servers, workspaces like mine generally just can't work. This is especially true given that the downstream projects are often further behind HEAD than my LLVM checkout (meaning that even if I do concat all the deps, the server doesn't understand LLVM HEAD).

silvas accepted this revision.Apr 6 2022, 11:17 AM

Thanks for fixing this River :)

mlir/utils/vscode/src/mlirContext.ts
143

maybe my JS/TS is out of date, but this vscode.EnvironmentVariableMutatorType looks like an no-op statement to me.

This revision is now accepted and ready to land.Apr 6 2022, 11:17 AM
rriddle added inline comments.Apr 6 2022, 11:18 AM
mlir/utils/vscode/src/mlirContext.ts
143

Nice catch (not sure how that slipped in there).

rriddle updated this revision to Diff 420958.Apr 6 2022, 11:42 AM
rriddle edited the summary of this revision. (Show Details)
jpienaar accepted this revision.Apr 9 2022, 11:08 AM

SG, thanks for the explanation