Fork me on GitHub
#emacs
<
2023-11-25
>
borkdude11:11:34

Anyone else using emacs as a JS editor? Man, it has become incredible laggy for me. https://github.com/mooz/js2-mode/issues/163

mpenet11:11:08

Did you try to run the profiler?

borkdude11:11:02

how do I do that again?

mpenet11:11:46

m-x profiler-start <type stuff> then m-x profiler-report

borkdude11:11:51

Not sure how to interpret that but considering the issue, I guess it's js2 that is just laggy with big files

Ed13:11:26

I switched from js2 to LSP mode for js and ts a few years ago. I think js2 has always had issues with large files.

2
❤️ 1
borkdude13:11:40

Does that also provide highlighting?

Ed13:11:55

I use js-mode + lsp-mode I think this is pretty much all my relevant config

(defun ed/setup-js-and-typescript ()
  (interactive)
  (lsp-mode)
  (flycheck-mode +1)
  (setq flycheck-check-syntax-automatically '(save mode-enabled))
  (eldoc-mode +1)
  (setq js-indent-level 2)
  (setq typescript-indent-level 2)
  (define-key js-mode-map (kbd "M-.") 'lsp-find-definition)
  (subword-mode +1)
  (yas-minor-mode-on))

(add-hook 'js-mode-hook #'ed/setup-js-and-typescript)

👍 1
borkdude12:11:29

I did this now. Any ideas how to completely disable / get rid of js2?

Ed13:11:15

I think for me it was the victim of one of my Emacs bankruptcies. I guess it depends on how you installed it? Maybe check your custom.el file for mentions of js2 and maybe M-x describe-variable auto-mode-alist and see if it mentions js2-mode anywhere? And maybe run (package-delete 'js2-mode)?

David Vujic17:11:27

About a week ago I updated the packages (by cleaning up the .emacs.d folder basically), and something happened with the completion that I don’t really understand. I am in Python land these days, and it looks like it has to do with company and the jedi backend, maybe? Any ideas? This is the error I get in the editor when it is about to autocomplete

Company: An error occurred in post-command
Company: frontend company-pseudo-tooltip-unless-just-one-frontend error "Args out of range: 0, -1" on command post-command

vemv17:11:39

I hadn't heard of that error in particular but people have observed a bunch of stuff around company-mode lately Try using https://github.com/company-mode/company-mode/releases/tag/0.10.1 Its author has expressed that there's been rework over the last few weeks.

gratitude 1
David Vujic17:11:17

Thank you! Will try that gratitude

David Vujic19:11:17

I was able to get the auto-complete back again by • downloading a previous version (0.9.13) • unzip it • run package-install-fileand pick company.el When looking into my .emacs.d/elpa folder, there are two versions of company there (the latest, and the one manually installed with only a few files in it). When I restart emacs, it will load the latest version (I think). But running the install-file will re-enable the lost auto complete 😄 I have not done that much package install before, other than specifying the things I want in my init.el file. There’s probably a much better way than my manual approach.

vemv21:11:56

Have you checked that you don't have a (package-install 'company) somewhere in your .emacs.d? There's of course the possibility of it being a transitive dependency of some other package. LMK

David Vujic22:11:41

Yes, I had it there as a package to install. When installing the file, I think I expected the existing installation to be overwritten. Thank you for helping me find the cause and a workaround! I have also added an issue to the company GitHub.

🙌 1
David Vujic16:11:18

Solved: and it was a facepalm on me. It was an other package that caused the issues - the emojify package that I had set to download from “melpa-stable” picard-facepalm At some point, that version became incompatible with company. Using “melpa” for this package solved all issues.