9091: Fix opening single files r=SomeoneToIgnore a=SomeoneToIgnore

Closes https://github.com/rust-analyzer/rust-analyzer/issues/9082

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
This commit is contained in:
bors[bot] 2021-05-31 18:38:15 +00:00 committed by GitHub
commit a127b10d00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -45,7 +45,7 @@ async function tryActivate(context: vscode.ExtensionContext) {
throw new Error(message);
});
if (vscode.workspace.workspaceFolders?.length === 0) {
if ((vscode.workspace.workspaceFolders || []).length === 0) {
const rustDocuments = vscode.workspace.textDocuments.filter(document => isRustDocument(document));
if (rustDocuments.length > 0) {
ctx = await Ctx.create(config, context, serverPath, { kind: 'Detached Files', files: rustDocuments });