Skip to content

Decouple Metadata as Source from the LSP miscellaneous files workspace #78421

@jasonmalinowski

Description

@jasonmalinowski

Right now our LSP miscellaneous files workspace is coupled to metadata as source -- if a new file appears, it's up to the miscellaneous files workspace to forward it to the other workspace:

if (metadataAsSourceFileService.TryAddDocumentToWorkspace(documentFilePath, container, out var documentId))
{
var metadataWorkspace = metadataAsSourceFileService.TryGetWorkspace();
Contract.ThrowIfNull(metadataWorkspace);
var document = metadataWorkspace.CurrentSolution.GetRequiredDocument(documentId);
return document;
}

I'm not really clear why we're doing this, other than borrowing the pattern from VS for Windows, where the Metadata as Source stuff is at a layer where it can't directly watch files being opened or closed. But in the LSP case, we could just generate the documents with a special URI from the start, and register the LSP workspace with those documents with those URIs, and just let things behave more naturally. I guess that's potentially bad from a perf perspective if you do hundreds/thousands of go to defs that require custom source...but maybe that's not really a concern?

This came up as we're building a more complicated Miscellaneous Files workspace for VS Code, since this bit of the implementation has to be duplicate when it doesn't really need to be.

Metadata

Metadata

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions