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 {
761
761
}
762
762
763
763
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
+ } )
770
771
) ;
771
772
772
773
ctx . addToDiscoveredWorkspaces ( workspaces ) ;
Original file line number Diff line number Diff line change 1
1
import * as vscode from "vscode" ;
2
2
import * as lc from "vscode-languageclient/node" ;
3
3
import * as ra from "./lsp_ext" ;
4
+ import * as path from "path" ;
4
5
5
6
import { Config , prepareVSCodeConfig } from "./config" ;
6
7
import { createClient } from "./client" ;
@@ -192,12 +193,13 @@ export class Ctx {
192
193
const discoverProjectCommand = this . config . discoverProjectCommand ;
193
194
if ( discoverProjectCommand ) {
194
195
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
+ } )
201
203
) ;
202
204
203
205
this . addToDiscoveredWorkspaces ( workspaces ) ;
You can’t perform that action at this time.
0 commit comments