Skip to content

Commit

Permalink
commandServer: reformatting
Browse files Browse the repository at this point in the history
  • Loading branch information
phillco committed Oct 4, 2023
1 parent 01c577d commit 0628eac
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions packages/cursorless-vscode/src/sidecar/commandServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ async function handleRequest(requestObj: any) {
requestObj.commandId,
...args,
);
return {result: result};
return { result: result };
}

try {
switch (requestObj.command) {
case "ping":
return {response: "pong"};
return { response: "pong" };
case "state":
return vsCodeState();
case "eval":
Expand All @@ -67,9 +67,9 @@ async function handleRequest(requestObj: any) {
// TODO(pcohen): this may change the editor state,
// but it doesn't actually block on Cursorless applying those changes
applyPrimaryEditorState();
return {response: "OK"};
return { response: "OK" };
case "command":
return {result: await runVSCodeCommand(requestObj)};
return { result: await runVSCodeCommand(requestObj) };
case "cursorless": {
// NOTE(pcohen): this need not be Cursorless specific; perhaps a better command name might be
// along the lines of "execute command and serialize state"
Expand Down Expand Up @@ -105,17 +105,16 @@ async function handleRequest(requestObj: any) {
case "pid":
return `${process.pid}`;
default:
return {error: `invalid command: ${requestObj.command}`};
return { error: `invalid command: ${requestObj.command}` };
}
} catch (e) {
vscode.window.showInformationMessage(
`Error during evaluation of command "${requestObj.command}": ${e}`,
);
return {error: `exception during execution: ${e}`};
return { error: `exception during execution: ${e}` };
}
}


export function startCommandServer(sidecarDirectory: string) {
try {
const socketPath = path.join(sidecarDirectory, `vscode-socket`);
Expand Down

0 comments on commit 0628eac

Please sign in to comment.