Cleanup sql projects tree (#21883)

* remove MessageTreeItem and rename projectUri to relativeProjectUri

* declare variables inline in constructor
This commit is contained in:
Kim Santiago
2023-02-09 11:42:00 -08:00
committed by GitHub
parent 37ad1b0fdb
commit 0e269e0438
9 changed files with 33 additions and 62 deletions

View File

@@ -777,7 +777,7 @@ export class ProjectsController {
await project.exclude(fileEntry);
} else {
TelemetryReporter.sendErrorEvent(TelemetryViews.ProjectTree, TelemetryActions.excludeFromProject);
void vscode.window.showErrorMessage(constants.unableToPerformAction(constants.excludeAction, node.projectUri.path));
void vscode.window.showErrorMessage(constants.unableToPerformAction(constants.excludeAction, node.relativeProjectUri.path));
}
this.refreshProjectsTree(context);
@@ -835,7 +835,7 @@ export class ProjectsController {
.withAdditionalProperties({ objectType: node.constructor.name })
.send();
void vscode.window.showErrorMessage(constants.unableToPerformAction(constants.deleteAction, node.projectUri.path));
void vscode.window.showErrorMessage(constants.unableToPerformAction(constants.deleteAction, node.relativeProjectUri.path));
}
}
@@ -1454,7 +1454,7 @@ export class ProjectsController {
const trimmedUri = utils.trimChars(utils.getPlatformSafeFileEntryPath(utils.trimUri(root.fileSystemUri, fileOrFolder.fileSystemUri)), '/');
return allFileEntries.find(x => utils.trimChars(utils.getPlatformSafeFileEntryPath(x.relativePath), '/') === trimmedUri);
}
return project.files.find(x => utils.getPlatformSafeFileEntryPath(x.relativePath) === utils.getPlatformSafeFileEntryPath(utils.trimUri(context.root.projectUri, context.projectUri)));
return project.files.find(x => utils.getPlatformSafeFileEntryPath(x.relativePath) === utils.getPlatformSafeFileEntryPath(utils.trimUri(context.root.relativeProjectUri, context.relativeProjectUri)));
}
private getProjectFromContext(context: Project | BaseProjectTreeItem | dataworkspace.WorkspaceTreeItem): Project {
@@ -1469,12 +1469,12 @@ export class ProjectsController {
if (context.root instanceof ProjectRootTreeItem) {
return (<ProjectRootTreeItem>context.root).project;
} else {
throw new Error(constants.unexpectedProjectContext(context.projectUri.path));
throw new Error(constants.unexpectedProjectContext(context.relativeProjectUri.path));
}
}
private getRelativePath(treeNode: BaseProjectTreeItem): string {
return treeNode instanceof FolderNode ? utils.trimUri(treeNode.root.projectUri, treeNode.projectUri) : '';
return treeNode instanceof FolderNode ? utils.trimUri(treeNode.root.relativeProjectUri, treeNode.relativeProjectUri) : '';
}
private getConnectionProfileFromContext(context: azdataType.IConnectionProfile | mssqlVscode.ITreeNodeInfo | undefined): azdataType.IConnectionProfile | mssqlVscode.IConnectionInfo | undefined {