Skip to content

Commit

Permalink
add logger statements
Browse files Browse the repository at this point in the history
  • Loading branch information
tonka3000 committed Feb 1, 2024
1 parent 2a3ed9e commit ba5140c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/commands/swiftSupport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ async function addSwiftSupport(manager: ExtensionManager, rootFolder: string) {
const gitignore = [".DS_Store", ".build/", ".swiftpm/", ".vscode/", "Package.resolved"];
const sourcesFolder = path.join(rootFolder, "Sources");
await afs.mkdir(sourcesFolder, { recursive: true });
manager.logger.debug(`Write ${gitignoreFilename}`);
await afs.writeFile(gitignoreFilename, gitignore.join("\n"));
const swiftPackageFilename = path.join(rootFolder, "Package.swift");
const swiftPackage = `// swift-tools-version: 5.9
Expand All @@ -54,6 +55,7 @@ let package = Package(
),
]
)`;
manager.logger.debug(`Write ${swiftPackageFilename}`);
await afs.writeFile(swiftPackageFilename, swiftPackage);

const example = [
Expand Down Expand Up @@ -110,9 +112,9 @@ ${commentify(example)}
${commentify(warning)}
${commentify(generalInstructions)}
`;
const swiftCodeFilename = path.join(sourcesFolder, `${packageName}.swift`);
manager.logger.debug(`Write ${swiftCodeFilename}`);
await afs.writeFile(swiftCodeFilename, source);
return swiftCodeFilename;
}
Expand All @@ -125,7 +127,7 @@ export async function addSwiftSupportCmd(manager: ExtensionManager) {
}
const swiftRootFolder = path.join(ws.uri.fsPath, "swift");
if (await fileExists(path.join(swiftRootFolder, "Package.swift"))) {
throw new Error("Swift Support already exist");
throw new Error("Swift Support already exists");
}
const swiftFilename = await addSwiftSupport(manager, swiftRootFolder);
showTextDocumentAtPosition(vscode.Uri.file(swiftFilename));
Expand Down

0 comments on commit ba5140c

Please sign in to comment.