Skip to content

Commit 964640c

Browse files
committed
Remove default location values in withProgress calls
1 parent 4969a08 commit 964640c

3 files changed

Lines changed: 54 additions & 66 deletions

File tree

extensions/ql-vscode/src/contextual/templateProvider.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
Location,
55
LocationLink,
66
Position,
7-
ProgressLocation,
87
ReferenceContext,
98
ReferenceProvider,
109
TextDocument,
@@ -87,7 +86,6 @@ export class TemplateQueryDefinitionProvider implements DefinitionProvider {
8786
);
8887
},
8988
{
90-
location: ProgressLocation.Notification,
9189
cancellable: true,
9290
title: "Finding definitions",
9391
},
@@ -150,7 +148,6 @@ export class TemplateQueryReferenceProvider implements ReferenceProvider {
150148
);
151149
},
152150
{
153-
location: ProgressLocation.Notification,
154151
cancellable: true,
155152
title: "Finding references",
156153
},

extensions/ql-vscode/src/extension.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,6 @@ export async function activate(
329329
),
330330
{
331331
title: progressTitle,
332-
location: ProgressLocation.Notification,
333332
},
334333
);
335334

extensions/ql-vscode/src/local-databases.ts

Lines changed: 54 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -794,74 +794,66 @@ export class DatabaseManager extends DisposableObject {
794794
}
795795

796796
public async loadPersistedState(): Promise<void> {
797-
return withProgress(
798-
async (progress, token) => {
799-
const currentDatabaseUri =
800-
this.ctx.workspaceState.get<string>(CURRENT_DB);
801-
const databases = this.ctx.workspaceState.get<PersistedDatabaseItem[]>(
802-
DB_LIST,
803-
[],
797+
return withProgress(async (progress, token) => {
798+
const currentDatabaseUri =
799+
this.ctx.workspaceState.get<string>(CURRENT_DB);
800+
const databases = this.ctx.workspaceState.get<PersistedDatabaseItem[]>(
801+
DB_LIST,
802+
[],
803+
);
804+
let step = 0;
805+
progress({
806+
maxStep: databases.length,
807+
message: "Loading persisted databases",
808+
step,
809+
});
810+
try {
811+
void this.logger.log(
812+
`Found ${databases.length} persisted databases: ${databases
813+
.map((db) => db.uri)
814+
.join(", ")}`,
804815
);
805-
let step = 0;
806-
progress({
807-
maxStep: databases.length,
808-
message: "Loading persisted databases",
809-
step,
810-
});
811-
try {
812-
void this.logger.log(
813-
`Found ${databases.length} persisted databases: ${databases
814-
.map((db) => db.uri)
815-
.join(", ")}`,
816+
for (const database of databases) {
817+
progress({
818+
maxStep: databases.length,
819+
message: `Loading ${database.options?.displayName || "databases"}`,
820+
step: ++step,
821+
});
822+
823+
const databaseItem = await this.createDatabaseItemFromPersistedState(
824+
progress,
825+
token,
826+
database,
816827
);
817-
for (const database of databases) {
818-
progress({
819-
maxStep: databases.length,
820-
message: `Loading ${
821-
database.options?.displayName || "databases"
822-
}`,
823-
step: ++step,
824-
});
825-
826-
const databaseItem =
827-
await this.createDatabaseItemFromPersistedState(
828-
progress,
829-
token,
830-
database,
831-
);
832-
try {
833-
await databaseItem.refresh();
834-
await this.registerDatabase(progress, token, databaseItem);
835-
if (currentDatabaseUri === database.uri) {
836-
await this.setCurrentDatabaseItem(databaseItem, true);
837-
}
838-
void this.logger.log(
839-
`Loaded database ${databaseItem.name} at URI ${database.uri}.`,
840-
);
841-
} catch (e) {
842-
// When loading from persisted state, leave invalid databases in the list. They will be
843-
// marked as invalid, and cannot be set as the current database.
844-
void this.logger.log(
845-
`Error loading database ${database.uri}: ${e}.`,
846-
);
828+
try {
829+
await databaseItem.refresh();
830+
await this.registerDatabase(progress, token, databaseItem);
831+
if (currentDatabaseUri === database.uri) {
832+
await this.setCurrentDatabaseItem(databaseItem, true);
847833
}
834+
void this.logger.log(
835+
`Loaded database ${databaseItem.name} at URI ${database.uri}.`,
836+
);
837+
} catch (e) {
838+
// When loading from persisted state, leave invalid databases in the list. They will be
839+
// marked as invalid, and cannot be set as the current database.
840+
void this.logger.log(
841+
`Error loading database ${database.uri}: ${e}.`,
842+
);
848843
}
849-
await this.updatePersistedDatabaseList();
850-
} catch (e) {
851-
// database list had an unexpected type - nothing to be done?
852-
void showAndLogExceptionWithTelemetry(
853-
redactableError(
854-
asError(e),
855-
)`Database list loading failed: ${getErrorMessage(e)}`,
856-
);
857844
}
845+
await this.updatePersistedDatabaseList();
846+
} catch (e) {
847+
// database list had an unexpected type - nothing to be done?
848+
void showAndLogExceptionWithTelemetry(
849+
redactableError(
850+
asError(e),
851+
)`Database list loading failed: ${getErrorMessage(e)}`,
852+
);
853+
}
858854

859-
void this.logger.log("Finished loading persisted databases.");
860-
},
861-
{
862-
location: vscode.ProgressLocation.Notification,
863-
},
864-
);
855+
void this.logger.log("Finished loading persisted databases.");
856+
});
865857
}
866858

867859
public get databaseItems(): readonly DatabaseItem[] {

0 commit comments

Comments
 (0)