]> git.eshelyaron.com Git - emacs.git/log
emacs.git
2 years agoGuess the "lsp identifier at point"
João Távora [Fri, 15 Jul 2022 11:01:44 +0000 (12:01 +0100)]
Guess the "lsp identifier at point"

* eglot.el (eglot--workspace-symbols): New helper.
(xref-backend-identifier-completion-table): Rework.
(xref-backend-identifier-at-point): Rework.

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

2 years agoTweak some details, fix some bugs
João Távora [Fri, 15 Jul 2022 09:25:55 +0000 (10:25 +0100)]
Tweak some details, fix some bugs

eglot--recover-workspace-symbol-meta had a bug that still made it
choke on improper lists.

Also, when simply M-. to the thing at point, let's not lose time on
iterating a potentially out-of-date eglot--workspace-symbols-cache.
So clear it early in the pre-command-hook.

* eglot.el (eglot--workspace-symbols-cache): Move up.
(eglot--pre-command-hook): Clear eglot--workspace-symbols-cache here.
(eglot--recover-workspace-symbol-meta): Check for consp.

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

2 years agoCosmetic decisions guaranteed to tick off someone somewhere (tm)
João Távora [Thu, 14 Jul 2022 09:09:27 +0000 (10:09 +0100)]
Cosmetic decisions guaranteed to tick off someone somewhere (tm)

The symbols returned by the LSP server must be converted to unique
strings if Emacs is to present them in a list.  On the other hand, the
search operates on the pattern and is completely controlled by the
backend.  There is not much Eglot, the LSP client, can do about this.

Decided to present the unique string to the user, even though it could
be hidden.  All the manner of :annotation-function,
:affixation-function, :group-funcion etc didn't seem to add much
value.

Grouping was especially useless, since it makes sense to respect the
LSP server's account of sorting score, so that better results bubble
up to the top.

* eglot.el (xref-backend-identifier-completion-table): Uniquify
symbols with containerName and kind.

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

2 years agoExperiment with grouping in xref-backend-identifier-completion-table
João Távora [Wed, 13 Jul 2022 15:42:10 +0000 (16:42 +0100)]
Experiment with grouping in xref-backend-identifier-completion-table

Doesn't look very good.

* eglot.el (xref-backend-identifier-completion-table): Add stuff.

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

2 years agoMake c-u m-. work half decently
João Távora [Tue, 12 Jul 2022 23:44:32 +0000 (00:44 +0100)]
Make c-u m-. work half decently

* NEWS.md: Mention change.

* eglot.el (eglot--lsp-interface-alist): Add WorkspaceSymbol
(eglot--workspace-symbols-cache): New variable.
(eglot--recover-workspace-meta): New helper.
(xref-backend-identifier-completion-table): Complicate.
(xref-backend-definitions): Complicate.
(completion-category-overrides): Register a category and a style here.
(completion-styles-alist): Add eglot--lsp-backend-style style
(eglot--lsp-backend-style-call): New funtion.
(eglot--lsp-backend-style-all-completions): New function.
(eglot--lsp-backend-style-try-completion): New function.

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

2 years agoPrevent desktop.el from saving/restoring eglot--managed-mode
João Távora [Thu, 7 Jul 2022 11:30:03 +0000 (12:30 +0100)]
Prevent desktop.el from saving/restoring eglot--managed-mode

Although desktop.el compatibility is Emacs bughttps://github.com/joaotavora/eglot/issues/56407, the optimal
solution agreed to there is a bit more work than what I have time to
right now.  See e.g.
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=bug%2356407https://github.com/joaotavora/eglot/issues/68.  For
now, just use `with-eval-after-load'

* eglot.el (Hacks desktop): Add eglot--managed-mode to
desktop-minor-mode-handlers

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

2 years agoApply any additionaltextedits unconditionally
João Távora [Fri, 24 Jun 2022 09:35:07 +0000 (10:35 +0100)]
Apply any additionaltextedits unconditionally

* eglot.el (eglot-completion-at-point): Apply any
additionalTextEdits unconditionally.

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

2 years agoReduce eldoc noise from hover messages
jicksaw [Thu, 30 Jun 2022 07:39:33 +0000 (10:39 +0300)]
Reduce eldoc noise from hover messages

Also close https://github.com/joaotavora/eglot/issues/985

Only echo hover response content, without response range.

LSP specification says the range is meant to visualize a hover.
Maybe echoing the range is useful for some, but it seems
non-standard behavior.

Example issue: haskell-language-server responds with range set to
whole file when hovering a comment -> Large, useless eldoc

* eglot.el (eglot--hover-info): Remove text selected by range from
output

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

2 years agoReduce memory footprint of eglot--{}
Basil L. Contovounesios [Fri, 24 Jun 2022 09:39:02 +0000 (12:39 +0300)]
Reduce memory footprint of eglot--{}

* eglot.el (eglot--{}): Specify smallest hash table :size, to spare
~1KiB according to memory-report-object-size.

See also https://github.com/joaotavora/eglot/pull/315.

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

2 years agoUpdate docstring of eglot-events-buffer-size
Yuan Fu [Sun, 12 Jun 2022 10:04:53 +0000 (03:04 -0700)]
Update docstring of eglot-events-buffer-size

* eglot.el (eglot-events-buffer-size): Mention that you need to
restart the connection for 'eglot-events-buffer-size' to take effect.

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

2 years agoDon't ignore flymake-no-changes-timeout
João Távora [Thu, 19 May 2022 08:59:55 +0000 (09:59 +0100)]
Don't ignore flymake-no-changes-timeout

Also per https://github.com/joaotavora/eglot/issues/957.

Only actually and eagerly report LSP diagnotics if the user has
Flymake starting automatically on a timer (flymake-no-changes-timeout
is a number).

By contrast, if flymake-no-changes-timeout is nil, the user starts the
diagnostic collection process on-demand via 'M-x flymake-start'.

Since the control of such collection is impossible with LSP, we should
just hold on to whatever diagnostics we have (which are presumably
up-to-date) until the next invocation of 'eglot-flymake-backend'.

For now, this doesn't affect Flymake "list-only" diagnostics.  Those
are reported via the 'flymake-list-only-diagonstics' variable and
are always communicated immediately to it.

* eglot.el: (eglot-handle-notification
textDocument/publishDiagnostics): Consult flymake-no-changes-timeout.

Suggested-by: Jim Davis <jim.jd.davis@gmail.com>
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/508

2 years agoUse format string instead of concat
Theodor Thornhill [Mon, 9 May 2022 19:04:12 +0000 (21:04 +0200)]
Use format string instead of concat

* eglot.el (eglot-handle-notification): Because diagnostics code can
be integer or string, and integer fails the sequencep test, use format
to create this string.

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

2 years agoFix egregious thinko in eglot--uri-to-path
João Távora [Mon, 9 May 2022 00:17:58 +0000 (01:17 +0100)]
Fix egregious thinko in eglot--uri-to-path

One shouldn't unhex the URI before parsing it.  Just consider a
filename with a # character in it.  The character is encoded as C%23,
after unhexing the file name becomes.

  /tmp/C#/Program.cs

Now, parsing this as the URL will fail completely as the # mean
"anchor" in URLs.

* eglot.el (eglot--uri-to-path): Fix thinko.

2 years agoConsider diagnostic.code when generating flymake diagnostics
João Távora [Wed, 4 May 2022 20:47:21 +0000 (21:47 +0100)]
Consider diagnostic.code when generating flymake diagnostics

Not sure this will please everybody, can almost guess someone is going
to ask for a custom switch.

Instead this info (and the source) should be passed on to Flymake.
That's where the custom switch for controlling formatting of
diagnostic messages should exist.  But that's too much work right now.

* eglot.el (eglot-handle-notification): Consider Diagnostic.code.

2 years agoEnsure exit-function of eglot-c-at-point runs on exact match
rbrtb [Tue, 3 May 2022 09:53:17 +0000 (09:53 +0000)]
Ensure exit-function of eglot-c-at-point runs on exact match

When the completion is exact match, exit-function should still run.

Say one is using auto-imports feature of pyright.  One types foo, and
triggers the completion.  There are two candidates: foo and foo_bar.  If
one chooses foo, the status would be 'exact' instead of 'finished', thus
exit-function is not executed, foo is not auto-imported.

* eglot.el (eglot-completion-at-point): Consider 'exact status.

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

2 years agoAdd out-of-box support for purescript lsp server
Tomasz Hołubowicz [Wed, 27 Apr 2022 11:48:47 +0000 (13:48 +0200)]
Add out-of-box support for purescript lsp server

* eglot.el (eglot-server-programs): Support purescript lsp.
* README.md: Update.
* NEWS.md: Update.

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

2 years agoEnsure non-null :settings param in didchangeconfiguration notif
João Távora [Wed, 27 Apr 2022 10:11:52 +0000 (11:11 +0100)]
Ensure non-null :settings param in didchangeconfiguration notif

* eglot.el (eglot-signal-didChangeConfiguration): Use eglot--{}

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

2 years agoAdd out-of-box support for futhark lsp server
Troels Henriksen [Fri, 15 Apr 2022 18:22:57 +0000 (20:22 +0200)]
Add out-of-box support for futhark lsp server

* eglot.el (eglot-server-programs): Support futhark lsp.
* README.md: Update.
* NEWS.md: Update.

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

2 years agoSolve flymake diagnostics synchronization problems
João Távora [Wed, 6 Apr 2022 10:08:12 +0000 (11:08 +0100)]
Solve flymake diagnostics synchronization problems

A diagnostics-lazy server is one who doesn't re-report already
reported diagnostics when it received textDocument/didSave.

Such is the case of Clangd, for example.  Before this change, saving
an Eglot/Clang-managed buffer with some diagnostics caused the Flymake
indicator to display Wait[0 0] until some change was actually done to
the buffer.

That is because Flymake, by default, wants diagnostics on buffer save,
per flymake-start-on-save-buffer.  But it doesn't work to simply turn
that off.  That's because if one types something and quickly saves,
and the LSP diagnostics do come in after the save (for some reason,
like server latency), then Flymake sometimes doesn't request any
diagnostics at all.

The reason for the Flymake behaviour wasn't investigated, but that
wasn't a very good solution either

Rather this change makes it so that when such a Flymake request comes
in, it always gets served immediately with the latest information.
The latest information is now always stored in eglot--diagnostics,
with eglot--unreported-diagnotics being removed.  The up-to-date list
is reported to Flymake whenever it requests it.  It is updated
whenever the LSP server decides to.

* eglot.el (eglot--last-reported-diagnostics): Delete.
(eglot--unreported-diagnostics): Delete.
(eglot--diagnostics): New variable..
(eglot--maybe-activate-editing-mode): Use eglot--diagnostics.
(eglot-handle-notification): Set eglot--diaggnostics.
(eglot-flymake-backend): Read eglot--diagnostics. Always report.
(eglot--report-to-flymake): Set eglot--diagnostics.

2 years agoUpdate invocation for out-of-box dart ls support
Billy.Zheng [Tue, 5 Apr 2022 11:45:47 +0000 (19:45 +0800)]
Update invocation for out-of-box dart ls support

* eglot.el (eglot-server-programs): Tweak dart-mode entry.

* README.md: Tweak Dart entry.

Co-authored-by: João Távora
Copyright-paperwork-exempt: Yes
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/862

2 years agoCheck textdocumentsync/willsave cap before sending it
João Távora [Mon, 4 Apr 2022 10:05:29 +0000 (11:05 +0100)]
Check textdocumentsync/willsave cap before sending it

* eglot.el (eglot--guess-contact): Default language-id to educated
guess when eglot--lookup-mode returns nil.

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

2 years agoGuess language-id if manually entering server program
João Távora [Mon, 4 Apr 2022 09:41:29 +0000 (10:41 +0100)]
Guess language-id if manually entering server program

* eglot.el (eglot--guess-contact): Default language-id to educated
guess when eglot--lookup-mode returns nil.

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

2 years agoTweak eglot mode-line menus
João Távora [Mon, 4 Apr 2022 09:23:56 +0000 (10:23 +0100)]
Tweak eglot mode-line menus

* eglot.el (eglot-manual): Rename from eglot-read-documentation
(eglot-customize): Delete.
(eglot-menu): Rename from eglot-menu-map.  Rework.
(eglot--mode-line-format): Tweak.
(eglot-menu-string): Rename from eglot-mode-line-string.
(Flymake customization): New source section.

* NEWS.md: Tweak.

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

2 years agoRework eglot's mode-line
Felicián Németh [Sat, 15 Jan 2022 17:51:36 +0000 (18:51 +0100)]
Rework eglot's mode-line

Mimic flymake by replacing the old menus of the mode-line with
"context menus".  List all usefull commands under the main menu
(eglot-menu-map), and commands related to LSP debugging under the
project menu (eglot-debug-map).

* eglot.el (eglot-read-documentation, eglot-customize): New
commands.
(eglot-mode-line-string): New defcustom.
(eglot-menu-map, eglot-debug-map,): New variables.
(eglot--mode-line-props): Rework to use eglot-menu-map and
eglot-debug-map.
(eglot--mode-line-format): Use eglot-mode-line-string.

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

2 years agoMake eglot--plist-keys a simple (non-map.el) helper again
João Távora [Mon, 4 Apr 2022 08:39:59 +0000 (09:39 +0100)]
Make eglot--plist-keys a simple (non-map.el) helper again

This removes a nagging compilation warning when developing on Emacs
master.

There's not much point in depending on map.el just for this util.  And
there' snot much point in making eglot--plist-keys go through a
generic dispatching mechanism when we happen to know the thing
being dispatched

* eglot.el (eglot--plist-keys): Define in helpers section.

2 years agoProtect against empty firsttriggercharacter strings
João Távora [Thu, 31 Mar 2022 13:21:29 +0000 (14:21 +0100)]
Protect against empty firsttriggercharacter strings

Which some LS's like gopls like to send.

* eglot.el (eglot--post-self-insert-hook): Beware of empty strings.

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

2 years agoEasier initializationoptions in eglot-server-programs
João Távora [Mon, 28 Mar 2022 10:00:44 +0000 (11:00 +0100)]
Easier initializationoptions in eglot-server-programs

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

* NEWS.md: Update.

* eglot.el (eglot-server-programs): Document new syntax.
(eglot-initialization-options): Can use initializationOptions from
server's saved initargs.
(eglot--connect): Allow a plist to be appended to a server
contact.

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

2 years agoTweak on-type-formatting code
João Távora [Mon, 28 Mar 2022 23:09:34 +0000 (00:09 +0100)]
Tweak on-type-formatting code

* eglot.el (eglot--post-self-insert-hook): Tweak.
(eglot-format): Tweak docstring.

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

2 years agoImplement on-type-formatting support
Felicián Németh [Wed, 23 Mar 2022 20:47:45 +0000 (21:47 +0100)]
Implement on-type-formatting support

* eglot.el (eglot-format): Add new optional argument `on-type-format'
to request :textDocument/onTypeFormatting, and ...
(eglot--post-self-insert-hook): ... call it from here when necessary.

* eglot-tests.el (eglot--simulate-key-event): New helper defun.
(rust-on-type-formatting): New test.

* NEWS.md: mention feature.

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

2 years agoMap more emacs variables to lsp formattingoptions fields
Felicián Németh [Sun, 27 Mar 2022 20:58:44 +0000 (22:58 +0200)]
Map more emacs variables to lsp formattingoptions fields

* eglot.el (eglot-format): Map require-final-newline to
insertFinalNewline and delete-trailing-lines to trimFinalNewlines.

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

2 years agoAdd omnisharp support for c#
Marcus Swanson [Sat, 26 Mar 2022 21:43:31 +0000 (22:43 +0100)]
Add omnisharp support for c#

* eglot.el (eglot-server-programs): Add omnisharp for C#.
* README.md: Document the above change.

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

2 years agoUse bounds of thing at point when asking for code actions
João Távora [Thu, 24 Mar 2022 16:06:08 +0000 (16:06 +0000)]
Use bounds of thing at point when asking for code actions

* eglot.el (eglot--region-bounds): Consider bounds of things at
point.

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

2 years agoAdd simple support for workspacefolders
Felicián Németh [Sun, 20 Mar 2022 08:50:15 +0000 (09:50 +0100)]
Add simple support for workspacefolders

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

Clients can support workspaceFolders since LSP 3.6.  rootUri and
rootPath are deprecated.  Dynamic changes in folders are not
supported, i.e., this patch does not implement
workspace/didChangeWorkspaceFolders.

* eglot.el (eglot-client-capabilities): Add capability
`workspaceFolders'.
(eglot-workspace-folders): New cl-defgeneric.
(eglot--connect): Add workspaceFolders to initializeParams.
(eglot-handle-request workspace/workspaceFolders): New cl-defmethod.

2 years agoDefend against broken move-to-column in recent emacs
João Távora [Fri, 18 Mar 2022 10:54:21 +0000 (10:54 +0000)]
Defend against broken move-to-column in recent emacs

* eglot.el (eglot-lsp-abiding-column): Use (min (point) (point-max))

This is a defensive fix for an Emacs/company-mode problem described
below.

The problem can be reproduced in Eglot before this commit with:

~/Source/Emacs/emacs/src/emacs -Q -f package-initialize -L       \
~/Source/Emacs/company-mode -l company -f global-company-mode -l \
 eglot.el ~/tmp/issue-860/args_out_of_range.c -f eglot -f        \
 display-line-numbers-mode -f toggle-debug-on-error

  1 // args_out_of_range.c
  2 struct Book {
  3   int id;
  4   char title[50]
  5 } book = { 1024, "C" };
  6
  7 int main(int argc, char *argv[])
  8 {
  9
 10   // Error when typing the dot to make "book."
 11   book
 12   return 0;
 13 }

When one types the dot after the "book" on line 11, company-mode
displays a two-line overlay that visually encompasses line 12 after
"book", which has the "return 0;" statement.  That line happens to
also hold a warning about incorrect syntax, one that starts at column
2.

Eglot uses 'move-to-column' to go that precise place.

In Emacs 27.2, move-to-column is unaffected by previous company-mode
overlays, even if the current line is being co-used visually by the
overlay.  It moves to the right buffer position.

In Emacs master, this isn't true.  It seems to be confounded by the
company-mode overlay and moves to eob, which eventually breaks Eglot
with a backtrace such as this one:

Debugger entered--Lisp error: (args-out-of-range #<buffer args_out_of_range.c> 110 124)
  encode-coding-region(110 124 utf-16 t)
  (length (encode-coding-region (or lbp (line-beginning-position)) (point) 'utf-16 t))
  (- (length (encode-coding-region (or lbp (line-beginning-position)) (point) 'utf-16 t)) 2)
  (/ (- (length (encode-coding-region (or lbp (line-beginning-position)) (point) 'utf-16 t)) 2) 2)
  eglot-lsp-abiding-column(110)
  (- column (eglot-lsp-abiding-column lbp))
  (setq diff (- column (eglot-lsp-abiding-column lbp)))
  (progn (setq diff (- column (eglot-lsp-abiding-column lbp))) (not (= 0 diff)))
  (while (progn (setq diff (- column (eglot-lsp-abiding-column lbp))) (not (= 0 diff))) (condition-case eob-err (forward-char (/ (if (> diff 0) (1+ diff) (1- diff)) 2)) (end-of-buffer (throw '--cl-block-nil-- eob-err))) (setq --cl-var-- nil))
  (let* ((lbp (line-beginning-position)) (diff nil) (--cl-var-- t)) (narrow-to-region lbp (line-end-position)) (move-to-column column) (while (progn (setq diff (- column (eglot-lsp-abiding-column lbp))) (not (= 0 diff))) (condition-case eob-err (forward-char (/ (if (> diff 0) (1+ diff) (1- diff)) 2)) (end-of-buffer (throw '--cl-block-nil-- eob-err))) (setq --cl-var-- nil)) nil)
  (catch '--cl-block-nil-- (let* ((lbp (line-beginning-position)) (diff nil) (--cl-var-- t)) (narrow-to-region lbp (line-end-position)) (move-to-column column) (while (progn (setq diff (- column (eglot-lsp-abiding-column lbp))) (not (= 0 diff))) (condition-case eob-err (forward-char (/ (if (> diff 0) (1+ diff) (1- diff)) 2)) (end-of-buffer (throw '--cl-block-nil-- eob-err))) (setq --cl-var-- nil)) nil))
  (save-restriction (catch '--cl-block-nil-- (let* ((lbp (line-beginning-position)) (diff nil) (--cl-var-- t)) (narrow-to-region lbp (line-end-position)) (move-to-column column) (while (progn (setq diff (- column (eglot-lsp-abiding-column lbp))) (not (= 0 diff))) (condition-case eob-err (forward-char (/ (if ... ... ...) 2)) (end-of-buffer (throw '--cl-block-nil-- eob-err))) (setq --cl-var-- nil)) nil)))
  eglot-move-to-lsp-abiding-column(2)

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

2 years agoDon't advertise didchangewatchedfiles on tramp
João Távora [Tue, 15 Mar 2022 10:20:24 +0000 (10:20 +0000)]
Don't advertise didchangewatchedfiles on tramp

* eglot.el (eglot--trampish-p): New helper.
(eglot-client-capabilities): Use it.
(eglot--uri-to-path): Use it.

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

2 years agoChange capability 'documentchanges' to t
Felicián Németh [Sat, 12 Mar 2022 09:57:53 +0000 (10:57 +0100)]
Change capability 'documentchanges' to t

Eglot does support woskspaceEdit/documentChanges, but failed to
advertise this fact.

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

* eglot.el (eglot-client-capabilities): Set documentChanges to t.

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

2 years agoUse new jdtls script for eclipse jdt
Manuel Uberti [Fri, 11 Mar 2022 12:41:53 +0000 (13:41 +0100)]
Use new jdtls script for eclipse jdt

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

* eglot.el (eglot-server-programs): use new jdtls
(eglot--eclipse-jdt-contact, eglot--eclipse-jdt). Remove.
(eglot-execute-command eglot-eclipse-jdt): Remove.
(eglot-initialization-options eglot-eclipse-jdt): Remove.

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

2 years agoDon't strip invisible text when formatting hover string
Augusto Stoffel [Thu, 10 Mar 2022 11:32:20 +0000 (12:32 +0100)]
Don't strip invisible text when formatting hover string

This was introduced in https://github.com/joaotavora/eglot/issues/482 due to a bad interaction with a specific
server.  But this solution makes hyperlinks in Eldoc buffers
unclickable, because the markdown-mode function that visits a link
relies on the invisible text.

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

* eglot.el (eglot--format-markup): Use buffer-string instead of
filter-buffer-substring

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

2 years agoHave a couple of lsp faces inherit from basic "shadow"
João Távora [Sun, 6 Mar 2022 11:15:18 +0000 (11:15 +0000)]
Have a couple of lsp faces inherit from basic "shadow"

* eglot.el (eglot-diagnostic-tag-unnecessary-face)
(eglot-diagnostic-tag-deprecated-face): Inherit from 'shadow'.

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

2 years agoPrevent empty diagnostic tags vector hiding main fontification
Brian Leung [Tue, 1 Mar 2022 15:59:05 +0000 (07:59 -0800)]
Prevent empty diagnostic tags vector hiding main fontification

* eglot.el (eglot-handle-notification): Require that the resulting
list of faces is non-empty and that each face corresponds only to a
known tag.

For unknown tags, we don't pass any additional face information to
Flymake, and instead expect it to make the appropriate overlay with
the "severity" property of the Diagnostic.

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

2 years agoProperly check the completionitem.deprecated property
Brian Leung [Sun, 23 Jan 2022 03:59:06 +0000 (19:59 -0800)]
Properly check the completionitem.deprecated property

* eglot.el (eglot-completion-at-point): Check the :deprecated property
is `t'.  We do this so that a :deprecated property of :json-false does
not cause a completion candidate to be incorrectly marked as deprecated.

2 years ago* eglot.el (eglot-handle-notification): silence byte-compiler.
Stefan Kangas [Sat, 22 Jan 2022 03:40:12 +0000 (04:40 +0100)]
* eglot.el (eglot-handle-notification): silence byte-compiler.

2 years agoAdd support for optional completionitem.tags
Brian Leung [Thu, 13 Jan 2022 03:06:18 +0000 (19:06 -0800)]
Add support for optional completionitem.tags

* eglot.el (eglot--lsp-interface-alist): Add optional CompletionItem.tags.
(eglot-completion-at-point): Add :company-deprecated key and value,
checking for either the appropriate tag (1) in the :tags property, or
a truthy value for the :deprecated property.
(eglot-client-capabilities): Advertise tagSupport (for tag == 1) and
deprecatedSupport.

Also load an updated version of seq.el in Emacsen < 27.

* Makefile (ELPA_DEPS): Require latest seq.el.

2 years agoDon't use :exclusive no
Stefan Kangas [Sat, 22 Jan 2022 03:13:11 +0000 (04:13 +0100)]
Don't use :exclusive no

See https://github.com/joaotavora/eglot/issues/812 for background, in particular:
https://github.com/joaotavora/eglot/issues/812#issuecomment-1014821345

* eglot.el (eglot-completion-at-point): Don't use :exclusive no, as it
leads to breakage in many cases.

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

2 years agoEnable lsp project-wide diagnostics via flymake
Theodor Thornhill [Thu, 20 Jan 2022 22:06:53 +0000 (23:06 +0100)]
Enable lsp project-wide diagnostics via flymake

* eglot.el (eglot-handle-notification): Pass on diagnostics from
unvisited files to flymake.  Enables project-wide-diagnostics, so that
we can view all diagnostics in a given workspace.  Uses new
functionality from flymake 1.2.1, hence the version bump.

* eglot-tests.el (project-wide-diagnostics-typescript): New tests
showcasing the possibility to see all related diagnostics in a
workspace.

* eglot-tests.el (project-wide-diagnostics-rust-analyzer): New tests
showcasing the possibility to see all related diagnostics in a
workspace.

* NEWS.md: Mention the new functionality
* README.md: Mention the new functionality

2 years agoAdd clojure-lsp support for clojure
Derek Passen [Wed, 19 Jan 2022 01:56:13 +0000 (19:56 -0600)]
Add clojure-lsp support for clojure

* eglot.el (eglot-server-programs): Add clojure-lsp for Clojure.
* README.md: Document the above change.

Copyright-paperwork-exempt: Yes

2 years ago; fix thinko in last commit
Stefan Kangas [Mon, 17 Jan 2022 22:32:50 +0000 (23:32 +0100)]
; fix thinko in last commit

2 years agoChange rust language server to rust-analyzer
Stefan Kangas [Fri, 14 Jan 2022 12:03:44 +0000 (13:03 +0100)]
Change rust language server to rust-analyzer

rust-analyzer is the officially blessed Language Server for Rust:
https://github.com/rust-lang/rfcs/pull/2912

Also drop the special support code for RLS.

* eglot.el (eglot-server-programs): Add rust-mode language server
"rust-analyzer" and prefer it to the older "rls".
(eglot-rls, jsonrpc-connection-ready-p)
(eglot-handle-notification): Delete special support for "rls".

* eglot-tests.el (rls-analyzer-watches-files)
(rls-analyzer-hover-after-edit): Rename to ...
(rust-analyzer-watches-files)
(rust-analyzer-hover-after-edit): ... this.  Update tests to work
with rust-analyzer.
* README.md: Update references for RLS to point to rust-analyzer.
* NEWS.md: Announce above change.

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

2 years ago; unbreak tests on emacs 26
Stefan Kangas [Sun, 16 Jan 2022 13:13:05 +0000 (14:13 +0100)]
; unbreak tests on emacs 26

* eglot.el (eglot--plist-keys): Define in Emacs 26, no longer
obsolete in Emacs 27 or later.
(eglot--check-object): Go back to eglot--plist-keys.

2 years ago* eglot.el (eglot--server-capable): don't use obsolete name.
Stefan Kangas [Sun, 16 Jan 2022 12:05:16 +0000 (13:05 +0100)]
* eglot.el (eglot--server-capable): don't use obsolete name.

2 years agoObsolete eglot--plist-keys in favor of map-keys
Stefan Kangas [Sun, 16 Jan 2022 12:05:13 +0000 (13:05 +0100)]
Obsolete eglot--plist-keys in favor of map-keys

* eglot.el (eglot--plist-keys): Make into obsolete function alias
for map-keys.

2 years ago; * eglot.el: move obsolete definition to new section.
Stefan Kangas [Sun, 16 Jan 2022 12:04:27 +0000 (13:04 +0100)]
; * eglot.el: move obsolete definition to new section.

2 years agoRemove unnecessary compatibility code
Stefan Kangas [Sat, 15 Jan 2022 23:12:05 +0000 (00:12 +0100)]
Remove unnecessary compatibility code

* eglot.el (eglot-mode-map): Remove unnecessary compatibility
code.  We already depend on eldoc 0.11.0.

2 years agoImprove backwards-compatibility of eglot-mode-map
Stefan Kangas [Sat, 15 Jan 2022 16:37:42 +0000 (17:37 +0100)]
Improve backwards-compatibility of eglot-mode-map

* eglot.el (eglot-mode-map): Only bind to eldoc-doc-buffer in Emacs
28.1 or later.

2 years ago* eglot.el (eglot-strict-mode): very minor docfix.
Stefan Kangas [Sat, 15 Jan 2022 16:35:19 +0000 (17:35 +0100)]
* eglot.el (eglot-strict-mode): very minor docfix.

2 years ago* eglot.el (eglot--connect): display seconds on timeout.
Stefan Kangas [Sat, 15 Jan 2022 12:47:30 +0000 (13:47 +0100)]
* eglot.el (eglot--connect): display seconds on timeout.

2 years agoPrint server command to events buffer
Stefan Kangas [Wed, 12 Jan 2022 23:50:35 +0000 (00:50 +0100)]
Print server command to events buffer

* eglot.el (eglot--connect): Print server command to events
buffer.

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

2 years ago; * eglot.el (eglot-server-initialized-hook): fix punctuation.
Stefan Kangas [Thu, 13 Jan 2022 21:47:36 +0000 (22:47 +0100)]
; * eglot.el (eglot-server-initialized-hook): fix punctuation.

2 years agoChange from symbol-at-point to thing-at-point
Theodor Thornhill [Mon, 30 Dec 2019 15:26:22 +0000 (16:26 +0100)]
Change from symbol-at-point to thing-at-point

* eglot.el (eglot-rename): Change from symbol-at-point to
thing-at-point to avoid interning a symbol.  Add "unknown symbol" to
prompt when no symbol is found.

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

2 years agoSupport optional diagnostic.tags
Brian Leung [Tue, 11 Jan 2022 05:48:21 +0000 (21:48 -0800)]
Support optional diagnostic.tags

https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#diagnosticTag

A DiagnosticTag can be either 1 (DiagnosticTag.Unnecessary) or
2 (DiagnosticTag.Deprecated).  Following the rendering suggestions in
the protocol, we fade out Unnecessary code and strike-through
Deprecated code.

* eglot.el (eglot-diagnostic-tag-unnecessary-face)
(eglot-diagnostic-tag-deprecated-face): New faces.
(eglot--tag-faces): New defconst.
(eglot--lsp-interface-alist): Add Diagnostic.tags.
(eglot-client-capabilities): Advertise supported tags.
(eglot-handle-notification): Assign the appropriate properties.

* eglot-tests.el (diagnostic-tags-unnecessary-code): New test.

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

2 years ago* eglot.el: improve commentary section.
Stefan Kangas [Thu, 13 Jan 2022 11:30:17 +0000 (12:30 +0100)]
* eglot.el: improve commentary section.

2 years agoSupport racket-langserver
Stefan Kangas [Thu, 13 Jan 2022 10:52:29 +0000 (11:52 +0100)]
Support racket-langserver

* eglot.el (eglot-server-programs): Support racket-langserver.
* README.md:
* NEWS.md: Update for above changes.

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

2 years agoBump eglot version to 1.8
Stefan Kangas [Wed, 12 Jan 2022 18:35:22 +0000 (19:35 +0100)]
Bump eglot version to 1.8

* eglot.el (Version): Bump to 1.8.
* NEWS.md (1.8): Rename header from "(upcoming)".

2 years agoDon't error out on unsupported diagnostic.codedescription
Brian Leung [Tue, 11 Jan 2022 03:32:19 +0000 (19:32 -0800)]
Don't error out on unsupported diagnostic.codedescription

A codeDescription property is, at the time of writing, an object with
an href property (of type URI, or a string), denoting a "URI to open
with more information about the diagnostic error".

It's not obvious how best to put this into a Flymake diagostic
aside from simply appending it to the diagnostic message, so we'll
worry about it some other time.

* eglot.el (eglot--lsp-interface-alist)
(eglot-client-capabilities): Don't error out on unsupported
Diagnostic.codeDescription.

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

2 years agoSupport autoimporttext from pyright language server
Fredrik Bergroth [Wed, 15 Dec 2021 12:05:22 +0000 (13:05 +0100)]
Support autoimporttext from pyright language server

* eglot.el (eglot-completion-at-point): show autoImportText via company-docsig.

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

2 years agoAdd tooltip describing pending requests
Felicián Németh [Mon, 10 Jan 2022 19:21:21 +0000 (20:21 +0100)]
Add tooltip describing pending requests

* eglot.el (eglot--mode-line-format): Add tooltip to `pending'.

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

2 years agoProperly print error message of eglot-alternatives
Brian Leung [Sun, 9 Jan 2022 02:08:23 +0000 (18:08 -0800)]
Properly print error message of eglot-alternatives

* eglot.el (eglot-alternatives): Work with the listified form. This
allows presumed executables provided as (EXECUTABLE &rest ARGS...)
to be displayed in the error.

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

2 years agoAdd up-to-date server executables for html/css/json
Brian Leung [Sun, 9 Jan 2022 01:43:23 +0000 (17:43 -0800)]
Add up-to-date server executables for html/css/json

* README.md: Advertise updated executables.
* eglot.el (eglot-server-programs): Prioritize the alternatives.

The {html,css,json}-languageserver executables that are distributed
outside VS Code are not regularly updated by Microsoft; any relevant
updates to the VS Code source tree reach VS Code users without the
need for VS Code developers to go out of their way to publish new
versions of the executables. Consequently, users of other editors who
have been using the server executables from the most obvious NPM
packages are likely using stale versions.

@hrsh7th, a Vim user, created an NPM package with updated versions of these
executables taken straight from VS Code's source tree. We therefore
prefer to direct users to the corresponding repo, which contains
appropriate installation instructions, in the README.

2 years ago; fix license statement
Stefan Kangas [Sun, 9 Jan 2022 16:41:40 +0000 (17:41 +0100)]
; fix license statement

Packages in GNU ELPA are considered part of GNU Emacs.

2 years ago; update copyright years
Stefan Kangas [Sun, 9 Jan 2022 16:38:40 +0000 (17:38 +0100)]
; update copyright years

2 years agoAdd vim-language-server for vimrc-mode
Brian Leung [Sun, 9 Jan 2022 02:30:57 +0000 (18:30 -0800)]
Add vim-language-server for vimrc-mode

* README.md: Advertise.
* eglot.el (eglot-server-programs): Add vim-language-server.

2 years agoAdd cmake-language-server for cmake-mode
Brian Leung [Sun, 9 Jan 2022 02:27:29 +0000 (18:27 -0800)]
Add cmake-language-server for cmake-mode

* README.md: Advertise.
* eglot.el (eglot-server-programs): Add cmake-language-server.

2 years agoUn-reverse references in xref buffer
Stefan Kangas [Sun, 9 Jan 2022 01:50:38 +0000 (02:50 +0100)]
Un-reverse references in xref buffer

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

2 years agoAdd variable to withhold the init req process id
Martin Carlson [Tue, 31 Aug 2021 10:24:34 +0000 (12:24 +0200)]
Add variable to withhold the init req process id

* eglot.el (eglot-withhold-process-id): New defvar.
(eglot--connect): Don't send pid to language server if above new
defvar has a non-nil value.

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

2 years agoSupport language server for html, css, json and docker
NA [Fri, 11 Jan 2019 03:58:04 +0000 (05:58 +0200)]
Support language server for html, css, json and docker

* eglot.el (eglot-server-programs): Support html-languageserver,
css-languageserver, json-languageserver, and docker-langserver.
* README.md: Update documentation for above changes.

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

2 years agoMinor checkdoc fixes
Stefan Kangas [Sat, 8 Jan 2022 18:43:29 +0000 (19:43 +0100)]
Minor checkdoc fixes

* eglot.el (eglot, eglot--when-buffer-window, eglot--widening)
(eglot-initialization-options, eglot--current-flymake-report-fn)
(eglot-handle-notification, eglot-handle-request)
(eglot--highlight-piggyback, eglot-register-capability)
(eglot-unregister-capability):
* eglot-tests.el (auto-detect-running-server, auto-shutdown)
(auto-reconnect, eglot--tests-force-full-eldoc, rename-a-symbol)
(basic-completions, non-unique-completions, basic-xref)
(snippet-completions, snippet-completions-with-company)
(eglot-eldoc-after-completions, python-yapf-formatting)
(javascript-basic, json-basic, eglot-ensure)
(eglot--guessing-contact): Doc fixes; formatting.

* eglot.el (xref-backend-identifier-completion-table): Fix error
format.

2 years agoAdd lua-lsp support for lua-mode
Omar Polo [Mon, 30 Aug 2021 12:32:32 +0000 (12:32 +0000)]
Add lua-lsp support for lua-mode

* eglot.el (eglot-server-programs): Add support for the lua-lsp server for lua.
* README.md: Document the above change.

2 years agoAdd support for the mint language server
jgart [Sat, 2 Oct 2021 04:20:57 +0000 (00:20 -0400)]
Add support for the mint language server

* eglot.el (eglot-server-programs): Add support for the mint language server.
* README.md: Document the above change.

Copyright-paperwork-exempt: Yes

2 years agoAdd pyright language server support for python-mode
Illia Danko [Sat, 18 Sep 2021 12:13:39 +0000 (15:13 +0300)]
Add pyright language server support for python-mode

* eglot.el (eglot-server-programs): Add pyright support for
python-mode.
* README.md: Document the above change.

Copyright-paperwork-exempt: Yes

2 years ago; fix typos
Stefan Kangas [Sat, 8 Jan 2022 17:18:16 +0000 (18:18 +0100)]
; fix typos

2 years agoUse fortls also for fortran-mode
Philipp Edelmann [Wed, 13 May 2020 17:50:12 +0000 (11:50 -0600)]
Use fortls also for fortran-mode

* eglot.el (eglot-server-programs): Use fortls also for fortran-mode.

Copyright-paperwork-exempt: Yes

2 years agoAdd yaml-language-server for yaml-mode
Brian Leung [Tue, 5 Oct 2021 05:39:12 +0000 (22:39 -0700)]
Add yaml-language-server for yaml-mode

* eglot.el (eglot-server-programs): Add yaml-language-server.
* README.md: Mention yaml-language-server.

2 years agoUse `locate-user-emacs-file` instead of `concat`
lorniu/sz [Sun, 26 Dec 2021 10:37:14 +0000 (18:37 +0800)]
Use `locate-user-emacs-file` instead of `concat`

* eglot.el (eglot--eclipse-jdt-contact): Use locate-user-emacs-file.

Copyright-paperwork-exempt: Yes

2 years ago; prefer https to http addresses
Stefan Kangas [Sat, 8 Jan 2022 15:02:06 +0000 (16:02 +0100)]
; prefer https to http addresses

3 years agoAdd missing entries from completionitemkind
Fredrik Bergroth [Wed, 15 Dec 2021 21:31:20 +0000 (22:31 +0100)]
Add missing entries from completionitemkind

* eglot.el (eglot--kind-names): update

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

3 years agoMark eglot-completion-at-point capf "non-exclusive"
Garret Buell [Wed, 15 Dec 2021 21:17:26 +0000 (13:17 -0800)]
Mark eglot-completion-at-point capf "non-exclusive"

Add :exclusive 'no to eglot-completion-at-point results marking it as
non-exclusive. This will allow completion to fall back to other less precise
completion backends (e.g. dabbrev) if Eglot's returns no results.

* eglot.el (eglot-completion-at-point): Set :exclusive to 'no

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

3 years agoMerge pull request from stephe-ada-guru/master
Stephen Leake [Tue, 16 Nov 2021 08:23:39 +0000 (00:23 -0800)]
Merge pull request from stephe-ada-guru/master

Fix issues https://github.com/joaotavora/eglot/issues/755, https://github.com/joaotavora/eglot/issues/401; severity not set in textDocument/publishDiagnostics

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

3 years agoFix issues; severity not set in textdocument/publishdiagnostics
Stephen Leake [Sat, 13 Nov 2021 10:39:59 +0000 (02:39 -0800)]
Fix issues; severity not set in textdocument/publishdiagnostics

* eglot.el (eglot-handle-notification): Handle severity not set.

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

3 years agoFix workspace/configuration handling when given scopeuri directory
Ingo Lohmar [Sat, 9 Oct 2021 19:19:37 +0000 (21:19 +0200)]
Fix workspace/configuration handling when given scopeuri directory

The path returned by eglot--uri-to-path is mostly used for file paths,
and therefore does not end with a slash.  Such a no-trailing-slash path
violates what default-directory demands (per its docstring), which
causes hack-dir-local-variables-non-file-buffer to not find the
appropriate dir-local vars.

3 years agoFixup last commit
João Távora [Sun, 5 Sep 2021 19:05:45 +0000 (20:05 +0100)]
Fixup last commit

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

I'm still not entirely convinced using all-completion here is a good
idea.  As usual the completion list we get from the server is
pre-filtered to whatever the server wishes.  Letting the completion
style do its own filtering (most completion styles use
completion-regexp-list and all-completions themselves) is completely
useless here.

Let's hope it's not harmful.

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

3 years agoRespect completion-regexp-alist in eglot's completion table
João Távora [Sun, 5 Sep 2021 08:44:27 +0000 (09:44 +0100)]
Respect completion-regexp-alist in eglot's completion table

See GitHub discussion https://github.com/joaotavora/eglot/issues/726

Suggested-by: Felicián Németh <felician.nemeth@gmail.com>
Suggested-by: JD Smith
* eglot (eglot-completion-at-point): use all-completions.

3 years agoFix typo in user-visible eglot-ignored-server-capabilities
João Távora [Wed, 1 Sep 2021 09:17:24 +0000 (10:17 +0100)]
Fix typo in user-visible eglot-ignored-server-capabilities

The name with the typo, eglot-ignored-server-capabilites, is still
supported.

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

* NEWS.md: Mention change

* eglot.el (eglot-ignored-server-capabilities): New defcustom.

3 years agoFall back to prompting user if eglot-alternatives fails
João Távora [Tue, 17 Aug 2021 09:12:27 +0000 (10:12 +0100)]
Fall back to prompting user if eglot-alternatives fails

* eglot.el (eglot-alternatives): Don't error in interactive case.

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

3 years agoLet eglot-flymake-backend be in flymake-d-functions even if eglot off
João Távora [Tue, 10 Aug 2021 19:28:35 +0000 (20:28 +0100)]
Let eglot-flymake-backend be in flymake-d-functions even if eglot off

This is useful when using  eglot-stay-out-of and a pattern like:

   (defun my/js-mode-hook ()
     (add-hook 'flymake-diagnostic-functions 'some-eslint-backend nil t))
     (setq-local eglot-stay-out-of '(flymake))
     (add-hook 'flymake-diagnostic-functions 'eglot-flymake-backend nil t))

   (add-hook 'js-mode-hook 'my/js-mode-hook)

Then, _both_ backends will run unconditionally, but Eglot backend only
actually reports diagnostics if Eglot is on.

* eglot.el (eglot-flymake-backend): If buffer isn't being managed
by Eglot, behave as a noop.

3 years agoAdd support for locationlink
Brian Leung [Sun, 31 Jan 2021 01:33:08 +0000 (17:33 -0800)]
Add support for locationlink

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

LocationLink was added in version 3.14 of the protocol and is
sometimes used in lieu of Location for definition- and
reference-related requests.

* eglot.el (eglot--lsp-interface-alist): Update with LocationLink.
(eglot-client-capabilities): Advertise
textDocument.{definition,declaration,implementation,typeDefinition}.linkSupport.
(eglot--lsp-xrefs-for-method): Accept LocationLinks.

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

3 years agoTranspose order of "pylsp" and "pyls" alternatives
João Távora [Sun, 13 Jun 2021 22:07:42 +0000 (23:07 +0100)]
Transpose order of "pylsp" and "pyls" alternatives

When operating remotely, searching for an executable that don't exist
takes longer than usual.  Better to put the most likely server first
in the list to minimize the slowdown.

* eglot.el (eglot-server-programs): Transpose python mode alternatives

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

3 years agoDon't call eglot--executable-find more than needed
João Távora [Sun, 13 Jun 2021 09:55:24 +0000 (10:55 +0100)]
Don't call eglot--executable-find more than needed

* eglot.el (eglot-alternatives): Complexify.
(eglot--guess-contact): No need to 'executable-find' if path
absolute.

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

3 years agoConsider tramp in eglot-alternatives
Liu Hui [Fri, 11 Jun 2021 22:49:19 +0000 (06:49 +0800)]
Consider tramp in eglot-alternatives

* eglot.el (eglot-alternatives): Use eglot--executable-find.

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

3 years agoUse project-files to know which directory watchers to skip
João Távora [Wed, 26 May 2021 17:51:30 +0000 (18:51 +0100)]
Use project-files to know which directory watchers to skip

The directory-finding logic is probably a bit slower than using
eglot--directories-recursively, but since it honours `.gitignores` and
ignores more directories it's much faster overall.  And guaranteed to
create less watchers.

Thanks to Dmitry Gutov <dgutov@yandex.ru> for the idea.

* eglot.el (eglot--directories-recursively): Remove.

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

3 years agoHard code an exception to "node_modules" directores
João Távora [Wed, 26 May 2021 14:23:29 +0000 (15:23 +0100)]
Hard code an exception to "node_modules" directores

* eglot.el (eglot--directories-recursively): Fix.

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