Skip to content

Commit b424157

Browse files
Merge pull request #2806 from github/robertbrignull/rename_externalApiUsages
Renames remaining references to "external API usage" in the code
2 parents 8c13124 + a5b22fd commit b424157

4 files changed

Lines changed: 14 additions & 18 deletions

File tree

extensions/ql-vscode/src/model-editor/bqrs.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ import { Call, CallClassification, Method } from "./method";
33
import { ModeledMethodType } from "./modeled-method";
44
import { parseLibraryFilename } from "./library";
55

6-
export function decodeBqrsToExternalApiUsages(
7-
chunk: DecodedBqrsChunk,
8-
): Method[] {
6+
export function decodeBqrsToMethods(chunk: DecodedBqrsChunk): Method[] {
97
const methodsByApiName = new Map<string, Method>();
108

119
chunk?.tuples.forEach((tuple) => {

extensions/ql-vscode/src/model-editor/external-api-usage-queries.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { QueryLanguage } from "../common/query-language";
1515
import { fetchExternalApiQueries } from "./queries";
1616
import { Method } from "./method";
1717
import { runQuery } from "../local-queries/run-query";
18-
import { decodeBqrsToExternalApiUsages } from "./bqrs";
18+
import { decodeBqrsToMethods } from "./bqrs";
1919

2020
type RunQueryOptions = {
2121
cliServer: CodeQLCliServer;
@@ -132,7 +132,7 @@ export async function runExternalApiQueries(
132132
maxStep: externalApiQueriesProgressMaxStep,
133133
});
134134

135-
return decodeBqrsToExternalApiUsages(bqrsChunk);
135+
return decodeBqrsToMethods(bqrsChunk);
136136
}
137137

138138
type GetResultsOptions = {

extensions/ql-vscode/src/model-editor/model-editor-view.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ export class ModelEditorView extends AbstractWebview<
193193

194194
break;
195195
case "refreshMethods":
196-
await withProgress((progress) => this.loadExternalApiUsages(progress), {
196+
await withProgress((progress) => this.loadMethods(progress), {
197197
cancellable: false,
198198
});
199199

@@ -227,7 +227,7 @@ export class ModelEditorView extends AbstractWebview<
227227

228228
await Promise.all([
229229
this.setViewState(),
230-
this.loadExternalApiUsages((update) =>
230+
this.loadMethods((update) =>
231231
progress({
232232
...update,
233233
step: update.step + 500,
@@ -283,7 +283,7 @@ export class ModelEditorView extends AbstractWebview<
283283
methods: this.methods,
284284
}),
285285
this.setViewState(),
286-
withProgress((progress) => this.loadExternalApiUsages(progress), {
286+
withProgress((progress) => this.loadMethods(progress), {
287287
cancellable: false,
288288
}),
289289
]);
@@ -311,7 +311,7 @@ export class ModelEditorView extends AbstractWebview<
311311

312312
await Promise.all([
313313
this.setViewState(),
314-
withProgress((progress) => this.loadExternalApiUsages(progress), {
314+
withProgress((progress) => this.loadMethods(progress), {
315315
cancellable: false,
316316
}),
317317
this.loadExistingModeledMethods(),
@@ -357,9 +357,7 @@ export class ModelEditorView extends AbstractWebview<
357357
}
358358
}
359359

360-
protected async loadExternalApiUsages(
361-
progress: ProgressCallback,
362-
): Promise<void> {
360+
protected async loadMethods(progress: ProgressCallback): Promise<void> {
363361
try {
364362
const cancellationTokenSource = new CancellationTokenSource();
365363
const queryResult = await runExternalApiQueries(this.mode, {

extensions/ql-vscode/test/unit-tests/model-editor/bqrs.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { decodeBqrsToExternalApiUsages } from "../../../src/model-editor/bqrs";
1+
import { decodeBqrsToMethods } from "../../../src/model-editor/bqrs";
22
import { DecodedBqrsChunk } from "../../../src/common/bqrs-cli-types";
33
import { CallClassification } from "../../../src/model-editor/method";
44

5-
describe("decodeBqrsToExternalApiUsages", () => {
5+
describe("decodeBqrsToMethods", () => {
66
const chunk: DecodedBqrsChunk = {
77
columns: [
88
{ name: "usage", kind: "Entity" },
@@ -230,11 +230,11 @@ describe("decodeBqrsToExternalApiUsages", () => {
230230
],
231231
};
232232

233-
it("extracts api usages", () => {
234-
// Even though there are a number of usages with the same number of usages, the order returned should be stable:
233+
it("extracts methods", () => {
234+
// Even though there are a number of methods with the same number of usages, the order returned should be stable:
235235
// - Iterating over a map (as done by .values()) is guaranteed to be in insertion order
236-
// - Sorting the array of usages is guaranteed to be a stable sort
237-
expect(decodeBqrsToExternalApiUsages(chunk)).toEqual([
236+
// - Sorting the array of methods is guaranteed to be a stable sort
237+
expect(decodeBqrsToMethods(chunk)).toEqual([
238238
{
239239
library: "rt",
240240
libraryVersion: undefined,

0 commit comments

Comments
 (0)