1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00
Commit graph

1174 commits

Author SHA1 Message Date
Eshel Yaron
fdf6c164ef Eglot: rework description and type of eglot-confirm-server-edits
Co-authored-by: João Távora <joaotavora@gmail.com>

* lisp/progmodes/eglot.el (eglot-confirm-server-edits): Improve
type description.
2023-09-01 22:59:48 +01:00
João Távora
82f45b9580 Eglot: handle unsaved buffers in new eglot--propose-changes-as-diff
* lisp/progmodes/eglot.el (eglot--confirm-server-edits): Add docstring.
(eglot--propose-changes-as-diff): Rework.  Handle unsaved buffers.
(eglot--apply-workspace-edit): Rework.
2023-09-01 22:59:48 +01:00
Ross Timson
369f2eea10 Add "terraform-ls" LSP server to Eglot
* lisp/progmodes/eglot.el (eglot-server-programs): Add "terraform-ls",
the official Terraform LSP server.  (Bug#65671)

Copyright-paperwork-exempt: yes
2023-09-01 19:58:26 +02:00
João Távora
ed5ccf9da2 Eglot: revamp confirmation model for server-proposed edits
bug#60338

The variable 'eglot-confirm-server-edits' replaces the obsolete
'eglot-confirm-server-initiated-edits' and brings about a new
confirmation model, making it possible to have only certain commands
require user confirmation.  This was achieved careful usage of the
'this-command' and 'last-command' variables.

There are now two types of confirmation: the usual
minibuffer summary and a temporary 'diff-mode' buffer to display the
proposed changes, so the user can apply them one by one.

Thanks to Philip Kaludercic for the diff-mode idea and implementation.

Co-authored-by: Philip Kaludercic <philipk@posteo.net>

* doc/misc/eglot.texi (Eglot Variables): Describe
'eglot-confirm-server-edits'.

* etc/EGLOT-NEWS (latest): Mention change.

* lisp/progmodes/eglot.el (diff-mode): Require it.
(eglot-confirm-server-initiated-edits): Obsolete it.
(eglot-confirm-server-edits): New variable.
(eglot-handle-request workspace/applyEdit): Use 'last-command'
(eglot-execute t t): Use 'this-command'.
(eglot--apply-workspace-edit): Rework.
(eglot-rename): Use 'this-command'.
2023-09-01 01:00:19 +01:00
Jimmy Yuen Ho Wong
fad48a20e6 Handle directory values of scopeUri in workspace/configuration
Even though scopeUri is specified to be of documentUri type, some
servers (notably pyright) insist on passing the pathname of a
directory there.  In pyright's case this is frequently useless, as the
directory is the project directory.  Nevertheless we can be lenient to
those servers by detecting whether the value is a directory and doing
the right thing.

Note that we do not (yet) support per-file configuration storage.

* lisp/progmodes/eglot.el (eglot--workspace-configuration-plist):
Rework.

Co-authored-by: João Távora <joaotavora@gmail.com>
GitHub-reference: https://github.com/joaotavora/eglot/pull/1281
2023-08-31 19:47:37 +01:00
dalu
9e0524a882 Add "lexical" LSP server for Elixir to Eglot
* lisp/progmodes/eglot.el (eglot-server-programs): Add lexical.
It does not support MS-Windows currently.  (Bug#65359)

Copyright-paperwork-exempt: yes
2023-08-19 17:09:15 +03:00
Eli Zaretskii
164588b174 ; Fix whitespace in eglot.el
* lisp/progmodes/eglot.el (eglot-server-programs): Fix whitespace.
Reported by Allen Li <darkfeline@felesatra.moe>.  (Bug#65161)
2023-08-09 16:15:25 +03:00
Felicián Németh
859b150f31 Eglot: send version in clientInfo (bug#62198)
* lisp/progmodes/eglot.el (eglot--version): New defconst.
(eglot--connect): Use it.
2023-08-03 13:19:02 +03:00
João Távora
7405f975ef Eglot: simplify and hopefully fix last change (bug#64784)
* lisp/progmodes/eglot.el (eglot--post-self-insert-hook): Use
last-command-event.
2023-07-22 10:30:24 +01:00
João Távora
7ff41bf8ed Eglot: fix textDocument/onTypeFormatting for 'newline' command
In the newline command, last-input-event is 13 (carriage return), but
most, if not all, language servers that support
documentOnTypeFormattingProvider expect 10 (linefeed) to be the
trigger, so convert 13 to 10 for the purposes of the
textDocument/onTypeFormatting request.

Also make this common edit silent in the mode-line/messages.

* lisp/progmodes/eglot.el (eglot--post-self-insert-hook): Convert
linefeed to carriage return.
(eglot-format): Pass SILENT to eglot--apply-text-edits.
(eglot--apply-text-edits): Take new optional SILENT arg.

* etc/EGLOT-NEWS: Mention change
2023-07-20 05:08:18 -05:00
Brian Leung
7446a8c34e Eglot: check correct capability name in eglot-imenu (bug#64682)
* lisp/progmodes/eglot.el (eglot-imenu): Declare the correct name of
the server capability providing textDocument/documentSymbol.

Without this change, eglot-imenu always aborts even when used with
servers supporting textDocument/documentSymbol.
2023-07-17 14:36:51 +01:00
João Távora
bc1e7b9b8e Eglot: fix advertisement of textDocument.codeAction.resolveSupport
See https://github.com/joaotavora/eglot/issues/1255.

* lisp/progmodes/eglot.el (eglot-client-capabilities):
Use correct format for textDocument.codeAction.resolveSupport.
2023-07-12 10:16:26 +01:00
João Távora
3b7273f4ae Eglot: add support for :codeAction/resolve
See https://github.com/emacs-grammarly/eglot-grammarly/issues/7.

* lisp/progmodes/eglot.el (eglot--lsp-interface-alist): Augment
CodeAction type.
(eglot-execute): Consider :codeAction/resolve
(eglot-client-capabilities): Advertise
textDocument.codeAction.resolveSupport
2023-07-11 00:09:20 +01:00
João Távora
b56f46c9de Eglot: fix eglot--sig-info again
See https://github.com/joaotavora/eglot/issues/1253

* lisp/progmodes/eglot.el (eglot--sig-info): Fall back to regexp
technique if no parameters or poor parameter information.
2023-07-10 14:06:42 +01:00
João Távora
d0f65fbdbb Eglot: fix eglot--sig-info
See https://github.com/joaotavora/eglot/issues/1253

* lisp/progmodes/eglot.el (eglot--sig-info): Fix.
2023-07-10 13:09:48 +01:00
João Távora
c2e4c68333 Eglot: another tweak to eglot--sig-info
Going to the start of the first param and skipping non-word syntax
backward would seem to be the right thing to do, for traditional
C-style languages and also languages like Ocaml where function
signatures don't start the param list with '('.

See also https://github.com/joaotavora/eglot/discussions/1251.

* lisp/progmodes/eglot.el (eglot--sig-info): Rework again.
2023-07-02 11:58:04 +01:00
João Távora
a371e1def7 Eglot: fix broken indentation of eglot--sig-info
* lisp/progmodes/eglot.el (eglot--sig-info): Fix.
2023-07-01 22:49:49 +01:00
João Távora
f6e6d6c730 Eglot: bail out of eglot-imenu if no server capability (bug#64274)
* lisp/progmodes/eglot.el (eglot-imenu): Bail out if no
capability.
2023-07-01 22:49:49 +01:00
João Távora
03d4ca6f6b Eglot: improve heuristic to highlight function names in signatures
* lisp/progmodes/eglot.el (eglot--sig-info): Rework.

See https://github.com/joaotavora/eglot/discussions/1251.
2023-07-01 22:49:48 +01:00
Eli Zaretskii
8e8667246a Merge from origin/emacs-29
d0147ff9e5 * lisp/emacs-lisp/shortdoc.el: More and better `substring...
fa06249a9f Fix "C-x RET r" when the new encoding is UTF
679e9d7c56 ; Mention MinGW64 GCC 13.1 problems in PROBLEMS
fdc1a12ed1 Fix "vc-print-log does not erase buffer" and associated p...
d507aa7336 Add selector_expression indentation rule
1f664a0af7 Add "nixd" LSP server to Eglot
e962cf4ba7 Fix building --with-native-compilation=aot from release t...
4ca371e9cc Fix bug#64152 (Minibuffer sometimes goes "modal")
a0ccf1859c Disable target-async by default in gdb-mi.el
2bad5829ff Revert "Fix parsing of dn line if WITHDN is non-nil"
7637e361d3 Don't truncate filenames with "emacs.el" in them
2591eb1190 Improve documentation of 'minibuffer-message'
6f211bc57b Eglot: again fix positions of coinciding inlay hint overl...
a24e9e3fee ; Update ChangeLog.4 and etc/AUTHORS.
2023-06-24 07:13:42 -04:00
Eli Zaretskii
1f664a0af7 Add "nixd" LSP server to Eglot
* lisp/progmodes/eglot.el (eglot-server-programs): Add "nixd".
Patch by Brian Leung <leungbk@posteo.net>.  (Bug#64214)
2023-06-22 19:33:31 +03:00
Michael Albinus
b104c8dfdc Merge from origin/emacs-29
3d930b928f Eglot: fix relative position of coinciding inlay hint ove...
aad7d68164 ; * doc/lispref/display.texi (Display Tables): Remove ext...
2023-06-22 10:50:46 +02:00
João Távora
6f211bc57b Eglot: again fix positions of coinciding inlay hint overlays (bug#64101)
This bug originated from the previous fix, and is reproducible on non
Mac OS platforms, as long as the very latest version (at time of
writing) of the rust-analyzer server is used.

* lisp/progmodes/eglot.el (eglot--update-hints-1): Reverse
priorities when pegging overlays after (i.e. when before-string is
used).
2023-06-19 23:31:17 +01:00
João Távora
3d930b928f Eglot: fix relative position of coinciding inlay hint overlays (bug#64101)
Only seems to happen on certain platforms, like Mac OS.  Reason
unknown reason so far, but this defensive fix seems safe.

* lisp/progmodes/eglot.el (eglot--update-hints-1): Explicitly put
priority in inlay hint overalys.
2023-06-17 15:25:51 +01:00
João Távora
3c01060c02 ; Eglot: simplify last change to eglot-unregister-capability
* lisp/progmodes/eglot.el (eglot-unregister-capability): Simplify.
2023-06-09 02:12:19 +01:00
João Távora
976cb7e0e6 Eglot: also add watches for newly created directories
GitHub-reference: https://github.com/joaotavora/eglot/pull/1228
GitHub-reference: https://github.com/joaotavora/eglot/discussions/1226

* lisp/progmodes/eglot.el (eglot-register-capability): Rework.

Suggested by: https://github.com/thejeffphil
2023-06-08 15:09:45 +01:00
João Távora
433a452814 Eglot: try reuse file watchers when server over-watches
GitHub-reference: https://github.com/joaotavora/eglot/pull/1228
GitHub-reference: https://github.com/joaotavora/eglot/discussions/1226

The Pyright language server issues very heavy file watching requests,
which sometimes exceed the OS limit.  Most of these file watches are
useless, but Pyright insists on issuing them.

What's more, for some (absurd?) reason, Pyright issues two file
watching requests for the _same_ directories, only to then almost
immediately ask to undo the effects of one of these requests.

This change to Eglot makes it so that if a single server requests to
watch a specific directory twice, only one file watch object is used.

Suggested by: https://github.com/thejeffphil

* lisp/progmodes/eglot.el (eglot-lsp-server): Change structure of
file-watches field.
(eglot--on-shutdown): Adapt to new structure.
(eglot-register-capability): Rework.
(eglot-unregister-capability): Rework.

* etc/EGLOT-NEWS: Mention change
2023-06-08 15:08:46 +01:00
João Távora
bdf852d4bc Eglot: fix execution of CodeAction commands
Reported in
https://github.com/joaotavora/eglot/discussions/1225.

* lisp/progmodes/eglot.el (eglot-execute): Fix typo.
2023-05-25 14:29:45 +01:00
Brian Leung
18d7c955b3 Eglot: Add nickel-mode configuration
* lisp/progmodes/eglot.el (eglot-server-programs): Add nls for nickel-mode.
2023-05-25 14:20:50 +01:00
Mattias Engdegård
73582ed6d4 Use return values of assq-delete-all and assoc-delete-all
* lisp/allout-widgets.el (allout-widgets-mode):
* lisp/progmodes/eglot.el (eglot-handle-notification):
Update variables with the new value, which was probably the intention
here.
2023-05-24 11:30:53 +02:00
João Távora
d3a17a58fb Eglot: rework eglot-handle-request (bug#62116)
Address comments in the bug tracker regarding widening, and
prematurely reporting success to the server before knowing if the file
can indeed be shown.

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=62116#70
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=62116#79

* lisp/progmodes/eglot.el (eglot-handle-request): Rework.
2023-05-16 19:23:57 +01:00
Felicián Németh
c083fa5cf8 Eglot: support window/showRequest (bug#62116)
Co-authored-by: João Távora

* lisp/progmodes/eglot.el (eglot-client-capabilities): Advertise
window/showDocument.
(eglot-handle-request window/showDocument): New handler.
2023-05-13 13:02:30 +01:00
João Távora
e9258a882a Eglot: Replace eglot-execute-command with new eglot-execute
Hopefully helps with https://github.com/joaotavora/eglot/discussions/1070 and
https://github.com/emacs-sideline/sideline/issues/5

* lisp/progmodes/eglot.el (eglot-execute-command): Obsolete.
(eglot-execute): New generic.
(eglot--read-execute-code-action): Use eglot-execute.
2023-05-09 10:39:38 +01:00
Dmitry Gutov
0c6311386a Merge from origin/emacs-29
79a886ba36 (package-upgrade): Don't remove the package from 'package...
c0ab4e9ca9 Eglot: re-rename eglot-upgrade to eglot-upgrade-eglot
b4e90070f9 Fix arguments of xml.c functions as displayed in Help buf...
b1bda8228e More fixes for NetBSD/vax
a2d4cd06f4 Improve VHDL mode highlighting
2f3a514b6d Clarify documentation wrt floating point division by zero...
94e984e670 Make loaddefs-generate slightly more tolerant
aba41d2c4b ; Minor doc cleanups in go-ts-mode.el
b42ccb2e5c ; Minor grammar fix in treesit manual.
ab44c8a6f9 Fix order of rcirc-connect arguments
8eb6e33691 Fix rcirc messages printing in the wrong place
2901a3443c Prevent unnecessary modifications of 'package-vc-selected...
eaad302bd6 Rename eglot-update to eglot-upgrade
eaf25b9c6a go-ts-mode: Use iota query only if supported (Bug#63086)
cc090294d7 (rng-complete-tag): Add the (ignored) argument to the :co...
21ec6c1d5c Update to Transient v0.3.7-219-g3ded15b
8d5aa8df4a Fix inserting selection data into Mozilla programs
57562c3fd0 Recognize defstruct slot names in various eieio functions
b93eb68cc3 Use 'calendar-buffer' instead of fixed string

# Conflicts:
#	etc/EGLOT-NEWS
2023-05-06 03:41:54 +03:00
João Távora
c0ab4e9ca9 Eglot: re-rename eglot-upgrade to eglot-upgrade-eglot
* doc/misc/eglot.texi (Getting the latest version): Mention
eglot-upgrade-eglot.

* etc/EGLOT-NEWS: Mention eglot-upgrade-eglot.

* lisp/progmodes/eglot.el (eglot-upgrade-eglot): Rename from
eglot-update.
(eglot-update): New compatibility alias.
2023-05-05 14:58:17 +01:00
Dmitry Gutov
eaad302bd6 Rename eglot-update to eglot-upgrade
* doc/misc/eglot.texi (Getting the latest version):
Update the reference.

* lisp/progmodes/eglot.el (eglot-upgrade): Rename from
'eglot-update', as discussed on emacs-devel, in line with
'package-upgrade'.
2023-05-04 01:39:15 +03:00
João Távora
30892cbd33 Eglot: bump to 1.15
* lisp/progmodes/eglot.el (Version): Bump to 1.15

* etc/EGLOT-NEWS: Update.
2023-04-29 23:31:29 +01:00
João Távora
c604cb6a8a Eglot: unbreak for Emacs 26
Emacs 26 doesn't have newer progress-reporter-update.
I think I'll start using compat.el soon.

* lisp/progmodes/eglot.el (eglot--apply-text-edits): Unbreak for
Emacs 26 which doesn't have newer progress-reporter-update.
2023-04-29 20:46:12 +01:00
Po Lu
a97c382682 Merge from origin/emacs-29
a40f181623 Fix two crashes upon startup
44ebd9cbd5 Eglot: explain how to update Eglot in manual (bug#62720)
941ef044f2 Eglot: fix edge case when deleting inlay hint overlays
a365984d9e package-upgrade[-all]: Expand docstrings to note the curr...
f965f35b33 Rename all functions called package-*-update-* to package...
31b58161bb Fix FOR_EACH_TAIL in c-ts-mode (bug#62951)
0cf6e0998b * Makefile.in (distclean): Remove the 'native-lisp' direc...
933705d61e Improve greek-ibycus4 input method

# Conflicts:
#	etc/NEWS
2023-04-28 11:51:01 +08:00
João Távora
44ebd9cbd5 Eglot: explain how to update Eglot in manual (bug#62720)
* lisp/progmodes/eglot.el (eglot-update): New command.

* doc/misc/eglot.texi (Troubleshooting): Rework.
2023-04-28 00:39:08 +01:00
João Távora
941ef044f2 Eglot: fix edge case when deleting inlay hint overlays
When asked to update hints in a region (FROM TO),
eglot--update-hints-1 first deletes the existing hints.  It must
however take care to delete all overlays that logically belong to the
region, even if they don't physically belong to it, e.g. inlay
overlays spanning (FROM-1 FROM) and having a 'after-string' property.

* lisp/progmodes/eglot.el (eglot--update-hints-1): Fix edge case.
2023-04-28 00:39:08 +01:00
Eli Zaretskii
f1ce49d148 Merge from origin/emacs-29
3899acbb33 ; * src/fringe.c: Fix description of large circle.  (Bug#...
2b10e1827d sql: add missing postgresql types
9ac1259278 Fix display of menu-bar bindings of commands in *Help* bu...
ecdd3a9efa Improve Completion Example section in the Emacs manual
626e1ac62b Improve 'message-server-alist' docstring
327986936c Add index entry for fallback modes
1c4783c330 ; * etc/NEWS: Copyedits and grammar fixes.
3d6f755331 xref-search-program-alist: Fix searching larger file list...
1b8b2cf61b Fix typo and inaccuracy in the ELisp Reference manual
df17682ebf ; Support 'dart-ts-mode' in Eglot
e0dc60e078 ; Fix typos in gdb-mi.el
60560cc7ad Fix description of lexical environment's internals
1456adf424 ; Eglot: fix a typo in a customization type
2f59595f5f ; * etc/NEWS: Grammar fixes.
596b780ab7 Update to Org 9.6.4-2-g0f6ae7
a0b04a2247 Documentation copyedits for 'package-install-upgrade-buil...
580d8278c5 Allow upgrading built-in packages with 'package-install'
329304c23f ; * src/term.c (init_tty): Fix last change.  (Bug#62877)
200dbf7d30 Minor changes in c-ts-mode.el's support of DEFUNs
9686b015a0 Fix strike-through attribute support on TTY frames
39035fbfc5 Avoid crashes in 'describe-keymap' due to shadowing

# Conflicts:
#	etc/NEWS
#	lisp/progmodes/c-ts-mode.el
#	lisp/progmodes/eglot.el
2023-04-21 07:29:14 -04:00
João Távora
9093834d0b Eglot: unbreak activation/management of derived modes (bug#62907)
After recent changes to how LSP "languageId" is computed from major
modes and stored in the eglot-lsp-server object, the activation of the
'eglot--managed-mode' minor mode in modes _derived_ from some
major-mode mentioned in 'eglot-server-programs' was broken.

This commit restores that by introducing a new helper which uses the
same logic to provide the current-buffer's "languageId" to the server
and to discover if the server should manage the mode at all.  This
ensures the two things stay in sync.

Also, this helper uses the function 'provided-mode-derived-p' to fix
this bug#62907.

* lisp/progmodes/eglot.el (eglot--languageId): New helper.
(eglot-current-server, eglot--TextDocumentItem): Use it.
2023-04-19 00:59:17 +01:00
Eli Zaretskii
df17682ebf ; Support 'dart-ts-mode' in Eglot
* lisp/progmodes/eglot.el (eglot-server-programs): Add
'dart-ts-mode'.  Patch by Mou Tong <mou.tong@outlook.com>.
(Bug#62879)
2023-04-18 14:49:18 +03:00
Idir Lankri
1456adf424 ; Eglot: fix a typo in a customization type
* lisp/progmodes/eglot.el (eglot-ignored-server-capabilities): Fix the
value associated with the tag "Go to declaration".  (Bug#62849)

Copyright-paperwork-exempt: yes
2023-04-18 14:17:25 +03:00
João Távora
2d24eb69ed Eglot: guard against empty 'textDocument/documentSymbol' response
* lisp/progmodes/eglot.el (eglot-imenu): Protect against missing response.
2023-04-17 01:37:19 +01:00
Eli Zaretskii
bc61a1afdd Merge from origin/emacs-29
b7023da662 Make image-map bindings available on image links
d9e96c029b * CONTRIBUTE: Fix a typo
3f71a2a0cf ; * lisp/progmodes/c-ts-mode.el (treesit-node-next-siblin...
adf9c956c2 Add to Eglot support for additional language-servers.
b3603b84bd Partial support for DEFUN in c-ts-mode (bug#62825)

# Conflicts:
#	lisp/progmodes/c-ts-mode.el
2023-04-15 13:05:04 -04:00
Jostein Kjønigsen
adf9c956c2 Add to Eglot support for additional language-servers.
* lisp/progmodes/eglot.el (eglot-server-programs): Add
'vscode-markdown-language-server' for Markdown and
'dot-language-server' for GraphViz.  (Bug#62844)
2023-04-15 12:16:48 +03:00
João Távora
a74403adda Eglot: fix LSP "languageId" detection
This sweeping fix has been planned for a while, but a user recently
hit this bug as described in
https://github.com/joaotavora/eglot/discussions/1206.

More and more servers today are "multi-language", meaning can handle
more than one file type.  This relies on the ':languageId' string
being set to the correct value for every buffer managed by Eglot
(TextDocumentItem in LSP parlance).

Previously this string was calculated based on an imperfect heuristic
and was wrong quite often.  Many servers don't even care but some
others do, so we have to fix it.

* lisp/progmodes/eglot.el (eglot-lsp-server): Remove slots
'major-modes' and 'language-id'.  Add slot 'languages'.
(eglot--major-modes, eglot--language-ids): New helpers.
(eglot--lookup-mode): Simplify or maybe complicate.
(eglot--guess-contact): Use new eglot--looup-mode.  Change return
value.
(eglot): Rework docstring.
(eglot-reconnect): Use eglot--language-ids, not id.
(eglot--connect): Setup eglot--languages slot in server.
(eglot--TextDocumentItem): Finally, get correct language id.

* test/lisp/progmodes/eglot-tests.el (eglot--guessing-contact):
Enhance macro.
(eglot-test-server-programs-guess-lang): Update test.
2023-04-13 17:42:37 +01:00
João Távora
43290391ce ; Eglot: make version parseable by version-to-list
* lisp/progmodes/eglot.el (Version): Correct version.
2023-04-12 13:08:14 +01:00