Skip to content

Commit 4316505

Browse files
committed
restore normal formatting logic
1 parent 6e352b4 commit 4316505

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

server/src/utils.ts

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -106,19 +106,18 @@ export let formatCode = (filePath: string, code: string): execResult => {
106106

107107
// Default to using the project formatter. If not, use the one we ship with
108108
// the analysis binary in the extension itself.
109-
// if (bscNativePath != null) {
110-
// let result = childProcess.execFileSync(bscNativePath, [
111-
// "-color",
112-
// "never",
113-
// "-format",
114-
// formatTempFileFullPath,
115-
// ]);
116-
// return {
117-
// kind: "success",
118-
// result: result.toString(),
119-
// };
120-
// } else
121-
{
109+
if (bscNativePath != null) {
110+
let result = childProcess.execFileSync(bscNativePath, [
111+
"-color",
112+
"never",
113+
"-format",
114+
formatTempFileFullPath,
115+
]);
116+
return {
117+
kind: "success",
118+
result: result.toString(),
119+
};
120+
} else {
122121
let result = runAnalysisAfterSanityCheck(
123122
formatTempFileFullPath,
124123
["format", formatTempFileFullPath],
@@ -128,9 +127,9 @@ export let formatCode = (filePath: string, code: string): execResult => {
128127
// The formatter returning an empty string means it couldn't format the
129128
// sources, probably because of errors. In that case, we bail from
130129
// formatting by returning the unformatted content.
131-
// if (result === "") {
132-
// result = code;
133-
// }
130+
if (result === "") {
131+
result = code;
132+
}
134133

135134
return {
136135
kind: "success",

0 commit comments

Comments
 (0)