emacs-grammarly / lsp-grammarly

lsp-mode ❤️ grammarly
GNU General Public License v3.0
196 stars 12 forks source link

How to get this package work with Grammarly premium. #50

Open ffsammak opened 1 year ago

ffsammak commented 1 year ago

Hi, Thank you for this project to get Grammarly to work inside Emacs. Please, bear with me on my questions. How can you install Grammarly-language-server in the first place? When I follow the link, it directs me to another page that mentions Grammarly for VSCode. I am confused, do I need to install VSCode on my Ubuntu 22.04 machine to get the server working? I appreciate your help in explaining the installation on Ubuntu 22.04.

jcs090218 commented 1 year ago

The language server is here, emacs-grammarly/grammarly-language-server.

To install server just M-x lsp-install-server, and select grammarly-ls.

I am confused, do I need to install VSCode on my Ubuntu 22.04 machine to get the server working?

Yeah, sorry for the confusion. You don't need to install VSCode. For the reason why, see https://github.com/emacs-grammarly/lsp-grammarly/issues/40#issuecomment-1501009081. With the current state of the language server, it's tough to tell weather the user are using the premium version or not.

ffsammak commented 1 year ago

Thanks for your quick reply. I have the code below in my init.el:

(use-package lsp-grammarly
  :straight (lsp-grammarly
         :host github
         :repo "emacs-grammarly/lsp-grammarly"
         :branch "master")
  :hook (text-mode . (lambda ()
                       (require 'lsp-grammarly)
                       (lsp))))

when I launch Emacs, I get a message in the mini-buffer: Building lsp-grammarly -> Cloning lsp-mode... it will be there forever.

To install server just M-x lsp-install-server, and select grammarly-ls.

I don't see lsp-install-server on my end. What am I missing? In the Grammarly-language-servere page, it says: this project relies on pnpm

pnpm install
pnpm run build

How can I install pnpm on Ubuntu 22.04?

I am now trying:

wget -qO- https://get.pnpm.io/install.sh | sh - .... in progress...

jcs090218 commented 1 year ago

I don't see lsp-install-server on my end. What am I missing?

That's from lsp-mode. Make sure you have installed lsp-mode before calling the command.

In the Grammarly-language-servere page, it says: this project relies on pnpm

You don't need to install pnpm, its for development only. All you need is node.js and lsp-mode.


If you are using straight.el to install packages, it's better to open the issue there.

ffsammak commented 1 year ago

If you are using straight.el to install packages, it's better to open the issue there.

sorry for bothering you with my comments. It finally worked without doing anything. I just had to wait for the cloning process; it took a while. Then I was prompted to install the Grammarly server, I typed yes, and everything went fine.

ffsammak commented 1 year ago

Now when I start to test, I get this error from Grammarly server: Error: Cannot find module 'node:perf_hooks. Require stack: I found this error message in the grammarly-ls::stderr buffer I have Node.js v12.22.9. I really appreciate your help.

jcs090218 commented 1 year ago

The language server requires v16. You might need to upgrade to node 16.

ffsammak commented 1 year ago

The language server requires v16. You might need to upgrade to node 16.

Did it, finally it worked. But I am lost now, I find markings in the fringe, on the words, but how to get suggestions?

ffsammak commented 1 year ago

With the current state of the language server, it's tough to tell weather the user are using the premium version or not.

I have a premium account in Grammarly. I would be glad to develop a test sentence to tell the difference, whether it is a premium or not. But off the top of my head, plagiarism is only supported in the premium. Can this be tested using lsp-grammarly?

jcs090218 commented 1 year ago

Did it, finally it worked. But I am lost now, I find markings in the fringe, on the words, but how to get suggestions?

I am using sideline with sideline-lsp backend. Another choice is lsp-ui.

ffsammak commented 1 year ago

Did it, finally it worked. But I am lost now, I find markings in the fringe, on the words, but how to get suggestions?

I am using sideline with sideline-lsp backend. Another choice is lsp-ui.

lsp-ui is working great. Thanks. I have a problem with the map keybinding for the lsp-mode, C-c l is suggested in this website:

(setq lsp-keymap-prefix "C-c l") will interfere with org-store-link command, what do you suggest using instead?

ffsammak commented 1 year ago

I found some a keybinding:

(use-package lsp-mode
  :straight (lsp-mode
         :host github
         :repo "emacs-lsp/lsp-mode"
         :branch "master")
  :init
  (setq lsp-keymap-prefix "C-'")
  :bind-keymap
  ("C-'" . lsp-command-map)
  :hook ((lsp-mode . lsp-enable-which-key-integration)
     )
  :commands lsp
  )

But is it safe to use lsp-grammarly-login? It will try to connect to Grammarly account.

image

ffsammak commented 1 year ago

I get this error:

LSP :: Error from the Language Server: Unhandled method $/resume (Method not Found)
LSP :: Error from the Language Server: Request initialize failed with message: request to https://js.grammarly.com/grammarly-sdk@2.3 failed, reason: connect ETIMEDOUT 108.139.79.15:443 (Internal Error)
LSP :: Error from the Language Server: Unhandled method $/resume (Method not Found)

What does that mean?

ffsammak commented 1 year ago

if you write:

Would you borrow me your umbrella?

Does is suggest to you to replace borrow with lend? This is how fluency is checked in Grammarly.

jcs090218 commented 1 year ago

What does that mean?

It seems like they have changed the protocol calls, let me find time to fix it. 🤔

Does is suggest to you to replace borrow with lend? This is how fluency is checked in Grammarly.

Got it! Thanks for sharing the experiment result.


Since only I work on the whole emacs-grammarly, it would be nice if experienced people would like to be one of the core developers. ;)

ffsammak commented 1 year ago

f you write:

Would you borrow me your umbrella?

Does is suggest to you to replace borrow with lend? This is how fluency is checked in Grammarly.

This is just to make sure we are on the same page. This is how to check whether you have premium account features working or not inside Emacs. If it suggests to you to do the replacement, then you know this is premium. From what I have experienced so far, I get only basic suggestions. Premium is not working. So back to my original question, thanks to your guidance and help to let me reach this point, how to get the premium kick in?

ffsammak commented 1 year ago

But is it safe to use lsp-grammarly-login? It will try to connect to Grammarly account.

image

When I hit the green button in the browser of "Continue" I get an error like this:

Screenshot from 2023-04-27 10-13-34

Brave Browser Version 1.50.125 Chromium: 112.0.5615.165 (Official Build) (64-bit)

anajuliabit commented 1 year ago

I have the same problem as @ffsammak while attempting to log in to Grammarly. Any updates?

Invalid redirect URI
Error: KIwcQYFYgq

update: I was able to log in using VS Code by following the instructions on README.md.