]> git.eshelyaron.com Git - emacs.git/log
emacs.git
4 years agoAbide by lsp when reporting and moving to columns
Felicián Németh [Sun, 19 Jan 2020 10:13:20 +0000 (11:13 +0100)]
Abide by lsp when reporting and moving to columns

* eglot.el (eglot-current-column-function): Set to
eglot-lsp-abiding-column.
(eglot-move-to-column-function): Set to
eglot-move-to-lsp-abiding-column.

* NEWS.md: Log the change here as well.

Co-authored-by: João Távora <joaotavora@gmail.com>
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/361

4 years agoFix eglot-move-to-lsp-abiding-column ()
João Távora [Sun, 19 Jan 2020 10:02:55 +0000 (11:02 +0100)]
Fix eglot-move-to-lsp-abiding-column ()

Ensure conformance with the this part of the specification: "if the
character value is greater than the line length it defaults back to
the line length."

* eglot.el: (eglot-move-to-lsp-abiding-column): Don't move beyond
line-end.

GitHub-reference: https://github.com/joaotavora/eglot/issues/361

4 years agoSend shutdown and exit messages without arguments
Felicián Németh [Thu, 16 Apr 2020 07:38:31 +0000 (09:38 +0200)]
Send shutdown and exit messages without arguments

Fix regression introduced in 70e6157b (https://github.com/joaotavora/eglot/issues/315).  According to the
LSP specification the exit notification and the shutdown request
shouldn't have arguments ("params: void").  Note that jsonrpc.el
send nil as null on the wire.

* eglot.el (eglot-shutdown): Change back the arguments of
:shutdown and :exit to nil.

GitHub-reference: fix https://github.com/joaotavora/eglot/issues/430

4 years agoIgnore empty hover info
Felicián Németh [Fri, 20 Mar 2020 08:42:44 +0000 (09:42 +0100)]
Ignore empty hover info

This just mimics a similar check in `eglot-help-at-point'.

* eglot.el (eglot-eldoc-function): Check emptiness of `contents' more
carefully.

GitHub-reference: fix https://github.com/joaotavora/eglot/issues/425

4 years agoMake a public reader for project-nickname
Felicián Németh [Fri, 22 Nov 2019 17:35:01 +0000 (18:35 +0100)]
Make a public reader for project-nickname

Close https://github.com/joaotavora/eglot/issues/399.

* eglot.el (eglot-lsp-server): Add a public reader for
project-nickname as eglot-project-nickname.
(eglot--connect, eglot--read-server, eglot--mode-line-format): Use
the public variant.

GitHub-reference: per https://github.com/joaotavora/eglot/issues/354

4 years agoAdd public hook eglot-managed-mode-hook
Felicián Németh [Fri, 22 Nov 2019 15:55:04 +0000 (16:55 +0100)]
Add public hook eglot-managed-mode-hook

Per https://github.com/joaotavora/eglot/issues/354.

* eglot.el (eglot-managed-p): New function.
(eglot--managed-mode-hook): Obsolete it.
(eglot-managed-mode-hook): New hook variable.
(eglot--managed-mode): Run the new hook.

* README.md (Customization): Mention the new hook.

GitHub-reference: fix https://github.com/joaotavora/eglot/issues/182

4 years agoIntroduce and use eglot--{}, the empty json object
Vladimir Panteleev [Tue, 19 Nov 2019 02:04:43 +0000 (02:04 +0000)]
Introduce and use eglot--{}, the empty json object

* eglot.el (Constants): Add eglot--{}.
(eglot-shutdown, eglot--connect): Use it.

Copyright-paperwork-exempt: yes
GitHub-reference: close https://github.com/joaotavora/eglot/issues/315

4 years agoCall shutdown/exit methods with params:{}, not null
Vladimir Panteleev [Sun, 6 Oct 2019 16:10:32 +0000 (16:10 +0000)]
Call shutdown/exit methods with params:{}, not null

"null" is not a valid JSON value for "params" according to the
JSON-RPC specification.

* eglot.el (eglot-shutdown): Do the same thing as for "initialized",
and use an empty hash table to be serialized to {}.

Copyright-paperwork-exempt: yes
GitHub-reference: per https://github.com/joaotavora/eglot/issues/315

4 years agoSupport bug-reference-prog-mode
Felicián Németh [Thu, 9 Jan 2020 18:28:08 +0000 (13:28 -0500)]
Support bug-reference-prog-mode

* eglot.el (Local Variables): Add bug-reference-bug-regexp and
bug-reference-url-format.

GitHub-reference: close https://github.com/joaotavora/eglot/issues/405

4 years agoRevert the last change about column calculation
Felicián Németh [Wed, 8 Jan 2020 17:02:07 +0000 (18:02 +0100)]
Revert the last change about column calculation

4 years agoDocument the changes in column calculation
Felicián Németh [Wed, 8 Jan 2020 15:51:09 +0000 (16:51 +0100)]
Document the changes in column calculation

* eglot.el (eglot-current-column-function)
(eglot-move-to-column-function): Document the change of the
default value.

* NEWS.md: Log the change here as well.

4 years agoAbide by lsp when reporting and moving to columns
João Távora [Fri, 29 Nov 2019 23:42:58 +0000 (23:42 +0000)]
Abide by lsp when reporting and moving to columns

* eglot.el (eglot-current-column-function): Set to
eglot-lsp-abiding-column.
(eglot-move-to-column-function): Set to
eglot-move-to-lsp-abiding-column.

GitHub-reference: fix https://github.com/joaotavora/eglot/issues/361

4 years agoMerge pull request from joaotavora/scratch/fix-277-exit-notification
Felicián Németh [Sun, 5 Jan 2020 13:32:15 +0000 (08:32 -0500)]
Merge pull request from joaotavora/scratch/fix-277-exit-notification

Fix https://github.com/joaotavora/eglot/issues/277: Send exit as a notification

GitHub-reference: https://github.com/joaotavora/eglot/issues/400

4 years agoSend exit as a notification
Felicián Németh [Sat, 4 Jan 2020 15:55:00 +0000 (16:55 +0100)]
Send exit as a notification

This is what the specification requires.  @PerMildner, thanks for
reporting and analyzing the issue.

* eglot.el (eglot-shutdown): Use `notify' instead of `request' for the
`exit' LSP method.

GitHub-reference: fix https://github.com/joaotavora/eglot/issues/277

4 years agoAvoid double shutdowns and simplify shutdown logic
João Távora [Wed, 1 Jan 2020 22:05:29 +0000 (22:05 +0000)]
Avoid double shutdowns and simplify shutdown logic

* eglot.el (eglot-shutdown): Don't turn off eglot--managed-mode here.
(eglot--on-shutdown): Rather here, but without autoshutdown.
(eglot--managed-mode): Don't check eglot--shutdown-requested.

GitHub-reference: fix https://github.com/joaotavora/eglot/issues/389

4 years agoUse completing-read in eglot-code-actions
Theodor Thornhill [Thu, 2 Jan 2020 09:33:26 +0000 (10:33 +0100)]
Use completing-read in eglot-code-actions

See also https://github.com/joaotavora/eglot/issues/386.

* eglot.el (eglot-code-actions): Replace tmm with completing-read

Copyright-paperwork-exempt: yes
Co-authored-by: João Távora <joaotavora@gmail.com>
GitHub-reference: close https://github.com/joaotavora/eglot/issues/393

5 years ago* eglot.el (eglot-eldoc-function): fix outdated docstring.
Evgeni Kolev [Mon, 30 Dec 2019 09:13:08 +0000 (11:13 +0200)]
* eglot.el (eglot-eldoc-function): fix outdated docstring.

Fix https://github.com/joaotavora/eglot/issues/387

5 years agoAdd elm-language-server as the language server for elm
Steve Purcell [Sat, 28 Dec 2019 13:08:19 +0000 (02:08 +1300)]
Add elm-language-server as the language server for elm

* README.md (Connecting to a server): Add elm-language-server

* eglot.el (eglot-server-programs): Add elm-language-server

Co-authored-by: João Távora <joaotavora@gmail.com>
GitHub-reference: close https://github.com/joaotavora/eglot/issues/383

5 years agoNew eglot-confirm-server-initiated-edits defcustom
Theodor Thornhill [Thu, 26 Dec 2019 08:39:33 +0000 (09:39 +0100)]
New eglot-confirm-server-initiated-edits defcustom

* eglot.el (eglot-confirm-server-initiated-edits): New defcustom.

Copyright-paperwork-exempt: yes
Co-authored-by: João Távora <joaotavora@gmail.com>
GitHub-reference: close https://github.com/joaotavora/eglot/issues/382

5 years agoAdd built-in support for tex and friends
Augusto Stoffel [Wed, 18 Dec 2019 12:44:28 +0000 (13:44 +0100)]
Add built-in support for tex and friends

plain-tex-mode and latex-mode are derived from tex-mode.  Some other
TeX-related modes are not, so they require an explicit mention in
eglot-server-programs.

* README.md (Connecting to a server): Add Digestif to the list

* eglot.el (eglot-server-programs): Add Digestif for TeX-related modes

Copyright-paperwork-exempt: yes
GitHub-reference: close https://github.com/joaotavora/eglot/issues/379

5 years agoAdd metals as the language server for scala
Antoine Kalmbach [Tue, 17 Dec 2019 19:34:29 +0000 (21:34 +0200)]
Add metals as the language server for scala

* README.md (Connecting to a server): Add metals to the list

* eglot.el (eglot-server-programs): Add metals for scala-mode

Copyright-paperwork-exempt: yes
GitHub-reference: close https://github.com/joaotavora/eglot/issues/376

5 years agoAllow non-standard keys in textdocument/publishdiagnostics.
João Távora [Sat, 30 Nov 2019 00:16:12 +0000 (00:16 +0000)]
Allow non-standard keys in textdocument/publishdiagnostics.

* eglot.el (eglot-handle-notification): Allow other keys for
textDocument/publishDiagnostics.

GitHub-reference: fix https://github.com/joaotavora/eglot/issues/357

5 years agoUnbreak window/showmessagerequest
João Távora [Fri, 29 Nov 2019 23:33:12 +0000 (23:33 +0000)]
Unbreak window/showmessagerequest

* eglot.el (eglot-handle-request): Answer with a proper
MessageActionItem.

GitHub-reference: fix https://github.com/joaotavora/eglot/issues/362

5 years agoResolve compilation warnings
João Távora [Wed, 20 Nov 2019 22:55:29 +0000 (22:55 +0000)]
Resolve compilation warnings

* eglot.el (company-tooltip-align-annotations): Forward declare.
(eglot--cached-server): Renamed from eglot--cached-current-server.
(eglot--managed-mode, eglot-current-server)
(eglot--current-server-or-lose)
(eglot--maybe-activate-editing-mode): use it.
(eglot-completion-at-point): Don't use insertTextFormat.

5 years agoLocally tweak imenu-create-index-function
João Távora [Wed, 20 Nov 2019 22:51:42 +0000 (22:51 +0000)]
Locally tweak imenu-create-index-function

* eglot.el (eglot--managed-mode): locally tweak
imenu-create-index-function.

GitHub-reference: fix https://github.com/joaotavora/eglot/issues/351

5 years agoFail when eglot-find-* finds no references
Felicián Németh [Mon, 18 Nov 2019 11:23:37 +0000 (12:23 +0100)]
Fail when eglot-find-* finds no references

* eglot.el (eglot--lsp-xref-helper): Display message when no
references have been found instead of calling xref-find-references.

GitHub-reference: fix https://github.com/joaotavora/eglot/issues/339

5 years agoWaste less space in completion annotations
Xu Chunyang [Sun, 17 Nov 2019 13:17:47 +0000 (21:17 +0800)]
Waste less space in completion annotations

* eglot.el (eglot-completion-at-point): don't add "(snippet)"

Copyright-paperwork-exempt: yes
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/349

5 years ago* eglot.el (eglot-completion-at-point): remove spurious unrelated change.
João Távora [Sun, 17 Nov 2019 13:07:08 +0000 (13:07 +0000)]
* eglot.el (eglot-completion-at-point): remove spurious unrelated change.

5 years agoEnsure process starts in project's root
João Távora [Fri, 15 Nov 2019 16:04:55 +0000 (16:04 +0000)]
Ensure process starts in project's root

Also fix https://github.com/joaotavora/eglot/issues/347.

* eglot.el (eglot--connect): Bind default-directory around make
process.

GitHub-reference: fix https://github.com/joaotavora/eglot/issues/330

5 years agoLet other imenu functions work if lsp server's doesn't
João Távora [Tue, 12 Nov 2019 08:51:09 +0000 (08:51 +0000)]
Let other imenu functions work if lsp server's doesn't

* eglot.el (eglot--stay-out-of-p): New helper.
(eglot--setq-saving): Use it.
(eglot--managed-mode): Use add-function :before-until for
imenu-create-index-function.
(eglot-imenu): Don't error.  Fix indentation.

GitHub-reference: fix https://github.com/joaotavora/eglot/issues/343

5 years agoSupport serverinfo of lsp 3.15.0
Felicián Németh [Tue, 12 Nov 2019 12:50:11 +0000 (13:50 +0100)]
Support serverinfo of lsp 3.15.0

Add support for serverInfo from the upcoming specification.  This
changeset just stores the info sent by the server and slightly changes
a greeting message.  But it opens up the possibility to identify
servers even when eglot uses a TCP connection and therefore makes
possible to implement server specific features (in eglot-x).

Old message:
```
Connected! Server `EGLOT (test-ccls/c++-mode)' now managing `c++-mode' buffers in project `test-ccls'.
```

New message:
```
Connected! Server `ccls' now managing `c++-mode' buffers in project `test-ccls'.
```

* eglot.el (eglot--lsp-interface-alist):  Extend it with serverInfo.
(eglot-lsp-server): Add member variable server-info.
(eglot--connect): Store server-info and display server's name
when connected.

5 years agoSet nobreak-char-display to nil in *eglot-help*
r-zip [Tue, 12 Nov 2019 18:44:01 +0000 (13:44 -0500)]
Set nobreak-char-display to nil in *eglot-help*

* eglot.el (eglot-help-at-point): set nobreak-char-display

Copyright-paperwork-exempt: yes
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/345

5 years agoProtect against empty-string inserttext in completions
João Távora [Wed, 6 Nov 2019 15:11:12 +0000 (15:11 +0000)]
Protect against empty-string inserttext in completions

* eglot.el (eglot-completion-at-point): Don't use insertText as a
proxy.

GitHub-reference: fix https://github.com/joaotavora/eglot/issues/341

5 years agoProvide stable eglot-current-server helper
João Távora [Sat, 9 Nov 2019 22:58:08 +0000 (22:58 +0000)]
Provide stable eglot-current-server helper

It's better if eglot--current-server is removed, since it was being
abused by other packages, and has side effects.  The only place where
it was really needed was eglot--maybe-activate-editing-mode, so the
find-and-cache logic has been moved there.  All other places that can
handle a nil server now use eglot-current-server, the external
version.

* eglot.el (eglot-shutdown, eglot, eglot--read-server)
(eglot--mode-line-format): Use eglot-current-server.
(eglot--connect): Update comment.
(eglot--current-server): Remove.
(eglot-current-server): New helper.
(eglot--maybe-activate-editing-mode): find and cache the server here.

* eglot-tests.el (auto-detect-running-server)
(auto-shutdown, auto-reconnect, eglot-ensure)
(slow-async-connection): Use eglot-current-server.

GitHub-reference: fix https://github.com/joaotavora/eglot/issues/342

5 years agoDon't choke on workspace/configuration with no scopeuri
João Távora [Tue, 5 Nov 2019 23:53:35 +0000 (23:53 +0000)]
Don't choke on workspace/configuration with no scopeuri

* eglot.el (eglot-handle-request): Don't choke on nil scopeUri.

GitHub-reference: fix https://github.com/joaotavora/eglot/issues/340

5 years agoOnly set eglot--cached-current-server by (more aggressive) caching
Ingo Lohmar [Sun, 20 Oct 2019 10:21:37 +0000 (12:21 +0200)]
Only set eglot--cached-current-server by (more aggressive) caching

* eglot.el (eglot--current-server): Always set cache value.
(eglot--maybe-activate-editing-mode): No need to set cached server.

5 years agoSimplify "maybe"-activation, dump "server" arg
Ingo Lohmar [Fri, 18 Oct 2019 19:19:46 +0000 (21:19 +0200)]
Simplify "maybe"-activation, dump "server" arg

* eglot.el (eglot--maybe-activate-editing-mode): Remove `server' arg.

5 years agoMerge -onoff proxy code into minor mode function
Ingo Lohmar [Fri, 18 Oct 2019 19:11:59 +0000 (21:11 +0200)]
Merge -onoff proxy code into minor mode function

This simplifies bookkeeping and keeping the state of locally cached
servers, their managed buffers, and the buffer-local mode consistent.

The "on" case of the -onoff code now expects that
`eglot--cached-current-server' has been set already, the "off" case uses
the same value.

* eglot.el (eglot--managed-mode-onoff): Remove.
(eglot--managed-mode): Adopt code.
(eglot--managed-mode-off): New minimal wrapper.

5 years agoUse completionitem/resolve more abundantly
João Távora [Wed, 30 Oct 2019 01:24:10 +0000 (01:24 +0000)]
Use  completionitem/resolve more abundantly

It was already used to resolve documentation bits of completions, but
it can also be useful to resolve snippet templates and such.

To resolve a completion, you need some part of a completion to start
with.  If it has a :data field exists and the server supports
:resolveProvider, fetch the new object, otherwise use whatever we had
already.

* eglot.el (eglot-completion-at-point): Add another local
function for resolving completions.

GitHub-reference: per https://github.com/joaotavora/eglot/issues/50

5 years agoSupport markdown for textdocument/hover ()
Xu Chunyang [Mon, 28 Oct 2019 15:29:03 +0000 (23:29 +0800)]
Support markdown for textdocument/hover ()

* eglot.el (eglot-client-capabilities): annouce markdown support for hover.
(eglot--format-markup): Format hover info with Markdown.

Fixes: https://github.com/joaotavora/eglot/issues/328
Copyright-paperwork-exempt: yes
GitHub-reference: https://github.com/joaotavora/eglot/issues/329

5 years agoDon't run mode hooks in eglot--format-markup
Xu Chunyang [Sun, 27 Oct 2019 15:41:53 +0000 (23:41 +0800)]
Don't run mode hooks in eglot--format-markup

* eglot.el (eglot--format-markup): Use delay-mode-hooks.

Copyright-paperwork-exempt: yes

5 years agoSupport workspace/configuration
João Távora [Sat, 26 Oct 2019 21:51:57 +0000 (22:51 +0100)]
Support workspace/configuration

This helps users configure servers such as Gopls, which doesn't
support didChangeConfiguration signals.

* README.md (Per-project server configuration): New section.

* eglot.el (eglot-workspace-configuration): Fix docstring.
(eglot-signal-didChangeConfiguration): Rename a variable.
(eglot-handle-request workspace/configuration): New request
handler.

GitHub-reference: fix https://github.com/joaotavora/eglot/issues/326

5 years agoExpand readme.md section on handling quirky servers
João Távora [Thu, 24 Oct 2019 11:32:51 +0000 (12:32 +0100)]
Expand readme.md section on handling quirky servers

Also remove explicit cquery support (cquery seems to be dead anyway).

* README.md (Handling quirky servers): New section.

* eglot.el (eglot-initialization-options eglot-cquery): Remove.

5 years agoUnbreak imenu
João Távora [Tue, 22 Oct 2019 11:18:53 +0000 (12:18 +0100)]
Unbreak imenu

* eglot.el (eglot-imenu): Unbreak.

5 years agoForce company to align completion annotations in eglot sessions
João Távora [Tue, 22 Oct 2019 00:44:54 +0000 (01:44 +0100)]
Force company to align completion annotations in eglot sessions

* eglot.el (eglot--managed-mode): force
company-tooltip-align-annotations to t.

5 years agoFix race condition when company-completing quickly
João Távora [Mon, 21 Oct 2019 21:25:13 +0000 (22:25 +0100)]
Fix race condition when company-completing quickly

For some reason, probably related to the way that Eglot tries to
maintain the responsiveness of Company completion tooltips (see
below), the user's explicit input will sometimes be surprisingly
deleted by Company, leading to a horrible completion experience.

This is sometimes hard to reproduce, but appears to match this
description perfectly:
https://github.com/joaotavora/eglot/issues/319#issuecomment-542955432

Fortunately, Company has a good fix for this, which is to pass
`:company-require-match 'never` in the completion-at-point function.
This is the fix applied in this commit.

However, this line shouldn't be required since the default value for
`company-require-match` is `company-explicit-action-p`, presumably
meaning that the auto-deletion should never take place for characters
typed by the user.

This points to a bug in Company, or at least something which may have
been exacerbated by the way that Eglot aggressively fetches
completions from the server by passing :cancel-on-input to
`jsonrpc-request`, discarding out-of-date replies.  Perhaps that
discarding step bears with it some side-effects that make the
`company-explicit-action-p` test return `nil` instead of the correct
`t`.  Company interprets this as carte blanche to delete the last
inserted character.

* eglot.el (eglot-completion-at-point): Use :company-require-match
'never.

GitHub-reference: per https://github.com/joaotavora/eglot/issues/319

5 years agoUnbreak m-x vc-revert, which reverts preserving modes
João Távora [Mon, 21 Oct 2019 15:07:38 +0000 (16:07 +0100)]
Unbreak m-x vc-revert, which reverts preserving modes

Unlike the normal revert-buffer command, vc-revert, doesn't re-apply
the major mode, meaning it was missing a didOpen to pair with the
didClose that is unconditionally sent on both commands.

Needed to use the dynamic variable revert-buffer-preserve-modes, and,
curiously, also forward-declare it to appease the byte compiler.

* eglot.el (eglot--managed-mode): Use after-revert-hook.
(revert-buffer-preserve-modes): Forward declare.
(eglot--after-revert-hook): Signal didOpen when preserving-modes.
(eglot--maybe-activate-editing-mode): Tweak comment.

5 years ago(again): fix issue with replace-buffer-contents
João Távora [Mon, 21 Oct 2019 12:08:45 +0000 (13:08 +0100)]
(again): fix issue with replace-buffer-contents

Manually calling the before/after change hooks for Emacs 26.1's buggy
replace-buffer-contents must be done with absolute positions, not
markers.

* eglot.el (eglot--apply-text-edits): Call change hooks with
buffer positions, not markers.

GitHub-reference: fix https://github.com/joaotavora/eglot/issues/259

5 years ago* eglot.el (version): bump to 1.5
João Távora [Sun, 20 Oct 2019 11:56:41 +0000 (12:56 +0100)]
* eglot.el (version): bump to 1.5

* NEWS.md: update.

5 years agoLet user keep control of some variables during eglot sessions
João Távora [Sat, 19 Oct 2019 22:07:47 +0000 (23:07 +0100)]
Let user keep control of some variables during eglot sessions

* NEWS.md: Mention new variable eglot-stay-out-of

* eglot.el (eglot-stay-out-of): New variable.
(eglot--setq-saving): Use it.
(eglot--managed-mode): Use eglot--setq-saving for imenu.  No need
to remove 'eglot-flymake-backend from diagnostic functions.

GitHub-reference: fix https://github.com/joaotavora/eglot/issues/324

5 years agoDon't immediately request completions in eglot-completion-at-point
João Távora [Fri, 18 Oct 2019 15:43:50 +0000 (16:43 +0100)]
Don't immediately request completions in eglot-completion-at-point

Yet another adjustment to this function.  According to the
documentation of completion-at-point-functions, we should strive to
make functions like eglot-completion-at-point "cheap to run".
Requesting completion from the server immediately after calling the
function goes against that.  The reason we were doing it is that it
might have helped compute more accurate "bounds" for the return value
(START and END) from possible TextEdit completion items.  But I've
decided it's not worth the effort, at least for now.

* eglot.el (eglot-completion-at-point): Request completions
asynchronously.

5 years agoProtect against zero-length completions
João Távora [Wed, 16 Oct 2019 22:13:09 +0000 (23:13 +0100)]
Protect against zero-length completions

Apparently the Vue Language Server sends such things (see https://github.com/joaotavora/eglot/issues/319).

* eglot.el (eglot-completion-at-point): Protect against
zero-length completions.

5 years agoDon't choke on single-location reply to td/definition
João Távora [Wed, 16 Oct 2019 18:25:51 +0000 (19:25 +0100)]
Don't choke on single-location reply to td/definition

* eglot.el (eglot--lsp-xrefs-for-method): Accept non-vector
Location.

GitHub-reference: fix https://github.com/joaotavora/eglot/issues/321

5 years agoUnbreak eglot--setq-saving if symbol is unbound
João Távora [Wed, 16 Oct 2019 15:46:03 +0000 (16:46 +0100)]
Unbreak eglot--setq-saving if symbol is unbound

* eglot.el (eglot--setq-saving): check if symbol is bound

5 years agoUse of company-capf backend in eglot-managed buffers
João Távora [Wed, 16 Oct 2019 15:29:41 +0000 (16:29 +0100)]
Use of company-capf backend in eglot-managed buffers

* eglot.el (company-backends): forward-declare
(eglot--managed-mode): Force company-backends to company-capf

5 years agoPlay along with lsp's filtertext hacks
João Távora [Wed, 16 Oct 2019 13:16:52 +0000 (14:16 +0100)]
Play along with lsp's filtertext hacks

Reworked important parts of eglot-completion-at-point.

One of the tasks was to cleanup the nomenclature so it's easier to
spot how LSP and Emacs's views of completion techniques differ.  When
reading this rather long function, remember an "item" is a plist
representing the LSP completionItem object, and "proxy" is a
propertized string that Emacs's frontends will use to represent that
completion.  When the completion is close to done, the :exit-function
is called, to potentially rework the inserted text so that the final
result might be quite different from the proxy (it might be a snippet,
or even a suprising text edit).

The most important change in this commit reworks the way the
completion "bounds" are calculated in the buffer.  This is the region
that Emacs needs to know that is being targeted for the completion.  A
server can specify this region by using textEdit-based completions all
consistently pointing to the same range.  If it does so, Emacs will
use that region instead of its own understanding of symbol
boundaries (provided by thingatpt.el and syntax tables).

To implement server-side completion filtering, the server can also
provide a filterText "cookie" in each completion, which, when
prefix-matched to the intended region, selects or rejects the
completion.  Given the feedback in
https://github.com/microsoft/language-server-protocol/issues/651, we
have no choice but to play along with that inneficient and grotesque
strategy to implement flex-style matching.  Like ever in LSP, we do so
while being backward-compatible to all previously supported behaviour.

* eglot.el (eglot-completion-at-point): rework.

GitHub-reference: close https://github.com/joaotavora/eglot/issues/235

5 years agoAlways filter completions client-side by prefix
João Távora [Wed, 16 Oct 2019 08:49:09 +0000 (09:49 +0100)]
Always filter completions client-side by prefix

Prefix completion is all we get in LSP because there are some servers
that send *all* completions everytime.  This is horrible, but it's the
currently defined behaviour.  See
https://github.com/microsoft/language-server-protocol/issues/651.

* eglot.el (eglot-completion-at-point): Use all-completions.

GitHub-reference: per https://github.com/joaotavora/eglot/issues/319

5 years agoFix bug in workspace/didchangewatchedfiles
João Távora [Tue, 15 Oct 2019 17:42:33 +0000 (18:42 +0100)]
Fix bug in workspace/didchangewatchedfiles

* eglot.el (eglot-register-capability): Fix a bug and a couple of
warnings.

5 years agoAdd support for the ada language server
Tom Tromey [Tue, 15 Oct 2019 16:32:57 +0000 (10:32 -0600)]
Add support for the ada language server

* eglot.el (eglot-server-programs): Add ada-mode entry.

* README.md (Connecting to a server): Add Ada entry.

GitHub-reference: close https://github.com/joaotavora/eglot/issues/316

5 years agoFix eglot-completion-at-point to work with bare completion-at-point
João Távora [Sat, 12 Oct 2019 00:57:00 +0000 (01:57 +0100)]
Fix eglot-completion-at-point to work with bare completion-at-point

Fixes https://github.com/joaotavora/eglot/issues/313, fixes https://github.com/joaotavora/eglot/issues/311, fixes https://github.com/joaotavora/eglot/issues/279

As is well known, LSP's and Emacs's completion mechanics don't fit
very well together, mostly because Emacs expects completion to be a
something of a pure function of a string argument and LSP treats as a
function of a concrete buffer position.

A further complication arises because some completion frontends like
"bare" completion-at-point make Emacs modify the buffer's contents
during the completion process, while other (notably company-mode)
don't do that.  Thus, 'eglot-completion-at-point' must take extra care
to answer to the questions listed in the "(elisp)Programmed
Completion" info node based on its (quite hacky) "completions" local
var and _not_ based on the intermediate buffer contents.  That var is
also used to cache the last LSP response and allow the :exit-function
callback to retrieve much more than just the completion text in

In yet another related problem, :exit-function won't be called at all
with completion-at-point if the completion table doesn't answer
properly to test-completion.  A previous use of
completion-table-dynamic was found to be unsuitable here: we must
answer all the requests separately.

* eglot.el (eglot-completion-at-point): Rework.

5 years agoUnbreak xref-find-definitions
João Távora [Sun, 13 Oct 2019 21:32:52 +0000 (22:32 +0100)]
Unbreak xref-find-definitions

* eglot-tests.el (basic-xref): New test.

* eglot.el (eglot--collecting-xrefs): Add an edebug spec.
(eglot--lsp-xrefs-for-method): Actually collect xref.
(xref-backend-apropos): Fix indentation slightly.

GitHub-reference: fix https://github.com/joaotavora/eglot/issues/318

5 years agoMisc improvements to the xref glue code
João Távora [Wed, 9 Oct 2019 18:30:27 +0000 (19:30 +0100)]
Misc improvements to the xref glue code

* eglot.el (eglot-xref-backend): Don't check capability here.
(eglot--collecting-xrefs): Reworked from  eglot--handling-xrefs.
(eglot--handling-xrefs): Remove.
(xref-backend-apropos, eglot--lsp-xrefs-for-method): Use eglot--collecting-xrefs.

5 years agoRework and correct major part of xref glue code
João Távora [Sun, 6 Oct 2019 15:10:33 +0000 (16:10 +0100)]
Rework and correct major part of xref glue code

See comments of https://github.com/joaotavora/eglot/pull/314.  Up to
now, xref-backend-indentifier-completion-table was a gross hack that
only worked sometimes.  It relied on some fugly gymnastics to cache a
response from :textDocument/documentSymbol and somehow used that
information to build a completion table.  But it doesn't work well.

Summarily, LSP doesn't lend itself well to the xref interface of
prompting for an arbitrary identifier and then go look for whichever
type of references of that identifier.  All the LSP
:textDocument/{definition,references,implementation,...} methods
expect to know the exact context of the search the user is about to
perform, in the form of a document location.  That conflicts with the
xref "arbitrary string" requirement.

Therefore, the slightly limited, but much more correct way, for Eglot
to function is to override the user's preference of
xref-prompt-for-identifier, temporarily setting it to nil in
eglot--managed-mode (ideally, though, xref-prompt-for-identifier
should be a function of the backend.)

Later on, a possibly better behaved identifier completion table can be
built on top of the :workspace/symbol LSP method.

* eglot.el (xref-backend-identifier-at-point): Rewrite.
(eglot--lsp-xrefs-for-method): New helper.
(eglot--lsp-xref-helper): Use eglot--lsp-xrefs-for-method.
(eglot--xref-definitions-method): Delete.
(eglot--lsp-xref-refs): New variable.
(xref-backend-references, xref-backend-definitions): Use
eglot--lsp-xrefs-for-method.
(eglot--managed-mode): Set xref-prompt-for-identifier
to nil.
(eglot--xref-reset-known-symbols, eglot--xref-known-symbols): Delete
(xref-backend-identifier-completion-table): Nullify.
(eglot-find-declaration, eglot-find-implementation)
(eglot-find-typeDefinition): Use eglot--lsp-xref-helper.

5 years agoSupport goto-{declaration, implementation, typedefinition}
Felicián Németh [Thu, 3 Oct 2019 19:11:18 +0000 (21:11 +0200)]
Support goto-{declaration, implementation, typedefinition}

Closes https://github.com/joaotavora/eglot/issues/302.

* eglot.el (eglot--xref-definitions-method): New variable.
(xref-backend-definitions): Use it.
(eglot-find-declaration, eglot-find-implementation,
eglot-find-typeDefinition): New functions.

* README.md (Language features): Add new capabilities.

* eglot.el (eglot-client-capabilities): Add new capabilities.
(eglot-ignored-server-capabilites): Add new capability.

5 years agoAllow user to set idle time to wait before processing changes
ambihelical [Sat, 11 May 2019 18:41:52 +0000 (11:41 -0700)]
Allow user to set idle time to wait before processing changes

* eglot.el (eglot-send-changes-idle-time): New defcustom.
(eglot--after-change): Use it.

Co-authored-by: João Távora <joaotavora@gmail.com>
Copyright-paperwork-exempt: yes
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/258

5 years agoMuch less noisy mode line
João Távora [Sat, 5 Oct 2019 11:32:23 +0000 (12:32 +0100)]
Much less noisy mode line

* eglot.el (eglot--mode-line-format): Simplify.

GitHub-reference: fix https://github.com/joaotavora/eglot/issues/236

5 years agoUnbreak elm language server which does use :triggercharacters
João Távora [Mon, 30 Sep 2019 16:06:48 +0000 (18:06 +0200)]
Unbreak elm language server which does use :triggercharacters

Only query completionProvider -> triggerCharacter information if the
server has provided it.  Elm's, and probaly other's, do not provide
it, which doesn't mean they don't support completion.

* eglot.el (eglot-completion-at-point): Check that completion
capability is a list before treating it like one.

GitHub-reference: fix https://github.com/joaotavora/eglot/issues/285

5 years agoRevert "treat null/nil server capabilities as false"
João Távora [Sat, 5 Oct 2019 10:46:08 +0000 (11:46 +0100)]
Revert "treat null/nil server capabilities as false"

This reverts commit 645bcfc6e57181c39dae1f238758e76c1759a765.

A capability of "null" is downright invalid, and must NOT be mistaken
for a value of "{}" (which indicates the presence of the capability)
or "False" (which indicates its asence).  See
https://github.com/microsoft/language-server-protocol/issues/830#issuecomment-537849292
for a clarification from the LSP maintainer.

5 years agoDon't send dummy json object in "initialized" notification ()
Vladimir Panteleev [Fri, 4 Oct 2019 10:13:32 +0000 (10:13 +0000)]
Don't send dummy json object in "initialized" notification ()

Eglot uses a JSON object { __dummy__ : true } as a placeholder instead
of the empty object {}.  It does this out of necessity, since encoding
an empty object can't currently be easily using the current jsonrpc.el
library.  However, this also causes the parameter to be actually sent
to the server.

Since the JSON-RPC specification states "The names MUST match exactly,
including case, to the method's expected parameters" this is
non-conforming to the protocol.

The LSP specification does not seem to indicate how servers should
handle method calls with parameters they do not support.  As such,
ignoring the parameter, or reporting an error, or crashing all seem to
be "valid" behaviors as far as the specification is concerned.

We can avoid this by using an empty hash table instead of a dummy
parameter.  Currently, an empty hash table is the only Emacs Lisp
object which jsonrpc.el serializes to an empty JSON object in
jsonrpc--json-encode.

* eglot.el (eglot--connect): Use make-hash-table instead of dummy
  object.

Copyright-paperwork-exempt: yes
GitHub-reference: https://github.com/joaotavora/eglot/issues/312

5 years agoOptionally shutdown after killing last buffer of managed project ()
Ingo Lohmar [Wed, 2 Oct 2019 16:05:15 +0000 (18:05 +0200)]
Optionally shutdown after killing last buffer of managed project ()

This should close issue https://github.com/joaotavora/eglot/issues/217, also cf. https://github.com/joaotavora/eglot/issues/270.

* eglot.el (eglot-autoshutdown): New defcustom.
(eglot--managed-mode-onoff): Shutdown if so configured and
no managed buffers left.

Co-authored-by: João Távora <joaotavora@gmail.com>
GitHub-reference: https://github.com/joaotavora/eglot/issues/309

5 years agoOn buffer kill, first send didclose then teardown local structures
Ingo Lohmar [Wed, 2 Oct 2019 16:03:48 +0000 (18:03 +0200)]
On buffer kill, first send didclose then teardown local structures

It used to be the reverse way around, which doesn't make sense.

* eglot.el (eglot-managed-mode): Fix order in `kill-buffer-hook'

Co-authored-by: João Távora <joaotavora@gmail.com>
5 years agoAlso use signature label offsets for parameter info
galeo [Thu, 26 Sep 2019 12:04:13 +0000 (20:04 +0800)]
Also use signature label offsets for parameter info

According to the LSP specification, a parameter of a callable-signature
has a label and a optional doc-commet. The label of a parameter
information is either a string or an inclusive start and exclusive end
offsets within its containing signature label.

Previously, this was only taken in account for highlighting the
parameter in the definition signature.

* eglot.el (eglot--sig-info): Handle signature label offsets
  when printing the signature parameter information.

Copyright-paperwork-exempt: yes
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/272

5 years agoMerge pull request from jorams/nil-capabilities-as-false
Felicián Németh [Tue, 24 Sep 2019 15:47:58 +0000 (17:47 +0200)]
Merge pull request from jorams/nil-capabilities-as-false

Treat null/nil server capabilities as false

GitHub-reference: https://github.com/joaotavora/eglot/issues/298

5 years agoUse gopls server as the default for go ()
Ingo Lohmar [Mon, 23 Sep 2019 18:05:55 +0000 (20:05 +0200)]
Use gopls server as the default for go ()

Developers recommend it: see
https://github.com/sourcegraph/go-langserver/blob/master/README.md

* eglot (eglot-server-programs): Use gopls.

* README.md: mention gopls instead of go-langserver.

GitHub-reference: https://github.com/joaotavora/eglot/issues/304

5 years agoTreat null/nil server capabilities as false
Joram Schrijver [Fri, 13 Sep 2019 09:48:10 +0000 (11:48 +0200)]
Treat null/nil server capabilities as false

Some language servers may specify null for some capabilities in the list
of server capabilities. This does not conform to the specification, but
treating it as false is more reasonable than treating it as true.

A current example is the PHP language server. which specifies null for
every capability it does not handle, like documentHighlightProvider.
This would cause Eglot to send constant textDocument/documentHighlight
requests, which all timed out.

* eglot.el (eglot--server-capable): Change the handling of null values
  for capabilities to treat them as false instead of true.

Copyright-paperwork-exempt: yes

5 years agoChange the default of eglot-move-to-column-function
Felicián Németh [Tue, 10 Sep 2019 13:31:16 +0000 (15:31 +0200)]
Change the default of eglot-move-to-column-function

Previous default (move-to-column) works on visual columns, the LSP
specification and the new default (eglot-move-to-column) use "real"
columns.  Fixes https://github.com/joaotavora/eglot/issues/293 and https://github.com/joaotavora/eglot/issues/297.

* eglot.el (eglot-move-to-column): New function.
(eglot-move-to-column-function): Use it as default.

5 years agoRequire array package to use current-line ()
David Florness [Mon, 19 Aug 2019 00:09:13 +0000 (18:09 -0600)]
Require array package to use current-line ()

The jsonrpc package (one of eglot's dependencies) recently
updated and removed the line requiring the array package. Since
current-line is provided by array and is used by eglot, require
array explicitly.

Here's jsonrpc's guilty commit:

https://git.savannah.gnu.org/cgit/emacs.git/commit/lisp/jsonrpc.el?id=c676444a43e4634c1f98ec286b5bd9e46b23216b

Copyright-paperwork-exempt: Yes

* eglot.el (array): Require it.

GitHub-reference: https://github.com/joaotavora/eglot/issues/294

5 years agoExpand directory watcher globs containing ** ()
Jürgen Hötzel [Mon, 12 Aug 2019 20:13:47 +0000 (22:13 +0200)]
Expand directory watcher globs containing ** ()

Previously, if the server requested a glob pattern like foo/**/*
to be watched, we would just error.  Now we watch foo/bar/ and
foo/baz/ as if the server had requested those two watchers
instead of just the one with the **.

As a limitation, the implementation of file-expand-wildcards
doesn't fully handle ** globstars (** matches at most one path
segment).

* eglot.el (eglot-register-capability workspace/didChangeWatchedFiles):
Use file-expand-wildcards to make a ** glob into multiple **-less
globs.

GitHub-reference: https://github.com/joaotavora/eglot/issues/293

5 years agoFix invalid guess for php language server ()
Jürgen Hötzel [Thu, 18 Jul 2019 19:36:56 +0000 (21:36 +0200)]
Fix invalid guess for php language server ()

* eglot.el (eglot-server-programs): Change the position of the php
language server, otherwise it will always be hidden by the c-mode
server (php-mode is derived from c-mode).

Copyright-paperwork-exempt: yes
GitHub-reference: https://github.com/joaotavora/eglot/issues/288

5 years agoFix a typo
haqle314 [Tue, 2 Jul 2019 21:58:41 +0000 (16:58 -0500)]
Fix a typo

* eglot.el (eglot--lsp-position-to-point): fix eglot--warn
call

Copyright-paperwork-exempt: yes
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/273

5 years agoSimplify eldoc usage ()
Ingo Lohmar [Thu, 27 Jun 2019 16:56:45 +0000 (18:56 +0200)]
Simplify eldoc usage ()

* eglot-tests.el (hover-after-completions): Protect test.  Rewrite
docstring.

* eglot.el (eglot--managed-mode): Don't mess with eldoc-message-function.
(eglot--eldoc-hint): Remove.
(eglot--update-doc): Rename and rewrite from eglot--eldoc-message.
(eglot-eldoc-function): Don't set eglot--eldoc-hint.
Call eglot--update-doc.

GitHub-reference: https://github.com/joaotavora/eglot/issues/269

5 years agoLeniently handle invalid positions sent by some servers
João Távora [Thu, 27 Jun 2019 16:55:05 +0000 (17:55 +0100)]
Leniently handle invalid positions sent by some servers

* eglot.el (eglot--lsp-position-to-point): Leniently squash
invalid character positions to 0.

GitHub-reference: fix https://github.com/joaotavora/eglot/issues/273

5 years agoAdd built-in support for elixir's elixir-ls ()
Akash Hiremath [Sun, 12 May 2019 10:47:37 +0000 (16:17 +0530)]
Add built-in support for elixir's elixir-ls ()

* README.md: add elixir-ls.

* eglot.el (eglot-server-programs): add elixir-ls.

Copyright-paperwork-exempt: yes
GitHub-reference: https://github.com/joaotavora/eglot/issues/264

5 years agoWork around a bug in emacs's change detection
João Távora [Thu, 9 May 2019 10:38:58 +0000 (11:38 +0100)]
Work around a bug in emacs's change detection

When using capitalize-word, or any case-fiddling function,
before-change-functions will record e.g. the whole word's start and
end, even though only the first character has changed.  Not only is
this longer than needed but also conflicts with what we get in
after-change-functions, which records just the one-char-long change.

Also, if the word didn't need any fiddling at all then
before-change-function will run but after-change-functions won't: an
"orphan" before-change will erroneously be sent to the server.

* eglot.el (eglot--after-change): Detect problematic case and fix
change description.
(eglot--before-change): Store markers of changed region.
(eglot--signal-textDocument/didChange): Weed out orphan changes.

GitHub-reference: fix https://github.com/joaotavora/eglot/issues/259

5 years agoFix case when eglot-put-doc-in-help-buffer is nil
João Távora [Thu, 9 May 2019 18:49:31 +0000 (19:49 +0100)]
Fix case when eglot-put-doc-in-help-buffer is nil

* eglot.el (eglot--eldoc-message): Check eglot-put-doc-in-help-buffer.

GitHub-reference: fix https://github.com/joaotavora/eglot/issues/263

5 years agoOnly consider eglot's own diagnostics in eglot-code-actions
Michal Krzywkowski [Wed, 8 May 2019 11:33:34 +0000 (13:33 +0200)]
Only consider eglot's own diagnostics in eglot-code-actions

* eglot.el (eglot-code-actions): Filter out non-eglot diagnostics
  before sending a request to the server.

GitHub-reference: fix https://github.com/joaotavora/eglot/issues/260

5 years agoFix local function call in directory watcher ()
vjoki [Tue, 30 Apr 2019 09:35:24 +0000 (12:35 +0300)]
Fix local function call in directory watcher ()

Copyright-paperwork-exempt: yes

* eglot.el (eglot-register-capability
workspace/didChangeWatchFiles): fix call to handle-event.

GitHub-reference: https://github.com/joaotavora/eglot/issues/255

5 years agoUnbreak build
João Távora [Wed, 13 Feb 2019 09:24:02 +0000 (09:24 +0000)]
Unbreak build

Messed up the name of eglot-xref-lessp-function.

* eglot.el (eglot--handling-xrefs): Use eglot-xref-lessp-function

GitHub-reference: per https://github.com/joaotavora/eglot/issues/220

5 years ago* eglot.el (xref-backend-references): don't use return-from.
João Távora [Mon, 11 Feb 2019 21:34:50 +0000 (21:34 +0000)]
* eglot.el (xref-backend-references): don't use return-from.

5 years agoDon't sort xref's by default
João Távora [Mon, 11 Feb 2019 21:33:49 +0000 (21:33 +0000)]
Don't sort xref's by default

But use a eglot-xref-lessp-function in case someone wants to tweak
this.

* eglot.el (eglot-xref-lessp-function): New variable.
(eglot--handling-xrefs): Use it.

GitHub-reference: fix https://github.com/joaotavora/eglot/issues/220

5 years agoUse a less buggy flymake
João Távora [Mon, 11 Feb 2019 21:21:49 +0000 (21:21 +0000)]
Use a less buggy flymake

* eglot.el (Package-Requires) Require flymake 1.0.5

GitHub-reference: fix https://github.com/joaotavora/eglot/issues/223

5 years agoDon't teardown company if started via trigger chars
João Távora [Tue, 5 Feb 2019 21:49:38 +0000 (21:49 +0000)]
Don't teardown company if started via trigger chars

Reported by zhanghj in https://github.com/company-mode/company-mode/issues/866

* eglot.el (eglot-completion-at-point): More carefully calculate
:company-prefix-length

5 years agoConsider mode derivation when guessing servers
João Távora [Mon, 14 Jan 2019 15:31:26 +0000 (15:31 +0000)]
Consider mode derivation when guessing servers

* eglot.el (eglot-server-programs): Remove js2-mode and rjsx-mode.
(eglot--guess-contact): Use provided-mode-derived-p

GitHub-reference: per https://github.com/joaotavora/eglot/issues/177

5 years agoProtect against null messages from eldoc
João Távora [Mon, 14 Jan 2019 14:15:20 +0000 (14:15 +0000)]
Protect against null messages from eldoc

* eglot.el (eglot--eldoc-message): Protect against nil FORMAT.

GitHub-reference: fix https://github.com/joaotavora/eglot/issues/209

5 years agoFix bug introduced by commit fixing this issue
Sergey Kostyaev [Thu, 10 Jan 2019 19:45:30 +0000 (02:45 +0700)]
Fix bug introduced by commit fixing this issue

* eglot.el (eglot--sig-info): Protect against invalid label.

GitHub-reference: per https://github.com/joaotavora/eglot/issues/121

5 years agoAdd built-in support for dart's dart_language_server
Brady Trainor [Wed, 26 Dec 2018 00:21:53 +0000 (16:21 -0800)]
Add built-in support for dart's dart_language_server

Closes https://github.com/joaotavora/eglot/issues/194.

Copyright-paperwork-exempt: yes

* README.md (Connecting to a server): Add dart_language_server.

* eglot.el (eglot-server-programs): Add dart_language_server.

5 years agoHandle label offsets in parameterinformation
João Távora [Wed, 9 Jan 2019 21:09:35 +0000 (21:09 +0000)]
Handle label offsets in parameterinformation

At least ccls uses this.

* eglot.el (eglot-client-capabilities): Declare support for
:labelOffsetSupport.
(eglot--sig-info): Handle label offsets in ParameterInformation

GitHub-reference: fix https://github.com/joaotavora/eglot/issues/201

5 years agoDisplay truncated docstring if too large for echo area
João Távora [Mon, 7 Jan 2019 08:44:37 +0000 (08:44 +0000)]
Display truncated docstring if too large for echo area

* eglot.el (eglot--eldoc-message): Display first line doc.

5 years agoRename new defcustoms with friendlier names
João Távora [Sun, 6 Jan 2019 22:14:27 +0000 (22:14 +0000)]
Rename new defcustoms with friendlier names

* eglot.el (eglot-doc-too-large-for-echo-area): Rename from
eglot-eldoc-extra-buffer-if-too-large.
(eglot-put-doc-in-help-buffer): Rename from
eglot-eldoc-extra-buffer.
(eglot-auto-display-help-buffer): Rename from
eglot-auto-display-eldoc-extra-buffer.
(eglot--eldoc-message): Use new variable names.

5 years agoFix test failure introduced by previous commit
João Távora [Sun, 6 Jan 2019 12:55:21 +0000 (12:55 +0000)]
Fix test failure introduced by previous commit

Remove the hack of unsetting eldoc-last-message in
eglot--eldoc-message.  This allows any subsequent eglot-eldoc-function
calls (prompted by simple cursor movement) to return it immediately,
thus refreshing the help buffer with the same contents.  For this to
work, we also have to set eglot--eldoc-hint globally in
eglot-eldoc-function.

An alternative to making the test pass would be to keep the hack of
unsetting eldoc-last-message only in the case that we actually get to
display the help buffer.  This would actually be more efficient, but
potentially more hacky.

The bottom line here is that eldoc doesn't have a good API to deal
with asynchronous docstring fetching.  See this thread:

https://lists.gnu.org/archive/html/emacs-devel/2018-05/msg00151.html

* eglot.el (eglot--eldoc-message): Don't unset eldoc-last-message.
(eglot-eldoc-function): Set eglot--eldoc-hint for synchronous
operation too.