Skip to content

Commit

Permalink
add command
Browse files Browse the repository at this point in the history
  • Loading branch information
vetlek committed Dec 6, 2023
1 parent 15ef9bb commit 771f62e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
4 changes: 4 additions & 0 deletions client/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ export function activate(context: vscode.ExtensionContext) {
);
});

vscode.commands.registerCommand("septic.detectCycles", async () => {
let result = await client.sendRequest(protocol.detectCycles, {});
return result;
});
client.start();
}

Expand Down
6 changes: 5 additions & 1 deletion client/src/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License. See LICENSE in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { RequestType } from "vscode-languageclient";
import { Diagnostic, RequestType } from "vscode-languageclient";

export const fsReadFile = new RequestType<{ uri: string }, number[], any>(
"septic/fs_readfile"
Expand All @@ -16,3 +16,7 @@ export const findYamlFiles = new RequestType<{}, string[], any>(
export const globFiles = new RequestType<{ uri: string }, string[], any>(
"septic/globFiles"
);

export const detectCycles = new RequestType<{}, Diagnostic[], any>(
"septic/detectCycles"
);
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
],
"main": "./client/out/extension",
"contributes": {
"commands": [
{"command": "septic.detectCycles",
"title": "Septic: Detect Cycles in Calcs"}
],
"configuration": {
"type": "object",
"title": "Septic",
Expand Down
6 changes: 5 additions & 1 deletion server/src/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License. See LICENSE in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { RequestType } from "vscode-languageserver";
import { Diagnostic, RequestType } from "vscode-languageserver";

export const fsReadFile = new RequestType<{ uri: string }, number[], any>(
"septic/fs_readfile"
Expand All @@ -16,3 +16,7 @@ export const findYamlFiles = new RequestType<{}, string[], any>(
export const globFiles = new RequestType<{ uri: string }, string[], any>(
"septic/globFiles"
);

export const detectCycles = new RequestType<{}, Diagnostic[], any>(
"septic/detectCycles"
);

0 comments on commit 771f62e

Please sign in to comment.