Skip to content
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
9 changes: 8 additions & 1 deletion src/commands/runPlayground.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import { dirname } from "path";
import * as vscode from "vscode";
import { Location, Range } from "vscode-languageclient";

import { FolderContext } from "../FolderContext";
import configuration from "../configuration";
import { createSwiftTask } from "../tasks/SwiftTaskProvider";
import { TaskManager } from "../tasks/TaskManager";
import { packageName } from "../utilities/tasks";
Expand Down Expand Up @@ -50,7 +52,12 @@ export async function runPlayground(
packageName: packageName(folderContext),
presentationOptions: { reveal: vscode.TaskRevealKind.Always },
},
folderContext.toolchain
folderContext.toolchain,
configuration.swiftPlayPath
? {
PATH: `${dirname(configuration.swiftPlayPath)}${process.platform === "win32" ? ";" : ":"}${process.env["PATH"]}`,
}
: undefined
);

await tasks.executeTaskAndWait(task);
Expand Down
7 changes: 7 additions & 0 deletions src/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,13 @@ const configuration = {
/* Put in worker queue */
});
},
// TODO Remove when swift-play is in the toolchain
/** Only for development purposes for testing a local build of SwiftPM with swift-play */
get swiftPlayPath(): string {
return substituteVariablesInString(
vscode.workspace.getConfiguration("swift").get<string>("swiftPlayPath", "")
);
},
/** swift build arguments */
get buildArguments(): string[] {
return vscode.workspace
Expand Down
8 changes: 6 additions & 2 deletions src/playgrounds/PlaygroundProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import * as vscode from "vscode";

import { FolderContext } from "../FolderContext";
import { FolderOperation, WorkspaceContext } from "../WorkspaceContext";
import configuration from "../configuration";
import { SwiftLogger } from "../logging/SwiftLogger";
import { LSPPlaygroundsDiscovery, Playground } from "./LSPPlaygroundsDiscovery";

Expand Down Expand Up @@ -120,8 +121,11 @@ export class PlaygroundProvider implements vscode.Disposable {
await this.fetchPromise;
return;
}
if (!(await this.lspPlaygroundDiscovery.supportsPlaygrounds())) {
this.logger.debug(
if (
!configuration.swiftPlayPath &&
!(await this.lspPlaygroundDiscovery.supportsPlaygrounds())
) {
this.logger.warn(
`Fetching playgrounds not supported by the language server`,
this.folderContext.name
);
Expand Down
Loading