Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

Commit

Permalink
Adds a command to open your personal dictionary
Browse files Browse the repository at this point in the history
  • Loading branch information
sgregson committed Jun 9, 2023
1 parent cf8dcdc commit dd2b5df
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions extension/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ You may use `grammarly.files.exclude` to ignore specific files.

Run `grammarly.login` or **Grammarly: Login / Connect your account** command to connect your Grammarly account.
Run `grammarly.logout` or **Grammarly: Log out** to disconnect your account.
Run `grammarly.dictionary` or **Grammarly: Open Dictionary** to open grammarly.com to your personal dictionary.

## Configuration

Expand Down
8 changes: 8 additions & 0 deletions extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"onCommand:grammarly.check",
"onCommand:grammarly.login",
"onCommand:grammarly.logout",
"onCommand:grammarly.dictionary",
"onLanguage:plaintext",
"onLanguage:markdown",
"onLanguage:html"
Expand Down Expand Up @@ -773,6 +774,13 @@
"icon": "$(log-out)",
"enablement": "grammarly.isUserAccountConnected"
},
{
"title": "Open Dictionary",
"category": "Grammarly",
"command": "grammarly.dictionary",
"icon": "$(book)",
"enablement": "!grammarly.isRunning || !grammarly.isUserAccountConnected"
},
{
"title": "Restart language server",
"category": "Grammarly",
Expand Down
7 changes: 7 additions & 0 deletions extension/src/GrammarlyClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,13 @@ export class GrammarlyClient implements Registerable {
await this.client.protocol.logout()
await window.showInformationMessage('Logged out.')
}),
commands.registerCommand('grammarly.dictionary', async () => {
const dictionaryExternalURL = 'https://account.grammarly.com/customize';

if (!(await env.openExternal(dictionaryExternalURL))) {
await window.showErrorMessage('Failed to open dictionary.')
}
}),
{ dispose: () => this.session?.dispose() },
)
}
Expand Down

0 comments on commit dd2b5df

Please sign in to comment.