Code Monkey home page Code Monkey logo

grammarly's Introduction

Grammarly for VS Code

A language server implementation on top of Grammarly's SDK.

Development Setup

This project uses pnpm.

pnpm install
pnpm run build

Adding support for new language

  1. Add "onLanguage:<language name>" to activationEvents in extension/package.json
  2. Add tree-sitter grammar
    1. Install tree-sitter grammar package (generally package are named as tree-sitter-<language name>)
    2. Add the package to the wasm build script: scripts/build-wasm.mjs
  3. Add language transformer in the directory
    1. Create Language<LanguageName>.ts
    2. For reference, check LanguageHTML.ts

How to get help

Have a question, or want to provide feedback? Use repository discussions to ask questions, share bugs or feedback, or chat with other users.

Older Packages

unofficial-grammarly-api, unofficial-grammarly-language-client and unofficial-grammarly-language-server are deprecated and archived: https://github.com/znck/grammarly/tree/v0

Support

This extension is maintained by Rahul Kadyan. You can ๐Ÿ’– sponsor him for the continued development of this extension.




grammarly's People

Contributors

agrimprasad avatar andrew-codes avatar arpagon avatar chapeiro avatar csvn avatar dependabot-preview[bot] avatar dependabot[bot] avatar hanpari avatar haydencbarnes avatar hperrot avatar jaguarfi avatar siddhant-k-code avatar slind14 avatar vwchu avatar williamboman avatar znck avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

grammarly's Issues

Support for MDX

MDX is a superset of Markdown that enables you to write React inside of a Markdown document.

Files have a .mdx extension.

I don't see the possibility of adding custom extensions, so is it possible to natively add support for it?

Provide information when keytar fails due to in-availability of libsecret on linux

Receiving the following error when trying to log in to Grammarly:

Command 'Grammarly: Login to grammarly.com' resulted in an error (GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.secrets was not provided by any .service files)

And the extension does not show any issues highlighted even though on the Grammarly website there are 2 issues in that text.

I am running the extension version 0.12.1 on NixOS Linux.

Add support for AsciiDoc

Ascii doc seems very similar to markdown, so it should be pretty straight forward to get basic functionality. Currently I find myself changing the file type to plain text and back again to get the output from this extension.

Grammarly config dialog generates goals as string but array is expected

I set up my grammarly config via the Cmd + P menu and chose the single goal "describe". However, looking into the .vscode/settings.json file of my repo revealed that it looked like this:

"config": {
	"audience": "expert",
	...
	"goals": "describe",
	"emotion": "mild"
}

There was displayed a syntax error that goals should be an array instead.

Correcting it manually to "goals": ["describe"] fixed the problem.

Doesn't seem to be working on Insiders and on Windows

The extension worked briefly, but now it doesn't seem to be accepting the credentials anymore, always falling back to "asdf" every time the command palette is opened. the new credentials never stick. where can I delete the saved (wrong) credentials?

Extension fails with: Cannot read property 'some' of undefined

Hi,
thank you for creating this extension. I installed the extension and logged in successfully, but I cannot make it correct anything. I tried to run the grammarly:check command, but there appears an error message:

Request $/check failed with message: Cannot read property 'some' of undefined.

A similar message also appeared when I ran the grammarly.setGoals command. And a third error appeared when I clicked on the Grammarly icon (the little globe icon) at the bottom toolbar:

Grammarly: Cannot destructure property 'performance' of '(intermediate value)' as it is null.,

I looked into the extension host log and there are only two lines relevant to this extension

[2020-04-07 08:30:22.835] [exthost] [info] ExtensionService#_doActivateExtension znck.grammarly{"startup":false,"extensionId":"value":"znck.grammarly","_lower":"znck.grammarly"},"activationEvent":"onLanguage:plaintext"}

[2020-04-07 08:30:22.835] [exthost] [info] ExtensionService#loadCommonJSModulefile:///c:/Users/kaliv/.vscode/extensions/znck.grammarly-0.9.1/out/extension.js

I hope this info helps you to guide me in the right direction. Thank you in advance for any solutions.

Latex, Grammarly crashes after editing file

The plugin seems to work in Latex, however when I edit text in the Latex file I sometimes get the following error:

Grammarly connection terminated due to error: { error: 'runtime_error', severity: 'error', action: 'error', id: 12 }
Grammarly connection terminated due to error: { error: 'runtime_error', severity: 'error', action: 'error', id: 13 }
tag p has no close,is self-close? use class SelfCloseTag
tag p has no close,is self-close? use class SelfCloseTag
tag p has no close,is self-close? use class SelfCloseTag
tag p has no close,is self-close? use class SelfCloseTag
tag p has no close,is self-close? use class SelfCloseTag
tag p has no close,is self-close? use class SelfCloseTag
tag p has no close,is self-close? use class SelfCloseTag
tag p has no close,is self-close? use class SelfCloseTag
tag p has no close,is self-close? use class SelfCloseTag
tag p has no close,is self-close? use class SelfCloseTag
tag p has no close,is self-close? use class SelfCloseTag
[Error - 12:21:39 PM] Request textDocument/completion failed.
  Message: Unhandled method textDocument/completion
  Code: -32601 

Activate on .Jmd .Rmd files

Jmd and Rmd are markdown with respectively Julia and R code, and I think it would be really cool to be able to use the package on these. I would be happy to submit a PR if you point me in the right direction!

Is it possible to get synonymous?

In the official Grammarly websites, it is possible to get some synonymous suggestions by double-clicking the word. Is that functionality somehow embedded in this extension?

Add Word Ability

Thanks for the awesome work. I use SpellRight but I love Grammarly. Can you add the ability to Add a word. I use

{
  "key": "ctrl+alt+cmd+w",
  "command": "spellright.addFromSelectionToUserDictionary"
}

To add the word to global dictionary.

Silencing Grammarly API errors

When extension cannot connect to Grammarly API, which happens way too often recently, VSCode shows error in corner and switches to "Output" tab.

Is it possible to silence those errors?

Example of errors:
grammarly

At the same time when those two errors appear, VSCode also switches from "Terminal" to "Output" tab.

A request has failed. See the output for more information

I frequently receive a notification from Grammarly that says: "A request has failed. See the output for more information." This is what I can find in the output console:

...
2020-04-21T19:35:54.385Z grammarly:host Expecting: 140 Got: 31
2020-04-21T19:35:54.385Z grammarly:host Expecting: 141 Got: 31
[Error - 21:35:54] Request textDocument/codeAction failed.
  Message: Request textDocument/codeAction failed unexpectedly without providing any details.
  Code: -32603 
[Error - 21:35:54] Request textDocument/codeAction failed.
  Message: Request textDocument/codeAction failed unexpectedly without providing any details.
  Code: -32603 
2020-04-21T19:35:54.843Z grammarly:host ๐Ÿ”บ {
...

In addition, I receive notifications with the text "Grammarly: null" from time to time.

enable on restructured text (rst files)

When I try to run the grammarly extension on restructuredtext files, I get the error

Command 'Grammarly: Check grammar errors' is not enabled in the current context.

Could you enable the extension for rst files?
Or maybe more general, make it configurable on which languages the extension should be executed.

Option to use the extension "on demand" instead of "always on"

Thanks for this extension, it's very useful especially for non-native English speakers like me. Would it be possible to add a way to configure it so it only checks the document when I ask it to do it?

Now when I load or edit a large document, I get a lot of warnings everywhere, the extension makes a lot of requests to Grammarly, etc. It's a bit annoying and breaks my flow of thoughts when writing.

I'd like to write the text without any interruptions, and only when it's finished to start editing the text with the help of the extension - perhaps using a command from the command palette, similar to when I want to see a preview of rendered Markdown. This also solves many situations when I want to open a Markdown document in VS Code, but I do not want or need to check it by Grammarly at all.

GistPad Extension Error

I use the GistPad extension for keeping notes. When opening a markdown file in my Gists library, I get the following error in the vscode developer tools.

Screen Shot 2020-03-17 at 1 25 17 PM

Keyboard shortcut documentation

Looks like there is a default mapping for "Quick fix" CMD + .. It might be sense to mention this and other keyboard shortcuts in README.

Adding to dictionnary does not work for me

Whenever I add a new word to dictionnary (user, folder, grammarly), at the next restart of VS Code, new words are not recognized anymore. How can debug to see what happens ?

Error displaying error message

(node:75082) UnhandledPromiseRejectionWarning: Error: Request $/error failed with message: Found non-callable @@iterator
    at handleResponse (~/.vscode-insiders/extensions/znck.grammarly-0.10.0/out/server.js:5232:48)
    at processMessageQueue (~/.vscode-insiders/extensions/znck.grammarly-0.10.0/out/server.js:5059:17)
    at Immediate.<anonymous> (~/.vscode-insiders/extensions/znck.grammarly-0.10.0/out/server.js:5043:13)
    at processImmediate (internal/timers.js:439:21)

Not working with 1.43

The plugin does not seem to work with the new version of Visual Studio Code (1.43) released last month. Did anyone else encounter this issue or is it my machine?

If I make spelling mistakes on purpose, the score on the bottom left drops to 0/100, but the mistake is not highlighted.

Errors never disappear, even after being corrected

I am experiencing this odd behavior where the extension correctly highlights issues however the markers (eg. squiggly lines) remain in the document even after an issue is resolved (either by correcting a spelling mistake or adding the word to the ignore list).

As I continue editing the document, the error markers start to drift away from the words they were originally highlighting which leads to further confusion.

VSCode Version: 1.44.0-insider
OS: Darwin x64 19.4.0
File: *.mdx (Markdown React) using the VSCode MDX extension.

Unhandled method textDocument/completion

I keep get this error message like this in my console:

[Error - 1:20:21 a.m.] Request textDocument/completion failed.
  Message: Unhandled method textDocument/completion
  Code: -32601 

Can't add words to dictionary

In a .md file, when I attempt to add a new word to the dictionary, vscode throws

command 'grammarly.addWord' not found

Versions and environment:

Extension version: 0.9.0
VScode version: 1.43.2
VScode Commit: 0ba0ca52957102ca3527cf479571617f0de6ed50
VScode Date: 2020-03-24T07:34:57.037Z
Electron: 7.1.11
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: macOS 10.15.4

Making it available for latex files

Thanks for this much needed extension!

A request --- can you make this extension workable with latex (.tex) files? Since most of my writing happens in latex, would be great to use this extension with my writing.

Multiple Problem Handling

If multiple issues are found within the same line (with word-wrap enabled), it can be very hard to reach the suggestion box (even though possible by rapidly moving cursor upwards).

image

Better installation experience with example settings

I really love this extension, very good work!

I have some suggestion to make new users to get faster up-to-speed with the extension. Maybe README can supply sample settings.json for copy-pasting, possible values and more background what the setting does.

E.g.

  • What Grammarly username/password is used for and where are they stored
  • What options there are settings like dialect, audience etc.

if you could provide me with some pointers where I can this information, I am happy to do a PR to make README better.

Reduce grouping in the problems panel

When I look at the problems panel, every grammerly problem is the single item in a group. This clutters the problems panel and makes it hard to read. Since the items are already grouped by file, the file name can probably be dropped from the description.

Screen Shot: Missing comma after introductory phrase Grammaryly(334) [87, 13]
2020-03-15-relaxing-in-the-orvieto-countryside.md[91, 9]: Orvieto

I would prefer to see items listed in the following format similar to the screenshot below:

Missing comma after introductory phrase: however [87, 507]

Screen Shot 2020-03-14 at 9 30 24 AM

Unable to connect to grammarly: auth authentication failed 401 Headers

I noticed that the (excellent!) extension stopped working, checking out the log I noticed the following output (slightly redacted):

... 
2020-01-28T11:28:12.815Z grammarly:auth authenticating as <username> {
  accept: 'application/json',
  'accept-language': 'en-GB,en-US;q=0.9,en;q=0.8',
  'content-type': 'application/json',
  'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) ' +
    'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 ' +
    'Safari/537.36',
  'x-client-type': 'funnel',
  'x-client-version': '1.2.1082',
  'x-container-id': '<some_id>,
  'x-csrf-token': '<some_token>',
  'sec-fetch-site': 'same-site',
  'sec-fetch-mode': 'cors',
  cookie: 'gnar_containrId=some_value; ' +
    'grauth=some_bigger_value; ' +
    'csrf-token=some_token_value'
}

2020-01-28T11:28:13.509Z grammarly:auth authentication failed 401 Headers {
  [Symbol(map)]: [Object: null prototype] {
    date: [ 'Tue, 28 Jan 2020 11:28:13 GMT' ],
    'content-type': [ 'application/json' ],
    'content-length': [ '19' ],
    connection: [ 'close' ],
    'x-frame-options': [ 'DENY' ],
    'x-xss-protection': [ '1; mode=block' ],
    'x-content-type-options': [ 'nosniff' ],
    'content-security-policy': [ "default-src 'none'" ],
    'strict-transport-security': [ 'max-age=31536000' ],
    'cache-control': [ 'max-age=0, no-store, no-cache' ],
    'x-robots-tag': [ 'noindex, nofollow' ]
  }
}
(node:20470) UnhandledPromiseRejectionWarning: Error: Cannot connect to grammarly, no cookie found.
...

I made sure that my username and password were correct. Is there anything I can do to diagnose it? Please let me know if I can provide more information

grammarly:null

The extension is not working it seems it cannot connect to Grammarly's servers or something
output:

020-04-29T20:31:25.648Z grammarly:host ๐Ÿ”ป {
scores: {
Engagement: 1,
GeneralScore: 1,
Correctness: 1,
Tone: 1,
Clarity: 1
},
action: 'feedback',
id: 4
}
2020-04-29T20:31:25.648Z grammarly:host status: queue=0, pending=0
2020-04-29T20:31:29.091Z grammarly:host status: queue=0, pending=0
2020-04-29T20:31:29.158Z grammarly:host status: queue=0, pending=0
2020-04-29T20:31:29.568Z grammarly:host ๐Ÿ”ป {
sid: 1,
rev: 54,
score: 100,
outcomeScores: {
Engagement: 1,
GeneralScore: 1,
Correctness: 1,
Tone: 1,
Clarity: 1
},
generalScore: 100,
removed: [],
dialect: 'american',
foreign: false,
action: 'finished'
}
2020-04-29T20:33:09.170Z Grammarly:host status: queue=0, pending=0

Connection issue: UnhandledPromiseRejectionWarning

This extension does not work for me at all.
I have filled in grammarly.username and grammarly.password in settings.
Error message:
2020-02-24T07:49:37.149Z grammarly:host {
type: 'INIT',
documentId: 'file:///c%3A/XX.md',
account: 'public'
}
(node:19612) UnhandledPromiseRejectionWarning: FetchError: request to https://www.grammarly.com/signin failed, reason: getaddrinfo ENOTFOUND www.grammarly.com
at ClientRequest. (c:\Users\XX.vscode\extensions\znck.grammarly-0.6.2\out\server.js:15380:11)
at ClientRequest.emit (events.js:200:13)
at TLSSocket.socketErrorListener (_http_client.js:402:9)
at TLSSocket.emit (events.js:200:13)
at emitErrorNT (internal/streams/destroy.js:91:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
at processTicksAndRejections (internal/process/task_queues.js:84:9)
(node:19612) UnhandledPromiseRejectionWarning: FetchError: request to https://www.grammarly.com/signin failed, reason: getaddrinfo ENOTFOUND www.grammarly.com
at ClientRequest. (c:\Users\XX.vscode\extensions\znck.grammarly-0.6.2\out\server.js:15380:11)
at ClientRequest.emit (events.js:200:13)
at TLSSocket.socketErrorListener (_http_client.js:402:9)
at TLSSocket.emit (events.js:200:13)
at emitErrorNT (internal/streams/destroy.js:91:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
at processTicksAndRejections (internal/process/task_queues.js:84:9)
(node:19612) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 6)
(node:19612) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 6)

Work with JSON files

Hi there,

what is necessary for this to work with JSON files. With the default configuration it doesn't detect anything in a JSON file when using the "check grammar errors" command and I don't see any option to enable checking for JSON.

Support Git Commit Messages

I use code --wait as my default git editor so all my commit messages are composed in VSCode. It would be great to have grammar checking in these scenes.

The language identifiers are git-commit and git-rebase.

Context menu doesn't show autocorrect for misspelled word

Thank you for extension! I found a little problem with it. This extension shows red line under misspelled word, but there is no "fix word" (or something similar) in context menu. Is it right working of the extension? As I know, original Grammarly has correction suggestions.

My platform: MacOS 10.15.3, VSCode 1.44.0, grammarly extension 0.10.0

Grammar check of comments

Is that possible to enable Grammarly to check in any code comments? Or, at least, in JavaScript files

Getting correction error due to captcha

After using it for a little while I am getting

grammarly:auth *****@gmail.com connection failed { error: 'SHOW_CAPTCHA' }

When trying to log-in again I get:
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.