Skip to content

Commit

Permalink
prettier files
Browse files Browse the repository at this point in the history
  • Loading branch information
belav committed Sep 3, 2023
1 parent abf64fa commit ca73769
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Src/CSharpier.VSCode/src/CSharpierProcess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export interface ICSharpierProcess extends Disposable {
export class NullCSharpierProcess implements ICSharpierProcess {
static instance = new NullCSharpierProcess();

private constructor () { }
private constructor() {}

formatFile(content: string, filePath: string): Promise<string> {
return Promise.resolve("");
Expand Down
13 changes: 9 additions & 4 deletions Src/CSharpier.VSCode/src/CSharpierProcessProvider.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Disposable, Extension, TextEditor, window, workspace} from "vscode";
import { Disposable, Extension, TextEditor, window, workspace } from "vscode";
import { Logger } from "./Logger";
import * as path from "path";
import * as semver from "semver";
Expand All @@ -23,7 +23,11 @@ export class CSharpierProcessProvider implements Disposable {
constructor(logger: Logger, extension: Extension<unknown>) {
this.logger = logger;
this.customPathInstaller = new CustomPathInstaller(logger);
this.installerService = new InstallerService(this.logger, this.killRunningProcesses, extension);
this.installerService = new InstallerService(
this.logger,
this.killRunningProcesses,
extension,
);

window.onDidChangeActiveTextEditor((event: TextEditor | undefined) => {
if (event?.document?.languageId !== "csharp") {
Expand Down Expand Up @@ -137,11 +141,12 @@ export class CSharpierProcessProvider implements Disposable {
outputFromCsharpier = execSync(`dotnet csharpier --version`, {
cwd: directoryThatContainsFile,
env: { ...process.env, DOTNET_NOLOGO: "1" },
}).toString().trim();
})
.toString()
.trim();

this.logger.debug(`dotnet csharpier --version output ${outputFromCsharpier}`);
return outputFromCsharpier;

} catch (error: any) {
const message = !error.stderr ? error.toString() : error.stderr.toString();

Expand Down
8 changes: 6 additions & 2 deletions Src/CSharpier.VSCode/src/CustomPathInstaller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ export class CustomPathInstaller {
try {
const output = execSync(`${this.getPathForVersion(version)} --version`, {
env: { ...process.env, DOTNET_NOLOGO: "1" },
}).toString().trim();
})
.toString()
.trim();

this.logger.debug("dotnet csharpier --version output: " + output);

Expand All @@ -38,7 +40,9 @@ export class CustomPathInstaller {
);
}

this.logger.debug(`Removing directory at ${pathToDirectoryForVersion} because it appears to be corrupted`)
this.logger.debug(
`Removing directory at ${pathToDirectoryForVersion} because it appears to be corrupted`,
);
fs.rmdirSync(pathToDirectoryForVersion, { recursive: true });
}

Expand Down
4 changes: 3 additions & 1 deletion Src/CSharpier.VSCode/src/InstallerService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ export class InstallerService {
this.logger.info(this.extension.extensionKind);

if (this.extension.extensionKind === vscode.ExtensionKind.Workspace) {
window.showErrorMessage("CSharpier must be installed as a local dotnet tool in ./.config/dotnet-tools.json using `dotnet tool install csharpier` and the devcontainer rebuilt to support formatting files.");
window.showErrorMessage(
"CSharpier must be installed as a local dotnet tool in ./.config/dotnet-tools.json using `dotnet tool install csharpier` and the devcontainer rebuilt to support formatting files.",
);
return;
}

Expand Down

0 comments on commit ca73769

Please sign in to comment.