This is an archive of the discontinued LLVM Phabricator instance.

[mlir-vscode] Refactor server creation to be lazy
ClosedPublic

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

Details

Summary

We currently proactively create language clients for every workspace folder,
and every language. This makes startup time more costly, and also emits errors
for missing language servers in contexts that the user currently isn't in. For example,
if a user opens a .mlir file we don't want to emit errors about .pdll files. We also don't
want to emit errors for missing servers in workspace folders that don't even utilize
MLIR.

This commit refactors client creation to lazy-load when a document that requires the
server is opened.

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
jpienaar accepted this revision.Apr 6 2022, 8:08 AM

I might even suggest the error emission from not finding LSP should be logged (flagged in some way) rather than popup given the extension is the combination of LSP & syntax highlighting. And I'm reading these files more than I traverse via LSP assistance, so in fresh client/machine without lsp built the extension is still useful and the missing LSP warning interrupts my flow before I even tried to use any LSP functionality (and I may not need any at all). But that's just a nit.

This revision is now accepted and ready to land.Apr 6 2022, 8:08 AM

I might even suggest the error emission from not finding LSP should be logged (flagged in some way) rather than popup given the extension is the combination of LSP & syntax highlighting. And I'm reading these files more than I traverse via LSP assistance, so in fresh client/machine without lsp built the extension is still useful and the missing LSP warning interrupts my flow before I even tried to use any LSP functionality (and I may not need any at all). But that's just a nit.

Yeah, we could do that. We can just ignore missing servers if the options are empty (it's already behind a flag, but I can make it always true). I'll prepare a followup and then bump the version afterwards.

I might even suggest the error emission from not finding LSP should be logged (flagged in some way) rather than popup given the extension is the combination of LSP & syntax highlighting. And I'm reading these files more than I traverse via LSP assistance, so in fresh client/machine without lsp built the extension is still useful and the missing LSP warning interrupts my flow before I even tried to use any LSP functionality (and I may not need any at all). But that's just a nit.

Yeah, we could do that. We can just ignore missing servers if the options are empty (it's already behind a flag, but I can make it always true). I'll prepare a followup and then bump the version afterwards.

Sent out https://reviews.llvm.org/D123240 for that.

This revision was automatically updated to reflect the committed changes.