File tree Expand file tree Collapse file tree 4 files changed +14
-1
lines changed Expand file tree Collapse file tree 4 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -379,6 +379,10 @@ export class Extension extends Disposable implements IExtension {
379379 return this . setProjectAvailability ( )
380380 }
381381
382+ public getRoots ( ) {
383+ return this . dvcRoots
384+ }
385+
382386 public async initialize ( ) {
383387 this . resetMembers ( )
384388
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ export interface IExtension {
33 cwd : string ,
44 isCliGlobal ?: true
55 ) => Promise < string | undefined >
6+ getRoots : ( ) => string [ ]
67 hasRoots : ( ) => boolean
78 isPythonExtensionUsed : ( ) => Promise < boolean >
89
Original file line number Diff line number Diff line change @@ -65,6 +65,7 @@ const mockedCwd = __dirname
6565const mockedGetCliVersion = jest . fn ( )
6666const mockedGetFirstWorkspaceFolder = jest . mocked ( getFirstWorkspaceFolder )
6767const mockedHasRoots = jest . fn ( )
68+ const mockedGetRoots = jest . mocked ( ( ) => [ ] )
6869const mockedInitialize = jest . fn ( )
6970const mockedIsPythonExtensionUsed = jest . fn ( )
7071const mockedResetMembers = jest . fn ( )
@@ -258,6 +259,7 @@ describe('setupWorkspace', () => {
258259describe ( 'setup' , ( ) => {
259260 const extension = {
260261 getCliVersion : mockedGetCliVersion ,
262+ getRoots : mockedGetRoots ,
261263 hasRoots : mockedHasRoots ,
262264 initialize : mockedInitialize ,
263265 isPythonExtensionUsed : mockedIsPythonExtensionUsed ,
Original file line number Diff line number Diff line change @@ -161,7 +161,13 @@ export const setup = async (extension: IExtension) => {
161161
162162 await extension . setRoots ( )
163163
164- const { isAvailable, isCompatible } = await extensionCanRunCli ( extension , cwd )
164+ const roots = extension . getRoots ( )
165+ const dvcRootOrFirstFolder = roots . length > 0 ? roots [ 0 ] : cwd
166+
167+ const { isAvailable, isCompatible } = await extensionCanRunCli (
168+ extension ,
169+ dvcRootOrFirstFolder
170+ )
165171
166172 extension . setCliCompatible ( isCompatible )
167173 extension . setAvailable ( isAvailable )
You can’t perform that action at this time.
0 commit comments