Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use substituted config instead of raw #2485

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/launchDebugProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class LaunchDebugProvider implements vscode.DebugConfigurationProvider {
return Promise.resolve([providedDebugConfig]);
}

resolveDebugConfiguration(
resolveDebugConfigurationWithSubstitutedVariables(
folder: vscode.WorkspaceFolder | undefined,
config: vscode.DebugConfiguration, _token?: vscode.CancellationToken):
vscode.ProviderResult<vscode.DebugConfiguration> {
Expand Down
16 changes: 8 additions & 8 deletions test/launchDebugProvider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ describe("launchDebugProvider", () => {
});
});

describe("resolveDebugConfiguration", () => {
describe("resolveDebugConfigurationWithSubstitutedVariables", () => {
it("calls attach", async () => {
const mockConfig = {
name: "config",
request: "attach",
type: `${SETTINGS_STORE_NAME}.debug`,
};
await host.resolveDebugConfiguration(undefined, mockConfig, undefined);
await host.resolveDebugConfigurationWithSubstitutedVariables(undefined, mockConfig, undefined);
expect(attach).toHaveBeenCalled();
});

Expand All @@ -57,7 +57,7 @@ describe("launchDebugProvider", () => {
request: "launch",
type: `${SETTINGS_STORE_NAME}.debug`,
};
await host.resolveDebugConfiguration(undefined, mockConfig, undefined);
await host.resolveDebugConfigurationWithSubstitutedVariables(undefined, mockConfig, undefined);
expect(launch).toHaveBeenCalled();
});

Expand All @@ -68,11 +68,11 @@ describe("launchDebugProvider", () => {
request: "launch",
type: `${SETTINGS_STORE_NAME}.debug`,
};
await host.resolveDebugConfiguration(undefined, mockConfig, undefined);
await host.resolveDebugConfigurationWithSubstitutedVariables(undefined, mockConfig, undefined);
expect(launch).toHaveBeenCalledWith(expect.any(Object), "file:///index.html", mockConfig);

mockConfig.file = "/index.html";
await host.resolveDebugConfiguration(undefined, mockConfig, undefined);
await host.resolveDebugConfigurationWithSubstitutedVariables(undefined, mockConfig, undefined);
expect(launch).toHaveBeenCalledWith(expect.any(Object), "file:///index.html", mockConfig);

const mockFolder = {
Expand All @@ -81,7 +81,7 @@ describe("launchDebugProvider", () => {
uri: { path: "path" },
};
mockConfig.file = "${workspaceFolder}/index.html";
await host.resolveDebugConfiguration(mockFolder as any, mockConfig, undefined);
await host.resolveDebugConfigurationWithSubstitutedVariables(mockFolder as any, mockConfig, undefined);
expect(launch).toHaveBeenCalledWith(expect.any(Object), "file:///path/index.html", mockConfig);
});

Expand All @@ -92,12 +92,12 @@ describe("launchDebugProvider", () => {
type: `${SETTINGS_STORE_NAME}.debug`,
url: "http://localhost/index.html",
};
await host.resolveDebugConfiguration(undefined, mockConfig, undefined);
await host.resolveDebugConfigurationWithSubstitutedVariables(undefined, mockConfig, undefined);
expect(launch).toHaveBeenCalledWith(expect.any(Object), mockConfig.url, mockConfig);
});

it("reports error on no config", async () => {
const result = await host.resolveDebugConfiguration(undefined, null as any, undefined);
const result = await host.resolveDebugConfigurationWithSubstitutedVariables(undefined, null as any, undefined);
expect(result).toBeUndefined();
expect(mockReporter.sendTelemetryEvent).toHaveBeenCalled();
});
Expand Down