File tree Expand file tree Collapse file tree 2 files changed +15
-12
lines changed Expand file tree Collapse file tree 2 files changed +15
-12
lines changed Original file line number Diff line number Diff line change @@ -761,12 +761,13 @@ export function addProject(ctx: CtxInit): Cmd {
761761 }
762762
763763 const workspaces : JsonProject [ ] = await Promise . all (
764- vscode . workspace . workspaceFolders ! . map ( async ( folder ) : Promise < JsonProject > => {
765- const rustDocuments = vscode . workspace . textDocuments . filter ( isRustDocument ) ;
766- return discoverWorkspace ( rustDocuments , discoverProjectCommand , {
767- cwd : folder . uri . fsPath ,
768- } ) ;
769- } )
764+ vscode . workspace . textDocuments
765+ . filter ( isRustDocument )
766+ . map ( async ( file ) : Promise < JsonProject > => {
767+ return discoverWorkspace ( [ file ] , discoverProjectCommand , {
768+ cwd : path . dirname ( file . uri . fsPath ) ,
769+ } ) ;
770+ } )
770771 ) ;
771772
772773 ctx . addToDiscoveredWorkspaces ( workspaces ) ;
Original file line number Diff line number Diff line change 11import * as vscode from "vscode" ;
22import * as lc from "vscode-languageclient/node" ;
33import * as ra from "./lsp_ext" ;
4+ import * as path from "path" ;
45
56import { Config , prepareVSCodeConfig } from "./config" ;
67import { createClient } from "./client" ;
@@ -192,12 +193,13 @@ export class Ctx {
192193 const discoverProjectCommand = this . config . discoverProjectCommand ;
193194 if ( discoverProjectCommand ) {
194195 const workspaces : JsonProject [ ] = await Promise . all (
195- vscode . workspace . workspaceFolders ! . map ( async ( folder ) : Promise < JsonProject > => {
196- const rustDocuments = vscode . workspace . textDocuments . filter ( isRustDocument ) ;
197- return discoverWorkspace ( rustDocuments , discoverProjectCommand , {
198- cwd : folder . uri . fsPath ,
199- } ) ;
200- } )
196+ vscode . workspace . textDocuments
197+ . filter ( isRustDocument )
198+ . map ( async ( file ) : Promise < JsonProject > => {
199+ return discoverWorkspace ( [ file ] , discoverProjectCommand , {
200+ cwd : path . dirname ( file . uri . fsPath ) ,
201+ } ) ;
202+ } )
201203 ) ;
202204
203205 this . addToDiscoveredWorkspaces ( workspaces ) ;
You can’t perform that action at this time.
0 commit comments