Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

Commit

Permalink
Add View Folder Report command (#30)
Browse files Browse the repository at this point in the history
* Add 'View Folder Report' command

* Add description of new command

Signed-off-by: Joseph Kato <[email protected]>
  • Loading branch information
jdkato authored Dec 7, 2020
1 parent 21c6393 commit b1435a2
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ Add words and phrases to your active Vocab through the in-editor context menu.

Jump to your active Vocab files directly from the Command Palette.

### Folder Reports (Vale Server only)

Use the `Vale: View Folder Report` command to generate a [report for the active folder](https://docs.errata.ai/vale-server/gui#summary).

## Settings

The extension offers a number of settings and configuration options (_Preferences > Extensions > Vale_), which are split into three groups: `Vale > Core` (Vale and Vale Server), `Vale > Server` (Vale Server only), and `Vale > Vale CLI` (Vale only).
Expand Down Expand Up @@ -108,4 +112,4 @@ The extension offers a number of settings and configuration options (_Preference
}
```

- `vale.valeCLI.minAlertLevel` (default: `inherited`): Defines from which level of errors and above to display in the problems output.
- `vale.valeCLI.minAlertLevel` (default: `inherited`): Defines from which level of errors and above to display in the problems output.
14 changes: 12 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@
"command": "vale.openReject",
"category": "Vale",
"title": "Open Vocab File (reject)"
}
},
{
"command": "vale.doSummary",
"category": "Vale",
"title": "View Folder Report"
}
],
"menus": {
"editor/context": [
Expand All @@ -74,7 +79,12 @@
"command": "vale.openReject",
"category": "Vale",
"when": "!config.vale.core.useCLI"
},
},
{
"command": "vale.doSummary",
"category": "Vale",
"when": "!config.vale.core.useCLI"
},
{
"command": "vale.addToAccept",
"category": "Vale",
Expand Down
20 changes: 19 additions & 1 deletion src/features/vsCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,28 @@ export default function InitCommands(subscriptions: vscode.Disposable[]) {
vscode.commands.registerCommand("vale.addToReject", addToReject),

vscode.commands.registerCommand("vale.openAccept", openAccept),
vscode.commands.registerCommand("vale.openReject", openReject)
vscode.commands.registerCommand("vale.openReject", openReject),

vscode.commands.registerCommand("vale.doSummary", doSummary)
);
}

const doSummary = async () => {
const editor = vscode.window.activeTextEditor;
if (!editor) {
return;
}

let server: string = vscode.workspace
.getConfiguration()
.get("vale.server.serverURL", "http://localhost:7777");

let name = path.dirname(editor.document.fileName);
let link = server + `/summary.html?path=${name}`;

vscode.env.openExternal(vscode.Uri.parse(link));
};

const addToAccept = async () => {
await addToVocab("accept");
};
Expand Down

0 comments on commit b1435a2

Please sign in to comment.