Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flycheck-grammarly doesn't work with AUCTeX. #10

Closed
hongyi-zhao opened this issue Aug 2, 2021 · 13 comments
Closed

flycheck-grammarly doesn't work with AUCTeX. #10

hongyi-zhao opened this issue Aug 2, 2021 · 13 comments
Labels
bug Something isn't working

Comments

@hongyi-zhao
Copy link

On Ubuntu 20.04, I'm using the latest git master version of Emacs, and installed the flycheck-grammarly as follows:

(use-package flycheck-grammarly)

But I can't see the effect represented here, as shown by the following screenshot:

image

Any hints for this problem?

Regards,
HY

@jcs090218
Copy link
Member

jcs090218 commented Aug 2, 2021

Thanks for reporting the issue to us!

The support major modes is defined here. You can either customize the variable flycheck-grammarly-active-modes or to run flycheck-grammarly in the valid file type. (.txt, .md, etc)

(defcustom flycheck-grammarly-active-modes
'(text-mode latex-mode org-mode markdown-mode)
"List of major mode that work with Grammarly."
:type 'list
:group 'flycheck-grammarly)

Make sure you have (require 'flycheck-grammarly) inside your configuration since use-package doesn't load it for you!

@jcs090218 jcs090218 added the question Further information is requested label Aug 2, 2021
@hongyi-zhao
Copy link
Author

hongyi-zhao commented Aug 2, 2021

The support major modes is defined here.

I'm using AUCTeX, whose major mode, i.e., latex-mode is among the predefined supported major modes by flycheck-grammarly, as shown below:

image

Make sure you have (require 'flycheck-grammarly) inside your configuration since use-package doesn't load it for you!

I'm using straight.el, which will autoload the required feature. At the same time, I've already enabled its integration-with-use-package feature. Therefore, there is no need to explicitly use (require 'flycheck-grammarly) here.

@jcs090218
Copy link
Member

Oh, okay. This may duplicate to #7?

Sorry that this plugin isn't fully support latex file yet. Can you try with other text file? You can try to set flycheck-grammarly--show-debug-message to t in order to see the debug information.

@hongyi-zhao hongyi-zhao changed the title flycheck-grammarly doesn't work on Ubuntu 20.04. flycheck-grammarly doesn't work with AUCTeX. Aug 2, 2021
@hongyi-zhao
Copy link
Author

I tried with the following configuration:

(use-package flycheck-grammarly)
(setq flycheck-grammarly--show-debug-message t)

And then open a md file, but still failed to see any effect, as shown below:

image

@jcs090218
Copy link
Member

Did you start M-x flycheck-mode? Just to confirm. 😕

@hongyi-zhao
Copy link
Author

hongyi-zhao commented Aug 2, 2021

Did you start M-x flycheck-mode?

I enabled flycheck-mode globally by default:

(use-package flycheck
   ;:hook (after-init . global-flycheck-mode)
   ;https://www.flycheck.org/en/latest/user/installation.html#use-package
   :init (global-flycheck-mode)
   :config
    (flycheck-add-mode 'tex-chktex 'latex-mode)
    (flycheck-add-mode 'tex-lacheck 'latex-mode)
   :bind (:map flycheck-mode-map
              ("M-n" . flycheck-next-error)
              ("M-p" . flycheck-previous-error)))

@jcs090218
Copy link
Member

(setq flycheck-grammarly--show-debug-message t)

Try toggle M-x flycheck-mode manually, you should able to see message like

[INFO] Start connecting to Grammarly API...

Give it some time since it sents network request to Grammarly API.


Sorry I don't use straight.el and you mentioned autoload, does it do the same with (require 'flycheck-grammarly)? 😕 Try print out flycheck-checkers and make sure grammarly checker is in there.

@hongyi-zhao
Copy link
Author

hongyi-zhao commented Aug 2, 2021

Try toggle M-x flycheck-mode manually,

It has already been enabled by default, so M-x flycheck-mode will disable it in the current buffer:

image

Sorry I don't use straight.el and you mentioned autoload, does it do the same with (require 'flycheck-grammarly)?

I use it widely for all of my routine packages autoloading.

confused Try print out flycheck-checkers and make sure grammarly checker is in there.

image

It seems that the connection to Grammarly API has been established successfully, but I just can't see the checking results:

image

@jcs090218
Copy link
Member

I think this issue is from #3. I have applied a fix with 5568fea.

Let me know if it works!

@jcs090218 jcs090218 added bug Something isn't working and removed question Further information is requested labels Aug 14, 2021
@hongyi-zhao
Copy link
Author

hongyi-zhao commented Aug 15, 2021

Yes:

image

But:

  1. Sometimes the same suggestion info will appear more than once.
  2. The response is very slow.
  3. It doesn't give a correction hint.

@jcs090218
Copy link
Member

jcs090218 commented Aug 15, 2021

The performance is mentioned in our todo list section flycheck-grammarly#todo-list.

Try adding up the time flycheck-grammarly-check-time may help avoid duplicate messages.

Edit: Make sure you don't load flycheck-grammarly more than once due to the following code, or else it would try to highlight the error multiple times.

(add-to-list 'flycheck-checkers 'grammarly)
(add-to-list 'grammarly-on-open-function-list 'flycheck-grammarly--on-open)
(add-to-list 'grammarly-on-message-function-list 'flycheck-grammarly--on-message)
(add-to-list 'grammarly-on-close-function-list 'flycheck-grammarly--on-close)

@jcs090218
Copy link
Member

I would recommend you try lsp-grammarly, it's quite nice and fast in terms of speed.

@hongyi-zhao
Copy link
Author

hongyi-zhao commented Aug 15, 2021

Try adding up the time flycheck-grammarly-check-time may help avoid duplicate messages.

Thank you, it seems the following configuration does the trick:

(use-package flycheck-grammarly
    :config
     (setq flycheck-grammarly--show-debug-message t
           flycheck-grammarly-check-time 2))

I would recommend you try lsp-grammarly, it's quite nice and fast in terms of speed.

Thank you. I’ll give it a shot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants