Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Background conflicts between hl-line and inlay overlays #1274

Closed
angrybacon opened this issue Aug 20, 2023 · 1 comment
Closed

Background conflicts between hl-line and inlay overlays #1274

angrybacon opened this issue Aug 20, 2023 · 1 comment

Comments

@angrybacon
Copy link

The inlay overlays are masking the background from hl-line:

Screenshot 2023-08-20 at 15 59 04

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
			       ["." "\"" "'" "/" "@" "<"]
			       :resolveProvider t)
			      :codeActionProvider
			      (:codeActionKinds
			       ["source.fixAll.ts" "source.removeUnused.ts" "source.addMissingImports.ts" "source.organizeImports.ts" "source.removeUnusedImports.ts" "source.sortImports.ts" "quickfix" "refactor"])
			      :definitionProvider t :documentFormattingProvider t :documentRangeFormattingProvider t :documentHighlightProvider t :documentSymbolProvider t :executeCommandProvider
			      (:commands
			       ["_typescript.applyWorkspaceEdit" "_typescript.applyCodeAction" "_typescript.applyRefactoring" "_typescript.configurePlugin" "_typescript.organizeImports" "_typescript.applyRenameFile" "_typescript.goToSourceDefinition"])
			      :hoverProvider t :inlayHintProvider t :renameProvider t :referencesProvider t :selectionRangeProvider t :signatureHelpProvider
			      (:triggerCharacters
			       ["(" "," "<"]
			       :retriggerCharacters
			       [")"])
			      :workspaceSymbolProvider t :implementationProvider t :typeDefinitionProvider t :foldingRangeProvider t :semanticTokensProvider
			      (:documentSelector nil :legend
						 (:tokenTypes
						  ["class" "enum" "interface" "namespace" "typeParameter" "type" "parameter" "variable" "enumMember" "property" "function" "member"]
						  :tokenModifiers
						  ["declaration" "static" "async" "readonly" "defaultLibrary" "local"])
						 :full t :range t)
			      :workspace
			      (:fileOperations
			       (:willRename
				(:filters
				 [(:scheme "file" :pattern
					   (:glob "**/*.{ts,js,jsx,tsx,mjs,mts,cjs,cts}" :matches "file"))]))))))
[client-notification] Sun Aug 20 16:16:22 2023:
(:jsonrpc "2.0" :method "initialized" :params #s(hash-table size 1 test eql rehash-size 1.5 rehash-threshold 0.8125 data
							    ()))
[client-notification] Sun Aug 20 16:16:22 2023:
(:jsonrpc "2.0" :method "textDocument/didOpen" :params
	  (:textDocument
	   (:uri "file:///Users/angrybacon/Workspace/project/inlay.ts" :version 0 :languageId "typescript-ts" :text "type F = (foo: string) => 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
		[]))
@mohkale
Copy link
Contributor

mohkale commented May 30, 2024

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.

Repository owner locked and limited conversation to collaborators Aug 14, 2024
@joaotavora joaotavora converted this issue into discussion #1440 Aug 14, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants