@@ -274,7 +274,7 @@ export class Extension extends Disposable implements IExtension {
274274 )
275275
276276 this . internalCommands . registerExternalCommand (
277- RegisteredCommands . SETUP_WEBVIEW_SHOW ,
277+ RegisteredCommands . SETUP_SHOW ,
278278 async ( ) => {
279279 await this . setup . showWebview ( )
280280 }
@@ -341,39 +341,12 @@ export class Extension extends Disposable implements IExtension {
341341 this . watchForVenvChanges ( )
342342 }
343343
344- public async setupWorkspace ( ) {
345- const stopWatch = new StopWatch ( )
346- try {
347- const previousCliPath = this . config . getCliPath ( )
348- const previousPythonPath = this . config . getPythonBinPath ( )
349-
350- const completed = await setupWorkspace ( ( ) =>
351- this . config . setPythonAndNotifyIfChanged ( )
352- )
353- sendTelemetryEvent (
354- RegisteredCommands . EXTENSION_SETUP_WORKSPACE ,
355- { completed } ,
356- {
357- duration : stopWatch . getElapsedTime ( )
358- }
359- )
360-
361- const executionDetailsUnchanged =
362- this . config . getCliPath ( ) === previousPythonPath &&
363- this . config . getPythonBinPath ( ) === previousCliPath
364-
365- if ( completed && ! this . cliAccessible && executionDetailsUnchanged ) {
366- this . workspaceChanged . fire ( )
367- }
344+ public async showSetup ( ) {
345+ return await this . setup . showWebview ( )
346+ }
368347
369- return completed
370- } catch ( error : unknown ) {
371- return sendTelemetryEventAndThrow (
372- RegisteredCommands . EXTENSION_SETUP_WORKSPACE ,
373- error as Error ,
374- stopWatch . getElapsedTime ( )
375- )
376- }
348+ public shouldWarnUserIfCLIUnavailable ( ) {
349+ return this . hasRoots ( ) && ! this . setup . isFocused ( )
377350 }
378351
379352 public async isPythonExtensionUsed ( ) {
@@ -479,6 +452,41 @@ export class Extension extends Disposable implements IExtension {
479452 setContextValue ( 'dvc.commands.available' , available )
480453 }
481454
455+ private async setupWorkspace ( ) {
456+ const stopWatch = new StopWatch ( )
457+ try {
458+ const previousCliPath = this . config . getCliPath ( )
459+ const previousPythonPath = this . config . getPythonBinPath ( )
460+
461+ const completed = await setupWorkspace ( ( ) =>
462+ this . config . setPythonAndNotifyIfChanged ( )
463+ )
464+ sendTelemetryEvent (
465+ RegisteredCommands . EXTENSION_SETUP_WORKSPACE ,
466+ { completed } ,
467+ {
468+ duration : stopWatch . getElapsedTime ( )
469+ }
470+ )
471+
472+ const executionDetailsUnchanged =
473+ this . config . getCliPath ( ) === previousPythonPath &&
474+ this . config . getPythonBinPath ( ) === previousCliPath
475+
476+ if ( completed && ! this . cliAccessible && executionDetailsUnchanged ) {
477+ this . workspaceChanged . fire ( )
478+ }
479+
480+ return completed
481+ } catch ( error : unknown ) {
482+ return sendTelemetryEventAndThrow (
483+ RegisteredCommands . EXTENSION_SETUP_WORKSPACE ,
484+ error as Error ,
485+ stopWatch . getElapsedTime ( )
486+ )
487+ }
488+ }
489+
482490 private setProjectAvailability ( ) {
483491 const available = this . hasRoots ( )
484492 setContextValue ( 'dvc.project.available' , available )
0 commit comments