eglot
eglot copied to clipboard
Background conflicts between hl-line and inlay overlays
The inlay overlays are masking the background from hl-line
:
Here is the minimal configuration I can reproduce with:
(use-package eglot
:config
(setq-default
eglot-server-programs
(cl-substitute-if
(cons
'(js-base-mode typescript-ts-base-mode)
'("typescript-language-server" "--stdio" :initializationOptions
(:preferences
(:includeInlayEnumMemberValueHints t
:includeInlayFunctionLikeReturnTypeHints t
:includeInlayFunctionParameterTypeHints t
:includeInlayParameterNameHints "all"
:includeInlayParameterNameHintsWhenArgumentMatchesName t
:includeInlayPropertyDeclarationTypeHints t
:includeInlayVariableTypeHints t
:includeInlayVariableTypeHintsWhenTypeMatchesName t))))
(lambda (program)
(if (listp (car program))
(member 'typescript-ts-mode (car program))
(eq 'typescript-ts-mode program)))
eglot-server-programs))
:hook
(typescript-ts-base-mode . eglot-ensure))
(use-package hl-line
;; NOTE Default `hl-line-overlay-priority' is -50
:hook
(prog-mode . hl-line-mode))
(use-package treesit
:custom
;; NOTE Using grammars from https://github.com/casouri/tree-sitter-module
(treesit-extra-load-path
`(,(expand-file-name "elpa/tree-sitter-module/dist/" user-emacs-directory)))
(treesit-font-lock-level 4))
(use-package typescript-ts-mode
:mode
((rx ".ts" eos) . typescript-ts-mode)
((rx ".tsx" eos) . tsx-ts-mode))
And here is the sample TypeScript snippet used in the screenshot. It assumes a working TypeScript setup (with the built-in tree-sitter major mode) and if that's too much of a hassle to set up on your side, I assume the issue exists regardless of the server/language used
type F = (foo: string) => string;
const f: F = (foo) => foo;
M-x eglot-events-buffer
[internal] Sun Aug 20 16:16:21 2023: (:message "Running language server: typescript-language-server --stdio") [client-request] (id:1) Sun Aug 20 16:16:21 2023: (:jsonrpc "2.0" :id 1 :method "initialize" :params (:processId 36069 :rootPath "/Users/angrybacon/Workspace/project/" :rootUri "file:///Users/angrybacon/Workspace/project" :initializationOptions (:preferences (:includeInlayEnumMemberValueHints t :includeInlayFunctionLikeReturnTypeHints t :includeInlayFunctionParameterTypeHints t :includeInlayParameterNameHints "all" :includeInlayParameterNameHintsWhenArgumentMatchesName t :includeInlayPropertyDeclarationTypeHints t :includeInlayVariableTypeHints t :includeInlayVariableTypeHintsWhenTypeMatchesName t)) :capabilities (:workspace (:applyEdit t :executeCommand (:dynamicRegistration :json-false) :workspaceEdit (:documentChanges t) :didChangeWatchedFiles (:dynamicRegistration t) :symbol (:dynamicRegistration :json-false) :configuration t :workspaceFolders t) :textDocument (:synchronization (:dynamicRegistration :json-false :willSave t :willSaveWaitUntil t :didSave t) :completion (:dynamicRegistration :json-false :completionItem (:snippetSupport :json-false :deprecatedSupport t :resolveSupport (:properties ["documentation" "details" "additionalTextEdits"]) :tagSupport (:valueSet [1])) :contextSupport t) :hover (:dynamicRegistration :json-false :contentFormat ["plaintext"]) :signatureHelp (:dynamicRegistration :json-false :signatureInformation (:parameterInformation (:labelOffsetSupport t) :activeParameterSupport t)) :references (:dynamicRegistration :json-false) :definition (:dynamicRegistration :json-false :linkSupport t) :declaration (:dynamicRegistration :json-false :linkSupport t) :implementation (:dynamicRegistration :json-false :linkSupport t) :typeDefinition (:dynamicRegistration :json-false :linkSupport t) :documentSymbol (:dynamicRegistration :json-false :hierarchicalDocumentSymbolSupport t :symbolKind (:valueSet [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26])) :documentHighlight (:dynamicRegistration :json-false) :codeAction (:dynamicRegistration :json-false :codeActionLiteralSupport (:codeActionKind (:valueSet ["quickfix" "refactor" "refactor.extract" "refactor.inline" "refactor.rewrite" "source" "source.organizeImports"])) :isPreferredSupport t) :formatting (:dynamicRegistration :json-false) :rangeFormatting (:dynamicRegistration :json-false) :rename (:dynamicRegistration :json-false) :inlayHint (:dynamicRegistration :json-false) :publishDiagnostics (:relatedInformation :json-false :codeDescriptionSupport :json-false :tagSupport (:valueSet [1 2]))) :window (:workDoneProgress t) :general (:positionEncodings ["utf-32" "utf-8" "utf-16"]) :experimental #s(hash-table size 1 test eql rehash-size 1.5 rehash-threshold 0.8125 data ())) :workspaceFolders [(:uri "file:///Users/angrybacon/Workspace/project" :name "~/Workspace/project/")])) [server-notification] Sun Aug 20 16:16:22 2023: (:jsonrpc "2.0" :method "window/logMessage" :params (:type 2 :message "Using Typescript version (workspace) 5.1.6 from path \"/Users/angrybacon/Workspace/project/node_modules/typescript/lib/tsserver.js\"")) [server-reply] (id:1) Sun Aug 20 16:16:22 2023: (:jsonrpc "2.0" :id 1 :result (:capabilities (:textDocumentSync 2 :completionProvider (:triggerCharacters ["." "\"" "'" "/" "@" " string;\n\nconst f: F = (foo) => foo;\n"))) [client-notification] Sun Aug 20 16:16:22 2023: (:jsonrpc "2.0" :method "workspace/didChangeConfiguration" :params (:settings #s(hash-table size 1 test eql rehash-size 1.5 rehash-threshold 0.8125 data ()))) [client-request] (id:2) Sun Aug 20 16:16:22 2023: (:jsonrpc "2.0" :id 2 :method "textDocument/inlayHint" :params (:textDocument (:uri "file:///Users/angrybacon/Workspace/project/inlay.ts") :range (:start (:line 0 :character 0) :end (:line 3 :character 0)))) [server-notification] Sun Aug 20 16:16:22 2023: (:jsonrpc "2.0" :method "$/typescriptVersion" :params (:version "5.1.6" :source "workspace")) [server-request] (id:0) Sun Aug 20 16:16:22 2023: (:jsonrpc "2.0" :id 0 :method "window/workDoneProgress/create" :params (:token "efde070c-e1f7-4f50-a62e-233fe6ef363f")) [client-reply] (id:0) Sun Aug 20 16:16:22 2023: (:jsonrpc "2.0" :id 0 :result nil) [server-notification] Sun Aug 20 16:16:22 2023: (:jsonrpc "2.0" :method "$/progress" :params (:token "efde070c-e1f7-4f50-a62e-233fe6ef363f" :value (:kind "begin" :title "Initializing JS/TS language features…"))) [server-notification] Sun Aug 20 16:16:23 2023: (:jsonrpc "2.0" :method "$/progress" :params (:token "efde070c-e1f7-4f50-a62e-233fe6ef363f" :value (:kind "end"))) [server-reply] (id:2) Sun Aug 20 16:16:23 2023: (:jsonrpc "2.0" :id 2 :result [(:position (:line 2 :character 17) :label ": string" :kind 1 :paddingLeft t) (:position (:line 2 :character 18) :label ": string" :kind 1 :paddingLeft t)]) [server-notification] Sun Aug 20 16:16:23 2023: (:jsonrpc "2.0" :method "textDocument/publishDiagnostics" :params (:uri "file:///Users/angrybacon/Workspace/project/inlay.ts" :diagnostics [])) [client-request] (id:3) Sun Aug 20 16:16:25 2023: (:jsonrpc "2.0" :id 3 :method "textDocument/signatureHelp" :params (:textDocument (:uri "file:///Users/angrybacon/Workspace/project/inlay.ts") :position (:line 2 :character 0))) [client-request] (id:4) Sun Aug 20 16:16:25 2023: (:jsonrpc "2.0" :id 4 :method "textDocument/hover" :params (:textDocument (:uri "file:///Users/angrybacon/Workspace/project/inlay.ts") :position (:line 2 :character 0))) [client-request] (id:5) Sun Aug 20 16:16:25 2023: (:jsonrpc "2.0" :id 5 :method "textDocument/documentHighlight" :params (:textDocument (:uri "file:///Users/angrybacon/Workspace/project/inlay.ts") :position (:line 2 :character 0))) [server-reply] (id:3) Sun Aug 20 16:16:25 2023: (:jsonrpc "2.0" :id 3 :result nil) [server-reply] (id:4) Sun Aug 20 16:16:25 2023: (:jsonrpc "2.0" :id 4 :result (:contents [])) [server-reply] (id:5) Sun Aug 20 16:16:25 2023: (:jsonrpc "2.0" :id 5 :result []) [server-notification] Sun Aug 20 16:16:26 2023: (:jsonrpc "2.0" :method "textDocument/publishDiagnostics" :params (:uri "file:///Users/angrybacon/Workspace/project/inlay.ts" :diagnostics []))
BTW I don't think there's anything here eglot specific. It happens even with a basic overlay and hl-line mode. I've opened https://lists.gnu.org/archive/html/bug-gnu-emacs/2024-05/msg02012.html to report the issue.