Skip to content

Commit 38d58f9

Browse files
committed
format server.ts in accordance with rest of the project formatting
1 parent 00c806a commit 38d58f9

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

server/src/server.ts

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ let projectsFiles: Map<
5757
let codeActionsFromDiagnostics: codeActions.filesCodeActions = {};
5858

5959
// will be properly defined later depending on the mode (stdio/node-rpc)
60-
let send: (msg: p.Message) => void = (_) => { };
60+
let send: (msg: p.Message) => void = (_) => {};
6161

6262
interface CreateInterfaceRequestParams {
6363
uri: string;
@@ -189,7 +189,11 @@ let openedFile = (fileUri: string, fileContent: string) => {
189189
openFiles: new Set(),
190190
filesWithDiagnostics: new Set(),
191191
bsbWatcherByEditor: null,
192-
hasPromptedToStartBuild: /(\/|\\)node_modules(\/|\\)/.test(projectRootPath) ? "never" : false,
192+
hasPromptedToStartBuild: /(\/|\\)node_modules(\/|\\)/.test(
193+
projectRootPath
194+
)
195+
? "never"
196+
: false,
193197
};
194198
projectsFiles.set(projectRootPath, projectRootState);
195199
compilerLogsWatcher.add(
@@ -598,33 +602,30 @@ function format(msg: p.RequestMessage): Array<p.Message> {
598602
}
599603
}
600604

601-
const updateDiagnosticSyntax = (fileUri: string, fileContent: string) => {
605+
let updateDiagnosticSyntax = (fileUri: string, fileContent: string) => {
602606
let filePath = fileURLToPath(fileUri);
603607
let extension = path.extname(filePath);
604608
let tmpname = utils.createFileInTempDir(extension);
605609
fs.writeFileSync(tmpname, fileContent, { encoding: "utf-8" });
606610

607-
const items: p.Diagnostic[] | [] = utils.runAnalysisAfterSanityCheck(
608-
filePath,
609-
[
610-
"diagnosticSyntax",
611-
tmpname
612-
],
613-
);
611+
let items: p.Diagnostic[] | [] = utils.runAnalysisAfterSanityCheck(filePath, [
612+
"diagnosticSyntax",
613+
tmpname,
614+
]);
614615

615-
const notification: p.NotificationMessage = {
616+
let notification: p.NotificationMessage = {
616617
jsonrpc: c.jsonrpcVersion,
617618
method: "textDocument/publishDiagnostics",
618619
params: {
619620
uri: fileUri,
620-
diagnostics: items
621-
}
622-
}
621+
diagnostics: items,
622+
},
623+
};
623624

624625
fs.unlink(tmpname, () => null);
625626

626-
send(notification)
627-
}
627+
send(notification);
628+
};
628629

629630
function createInterface(msg: p.RequestMessage): p.Message {
630631
let params = msg.params as CreateInterfaceRequestParams;
@@ -826,7 +827,10 @@ function onMessage(msg: p.Message) {
826827
params.textDocument.uri,
827828
changes[changes.length - 1].text
828829
);
829-
updateDiagnosticSyntax(params.textDocument.uri, changes[changes.length - 1].text);
830+
updateDiagnosticSyntax(
831+
params.textDocument.uri,
832+
changes[changes.length - 1].text
833+
);
830834
}
831835
}
832836
} else if (msg.method === DidCloseTextDocumentNotification.method) {

0 commit comments

Comments
 (0)