Skip to content
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

Eglot over TRAMP doesn't recognize "projects" properly #826

Closed
xor-xor opened this issue Jan 30, 2022 · 4 comments
Closed

Eglot over TRAMP doesn't recognize "projects" properly #826

xor-xor opened this issue Jan 30, 2022 · 4 comments

Comments

@xor-xor
Copy link

xor-xor commented Jan 30, 2022

...and therefore, it spawns separate language servers for every sub-directory (which doesn't happen when you visit the same "project" locally).

Applying this workaround helps, but as I understand, one of Eglot's design decisions is not to rely on external packages like Projectile - hence I'm reporting this as an issue.

Steps to reproduce:

  1. Log into some remote Linux machine.
  2. Create a simple foobar "project" with the snippet below:
mkdir -p foobar/foo foobar/bar
echo "int main(){}" > foobar/foo/foo.cc
echo "int main(){}" > foobar/bar/bar.cc
git init foobar
  1. From within Emacs running on your local machine, C-x C-f to foo.cc via TRAMP, e.g. /ssh:my-remote-machine:foobar/foo/foo.cc.
  2. In a similar fashion, C-x C-f to bar.cc.

Result (see in *Messages* buffer):

[eglot] Connected! Server `clangd' now managing `c++-mode' buffers in project `foo'.
[eglot] Connected! Server `clangd' now managing `c++-mode' buffers in project `bar'.

Expected:

[eglot] Connected! Server `clangd' now managing `c++-mode' buffers in project `foobar'.

(i.e. the same outcome when you repeat steps 2-4, modulo TRAMP, on your local machine)

Details:

  • Server used: clangd (but I think this issue is server-agnostic)
  • Emacs version: GNU Emacs 27.1 (build 1, x86_64-apple-darwin18.7.0, Carbon Version 158 AppKit 1671.6) of 2020-11-21
  • Operating system: macOS (locally), Linux (remotely)
  • Eglot version: 20220123.1406
  • Eglot installation method: package.el
  • Using Doom: No

LSP transcript - M-x eglot-events-buffer (mandatory unless Emacs inoperable)

*EGLOT (foo/c++-mode) events* (remote):

[internal] Sun Jan 30 14:46:37 2022:
(:message "Running language server: (sh -c stty raw > /dev/null; clangd --clang-tidy\\=0)")
[stderr] I[13:46:37.746] Ubuntu clangd version 13.0.0-2
[stderr] I[13:46:37.746] Features: linux
[stderr] I[13:46:37.746] PID: 3637
[stderr] I[13:46:37.746] Working directory: /home/xor-xor/foobar/foo
[stderr] I[13:46:37.746] argv[0]: clangd
[stderr] I[13:46:37.746] argv[1]: --clang-tidy=0
[stderr] I[13:46:37.746] Starting LSP over stdin/stdout
[client-request] (id:1) Sun Jan 30 14:46:37 2022:
(:jsonrpc "2.0" :id 1 :method "initialize" :params
	  (:processId nil :rootPath "/home/xor-xor/foobar/foo/" :rootUri "file:///home/xor-xor/foobar/foo" :initializationOptions #s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8125 data
																				      ())
		      :capabilities
		      (:workspace
		       (:applyEdit t :executeCommand
				   (:dynamicRegistration :json-false)
				   :workspaceEdit
				   (:documentChanges :json-false)
				   :didChangeWatchedFiles
				   (:dynamicRegistration t)
				   :symbol
				   (:dynamicRegistration :json-false)
				   :configuration t)
		       :textDocument
		       (:synchronization
			(:dynamicRegistration :json-false :willSave t :willSaveWaitUntil t :didSave t)
			:completion
			(:dynamicRegistration :json-false :completionItem
					      (:snippetSupport :json-false :deprecatedSupport t :tagSupport
							       (:valueSet
								[1]))
					      :contextSupport t)
			:hover
			(:dynamicRegistration :json-false :contentFormat
					      ["markdown" "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)
			:publishDiagnostics
			(:relatedInformation :json-false :codeDescriptionSupport :json-false :tagSupport
					     (:valueSet
					      [1 2])))
		       :experimental #s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8125 data
						   ()))))
[stderr] I[13:46:37.792] <-- initialize(1)
[stderr] I[13:46:37.793] --> reply:initialize(1) 0 ms
[server-reply] (id:1) Sun Jan 30 14:46:37 2022:
(:id 1 :jsonrpc "2.0" :result
     (:capabilities
      (:astProvider t :callHierarchyProvider t :codeActionProvider
		    (:codeActionKinds
		     ["quickfix" "refactor" "info"])
		    :compilationDatabase
		    (:automaticReload t)
		    :completionProvider
		    (:allCommitCharacters
		     [" " "	" "(" ")" "[" "]" "{" "}" "<" ">" ":" ";" "," "+" "-" "/" "*" "%" "^" "&" "#" "?" "." "=" "\"" "'" "|"]
		     :resolveProvider :json-false :triggerCharacters
		     ["." "<" ">" ":" "\"" "/"])
		    :declarationProvider t :definitionProvider t :documentFormattingProvider t :documentHighlightProvider t :documentLinkProvider
		    (:resolveProvider :json-false)
		    :documentOnTypeFormattingProvider
		    (:firstTriggerCharacter "\n" :moreTriggerCharacter
					    [])
		    :documentRangeFormattingProvider t :documentSymbolProvider t :executeCommandProvider
		    (:commands
		     ["clangd.applyFix" "clangd.applyTweak"])
		    :hoverProvider t :implementationProvider t :memoryUsageProvider t :referencesProvider t :renameProvider t :selectionRangeProvider t :semanticTokensProvider
		    (:full
		     (:delta t)
		     :legend
		     (:tokenModifiers
		      ["declaration" "deprecated" "deduced" "readonly" "static" "abstract" "dependentName" "defaultLibrary" "functionScope" "classScope" "fileScope" "globalScope"]
		      :tokenTypes
		      ["variable" "variable" "parameter" "function" "method" "function" "property" "variable" "class" "interface" "enum" "enumMember" "type" "type" "unknown" "namespace" "typeParameter" "concept" "type" "macro" "comment"])
		     :range :json-false)
		    :signatureHelpProvider
		    (:triggerCharacters
		     ["(" ","])
		    :textDocumentSync
		    (:change 2 :openClose t :save t)
		    :typeHierarchyProvider t :workspaceSymbolProvider t)
      :serverInfo
      (:name "clangd" :version "Ubuntu clangd version 13.0.0-2 linux x86_64-pc-linux-gnu")))
[client-notification] Sun Jan 30 14:46:37 2022:
(:jsonrpc "2.0" :method "initialized" :params #s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8125 data
							    ()))
[client-notification] Sun Jan 30 14:46:37 2022:
(:jsonrpc "2.0" :method "textDocument/didOpen" :params
	  (:textDocument
	   (:uri "file:///home/xor-xor/foobar/foo/foo.cc" :version 0 :languageId "c++" :text "int main(){}\n")))
[client-notification] Sun Jan 30 14:46:37 2022:
(:jsonrpc "2.0" :method "workspace/didChangeConfiguration" :params
	  (:settings nil))
[stderr] I[13:46:37.809] <-- initialized
[stderr] I[13:46:37.879] <-- textDocument/didOpen
[stderr] I[13:46:37.880] Failed to find compilation database for /home/xor-xor/foobar/foo/foo.cc
[stderr] I[13:46:37.880] ASTWorker building file /home/xor-xor/foobar/foo/foo.cc version 0 with command clangd fallback
[stderr] [/home/xor-xor/foobar/foo]
[stderr] /usr/lib/llvm-13/bin/clang -resource-dir=/usr/lib/llvm-13/lib/clang/13.0.0 -- /home/xor-xor/foobar/foo/foo.cc
[stderr] I[13:46:37.883] <-- workspace/didChangeConfiguration
[stderr] I[13:46:37.897] --> textDocument/publishDiagnostics
[server-notification] Sun Jan 30 14:46:37 2022:
(:jsonrpc "2.0" :method "textDocument/publishDiagnostics" :params
	  (:diagnostics
	   []
	   :uri "file:///home/xor-xor/foobar/foo/foo.cc" :version 0))
[client-request] (id:2) Sun Jan 30 14:46:41 2022:
(:jsonrpc "2.0" :id 2 :method "textDocument/signatureHelp" :params
	  (:textDocument
	   (:uri "file:///home/xor-xor/foobar/foo/foo.cc")
	   :position
	   (:line 0 :character 0)))
[client-request] (id:3) Sun Jan 30 14:46:41 2022:
(:jsonrpc "2.0" :id 3 :method "textDocument/hover" :params
	  (:textDocument
	   (:uri "file:///home/xor-xor/foobar/foo/foo.cc")
	   :position
	   (:line 0 :character 0)))
[client-request] (id:4) Sun Jan 30 14:46:41 2022:
(:jsonrpc "2.0" :id 4 :method "textDocument/documentHighlight" :params
	  (:textDocument
	   (:uri "file:///home/xor-xor/foobar/foo/foo.cc")
	   :position
	   (:line 0 :character 0)))
[stderr] I[13:46:41.785] <-- textDocument/signatureHelp(2)
[stderr] I[13:46:41.790] <-- textDocument/hover(3)
[stderr] I[13:46:41.790] --> reply:textDocument/hover(3) 0 ms
[stderr] I[13:46:41.790] --> reply:textDocument/signatureHelp(2) 4 ms
[stderr] I[13:46:41.799] <-- textDocument/documentHighlight(4)
[stderr] I[13:46:41.799] --> reply:textDocument/documentHighlight(4) 0 ms
[server-reply] (id:3) Sun Jan 30 14:46:41 2022:
(:id 3 :jsonrpc "2.0" :result nil)
[server-reply] (id:2) Sun Jan 30 14:46:41 2022:
(:id 2 :jsonrpc "2.0" :result
     (:activeParameter 0 :activeSignature 0 :signatures
		       []))
[server-reply] (id:4) Sun Jan 30 14:46:41 2022:
(:id 4 :jsonrpc "2.0" :result
     [])

*EGLOT (bar/c++-mode) events* (remote):

[internal] Sun Jan 30 14:46:47 2022:
(:message "Running language server: (sh -c stty raw > /dev/null; clangd --clang-tidy\\=0)")
[stderr] I[13:46:47.070] Ubuntu clangd version 13.0.0-2
[stderr] I[13:46:47.071] Features: linux
[stderr] I[13:46:47.071] PID: 3707
[stderr] I[13:46:47.071] Working directory: /home/xor-xor/foobar/bar
[stderr] I[13:46:47.071] argv[0]: clangd
[stderr] I[13:46:47.071] argv[1]: --clang-tidy=0
[stderr] I[13:46:47.071] Starting LSP over stdin/stdout
[client-request] (id:1) Sun Jan 30 14:46:47 2022:
(:jsonrpc "2.0" :id 1 :method "initialize" :params
	  (:processId nil :rootPath "/home/xor-xor/foobar/bar/" :rootUri "file:///home/xor-xor/foobar/bar" :initializationOptions #s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8125 data
																				      ())
		      :capabilities
		      (:workspace
		       (:applyEdit t :executeCommand
				   (:dynamicRegistration :json-false)
				   :workspaceEdit
				   (:documentChanges :json-false)
				   :didChangeWatchedFiles
				   (:dynamicRegistration t)
				   :symbol
				   (:dynamicRegistration :json-false)
				   :configuration t)
		       :textDocument
		       (:synchronization
			(:dynamicRegistration :json-false :willSave t :willSaveWaitUntil t :didSave t)
			:completion
			(:dynamicRegistration :json-false :completionItem
					      (:snippetSupport :json-false :deprecatedSupport t :tagSupport
							       (:valueSet
								[1]))
					      :contextSupport t)
			:hover
			(:dynamicRegistration :json-false :contentFormat
					      ["markdown" "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)
			:publishDiagnostics
			(:relatedInformation :json-false :codeDescriptionSupport :json-false :tagSupport
					     (:valueSet
					      [1 2])))
		       :experimental #s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8125 data
						   ()))))
[stderr] I[13:46:47.121] <-- initialize(1)
[stderr] I[13:46:47.122] --> reply:initialize(1) 1 ms
[server-reply] (id:1) Sun Jan 30 14:46:47 2022:
(:id 1 :jsonrpc "2.0" :result
     (:capabilities
      (:astProvider t :callHierarchyProvider t :codeActionProvider
		    (:codeActionKinds
		     ["quickfix" "refactor" "info"])
		    :compilationDatabase
		    (:automaticReload t)
		    :completionProvider
		    (:allCommitCharacters
		     [" " "	" "(" ")" "[" "]" "{" "}" "<" ">" ":" ";" "," "+" "-" "/" "*" "%" "^" "&" "#" "?" "." "=" "\"" "'" "|"]
		     :resolveProvider :json-false :triggerCharacters
		     ["." "<" ">" ":" "\"" "/"])
		    :declarationProvider t :definitionProvider t :documentFormattingProvider t :documentHighlightProvider t :documentLinkProvider
		    (:resolveProvider :json-false)
		    :documentOnTypeFormattingProvider
		    (:firstTriggerCharacter "\n" :moreTriggerCharacter
					    [])
		    :documentRangeFormattingProvider t :documentSymbolProvider t :executeCommandProvider
		    (:commands
		     ["clangd.applyFix" "clangd.applyTweak"])
		    :hoverProvider t :implementationProvider t :memoryUsageProvider t :referencesProvider t :renameProvider t :selectionRangeProvider t :semanticTokensProvider
		    (:full
		     (:delta t)
		     :legend
		     (:tokenModifiers
		      ["declaration" "deprecated" "deduced" "readonly" "static" "abstract" "dependentName" "defaultLibrary" "functionScope" "classScope" "fileScope" "globalScope"]
		      :tokenTypes
		      ["variable" "variable" "parameter" "function" "method" "function" "property" "variable" "class" "interface" "enum" "enumMember" "type" "type" "unknown" "namespace" "typeParameter" "concept" "type" "macro" "comment"])
		     :range :json-false)
		    :signatureHelpProvider
		    (:triggerCharacters
		     ["(" ","])
		    :textDocumentSync
		    (:change 2 :openClose t :save t)
		    :typeHierarchyProvider t :workspaceSymbolProvider t)
      :serverInfo
      (:name "clangd" :version "Ubuntu clangd version 13.0.0-2 linux x86_64-pc-linux-gnu")))
[client-notification] Sun Jan 30 14:46:47 2022:
(:jsonrpc "2.0" :method "initialized" :params #s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8125 data
							    ()))
[client-notification] Sun Jan 30 14:46:47 2022:
(:jsonrpc "2.0" :method "textDocument/didOpen" :params
	  (:textDocument
	   (:uri "file:///home/xor-xor/foobar/bar/bar.cc" :version 0 :languageId "c++" :text "int main(){}\n")))
[client-notification] Sun Jan 30 14:46:47 2022:
(:jsonrpc "2.0" :method "workspace/didChangeConfiguration" :params
	  (:settings nil))
[stderr] I[13:46:47.139] <-- initialized
[stderr] I[13:46:47.207] <-- textDocument/didOpen
[stderr] I[13:46:47.208] Failed to find compilation database for /home/xor-xor/foobar/bar/bar.cc
[stderr] I[13:46:47.208] ASTWorker building file /home/xor-xor/foobar/bar/bar.cc version 0 with command clangd fallback
[stderr] [/home/xor-xor/foobar/bar]
[stderr] /usr/lib/llvm-13/bin/clang -resource-dir=/usr/lib/llvm-13/lib/clang/13.0.0 -- /home/xor-xor/foobar/bar/bar.cc
[stderr] I[13:46:47.211] <-- workspace/didChangeConfiguration
[stderr] I[13:46:47.224] --> textDocument/publishDiagnostics
[server-notification] Sun Jan 30 14:46:47 2022:
(:jsonrpc "2.0" :method "textDocument/publishDiagnostics" :params
	  (:diagnostics
	   []
	   :uri "file:///home/xor-xor/foobar/bar/bar.cc" :version 0))

*EGLOT (foobar/c++-mode) events* (local):

[internal] Sun Jan 30 15:09:18 2022:
(:message "Running language server: (clangd --clang-tidy=0)")
[client-request] (id:1) Sun Jan 30 15:09:18 2022:
(:jsonrpc "2.0" :id 1 :method "initialize" :params
	  (:processId 58747 :rootPath "/Users/xor-xor/tmp/foobar/" :rootUri "file:///Users/xor-xor/tmp/foobar" :initializationOptions #s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8125 data
																					  ())
		      :capabilities
		      (:workspace
		       (:applyEdit t :executeCommand
				   (:dynamicRegistration :json-false)
				   :workspaceEdit
				   (:documentChanges :json-false)
				   :didChangeWatchedFiles
				   (:dynamicRegistration t)
				   :symbol
				   (:dynamicRegistration :json-false)
				   :configuration t)
		       :textDocument
		       (:synchronization
			(:dynamicRegistration :json-false :willSave t :willSaveWaitUntil t :didSave t)
			:completion
			(:dynamicRegistration :json-false :completionItem
					      (:snippetSupport :json-false :deprecatedSupport t :tagSupport
							       (:valueSet
								[1]))
					      :contextSupport t)
			:hover
			(:dynamicRegistration :json-false :contentFormat
					      ["markdown" "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)
			:publishDiagnostics
			(:relatedInformation :json-false :codeDescriptionSupport :json-false :tagSupport
					     (:valueSet
					      [1 2])))
		       :experimental #s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8125 data
						   ()))))
[stderr] I[15:09:18.359] Homebrew clangd version 13.0.0
[stderr] I[15:09:18.359] Features: mac+xpc
[stderr] I[15:09:18.359] PID: 63520
[stderr] I[15:09:18.360] Working directory: /Users/xor-xor/tmp/foobar
[stderr] I[15:09:18.360] argv[0]: /usr/local/opt/llvm/bin/clangd
[stderr] I[15:09:18.360] argv[1]: --clang-tidy=0
[stderr] I[15:09:18.360] Starting LSP over stdin/stdout
[stderr] I[15:09:18.360] <-- initialize(1)
[stderr] I[15:09:18.380] --> reply:initialize(1) 20 ms
[server-reply] (id:1) Sun Jan 30 15:09:18 2022:
(:id 1 :jsonrpc "2.0" :result
     (:capabilities
      (:astProvider t :callHierarchyProvider t :codeActionProvider
		    (:codeActionKinds
		     ["quickfix" "refactor" "info"])
		    :compilationDatabase
		    (:automaticReload t)
		    :completionProvider
		    (:allCommitCharacters
		     [" " "	" "(" ")" "[" "]" "{" "}" "<" ">" ":" ";" "," "+" "-" "/" "*" "%" "^" "&" "#" "?" "." "=" "\"" "'" "|"]
		     :resolveProvider :json-false :triggerCharacters
		     ["." "<" ">" ":" "\"" "/"])
		    :declarationProvider t :definitionProvider t :documentFormattingProvider t :documentHighlightProvider t :documentLinkProvider
		    (:resolveProvider :json-false)
		    :documentOnTypeFormattingProvider
		    (:firstTriggerCharacter "\n" :moreTriggerCharacter
					    [])
		    :documentRangeFormattingProvider t :documentSymbolProvider t :executeCommandProvider
		    (:commands
		     ["clangd.applyFix" "clangd.applyTweak"])
		    :hoverProvider t :implementationProvider t :memoryUsageProvider t :referencesProvider t :renameProvider t :selectionRangeProvider t :semanticTokensProvider
		    (:full
		     (:delta t)
		     :legend
		     (:tokenModifiers
		      ["declaration" "deprecated" "deduced" "readonly" "static" "abstract" "dependentName" "defaultLibrary" "functionScope" "classScope" "fileScope" "globalScope"]
		      :tokenTypes
		      ["variable" "variable" "parameter" "function" "method" "function" "property" "variable" "class" "interface" "enum" "enumMember" "type" "type" "unknown" "namespace" "typeParameter" "concept" "type" "macro" "comment"])
		     :range :json-false)
		    :signatureHelpProvider
		    (:triggerCharacters
		     ["(" ","])
		    :textDocumentSync
		    (:change 2 :openClose t :save t)
		    :typeHierarchyProvider t :workspaceSymbolProvider t)
      :serverInfo
      (:name "clangd" :version "Homebrew clangd version 13.0.0 mac+xpc x86_64-apple-darwin19.6.0")))
[client-notification] Sun Jan 30 15:09:18 2022:
(:jsonrpc "2.0" :method "initialized" :params #s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8125 data
							    ()))
[client-notification] Sun Jan 30 15:09:18 2022:
(:jsonrpc "2.0" :method "textDocument/didOpen" :params
	  (:textDocument
	   (:uri "file:///Users/xor-xor/tmp/foobar/foo/foo.cc" :version 0 :languageId "c++" :text "int main(){}\n")))
[client-notification] Sun Jan 30 15:09:18 2022:
(:jsonrpc "2.0" :method "workspace/didChangeConfiguration" :params
	  (:settings nil))
[stderr] I[15:09:18.409] <-- initialized
[stderr] I[15:09:18.411] <-- textDocument/didOpen
[stderr] I[15:09:18.413] Failed to find compilation database for /Users/xor-xor/tmp/foobar/foo/foo.cc
[stderr] I[15:09:18.413] ASTWorker building file /Users/xor-xor/tmp/foobar/foo/foo.cc version 0 with command clangd fallback
[stderr] [/Users/xor-xor/tmp/foobar/foo]
[stderr] /Library/Developer/CommandLineTools/usr/bin/clang -resource-dir=/usr/local/Cellar/llvm/13.0.0_2/lib/clang/13.0.0 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -- /Users/xor-xor/tmp/foobar/foo/foo.cc
[stderr] I[15:09:18.414] <-- workspace/didChangeConfiguration
[stderr] I[15:09:18.430] --> textDocument/publishDiagnostics
[server-notification] Sun Jan 30 15:09:18 2022:
(:jsonrpc "2.0" :method "textDocument/publishDiagnostics" :params
	  (:diagnostics
	   []
	   :uri "file:///Users/xor-xor/tmp/foobar/foo/foo.cc" :version 0))
[client-request] (id:2) Sun Jan 30 15:10:23 2022:
(:jsonrpc "2.0" :id 2 :method "textDocument/signatureHelp" :params
	  (:textDocument
	   (:uri "file:///Users/xor-xor/tmp/foobar/foo/foo.cc")
	   :position
	   (:line 0 :character 0)))
[client-request] (id:3) Sun Jan 30 15:10:23 2022:
(:jsonrpc "2.0" :id 3 :method "textDocument/hover" :params
	  (:textDocument
	   (:uri "file:///Users/xor-xor/tmp/foobar/foo/foo.cc")
	   :position
	   (:line 0 :character 0)))
[client-request] (id:4) Sun Jan 30 15:10:23 2022:
(:jsonrpc "2.0" :id 4 :method "textDocument/documentHighlight" :params
	  (:textDocument
	   (:uri "file:///Users/xor-xor/tmp/foobar/foo/foo.cc")
	   :position
	   (:line 0 :character 0)))
[stderr] I[15:10:23.195] <-- textDocument/signatureHelp(2)
[stderr] I[15:10:23.196] <-- textDocument/hover(3)
[stderr] I[15:10:23.197] <-- textDocument/documentHighlight(4)
[stderr] I[15:10:23.197] --> reply:textDocument/hover(3) 1 ms
[stderr] I[15:10:23.197] --> reply:textDocument/documentHighlight(4) 0 ms
[stderr] I[15:10:23.202] --> reply:textDocument/signatureHelp(2) 7 ms
[server-reply] (id:3) Sun Jan 30 15:10:23 2022:
(:id 3 :jsonrpc "2.0" :result nil)
[server-reply] (id:4) Sun Jan 30 15:10:23 2022:
(:id 4 :jsonrpc "2.0" :result
     [])
[server-reply] (id:2) Sun Jan 30 15:10:23 2022:
(:id 2 :jsonrpc "2.0" :result
     (:activeParameter 0 :activeSignature 0 :signatures
		       []))
[client-notification] Sun Jan 30 15:10:27 2022:
(:jsonrpc "2.0" :method "textDocument/didOpen" :params
	  (:textDocument
	   (:uri "file:///Users/xor-xor/tmp/foobar/bar/bar.cc" :version 0 :languageId "c++" :text "int main(){}\n")))
[stderr] I[15:10:27.055] <-- textDocument/didOpen
[stderr] I[15:10:27.056] Failed to find compilation database for /Users/xor-xor/tmp/foobar/bar/bar.cc
[stderr] I[15:10:27.056] ASTWorker building file /Users/xor-xor/tmp/foobar/bar/bar.cc version 0 with command clangd fallback
[stderr] [/Users/xor-xor/tmp/foobar/bar]
[stderr] /Library/Developer/CommandLineTools/usr/bin/clang -resource-dir=/usr/local/Cellar/llvm/13.0.0_2/lib/clang/13.0.0 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -- /Users/xor-xor/tmp/foobar/bar/bar.cc
[stderr] I[15:10:27.069] --> textDocument/publishDiagnostics
[server-notification] Sun Jan 30 15:10:27 2022:
(:jsonrpc "2.0" :method "textDocument/publishDiagnostics" :params
	  (:diagnostics
	   []
	   :uri "file:///Users/xor-xor/tmp/foobar/bar/bar.cc" :version 0))
[client-request] (id:5) Sun Jan 30 15:10:27 2022:
(:jsonrpc "2.0" :id 5 :method "textDocument/signatureHelp" :params
	  (:textDocument
	   (:uri "file:///Users/xor-xor/tmp/foobar/bar/bar.cc")
	   :position
	   (:line 0 :character 0)))
[client-request] (id:6) Sun Jan 30 15:10:27 2022:
(:jsonrpc "2.0" :id 6 :method "textDocument/hover" :params
	  (:textDocument
	   (:uri "file:///Users/xor-xor/tmp/foobar/bar/bar.cc")
	   :position
	   (:line 0 :character 0)))
[client-request] (id:7) Sun Jan 30 15:10:27 2022:
(:jsonrpc "2.0" :id 7 :method "textDocument/documentHighlight" :params
	  (:textDocument
	   (:uri "file:///Users/xor-xor/tmp/foobar/bar/bar.cc")
	   :position
	   (:line 0 :character 0)))
[stderr] I[15:10:27.639] <-- textDocument/signatureHelp(5)
[stderr] I[15:10:27.640] <-- textDocument/hover(6)
[stderr] I[15:10:27.640] --> reply:textDocument/hover(6) 0 ms
[stderr] I[15:10:27.641] <-- textDocument/documentHighlight(7)
[stderr] I[15:10:27.641] --> reply:textDocument/documentHighlight(7) 0 ms
[stderr] I[15:10:27.645] --> reply:textDocument/signatureHelp(5) 5 ms
[server-reply] (id:6) Sun Jan 30 15:10:27 2022:
(:id 6 :jsonrpc "2.0" :result nil)
[server-reply] (id:7) Sun Jan 30 15:10:27 2022:
(:id 7 :jsonrpc "2.0" :result
     [])
[server-reply] (id:5) Sun Jan 30 15:10:27 2022:
(:id 5 :jsonrpc "2.0" :result
     (:activeParameter 0 :activeSignature 0 :signatures
		       []))
[client-request] (id:8) Sun Jan 30 15:25:01 2022:
(:jsonrpc "2.0" :id 8 :method "textDocument/signatureHelp" :params
	  (:textDocument
	   (:uri "file:///Users/xor-xor/tmp/foobar/bar/bar.cc")
	   :position
	   (:line 0 :character 0)))
[client-request] (id:9) Sun Jan 30 15:25:01 2022:
(:jsonrpc "2.0" :id 9 :method "textDocument/hover" :params
	  (:textDocument
	   (:uri "file:///Users/xor-xor/tmp/foobar/bar/bar.cc")
	   :position
	   (:line 0 :character 0)))
[client-request] (id:10) Sun Jan 30 15:25:01 2022:
(:jsonrpc "2.0" :id 10 :method "textDocument/documentHighlight" :params
	  (:textDocument
	   (:uri "file:///Users/xor-xor/tmp/foobar/bar/bar.cc")
	   :position
	   (:line 0 :character 0)))
[stderr] I[15:25:01.092] <-- textDocument/signatureHelp(8)
[stderr] I[15:25:01.093] <-- textDocument/hover(9)
[stderr] I[15:25:01.094] --> reply:textDocument/hover(9) 0 ms
[stderr] I[15:25:01.094] <-- textDocument/documentHighlight(10)
[stderr] I[15:25:01.094] --> reply:textDocument/documentHighlight(10) 0 ms
[stderr] I[15:25:01.099] --> reply:textDocument/signatureHelp(8) 6 ms
[server-reply] (id:9) Sun Jan 30 15:25:01 2022:
(:id 9 :jsonrpc "2.0" :result nil)
[server-reply] (id:10) Sun Jan 30 15:25:01 2022:
(:id 10 :jsonrpc "2.0" :result
     [])
[server-reply] (id:8) Sun Jan 30 15:25:01 2022:
(:id 8 :jsonrpc "2.0" :result
     (:activeParameter 0 :activeSignature 0 :signatures
		       []))

Backtrace (mandatory, unless no error message seen or heard):

There were no errors/backtraces.

Minimal configuration (mandatory)

(with-eval-after-load 'cc-mode
  (require 'eglot)
  (add-to-list 'eglot-server-programs '((c++-mode c-mode) . ("clangd" "--clang-tidy=0")))
  (add-hook 'c-mode-hook 'eglot-ensure)
  (add-hook 'c++-mode-hook 'eglot-ensure))
@nemethf
Copy link
Collaborator

nemethf commented Mar 1, 2022

I agree this should be server-agnostic, but I've failed to reproduce it with rust-analzer. Do you still see the issue with the latest Eglot? What's the result of the following command if you start it from the buffer of the remote foo.cc?

   M-: (project-current) RET

@xor-xor
Copy link
Author

xor-xor commented Mar 1, 2022

Turns out that this behaviour is caused by my config:

; disable vc to avoid delays ("Tramp: Checking ‘vc-registered’" msgs etc.)
(setq vc-ignore-dir-regexp
      (format "\\(%s\\)\\|\\(%s\\)"
              vc-ignore-dir-regexp
              tramp-file-name-regexp))

I've omitted this "detail" from from my bug report because I thought it was irrelevant (sorry for that! I should've followed the instructions more closely 🤦🏻‍♂️).

But! There's actually some gain here 😉

While investigating this, I've discovered another thing, which may be a somewhat known problem: having foo.cc opened (and handled successfully by Eglot), C-x C-f to bar.cc gives:

error in process filter: tramp-error: peculiar error: "Forbidden reentrant call of Tramp"
error in process filter: peculiar error: "Forbidden reentrant call of Tramp"

...but this probably requires a separate bug report, which I'll provide shortly (say, tomorrow) 😺

@xor-xor xor-xor closed this as completed Mar 1, 2022
@xor-xor
Copy link
Author

xor-xor commented Mar 2, 2022

...but this probably requires a separate bug report, which I'll provide shortly (say, tomorrow) 😺

Turns out that I can easily reproduce this error with Eglot 20220123.1406 (and for that matter, TRAMP 2.5.2), but after switching to Eglot's current master (i.e. 8dc5180), it doesn't appear anymore.

@xor-xor
Copy link
Author

xor-xor commented Mar 3, 2022

...but this probably requires a separate bug report, which I'll provide shortly (say, tomorrow) 😺

Turns out that I can easily reproduce this error with Eglot 20220123.1406 (and for that matter, TRAMP 2.5.2), but after switching to Eglot's current master (i.e. 8dc5180), it doesn't appear anymore.

Acutally, I can reproduce it on current master too - see #859.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants