Skip to content

Commit

Permalink
Only display folder name for more than one workspace folder scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
Kartik Raj committed Jul 11, 2022
1 parent 1dc6bc6 commit c24cb01
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,15 @@ export class InvalidPythonInterpreterDiagnostic extends BaseDiagnostic {
scope = DiagnosticScope.WorkspaceFolder,
) {
let formatArg = '';
if (workspaceService.workspaceFile) {
if (
workspaceService.workspaceFile &&
workspaceService.workspaceFolders &&
workspaceService.workspaceFolders?.length > 1
) {
// Specify folder name in case of multiroot scenarios
const folder = workspaceService.getWorkspaceFolder(resource);
if (folder) {
formatArg = ` for ${path.basename(folder.uri.fsPath)}`;
formatArg = ` ${localize('Common.for', 'for')} ${path.basename(folder.uri.fsPath)}`;
}
}
super(code, messages[code].format(formatArg), DiagnosticSeverity.Error, scope, resource, undefined, 'always');
Expand Down

0 comments on commit c24cb01

Please sign in to comment.