1+ import  {  window  }  from  'vscode' ; 
12import  {  Commands  }  from  '../constants.commands' ; 
23import  type  {  Container  }  from  '../container' ; 
34import  type  {  GraphWebviewShowingArgs  }  from  '../plus/webviews/graph/registration' ; 
4- import  {  command  }  from  '../system/vscode/command' ; 
5+ import  {  command ,   executeCoreCommand  }  from  '../system/vscode/command' ; 
56import  type  {  HomeWebviewShowingArgs  }  from  '../webviews/home/registration' ; 
67import  type  {  CommandContext  }  from  './base' ; 
78import  {  Command  }  from  './base' ; 
@@ -36,6 +37,22 @@ export class ShowViewCommand extends Command {
3637		return  this . execute ( context ,  ...args ) ; 
3738	} 
3839
40+ 	async  notifyWhenNoRepository ( featureName ?: string )  { 
41+ 		if  ( this . container . git . openRepositoryCount  >  0 )  { 
42+ 			return ; 
43+ 		} 
44+ 
45+ 		const  message  =  featureName 
46+ 			? `No repository detected. To view ${ featureName }  
47+ 			: 'No repository detected. To use GitLens, open a folder containing a git repository or clone from a URL in Source Control.' ; 
48+ 
49+ 		const  openRepo  =  {  title : 'Open a Folder or Repo' ,  isCloseAffordance : true  } ; 
50+ 		const  result  =  await  window . showInformationMessage ( message ,  openRepo ) ; 
51+ 		if  ( result  ===  openRepo )  { 
52+ 			void  executeCoreCommand ( 'workbench.view.scm' ) ; 
53+ 		} 
54+ 	} 
55+ 
3956	async  execute ( context : CommandContext ,  ...args : unknown [ ] )  { 
4057		const  command  =  context . command  as  Commands ; 
4158		switch  ( command )  { 
@@ -47,6 +64,7 @@ export class ShowViewCommand extends Command {
4764			case  Commands . ShowBranchesView :
4865				return  this . container . views . showView ( 'branches' ) ; 
4966			case  Commands . ShowCommitDetailsView :
67+ 				void  this . notifyWhenNoRepository ( 'Inspect' ) ; 
5068				return  this . container . views . commitDetails . show ( ) ; 
5169			case  Commands . ShowCommitsView :
5270				return  this . container . views . showView ( 'commits' ) ; 
@@ -57,6 +75,7 @@ export class ShowViewCommand extends Command {
5775			case  Commands . ShowFileHistoryView :
5876				return  this . container . views . showView ( 'fileHistory' ) ; 
5977			case  Commands . ShowGraphView :
78+ 				void  this . notifyWhenNoRepository ( 'the Commit Graph' ) ; 
6079				return  this . container . views . graph . show ( undefined ,  ...( args  as  GraphWebviewShowingArgs ) ) ; 
6180			case  Commands . ShowHomeView :
6281				return  this . container . views . home . show ( undefined ,  ...( args  as  HomeWebviewShowingArgs ) ) ; 
0 commit comments