1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-13 01:20:28 -08:00
Commit graph

1070 commits

Author SHA1 Message Date
Brennan Vincent
6a5c2edd84 Eglot: use :immediate t when resolving completions (bug#73279)
Copyright-paperwork-exempt: Yes

* lisp/progmodes/eglot.el (eglot-completion-at-point): Tweak
eglot--request call.
2024-10-09 06:30:30 -05:00
João Távora
cd36e070c2 Eglot: minor changes to doc and docstrings
* doc/misc/eglot.texi (Quick Start): Tweak.
(Setting Up LSP Servers): Tweak.
(Customizing Eglot): Clarify eglot-connect-hook and
eglot-initialized-hook.

* lisp/progmodes/eglot.el (eglot-connect-hook)
(eglot-server-initialized-hook): Rework docstring.
2024-10-09 06:26:27 -05:00
Stefan Kangas
96b87ad536 Mention LSP acronym in eglot defgroup docstring
* lisp/progmodes/eglot.el (eglot): Improve defgroup description by
mentioning the LSP acronym, for users that might be searching for that.
2024-10-01 00:24:23 +02:00
Stefan Kangas
9c904e8cea Change :group of 'eglot' defgroup to 'tools'
In 'M-x customize', Eglot fits in better in "Programming -> Tools", with
the likes of Flymake and Gud, than it does in "Applications", with ERC
and Newsticker.

* lisp/progmodes/eglot.el (eglot): Change :group of defgroup to 'tools'.
2024-10-01 00:16:01 +02:00
Stefan Monnier
29d50e245f * lisp/progmodes/eglot.el (eglot--signal-textDocument/didOpen): Fix bug#72696 2024-09-20 14:42:22 -04:00
Dmitry Gutov
9ffa38d392 Eglot: fix completion highlighting (bug#72824)
* lisp/progmodes/eglot.el (eglot-completion-at-point):
Make sure to refer to 'completion-ignore-case' in the
'all-completions' method.
2024-08-28 02:20:33 +03:00
Dmitry Gutov
713069dd7a [Eglot] Stricter "expand common" behavior
* lisp/progmodes/eglot.el (eglot--dumb-tryc): Check that the
expanded string matches every completion strictly (bug#72705).
And in the fallback case, check whether the table matches the
original prefix at all.  Return nil otherwise.

* test/lisp/progmodes/eglot-tests.el
(eglot-test-stop-completion-on-nonprefix)
(eglot-test-try-completion-nomatch): Corresponding tests.

* etc/EGLOT-NEWS: New entry.
2024-08-25 18:23:51 +03:00
João Távora
cfcba7ddc4 Eglot: bump version to 1.17.30 and update EGLOT-NEWS
This is a change specific to emacs-30.  Don't merge to master.

* lisp/progmodes/eglot.el (Version): Mark it 1.17.30.

* etc/EGLOT-NEWS (1.17.30): Fill in section.
2024-08-22 17:28:11 +01:00
Stefan Kangas
47c79b62dd Checkdoc fixes in progmodes
* lisp/progmodes/cperl-mode.el (cperl-file-style)
(cperl-continued-brace-offset, cperl-tips-faces):
* lisp/progmodes/eglot.el (eglot-confirm-server-edits, eglot)
(eglot-list-connections-mode, eglot--outstanding-inlay-hints-region)
(eglot--outstanding-inlay-regions-timer):
* lisp/progmodes/etags.el (etags-goto-tag-location)
(etags--xref-apropos-additional):
* lisp/progmodes/flymake.el (flymake-autoresize-margins):
* lisp/progmodes/gdb-mi.el (gdb-mouse-until, gdb-mouse-jump):
* lisp/progmodes/hideif.el (hif-parse-macro-arglist):
* lisp/progmodes/idlw-help.el (idlwave-html-help-location):
* lisp/progmodes/idlwave.el (idlwave-reserved-word-upcase):
* lisp/progmodes/java-ts-mode.el (java-ts-mode--string-highlight-helper):
* lisp/progmodes/js.el (js--chained-expression-p):
* lisp/progmodes/pascal.el (pascal-mode, pascal-comment-area):
* lisp/progmodes/python.el (python--treesit-fontify-union-types):
* lisp/progmodes/ruby-mode.el (ruby-align-chained-calls)
(ruby-block-indent, ruby-rubocop-use-bundler):
* lisp/progmodes/rust-ts-mode.el
(rust-ts-mode--prettify-symbols-compose-p):
* lisp/progmodes/verilog-mode.el (verilog-cache-has-lisp)
(verilog-auto-insert-lisp, verilog-highlight-region):
* lisp/progmodes/xref.el (xref--get-history): Various checkdoc fixes.
2024-07-07 17:46:30 +02:00
João Távora
74b82e6802 Eglot: support deprecated MarkedString (bug#71353)
* lisp/progmodes/eglot.el: Make a markdown code block if
MarkedString passed.
2024-07-06 10:17:42 +01:00
Stefan Kangas
45a20d781a ; Fix typos in symbols 2024-06-29 17:29:38 +02:00
Troy Brown
fb1b188e1a Eglot: Fix command execution (bug#71642)
* lisp/progmodes/eglot.el (eglot--lsp-interface-alist): Add
ExecuteCommandParams interface.
(eglot--execute): Fix handling of Command and CodeAction and add
ExecuteCommandParams.

Copyright-paperwork-exempt: yes
2024-06-22 12:46:36 +03:00
João Távora
6906ed28f1 Eglot: better fix for bug#70724
If the project's root is or destroyed , this may happen for a
variety of reasons, including reasons affecting non-reconnection
scenarios, so better to check in eglot--connect.

An Eglot "reconnection" has always created as accurate a copy of
the previous server object as possible, down to the 'eq'ness or
the saved initargs, language ids, etc.  So re-querying for
projects is not the thing to do here.

A new different server can be created with `M-x eglot` which will
ask about shutting down the existing one.

* lisp/progmodes/eglot.el (eglot-reconnect):  Revert previous change.
(eglot--connect):  Do sanity check here
2024-06-06 17:13:57 -05:00
Dmitry Gutov
b571c6571c eglot-reconnect: Re-fetch the current project
* lisp/progmodes/eglot.el (eglot-reconnect): Retrieve the current
project just in case something changed (bug#70724).
2024-06-06 23:35:20 +03:00
Troy Brown
58a26db626 Support ada-ts-mode, gpr-mode and gpr-ts-mode in Eglot
* lisp/progmodes/eglot.el (eglot-server-programs): Add
ada-ts-mode, gpr-mode and gpr-ts-mode.

Copyright-paperwork-exempt: yes
2024-06-03 17:55:16 +02:00
João Távora
1a9128e020 Eglot: run eglot-managed-mode-hook when turning off (bug#70958)
* lisp/progmodes/eglot.el (eglot--managed-mode): Run
  eglot-managed-mode-hook.
2024-05-27 16:58:55 -05:00
nibon7
d1d031aea6 eglot: Add blueprint language server (Bug#70015)
* lisp/progmodes/eglot.el (eglot-server-programs): Add
blueprint-compiler.
2024-05-18 23:37:20 +02:00
Sean Whitton
c85294a613 (eglot--managed-mode): Avoid calling track-changes unregistered
* lisp/progmodes/eglot.el (eglot--managed-mode): Unregister from
track-changes after `eglot-shutdown` since that function may
call `eglot--signal-textDocument/didChange`.  (bug#70927)
2024-05-15 14:50:18 -04:00
Stefan Monnier
44036b32ba eglot.el: Require track-changes unconditionally
* lisp/emacs-lisp/track-changes.el: Bump version.

* lisp/progmodes/eglot.el: Require `track-changes` unconditionally.
(Package-Requires:): Add `track-changes`.
(eglot--track-changes-signal, eglot--signal-textDocument/didChange)
(eglot--managed-mode): Remove non-track-changes alternative code.
(eglot--before-change, eglot--after-change): Delete functions.
2024-05-05 17:23:29 -04:00
Stefan Monnier
043bb36312 (eglot--track-changes-signal): Improve last fix (bug#70541)
* lisp/progmodes/eglot.el (eglot--add-one-shot-hook): New function.
(eglot--track-changes-signal): Use it.
2024-05-04 17:14:46 -04:00
Stefan Monnier
d0e391957b * lisp/progmodes/eglot.el (eglot--track-changes-signal): More typo 2024-05-03 16:51:57 -04:00
Philip Kaludercic
3d4918c2f1 Query Eglot version via package.el
* lisp/progmodes/eglot.el (eglot--version): Remove constant.
(eglot--connect): Use 'package-get-version'.
2024-05-03 20:14:20 +02:00
Stefan Monnier
b6d4e81a48 track-changes.el: Add a workaround for bug#70541
* lisp/emacs-lisp/track-changes.el (track-changes-inconsistent-state-p):
 New function.
* lisp/progmodes/eglot.el (eglot--track-changes-signal): Use it.
2024-05-03 13:23:00 -04:00
Augusto Stoffel
b98a6af8ca Eglot: Add 'command-modes' property to all suitable commands
Those are the commands that call 'eglot--current-server-or-lose'.
* lisp/progmodes/eglot.el (eglot--managed-mode),
(eglot-list-connections-mode): Make non-interactive.  (Bug#70554)
2024-05-02 11:50:57 +03:00
Philip Kaludercic
f68e917273 Add Compat as an Eglot dependency
* lisp/progmodes/eglot.el (eglot--format-markup): Remove fboundp
check for 'text-property-search-forward'.
(eglot-alternatives): Use Compat's 'executable-find'
(eglot--executable-find): Remove function.

Additionally this should make 'package-get-version' available
for releases of Emacs previous to 27.1.  (bug#62198)
2024-05-01 16:44:13 +02:00
Eli Zaretskii
d8d4fd8c6d ; * lisp/progmodes/eglot.el (eglot-path-to-uri): Improve commentary. 2024-04-23 21:28:09 +03:00
João Távora
3a4583baf6 Eglot: fix bug#70408 yet another way
The previous fix based on comparing the Eglot-provided didOpen URI to
the server-provided textDocument/publishDiagnostics URI didn't quite
work because the URI differs slightly in escaping conventions on certain
platforms.

This elephant-size bug is easily reproducible on Windows with clangd,
where every file is basically diagnostic-free.

* lisp/progmodes/eglot.el (eglot-path-to-uri): Rework.
(eglot--TextDocumentIdentifier-cache):
Rename from eglot--TextDocumentIdentifier-uri.
(eglot-handle-notification textDocument/publishDiagnostics): Tweak.
(eglot--TextDocumentIdentifier): Rework.
(eglot--signal-textDocument/didOpen): Tweak.
2024-04-23 08:44:43 -05:00
Eli Zaretskii
4d5fac4002 ; * lisp/progmodes/eglot.el (eglot-path-to-uri): Add comment. 2024-04-20 10:32:34 +03:00
João Távora
f90008411e Eglot: tweak previous change (bug#70036)
* lisp/progmodes/eglot.el (eglot--TextDocumentIdentifier-uri):
Rename from eglot--cached-tdi.
(eglot-handle-notification): Tweak comment.  Use
eglot--TextDocumentIdentifier-uri.
(eglot--TextDocumentIdentifier)
(eglot--signal-textDocument/didOpen): Use
eglot--TextDocumentIdentifier-uri.

* test/lisp/progmodes/eglot-tests.el (eglot-test-basic-symlink):
Address compilation warning.  Tweak comment slightly.
2024-04-19 16:30:41 -05:00
Theodor Thornhill
49ef173b02 Make publishDiagnostics faster by using cached variable
* lisp/progmodes/eglot.el (eglot--cached-tdi): Move variable.
(eglot-handle-notification): Expose 'server' and search through managed
buffers for a cached textDocumentIdentifier, which has a file-truename
resolved path.
* test/lisp/progmodes/eglot-tests.el (eglot-test-basic-symlink): Add
regression test for symlink behavior
2024-04-19 22:21:38 +02:00
Stefan Monnier
c833892140 (eglot--signal-textDocument/didChange): Fix tests
The tests call `eglot--signal-textDocument/didChange` eagerly,
which means in the case where we use `track-changes` that they
call it before the tracker's signal has been called.
So make sure we fetch pending changes even if we haven't yet
been notified of them, and make sure `eglot--versioned-identifier`
is incremented even when the signal is not called.

* lisp/progmodes/eglot.el (eglot--track-changes-fetch)
(eglot--after-change): Increment `eglot--versioned-identifier` here...
(eglot--track-changes-signal): ...instead of here.
(eglot--signal-textDocument/didChange): Try and fetch changes even if the
tracker's signal wasn't called yet.

* test/lisp/progmodes/eglot-tests.el (eglot-tests--get): New function.
(eglot-tests--lsp-abiding-column-1): Use it.
2024-04-18 23:39:30 -04:00
João Távora
3228c1222c Better way to fix bug#70036
Cache a new eglot--cached-tdi var per buffer, which contains value to
return from eglot--TextDocumentIdentifier.

This avoids frequent expensive recomputation of a value that requires
potentially many 'file-truename' calls.  This technique is used in a
number of other cases already, like eglot--recent-changes or
eglot--versioned-identifier.

* lisp/progmodes/eglot.el (eglot--cached-tdi): New variable.
(eglot--TextDocumentIdentifier): Tweak.
(eglot--signal-textDocument/didOpen): Clear eglot--cached-tdi.
2024-04-18 09:33:32 -05:00
João Távora
306feb7d96 Revert "Don't use file-truepath in Eglot (bug#70036)"
This reverts commit 08c80c45dd.

It introduces bugs when a project contains symlinked files.  The server
will be informed of duplicate documents which are really the same and it
frequently has no means to deduplicate such information.

This leads to bugs such as excessive textDocument/references to a
function.

* lisp/progmodes/eglot.el (eglot-lsp-server): Revert change.
(eglot-uri-to-path): Revert change.
(eglot--on-shutdown): Revert change.
(eglot--managed-mode): Revert change.
(eglot-handle-notification textDocument/publishDiagnostics): Revert change.
2024-04-18 09:33:32 -05:00
Siddharth Sharma
f66820d877 Add YANG LSP support to Eglot
* lisp/progmodes/eglot.el (eglot-server-programs): Add
'yang-language-server' and 'json-ts-mode'.  (Bug#70364)

Copyright-paperwork-exempt: yes
2024-04-18 13:34:31 +03:00
Theodor Thornhill
0dbd9ed046 Document earlier change in eglot-report-progress
* lisp/progmodes/eglot.el (eglot-report-progress): Document the changed
behavior.
* etc/EGLOT-NEWS (https): Mention the change.
2024-04-17 20:42:23 +02:00
Stefan Monnier
fcee1bf07b eglot.el: Remove accidentally included debugging code
* lisp/progmodes/eglot.el (eglot--signal-textDocument/didChange):
Remove leftover debug message.
2024-04-17 14:01:35 -04:00
Stefan Monnier
a33ab7565e track-changes.el: Minor changes for version 1.0
Arrange for the library to be usable on older Emacsen, which
includes reducing the noise when `before/after-change-functions`
are badly paired or missing.
Also, since the signal function receives the distance (for `:disjoint`),
we don't need `track-changes--disjoint-threshold`: the signal
function can simply do nothing when the distance is smaller than
the threshold it wants to use.

* lisp/emacs-lisp/track-changes.el: Prepare header for ELPA.
(track-changes--tracker, track-changes--state): Don't use `:noinline`,
so as to be compatible with Emacs<27.
(track-changes-record-errors): New variable.
(track-changes--recover-from-error): Use it.  Record only the last 20
keys and the last 50 stack frames in the error log.
(track-changes--disjoint-threshold): Delete variable.
(track-changes--before): Don't use it any more.

* lisp/progmodes/eglot.el (eglot--track-changes-signal):
Coalesce disjoint changes nearer than what used to be coalesced because of
`track-changes--disjoint-threshold`.
2024-04-16 21:57:05 -04:00
Stefan Monnier
d7a83e23d4 lisp/emacs-lisp/track-changes.el: New file (bug#70077)
This new package provides an API that is easier to use right than
our `*-change-functions` hooks.

The patch includes changes to `diff-mode.el` and `eglot.el` to
make use of this new package.

* lisp/emacs-lisp/track-changes.el: New file.
* test/lisp/emacs-lisp/track-changes-tests.el: New file.
* doc/lispref/text.texi (Tracking changes): New subsection.

* lisp/progmodes/eglot.el: Require `track-changes`.
(eglot--virtual-pos-to-lsp-position): New function.
(eglot--track-changes): New var.
(eglot--managed-mode): Use `track-changes-register` i.s.o
`after/before-change-functions` when available.
(eglot--track-changes-signal): New function, partly extracted from
`eglot--after-change`.
(eglot--after-change): Use it.
(eglot--track-changes-fetch): New function.
(eglot--signal-textDocument/didChange): Use it.

* lisp/vc/diff-mode.el: Require `track-changes`.
Also require `easy-mmode` before the `eval-when-compile`s.
(diff-unhandled-changes): Delete variable.
(diff-after-change-function): Delete function.
(diff--track-changes-function): Rename from `diff-post-command-hook`
and adjust to new calling convention.
(diff--track-changes): New variable.
(diff--track-changes-signal): New function.
(diff-mode, diff-minor-mode): Use it with `track-changes-register`.
2024-04-13 09:43:11 -04:00
Theodor Thornhill
08c80c45dd Don't use file-truepath in Eglot (bug#70036)
`file-truepath' is slow because of recursive calls and being implemented
in lisp.  It seems to not be needed in eglot, but it is used behind the
scenes in `find-buffer-visiting', thus appearing in profiles.  Moving
the implementation to a hash map will yield similar performance
benefits, but wouldn't require us to rewrite `file-truename' in C.

* lisp/progmodes/eglot.el (eglot-lsp-server): Convert 'managed-buffers'
to a hashmap.
(eglot-uri-to-path): Don't use file-truepath, as it is too slow to be
included in the hot path.
(eglot--on-shutdown): Use buffers from buffer map.
(eglot--managed-mode): Add buffer to map, rather than list. Also remove
it from the map on deactivation.
(eglot-handle-notification): Expose server and get buffer from the
buffer map.
2024-04-03 15:02:16 +02:00
Theodor Thornhill
a33e7c0286 Disable workDoneProgress if defcustom is nil
There is no need to receive the $/progress notifications from the server
if we don't want to render them. Because they are effectively ignored
when eglot-report-progress is nil we'd rather not waste cycles on serde
of the messages.

* lisp/progmodes/eglot.el (eglot-client-capabilities): use value from
defcustom to decide whether or not to advertise to server.
2024-03-30 20:48:32 +01:00
Theodor Thornhill
e5e3c9cef6 Fix typo in docstring
* lisp/progmodes/eglot.el (eglot-lsp-server): eglot-current-server is
now exposed.
2024-03-30 20:48:32 +01:00
Dionisio E Alonso
6235212d73 Add BasedPyright LSP server alternative for Eglot's 'python-mode'
* lisp/progmodes/eglot.el (eglot-server-programs): Add
BasedPyright, a new server for python, forked from the
unmaintained 'pyright' LSP server.  (Bug#69925)

Copyright-paperwork-exempt: yes
2024-03-23 09:37:45 +02:00
Pankaj Jangid
eae2c73edb Add language server for Move to eglot
* lisp/progmodes/eglot.el (eglot-server-programs): Added
'move-analyzer' language server.  (Bug#69796)
2024-03-14 17:16:38 +02:00
Phil Hagelberg
3807f380b3 bug#69685: Add language server for Fennel to eglot
* lisp/progmodes/eglot.el (eglot-server-programs): Add
fennel-ls language server.

Copyright-paperwork-exempt: yes
2024-03-14 11:52:06 +02:00
Stefan Monnier
357eb52e09 (eglot-server-programs): Comment and whitespace only change
* lisp/progmodes/eglot.el (eglot-server-programs): Add comment.
Make the definition fit into 80 columns.
2024-03-09 10:29:52 -05:00
Philip Kaludercic
477eb882b5 Add sml-mode entry to 'eglot-server-programs'
* lisp/progmodes/eglot.el (eglot-server-programs): Use the
"millet" LSP server (https://github.com/azdavis/millet).
2024-02-24 11:04:30 +01:00
Stefan Kangas
fc8b09484a ; Fix typos 2024-02-04 11:06:50 +01:00
Eli Zaretskii
25bf8d3cdc Merge from origin/emacs-29
b91f0ee2fc ; Fix last change
2f69353e4a Fix incompatibility with tree-sitter-javascript >= 0.20.2
d49124fc14 Avoid signaling errors from 'pixel-fill-region'
a398712761 eglot: Add nushell language server
5f56bc1cdf eglot: Add php-ts-mode to eglot-server-programs
c14c978e3b Support kotlin-ts-mode in Eglot
2024-02-03 06:49:53 -05:00
nibon7
a398712761 eglot: Add nushell language server
* lisp/progmodes/eglot.el (eglot-server-programs): Add nushell
language server.  (Bug#68823)
2024-02-02 08:54:25 +01:00
Piotr Kwiecinski
5f56bc1cdf eglot: Add php-ts-mode to eglot-server-programs
* lisp/progmodes/eglot.el (eglot-server-programs): Add
php-ts-mode.  (Bug#68870)

Copyright-paperwork-exempt: yes
2024-02-02 08:51:07 +01:00