* lisp/progmodes/js.el:
* lisp/progmodes/typescript-ts-mode.el: Indent jsx_text from correct
column when a modern grammar is installed; previously was over-indented.
The entry condition to eglot--semtok-font-lock-1, which checks
if the region to refontify is contained in the recorded region
in eglot--semtok-cache was blatantly wrong. It used 'beg'
twice!
* lisp/progmodes/eglot.el (eglot--semtok-font-lock): Fix bug.
When the server sends workspace/semanticTokens/refresh, calling
font-lock-flush isn't enough. It will trigger a new
eglot--semtok-font-lock call, but we can't assume anything about
the validity of eglot--semtok-cache.
Clangd seems to send workspace/semanticTokens/refresh when
complicated enough changes happen in an LSP document. If the
buffer-local eglot--semtok-cache isn't flushed we'll likely
request a delta, and clangd may still supply it, but it won't
apply correctly to the outdated local state.
* lisp/progmodes/eglot.el (eglot--semtok-cache)
(eglot--semtok-inflight): Move up here.
(eglot-handle-request): Flush the eglot--semtok-cache.
* lisp/progmodes/eglot.el (eglot--lsp-position-to-point): Use
eglot--widening.
(eglot--lsp-position-to-point): Use eglot--widening.
(eglot-range-region): New util.
(eglot-format)
(eglot--code-action-params)
(eglot--update-hints-1)
(eglot--semtok-request): Use eglot-range-region.
(eglot--after-change): Add comment.
eglot-range-region is an idea by Lua Viana Reis <me@lua.blog.br>
Don't block user input while rendering the *Completions* buffer
due to eager-display. This allows eager-display to be used with
larger and slower completion tables without interfering with the
user. Like in eager-update, we use while-no-input and
non-essential to ensure that eager-display happens without
blocking the user.
To support this, we remove the ability to set eager-display to a
function. The only user was tmm.el, which nows sets
eager-display to t and adds a completion-setup-hook instead.
(This also fixes a bug in tmm where dismissing and redisplaying
the *Completions* buffer would not have the special help text)
* lisp/minibuffer.el (completion-eager-display--timer)
(completions--eager-display, completions--start-eager-display):
Add. (bug#79819)
(completing-read-default): Call
completions--start-eager-display, stop supporting functionp
eager-display.
* lisp/tmm.el (tmm-add-prompt): Delete.
(tmm--completion-setup-hook): Add.
(tmm-add-prompt): Add completion-setup-hook, set eager-display
to t.
(tmm-goto-completions): Call minibuffer-completion-help instead
of tmm-add-prompt.
The tests are pretty basic, I don't expect them to catch
anything else than giant bugs.
* test/lisp/progmodes/eglot-tests.el (eglot-test-semtok-basic)
(eglot-test-semtok-refontify): New tests.
(eglot--semtok-faces, eglot--semtok-wait): New helpers.
* lisp/progmodes/eglot.el (eglot--semtok-request): Return value
records return reason.
(eglot--semtok-font-lock-1): Return number of painted tokens and
exit locus.
(eglot--semtok-decode-token): Rename
from eglot--semtok-token-faces. Rework.
(eglot--semtok-font-lock-1): Use eglot--semtok-decode-token.
And turn off semtok when tearing down eglot--managed-mode.
* lisp/progmodes/eglot.el (eglot--delete-overlays): New helper.
(eglot--managed-mode): Turn off minor modes and cleanup here.
(eglot--managed-mode-off): Not here.
(eglot-highlight-eldoc-function)
(eglot-code-action-suggestion): Use eglot--overlay prop.
(eglot-inlay-hints-mode): Use eglot--delete-overlays.
Don't use integers to store match data for "long term".
Otherwise, buffer edits that occur between two steps
(e.g. via process filters of post-command-hooks) makes it invalid,
leading to very confusing behavior, e.g. after `C-M-% ... y`
the right (next) match is highlighted yet if a process-filter or
post-command-hook runs, the next `y` may replace something else
than what was highlighted.
Also clarify how to turn off semantic tokens and inlay hints, since I
suspect that will be a theme.
* doc/misc/eglot.texi (Eglot Features): Add semantic tokens. (Eglot
Commands): Document eglot-semantic-tokens-mode. (Eglot and Buffers):
Provide example on how to turn off semtok and inlay hints.
* etc/EGLOT-NEWS (Changes to upcoming Eglot): Announce semantic
tokens support
Don't have evidence for the usefulness of this technique yet.
* lisp/progmodes/eglot.el (eglot--semtok-idle-timer): Delete.
(eglot--semtok-request): Simplify.
Many back-to-back calls for 'eglot--semtok-request' and small
regions occur even on trivial fast edits. Even though it's
cheap and harmless to send many delta rquests, it's nicer to
just send just one.
The debouncing from jsonrpc-async-request isn't enough. When a response
to a semtok request is received, it's important to remember which
regions to flush. Font-lock logic will then do its magic and coalesce
those regions into one before invoking eglot--semtok-font-lock, and
eglot--semtok-font-lock-1 will have up-to-date data to work with.
* lisp/progmodes/eglot.el (eglot--semtok-inflight): New variable.
(eglot--semtok-request): Use it.
Stefan's idea to use ONLY font-lock instead of jit-lock seems more
promising and less buggy. I did have to add this slightly odd
eglot--semtok-font-lock-2 kludge. Other than that, it seems fine.
* lisp/progmodes/eglot.el (eglot-semantic-tokens-mode): Now use
ONLY font-lock.
(eglot--semtok-request): Rework, don't call painting function
here.
(eglot--semtok-font-lock): Rename from eglot--semtok-jit-lock and
use a single arg. Maybe call eglot--semtok-font-lock-2. Return
nil or risk crashing Emacs.
(eglot--semtok-font-lock-1): Rework slightly.
(eglot--semtok-font-lock-2): New helper.
(eglot-region-range): Delete.
Kept the general structure but clarified the code paths.
Simplify many things. Instead of font-lock-add-keywords, use
jit-lock-register exclusively. Works, but slightly problematic,
since when editing the buffer the existing enriched face
information is first removed, then re-added. Will try other
approaches.
* lisp/progmodes/eglot.el (eglot-lsp-server): Tweak doc.
(eglot--semtok-request-full-on-idle): Delete. Integrated into caller.
(eglot--semtok-jit-lock): Rename from eglot--semtok-propertize. Rework.
(eglot--semtok-jit-lock-1): Extract from old eglot--semtok-propertize.
(eglot-semantic-tokens-mode): Use new eglot--semtok-jit-lock name.
(eglot--semtok-put-cache)
(eglot--semtok-ingest-range-response)
(eglot--semtok-ingest-delta-response)
(eglot--semtok-ingest-full-response): Delete helpers.
(eglot--semtok-apply-delta-edits): Rework with more cl-loopy idioms.
(eglot--semtok-flush-region): Delete.
(eglot--semtok-request): Now takes a region as argument. Rework extensively.
(eglot-connect-hook): Don't put
eglot--semtok-initialize here.
(eglot--connect): Rather here.
(eglot--semtok-token-faces): New helper.
(eglot--semtok-font-lock): Delete.
(eglot--semtok-initialize): Rework.
(eglot-semantic-tokens-mode): Simplify.
src/emacs -Q src/cm.c \
--eval '(trace-function (quote eglot--semtok-propertize))' \
--eval '(trace-function (quote eglot--semtok-request))' \
--eval '(trace-function (quote font-lock-flush))' -f eglot
More trace-values will show that too many full requests are being
sent.
* lisp/progmodes/eglot.el
(eglot-handle-request): Don't bump eglot--versioned-identifier,
since that confuses semtok bootstrap in a new file with clangd.
* lisp/progmodes/eglot.el (eglot-semantic-tokens-faces)
(eglot-semantic-tokens-modifier-faces): Move up to defcustom section.
(eglot--semtok-request-full-on-idle, eglot-handle-request)
(eglot--semtok-build-face-map, eglot--semtok-initialize)
(eglot-semantic-tokens-mode): Move into semantic tokens section.
(eglot--semtok-font-lock): Rename from
eglot--semtok-fontify-tokens.
(eglot-semantic-tokens-mode): Use eglot--semtok-font-lock.
(eglot--semtok-ingest-delta-response): Rename from
eglot--semtok-ingest-full/delta-response
(eglot--semtok-request): Use new function.
* lisp/vc/vc-dispatcher.el (vc-do-command): Restore using a pipe
in the async case. This was unintentionally changed when adding
support for discarding output.
* src/android-asset.h (AAssetManager_open): Initialize desc and
asset to NULL, lest `desc' be accessed uninitialized if C_NAME
does not exist in the directory tree.
bug#79810
* lisp/progmodes/hideshow.el (hs-hideable-region-p): Simplify.
(hs-block-positions): Change return value.
(hs--add-indicators): Go to the next line only if we have
successfully created the overlays.
(hs-hide-block-at-point, hs-hide-block): Update code.
* lisp/progmodes/heex-ts-mode.el (heex-ts--thing-settings): Add 'defun' thing.
(heex-ts-mode): Use it in 'hs-treesit-things'.
* lisp/textmodes/yaml-ts-mode.el (yaml-ts-mode): Set 'hs-treesit-things'
and 'hs-adjust-block-end-function'.