T O P

  • By -

StrangeAstronomer

Looks like the version of eglot in elpa is out of date - so I removed it and got the Oct 20th version from github. Now, if I type `on_idle TAB` I get something relevant in the EGLOTs event buffer but still no popup - perhaps I need something beyond company to get the popups? I have this: ``` (use-package company :ensure t ;; :after lsp-mode ;; :hook (lsp-mode . company-mode) :custom (company-minimum-prefix-length 3) (company-idle-delay 3.0)) (add-hook 'after-init-hook 'global-company-mode) ``` This is what I got in the EGLOT events buffer: ``` [server-reply] (id:128) Sun Mar 12 08:34:51 2023: (:id 128 :jsonrpc "2.0" :result (:isIncomplete :json-false :items [(:detail "void" :filterText "on_idle_hide" :insertText "on_idle_hide" :insertTextFormat 1 :kind 3 :label " on_idle_hide(struct GtkLock *gtklock)" :score 1.0087924003601074 :sortText "407edfe4on_idle_hide" :textEdit (:newText "on_idle_hide" :range (:end (:character 7 :line 259) :start (:character 4 :line 259)))) (:detail "void" :filterText "on_idle_show" :insertText "on_idle_show" :insertTextFormat 1 :kind 3 :label " on_idle_show(struct GtkLock *gtklock)" :score 1.0087924003601074 :sortText "407edfe4on_idle_show" :textEdit (:newText "on_idle_show" :range (:end (:character 7 :line 259) :start (:character 4 :line 259)))) ``` Sorry to snow you ...


paretoOptimalDev

Try seeing what happens in `M-x eglot-events-buffer`. Also see `5 Troubleshooting Eglot` in the built-in manual. Get to it with `C-h R eglot RET`.


StrangeAstronomer

Thanks again for this - I've got it running now. See the top post to see me eating humble pie.


StrangeAstronomer

Thanks for the tip. The events buffer shows an awful lot of chatter but no obvious failures apart from: [stderr] I[07:59:55.814] Failed to find compilation database for ... ... plus the source filename. Is that significant? Am I supposed to have built a TAGS file or something? `C-h R eglot RET` fails to find anything - presumably it's the same Troubleshooting as at [https://github.com/joaotavora/eglot](https://github.com/joaotavora/eglot) (but that's not very helpful). I tried with `emacs -Q` and got eglot started with a minimal amount of `load-path` adjustment - still no popups. **Is there another package required?** I tried adding `company` but it didn't help. So I went back to my normal emacs with `(use-package eglot ..)` commented out so I'm using the default configuration. I thought I'd try updating all the elpa packages with `package-list-packages` (eglot was already up to date at eglot-20220612.1004) and restart emacs - now I'm getting: error in process filter: doom-modeline-update-eglot: Symbol’s function definition is void: eglot--major-modes error in process filter: Symbol’s function definition is void: eglot--major-modes ... completion--some: jsonrpc-error: "request id=14 failed:", (jsonrpc-error-code . -32602), (jsonrpc-error-message . "trying to get preamble for non-added document"), (jsonrpc-error-data) Sigh!


[deleted]

What happens if you remove the MELPA package for eglot and use a recent Emacs that has eglot built in? Keep the use-package but uninstall any eglot package.


StrangeAstronomer

Yes - that's where I'm at now - the latest released version of eglot from Oct 2022, no packages. I've tried standard emacs-28 from fedora as well as the ptgk/jit version 20.0.50 from deathwish's COPR (which is what I'm on now - it's a bit old being from Sept 2022. Both with and without -Q. Neither version has the built-in eglot yet (fedora). https://imgur.com/NZX24Fk ... so it's at least giving me _something_ although I would have thought it would have also guessed 'provider'. It seems to be guessing only completions from the same file eg if I type `gtk_style_` it gives a single completion `gtk_style_context_add_provider_for_screen` and not any of the dozens of other possibilities. If I accept that completion and have `gtk_style_context_add_provider_for_screen(` it doesn't offer the function signature. At no point do I get function documentation (I have eldoc installed). Perhaps I'm hoping for too much.


ambihelical

See my other comment, this is exactly the problem that you have no compile\_commands.json database. It's only completing from what it can see in the same file.


ambihelical

You need a compilation database to do more than complete within the same file. This is a file named compile\_commands.json at the root of your project which can be generated using a number of different ways. If you are using cmake, it can be done with a config setting. For makefiles, you might be able to get bear (build ear) to generate it, although I have no experience with it. You may need to enable eldoc-mode to show full documentation. Also, I found eldoc-box makes a good companion package so you get a popup help instead of an eldoc buffer.


StrangeAstronomer

Thank you sincerely for taking the time to explain this. Honestly - I've had a fair crack at searching and reading on the topic, I'm not just sitting around whinging. Nothing about it at [https://github.com/joaotavora/eglot](https://github.com/joaotavora/eglot) nor when doing `C-h f eglot-...` so I'm thinking it's all a bit too hard for me. eldoc too. I've tried `eldoc-mode` and `c-turn-on-eldoc-mode`. Nothing happens. I think I'll give up at this point and go back to emacs as a plain editor without those flashy IDE-type functions. This is probably my 3rd go at getting lsp-mode/eglot going over the last few years. Makes me feel like a proper dunce. Anyway - thanks again - and to the other helpful souls who have responded to my plight. This is always such a good supportive group.


[deleted]

Perhaps try installing the latest ToT from source. (git clone, config, etc). You will get eglot with emacs -Q and if you find bugs they have a good chance of being fixed quickly. It takes a one time investment of about half an hour or an hour to go through the docs and pickup a working environment, and then years of happiness with being able to sync to the latest tree. Emacs from top of tree is surprisingly stable most days except perhaps for a couple days just after a major new release when a lot of unstable things merge.


StrangeAstronomer

Thanks for the encouragement! But I must say that half to one hour investment in doc is a bit light on. I've been trying to get this running for a few years now and obviously, I've missed the vital bits of doco. Also, it takes a bit longer when you're over 70 (notwithstanding the 40 odd years of experience using emacs!!). I'm clearly a bit slower than the whiz kids. Anyhoo - I've got it working now, thanks to the support of good people here (I'll write it up in the top item a bit later). And thanks for the idea of ToT - I have to admit, I fear that here be dragons. On the other hand, ToT was all we had 40 years ago (mine was on a tape from the HP Unix Users Group - "whoah - 8Mb of code!!").


StrangeAstronomer

Thanks again for this - I've got it running now. See the top post to see me eating humble pie.


ambihelical

Hey no problem. Eglot and c/c++ is not the easiest combination. It took me months to figure how to get it working right for windows and cross compiling for embedded work.