11import * as path from 'path' ;
22import { Uri } from 'vscode' ;
3- import { showQuickPickWithButtons } from '../../common/window.apis' ;
3+ import { showQuickPickWithButtons , showWarningMessage } from '../../common/window.apis' ;
44import { ProjectCreatorString } from '../../common/localize' ;
55import { PythonProject , PythonProjectCreator , PythonProjectCreatorOptions } from '../../api' ;
66import { PythonProjectManager } from '../../internal.api' ;
77import { showErrorMessage } from '../../common/errors/utils' ;
88import { findFiles } from '../../common/workspace.apis' ;
9+ import { traceInfo } from '../../common/logging' ;
910
1011function getUniqueUri ( uris : Uri [ ] ) : {
1112 label : string ;
@@ -68,8 +69,9 @@ export class AutoFindProjects implements PythonProjectCreator {
6869 const filtered = files . filter ( ( uri ) => {
6970 const p = this . pm . get ( uri ) ;
7071 if ( p ) {
71- // If there ia already a project with the same path, skip it.
72- // If there is a project with the same parent path, skip it.
72+ // Skip this project if:
73+ // 1. There's already a project registered with exactly the same path
74+ // 2. There's already a project registered with this project's parent directory path
7375 const np = path . normalize ( p . uri . fsPath ) ;
7476 const nf = path . normalize ( uri . fsPath ) ;
7577 const nfp = path . dirname ( nf ) ;
@@ -79,11 +81,20 @@ export class AutoFindProjects implements PythonProjectCreator {
7981 } ) ;
8082
8183 if ( filtered . length === 0 ) {
84+ // No new projects found that are not already in the project manager
85+ traceInfo ( 'All discovered projects are already registered in the project manager' ) ;
86+ setImmediate ( ( ) => {
87+ showWarningMessage ( 'No new projects found' ) ;
88+ } ) ;
8289 return ;
8390 }
8491
92+ traceInfo ( `Found ${ filtered . length } new potential projects that aren't already registered` ) ;
93+
8594 const projects = await pickProjects ( filtered ) ;
8695 if ( ! projects || projects . length === 0 ) {
96+ // User cancelled the selection.
97+ traceInfo ( 'User cancelled project selection.' ) ;
8798 return ;
8899 }
89100
0 commit comments