Skip to content

Commit ad91e72

Browse files
committed
update warning messaging
1 parent df57b8c commit ad91e72

2 files changed

Lines changed: 22 additions & 9 deletions

File tree

src/features/creators/autoFindProjects.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,22 +70,27 @@ export class AutoFindProjects implements PythonProjectCreator {
7070
const filtered = files.filter((uri) => {
7171
const p = this.pm.get(uri);
7272
if (p) {
73-
// Skip this project if:
74-
// 1. There's already a project registered with exactly the same path
75-
// 2. There's already a project registered with this project's parent directory path
73+
// Skip this project if there's already a project registered with exactly the same path
7674
const np = path.normalize(p.uri.fsPath);
7775
const nf = path.normalize(uri.fsPath);
78-
const nfp = path.dirname(nf);
79-
return np !== nf && np !== nfp;
76+
return np !== nf;
8077
}
8178
return true;
8279
});
8380

8481
if (filtered.length === 0) {
8582
// No new projects found that are not already in the project manager
86-
traceInfo('All discovered projects are already registered in the project manager');
83+
traceInfo(
84+
`All selected resources are already registered in the project manager: ${files
85+
.map((uri) => uri.fsPath)
86+
.join(', ')}`,
87+
);
8788
setImmediate(() => {
88-
showWarningMessage('No new projects found');
89+
if (files.length === 1) {
90+
showWarningMessage(`${files[0].fsPath} already exists as project.`);
91+
} else {
92+
showWarningMessage('Selected resources already exist as projects.');
93+
}
8994
});
9095
return;
9196
}

src/features/creators/existingProjects.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,17 @@ export class ExistingProjects implements PythonProjectCreator {
5656

5757
if (filtered.length === 0) {
5858
// No new projects found that are not already in the project manager
59-
traceInfo('All discovered projects are already registered in the project manager');
59+
traceInfo(
60+
`All selected resources are already registered in the project manager: ${existingAddUri
61+
.map((uri) => uri.fsPath)
62+
.join(', ')}`,
63+
);
6064
setImmediate(() => {
61-
showWarningMessage('No new projects found');
65+
if (existingAddUri.length === 1) {
66+
showWarningMessage(`Selected resource already exists as project.`);
67+
} else {
68+
showWarningMessage('Selected resources already exist as projects.');
69+
}
6270
});
6371
return;
6472
}

0 commit comments

Comments
 (0)