Skip to content

Commit

Permalink
refactor: Update HtmlBeautifier class to use public logChannel
Browse files Browse the repository at this point in the history
  • Loading branch information
aliariff committed Aug 31, 2024
1 parent 7115d2f commit 9cb8cae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/formatter/htmlbeautifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as cp from "child_process";
const isWsl = require("is-wsl");

export default class HtmlBeautifier {
private logChannel: vscode.LogOutputChannel;
public logChannel: vscode.LogOutputChannel;

constructor() {
this.logChannel = vscode.window.createOutputChannel("ERB Beautifier", {
Expand Down
7 changes: 5 additions & 2 deletions src/formatter/htmlbeautifierProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,17 @@ export default class HtmlBeautifierProvider
range: vscode.Range
): vscode.ProviderResult<vscode.TextEdit[]> {
if (this.shouldIgnore(document)) {
console.log(`Ignoring ${document.fileName}`);
this.htmlbeautifier.logChannel.info(`Ignoring ${document.fileName}`);
return [];
}

return this.htmlbeautifier.format(document.getText(range)).then(
(result) => [new vscode.TextEdit(range, result)],
(err) => {
console.error(`Error formatting ${document.fileName}:`, err);
this.htmlbeautifier.logChannel.error(
`Error formatting ${document.fileName}:`,
err
);
return [];
}
);
Expand Down

0 comments on commit 9cb8cae

Please sign in to comment.