This is an archive of the discontinued LLVM Phabricator instance.

[mlir-vscode] Add better resolution for server file paths
ClosedPublic

Authored by rriddle on Mar 31 2022, 2:26 AM.

Details

Summary

We currently require that server paths are full paths, which is
fairly inconvenient for a myriad of reasons. This commit
attempts to resolve a given server path with the current workspace.

This has a nice additional affect that we can now actually have
default server paths. This means that mlir-lsp-server and
mlir-pdll-lsp-server can be transparently picked up from
build directories (i.e. generally no need for upstream users to
configure the extension).

Fixes #54627

Diff Detail

Event Timeline

rriddle created this revision.Mar 31 2022, 2:26 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 31 2022, 2:26 AM
rriddle requested review of this revision.Mar 31 2022, 2:26 AM
jpienaar accepted this revision.Mar 31 2022, 7:04 AM
jpienaar added inline comments.
mlir/utils/vscode/src/mlirContext.ts
157

Path feels weird here as these seem like tool names instead while the actual path is computed in caller.

188

And this is sufficient to find it in build dir? Any assumptions needed to make that true? (E.g., how it's been configured). Is this globbing expensive? It would seem like a search across all subdirs.

This revision is now accepted and ready to land.Mar 31 2022, 7:04 AM
rriddle updated this revision to Diff 420610.Apr 5 2022, 1:06 PM
rriddle marked 2 inline comments as done.
rriddle added inline comments.Apr 5 2022, 1:08 PM
mlir/utils/vscode/src/mlirContext.ts
188

Yes. This doesn't require any assumptions generally, it just globs for a file with that name in the workspace directory and returns the first one). The glob has never been perceptible to me, and the more refined the path is, the less time conceptually it should take (i.e. providing the full workspace relative path vs just the filename). It's up to the user how refined they want to make the path, e.g. in the case of multiple build directories and such. We could do something more intelligent to pick the most recently built variant or something(if you have multiple build directories and you are currently iterating in one), but this should be fine for now. I also made this a bit better by not recomputing this again in the config watcher.

jpienaar accepted this revision.Apr 5 2022, 1:10 PM

Nice, thanks that SGTM

This revision was automatically updated to reflect the committed changes.