Skip to content

Jump to definition broken with lua-language-server #711

Closed
@sm2n

Description

@sm2n
  • Server used: lua-language-server
  • Emacs version: GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.27, cairo version 1.17.4) of 2021-03-26
  • Operating system: linux
  • Eglot version: 5cc8df6
  • Eglot installation method: straight
  • Using Doom: No

LSP transcript

[client-request] (id:1) Tue Jul 20 11:38:34 2021:
(:jsonrpc "2.0" :id 1 :method "initialize" :params
	  (:processId 1222566 :rootPath "/tmp/test/" :rootUri "file:///tmp/test" :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 t)
					      :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)
			:declaration
			(:dynamicRegistration :json-false)
			:implementation
			(:dynamicRegistration :json-false)
			:typeDefinition
			(:dynamicRegistration :json-false)
			: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))
		       :experimental #s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8125 data
						   ()))))
[server-notification] Tue Jul 20 11:38:34 2021:
(:jsonrpc "2.0" :method "$/status/report" :params
	  (:text "😺Lua" :tooltip "Workspace   : \nCached files: 0/0\nMemory usage: 3M\n"))
[server-notification] Tue Jul 20 11:38:34 2021:
(:jsonrpc "2.0" :method "window/logMessage" :params
	  (:message "Log path: file:///tmp/lua-language-server.KThT/log/file_tmp_test.log" :type 4))
[server-reply] (id:1) Tue Jul 20 11:38:34 2021:
(:id 1 :jsonrpc "2.0" :result
     (:capabilities
      (:codeActionProvider
       (:codeActionKinds
	["" "quickfix" "refactor.rewrite" "refactor.extract"]
	:resolveProvider :json-false)
       :completionProvider
       (:resolveProvider t :triggerCharacters
			 ["	" "\n" "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z" "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z" "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "." ":" "(" "'" "\"" "[" "," "#" "*" "@" "|" "=" "-" "{" " "])
       :definitionProvider t :documentHighlightProvider t :documentOnTypeFormattingProvider
       (:firstTriggerCharacter "\n")
       :documentSymbolProvider t :executeCommandProvider
       (:commands
	["lua.removeSpace:1396933" "lua.solve:1396933" "lua.jsonToLua:1396933" "lua.setConfig:1396933" "lua.autoRequire:1396933"])
       :foldingRangeProvider t :hoverProvider t :referencesProvider t :renameProvider
       (:prepareProvider t)
       :signatureHelpProvider
       (:triggerCharacters
	["(" ","])
       :textDocumentSync
       (:change 2 :openClose t)
       :typeDefinitionProvider t :workspaceSymbolProvider t)
      :serverInfo
      (:name "sumneko.lua")))
[client-notification] Tue Jul 20 11:38:34 2021:
(:jsonrpc "2.0" :method "initialized" :params #s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8125 data
							    ()))
[client-notification] Tue Jul 20 11:38:34 2021:
(:jsonrpc "2.0" :method "textDocument/didOpen" :params
	  (:textDocument
	   (:uri "file:///tmp/test/foo.lua" :version 0 :languageId "lua" :text "return {baz = function () print \"baz\" end}\n")))
[client-notification] Tue Jul 20 11:38:34 2021:
(:jsonrpc "2.0" :method "textDocument/didOpen" :params
	  (:textDocument
	   (:uri "file:///tmp/test/bar.lua" :version 0 :languageId "lua" :text "require \"foo\"\n\nfoo.baz()\n")))
[client-notification] Tue Jul 20 11:38:34 2021:
(:jsonrpc "2.0" :method "workspace/didChangeConfiguration" :params
	  (:settings nil))
[server-notification] Tue Jul 20 11:38:34 2021:
(:jsonrpc "2.0" :method "workspace/semanticTokens/refresh" :params nil)
[server-notification] Tue Jul 20 11:38:34 2021:
(:jsonrpc "2.0" :method "workspace/semanticTokens/refresh" :params nil)
[server-notification] Tue Jul 20 11:38:34 2021:
(:jsonrpc "2.0" :method "workspace/semanticTokens/refresh" :params nil)
[server-notification] Tue Jul 20 11:38:34 2021:
(:jsonrpc "2.0" :method "workspace/semanticTokens/refresh" :params nil)
[server-notification] Tue Jul 20 11:38:34 2021:
(:jsonrpc "2.0" :method "$/status/show")
[server-notification] Tue Jul 20 11:38:34 2021:
(:jsonrpc "2.0" :method "workspace/semanticTokens/refresh" :params nil)
[server-notification] Tue Jul 20 11:38:34 2021:
(:jsonrpc "2.0" :method "workspace/semanticTokens/refresh" :params nil)
[server-notification] Tue Jul 20 11:38:34 2021:
(:jsonrpc "2.0" :method "workspace/semanticTokens/refresh" :params nil)
[server-notification] Tue Jul 20 11:38:34 2021:
(:jsonrpc "2.0" :method "workspace/semanticTokens/refresh" :params nil)
[server-notification] Tue Jul 20 11:38:34 2021:
(:jsonrpc "2.0" :method "workspace/semanticTokens/refresh" :params nil)
[server-notification] Tue Jul 20 11:38:34 2021:
(:jsonrpc "2.0" :method "workspace/semanticTokens/refresh" :params nil)
[server-notification] Tue Jul 20 11:38:34 2021:
(:jsonrpc "2.0" :method "workspace/semanticTokens/refresh" :params nil)
[server-notification] Tue Jul 20 11:38:34 2021:
(:jsonrpc "2.0" :method "workspace/semanticTokens/refresh" :params nil)
[server-notification] Tue Jul 20 11:38:34 2021:
(:jsonrpc "2.0" :method "workspace/semanticTokens/refresh" :params nil)
[server-notification] Tue Jul 20 11:38:34 2021:
(:jsonrpc "2.0" :method "workspace/semanticTokens/refresh" :params nil)
[server-notification] Tue Jul 20 11:38:34 2021:
(:jsonrpc "2.0" :method "workspace/semanticTokens/refresh" :params nil)
[server-notification] Tue Jul 20 11:38:34 2021:
(:jsonrpc "2.0" :method "workspace/semanticTokens/refresh" :params nil)
[server-notification] Tue Jul 20 11:38:34 2021:
(:jsonrpc "2.0" :method "workspace/semanticTokens/refresh" :params nil)
[server-notification] Tue Jul 20 11:38:34 2021:
(:jsonrpc "2.0" :method "workspace/semanticTokens/refresh" :params nil)
[server-notification] Tue Jul 20 11:38:34 2021:
(:jsonrpc "2.0" :method "workspace/semanticTokens/refresh" :params nil)
[server-notification] Tue Jul 20 11:38:34 2021:
(:jsonrpc "2.0" :method "$/status/report" :params
	  (:text "😺Lua" :tooltip "Workspace   : /tmp/test\nCached files: 0/0\nMemory usage: 3M\n"))
[server-request] (id:1) Tue Jul 20 11:38:34 2021:
(:id 1 :jsonrpc "2.0" :method "workspace/configuration" :params
     (:items
      [(:scopeUri "file:///tmp/test" :section "Lua")
       (:scopeUri "file:///tmp/test" :section "files.associations")
       (:scopeUri "file:///tmp/test" :section "files.exclude")
       (:scopeUri "file:///tmp/test" :section "editor.semanticHighlighting.enabled")
       (:scopeUri "file:///tmp/test" :section "editor.acceptSuggestionOnEnter")]))
[client-reply] (id:1) Tue Jul 20 11:38:34 2021:
(:jsonrpc "2.0" :id 1 :result
	  [nil nil nil nil nil])
[server-request] (id:2) Tue Jul 20 11:38:34 2021:
(:id 2 :jsonrpc "2.0" :method "workspace/configuration" :params
     (:items
      [(:scopeUri "file:///tmp/test" :section "Lua")
       (:scopeUri "file:///tmp/test" :section "files.associations")
       (:scopeUri "file:///tmp/test" :section "files.exclude")
       (:scopeUri "file:///tmp/test" :section "editor.semanticHighlighting.enabled")
       (:scopeUri "file:///tmp/test" :section "editor.acceptSuggestionOnEnter")]))
[client-reply] (id:2) Tue Jul 20 11:38:34 2021:
(:jsonrpc "2.0" :id 2 :result
	  [nil nil nil nil nil])
[server-request] (id:3) Tue Jul 20 11:38:34 2021:
(:id 3 :jsonrpc "2.0" :method "client/registerCapability" :params
     (:registrations
      [(:id "workspace/didChangeWatchedFiles" :method "workspace/didChangeWatchedFiles" :registerOptions
	    (:watchers
	     [(:globPattern "**/" :kind 7)]))]))
[client-reply] (id:3) Tue Jul 20 11:38:34 2021:
(:jsonrpc "2.0" :id 3 :result nil)
[server-notification] Tue Jul 20 11:38:34 2021:
(:jsonrpc "2.0" :method "$/status/report" :params
	  (:text "😺Lua" :tooltip "Workspace   : /tmp/test\nCached files: 0/0\nMemory usage: 2M\n"))
[server-request] (id:4) Tue Jul 20 11:38:34 2021:
(:id 4 :jsonrpc "2.0" :method "window/workDoneProgress/create" :params
     (:token 2))
[client-reply] (id:4) Tue Jul 20 11:38:34 2021:
(:jsonrpc "2.0" :id 4 :result nil)
[server-notification] Tue Jul 20 11:38:34 2021:
(:jsonrpc "2.0" :method "$/progress" :params
	  (:token 2 :value
		  (:cancellable :json-false :kind "begin" :message "0/1" :percentage 0 :title "Loading workspace")))
[server-notification] Tue Jul 20 11:38:34 2021:
(:jsonrpc "2.0" :method "$/progress" :params
	  (:token 2 :value
		  (:kind "report" :message "8/13" :percentage 53)))
[server-notification] Tue Jul 20 11:38:34 2021:
(:jsonrpc "2.0" :method "$/status/report" :params
	  (:text "😺Lua" :tooltip "Workspace   : /tmp/test\nCached files: 13/13\nMemory usage: 5M\n"))
[server-notification] Tue Jul 20 11:38:35 2021:
(:jsonrpc "2.0" :method "$/progress" :params
	  (:token 2 :value
		  (:kind "end")))
[client-request] (id:2) Tue Jul 20 11:38:36 2021:
(:jsonrpc "2.0" :id 2 :method "textDocument/signatureHelp" :params
	  (:textDocument
	   (:uri "file:///tmp/test/foo.lua")
	   :position
	   (:line 0 :character 38)))
[client-request] (id:3) Tue Jul 20 11:38:36 2021:
(:jsonrpc "2.0" :id 3 :method "textDocument/hover" :params
	  (:textDocument
	   (:uri "file:///tmp/test/foo.lua")
	   :position
	   (:line 0 :character 38)))
[client-request] (id:4) Tue Jul 20 11:38:36 2021:
(:jsonrpc "2.0" :id 4 :method "textDocument/documentHighlight" :params
	  (:textDocument
	   (:uri "file:///tmp/test/foo.lua")
	   :position
	   (:line 0 :character 38)))
[server-reply] (id:2) Tue Jul 20 11:38:36 2021:
(:id 2 :jsonrpc "2.0" :result
     (:signatures
      [(:activeParameter 0 :documentation
			 (:kind "markdown" :value "\nReceives any number of arguments and prints their values to `stdout`, converting each argument to a string following the same rules of [tostring](http://www.lua.org/manual/5.4/manual.html#pdf-tostring).\nThe function print is not intended for formatted output, but only as a quick way to show a value, for instance for debugging. For complete control over the output, use [string.format](http://www.lua.org/manual/5.4/manual.html#pdf-string.format) and [io.write](http://www.lua.org/manual/5.4/manual.html#pdf-io.write).\n\n\n[View documents](http://www.lua.org/manual/5.4/manual.html#pdf-print)\n")
			 :label "function print(...)" :parameters
			 [(:label
			   [15 18])])]))
[server-reply] (id:3) Tue Jul 20 11:38:36 2021:
(:id 3 :jsonrpc "2.0" :result
     (:contents
      (:kind "markdown" :value "```lua\nfunction baz()\n```")
      :range
      (:end
       (:character 41 :line 0)
       :start
       (:character 14 :line 0))))
[server-reply] (id:4) Tue Jul 20 11:38:36 2021:
(:id 4 :jsonrpc "2.0" :result
     [(:kind 3 :range
	     (:end
	      (:character 22 :line 0)
	      :start
	      (:character 14 :line 0)))
      (:kind 3 :range
	     (:end
	      (:character 41 :line 0)
	      :start
	      (:character 38 :line 0)))])
[server-notification] Tue Jul 20 11:38:36 2021:
(:jsonrpc "2.0" :method "textDocument/publishDiagnostics" :params
	  (:diagnostics
	   []
	   :uri "file:///tmp/test/foo.lua"))
[server-notification] Tue Jul 20 11:38:36 2021:
(:jsonrpc "2.0" :method "textDocument/publishDiagnostics" :params
	  (:diagnostics
	   [(:code "undefined-global" :message "Undefined global `foo`." :range
		   (:end
		    (:character 3 :line 2)
		    :start
		    (:character 0 :line 2))
		   :severity 2 :source "Lua Diagnostics.")]
	   :uri "file:///tmp/test/bar.lua"))
[server-notification] Tue Jul 20 11:38:36 2021:
(:jsonrpc "2.0" :method "$/status/report" :params
	  (:text "😺Lua" :tooltip "Workspace   : /tmp/test\nCached files: 13/13\nMemory usage: 6M\n"))
[client-request] (id:5) Tue Jul 20 11:38:36 2021:
(:jsonrpc "2.0" :id 5 :method "textDocument/signatureHelp" :params
	  (:textDocument
	   (:uri "file:///tmp/test/foo.lua")
	   :position
	   (:line 0 :character 37)))
[client-request] (id:6) Tue Jul 20 11:38:36 2021:
(:jsonrpc "2.0" :id 6 :method "textDocument/hover" :params
	  (:textDocument
	   (:uri "file:///tmp/test/foo.lua")
	   :position
	   (:line 0 :character 37)))
[client-request] (id:7) Tue Jul 20 11:38:36 2021:
(:jsonrpc "2.0" :id 7 :method "textDocument/documentHighlight" :params
	  (:textDocument
	   (:uri "file:///tmp/test/foo.lua")
	   :position
	   (:line 0 :character 37)))
[server-reply] (id:5) Tue Jul 20 11:38:36 2021:
(:id 5 :jsonrpc "2.0" :result
     (:signatures
      [(:activeParameter 0 :documentation
			 (:kind "markdown" :value "\nReceives any number of arguments and prints their values to `stdout`, converting each argument to a string following the same rules of [tostring](http://www.lua.org/manual/5.4/manual.html#pdf-tostring).\nThe function print is not intended for formatted output, but only as a quick way to show a value, for instance for debugging. For complete control over the output, use [string.format](http://www.lua.org/manual/5.4/manual.html#pdf-string.format) and [io.write](http://www.lua.org/manual/5.4/manual.html#pdf-io.write).\n\n\n[View documents](http://www.lua.org/manual/5.4/manual.html#pdf-print)\n")
			 :label "function print(...)" :parameters
			 [(:label
			   [15 18])])]))
[server-reply] (id:6) Tue Jul 20 11:38:36 2021:
(:id 6 :jsonrpc "2.0" :result nil)
[server-reply] (id:7) Tue Jul 20 11:38:36 2021:
(:id 7 :jsonrpc "2.0" :result nil)
[client-request] (id:8) Tue Jul 20 11:38:38 2021:
(:jsonrpc "2.0" :id 8 :method "textDocument/signatureHelp" :params
	  (:textDocument
	   (:uri "file:///tmp/test/bar.lua")
	   :position
	   (:line 2 :character 7)))
[client-request] (id:9) Tue Jul 20 11:38:38 2021:
(:jsonrpc "2.0" :id 9 :method "textDocument/hover" :params
	  (:textDocument
	   (:uri "file:///tmp/test/bar.lua")
	   :position
	   (:line 2 :character 7)))
[client-request] (id:10) Tue Jul 20 11:38:38 2021:
(:jsonrpc "2.0" :id 10 :method "textDocument/documentHighlight" :params
	  (:textDocument
	   (:uri "file:///tmp/test/bar.lua")
	   :position
	   (:line 2 :character 7)))
[server-reply] (id:8) Tue Jul 20 11:38:38 2021:
(:id 8 :jsonrpc "2.0" :result nil)
[server-reply] (id:9) Tue Jul 20 11:38:38 2021:
(:id 9 :jsonrpc "2.0" :result
     (:contents
      (:kind "markdown" :value "```lua\nglobal foo.baz: any\n```")
      :range
      (:end
       (:character 7 :line 2)
       :start
       (:character 4 :line 2))))
[server-reply] (id:10) Tue Jul 20 11:38:38 2021:
(:id 10 :jsonrpc "2.0" :result
     [(:kind 2 :range
	     (:end
	      (:character 7 :line 2)
	      :start
	      (:character 4 :line 2)))])
[client-request] (id:11) Tue Jul 20 11:38:39 2021:
(:jsonrpc "2.0" :id 11 :method "textDocument/signatureHelp" :params
	  (:textDocument
	   (:uri "file:///tmp/test/bar.lua")
	   :position
	   (:line 2 :character 6)))
[client-request] (id:12) Tue Jul 20 11:38:39 2021:
(:jsonrpc "2.0" :id 12 :method "textDocument/hover" :params
	  (:textDocument
	   (:uri "file:///tmp/test/bar.lua")
	   :position
	   (:line 2 :character 6)))
[client-request] (id:13) Tue Jul 20 11:38:39 2021:
(:jsonrpc "2.0" :id 13 :method "textDocument/documentHighlight" :params
	  (:textDocument
	   (:uri "file:///tmp/test/bar.lua")
	   :position
	   (:line 2 :character 6)))
[server-reply] (id:11) Tue Jul 20 11:38:39 2021:
(:id 11 :jsonrpc "2.0" :result nil)
[server-reply] (id:12) Tue Jul 20 11:38:39 2021:
(:id 12 :jsonrpc "2.0" :result
     (:contents
      (:kind "markdown" :value "```lua\nglobal foo.baz: any\n```")
      :range
      (:end
       (:character 7 :line 2)
       :start
       (:character 4 :line 2))))
[server-reply] (id:13) Tue Jul 20 11:38:39 2021:
(:id 13 :jsonrpc "2.0" :result
     [(:kind 2 :range
	     (:end
	      (:character 7 :line 2)
	      :start
	      (:character 4 :line 2)))])
[client-request] (id:14) Tue Jul 20 11:38:43 2021:
(:jsonrpc "2.0" :id 14 :method "textDocument/signatureHelp" :params
	  (:textDocument
	   (:uri "file:///tmp/test/bar.lua")
	   :position
	   (:line 0 :character 5)))
[client-request] (id:15) Tue Jul 20 11:38:43 2021:
(:jsonrpc "2.0" :id 15 :method "textDocument/hover" :params
	  (:textDocument
	   (:uri "file:///tmp/test/bar.lua")
	   :position
	   (:line 0 :character 5)))
[client-request] (id:16) Tue Jul 20 11:38:43 2021:
(:jsonrpc "2.0" :id 16 :method "textDocument/documentHighlight" :params
	  (:textDocument
	   (:uri "file:///tmp/test/bar.lua")
	   :position
	   (:line 0 :character 5)))
[server-reply] (id:14) Tue Jul 20 11:38:43 2021:
(:id 14 :jsonrpc "2.0" :result
     (:signatures
      [(:activeParameter -1 :documentation
			 (:kind "markdown" :value "\nLoads the given module, returns any value returned by the searcher(`true` when `nil`). Besides that value, also returns as a second result the loader data returned by the searcher, which indicates how `require` found the module. (For instance, if the module came from a file, this loader data is the file path.)\n\n[View documents](http://www.lua.org/manual/5.4/manual.html#pdf-require)\n")
			 :label "function require(modname: string)" :parameters
			 [(:label
			   [17 32])])]))
[server-reply] (id:15) Tue Jul 20 11:38:43 2021:
(:id 15 :jsonrpc "2.0" :result
     (:contents
      (:kind "markdown" :value "```lua\nfunction require(modname: string)\n  -> any\n  2. loaderdata: any\n```\n\n---\n\nLoads the given module, returns any value returned by the searcher(`true` when `nil`). Besides that value, also returns as a second result the loader data returned by the searcher, which indicates how `require` found the module. (For instance, if the module came from a file, this loader data is the file path.)\n\n[View documents](http://www.lua.org/manual/5.4/manual.html#pdf-require)\n")
      :range
      (:end
       (:character 7 :line 0)
       :start
       (:character 0 :line 0))))
[server-reply] (id:16) Tue Jul 20 11:38:43 2021:
(:id 16 :jsonrpc "2.0" :result
     [(:kind 2 :range
	     (:end
	      (:character 7 :line 0)
	      :start
	      (:character 0 :line 0)))])
[client-notification] Tue Jul 20 11:38:44 2021:
(:jsonrpc "2.0" :method "workspace/didChangeWatchedFiles" :params
	  (:changes
	   [(:uri "file:///tmp/test/[email protected]%3A1626224702" :type 1)]))
[client-notification] Tue Jul 20 11:38:47 2021:
(:jsonrpc "2.0" :method "textDocument/didChange" :params
	  (:textDocument
	   (:uri "file:///tmp/test/bar.lua" :version 12)
	   :contentChanges
	   [(:range
	     (:start
	      (:line 0 :character 0)
	      :end
	      (:line 0 :character 0))
	     :rangeLength 0 :text "l")
	    (:range
	     (:start
	      (:line 0 :character 1)
	      :end
	      (:line 0 :character 1))
	     :rangeLength 0 :text "o")
	    (:range
	     (:start
	      (:line 0 :character 2)
	      :end
	      (:line 0 :character 2))
	     :rangeLength 0 :text "c")
	    (:range
	     (:start
	      (:line 0 :character 3)
	      :end
	      (:line 0 :character 3))
	     :rangeLength 0 :text "a")
	    (:range
	     (:start
	      (:line 0 :character 4)
	      :end
	      (:line 0 :character 4))
	     :rangeLength 0 :text "l")
	    (:range
	     (:start
	      (:line 0 :character 5)
	      :end
	      (:line 0 :character 5))
	     :rangeLength 0 :text " ")
	    (:range
	     (:start
	      (:line 0 :character 6)
	      :end
	      (:line 0 :character 6))
	     :rangeLength 0 :text "f")
	    (:range
	     (:start
	      (:line 0 :character 7)
	      :end
	      (:line 0 :character 7))
	     :rangeLength 0 :text "o")
	    (:range
	     (:start
	      (:line 0 :character 8)
	      :end
	      (:line 0 :character 8))
	     :rangeLength 0 :text "o")
	    (:range
	     (:start
	      (:line 0 :character 9)
	      :end
	      (:line 0 :character 9))
	     :rangeLength 0 :text " ")
	    (:range
	     (:start
	      (:line 0 :character 10)
	      :end
	      (:line 0 :character 10))
	     :rangeLength 0 :text "=")
	    (:range
	     (:start
	      (:line 0 :character 11)
	      :end
	      (:line 0 :character 11))
	     :rangeLength 0 :text " ")]))
[server-notification] Tue Jul 20 11:38:47 2021:
(:jsonrpc "2.0" :method "$/status/report" :params
	  (:text "😺Lua" :tooltip "Workspace   : /tmp/test\nCached files: 14/13\nMemory usage: 6M\n"))
[server-notification] Tue Jul 20 11:38:47 2021:
(:jsonrpc "2.0" :method "textDocument/publishDiagnostics" :params
	  (:diagnostics
	   []
	   :uri "file:///tmp/test/bar.lua"))
[client-notification] Tue Jul 20 11:38:48 2021:
(:jsonrpc "2.0" :method "textDocument/willSave" :params
	  (:reason 1 :textDocument
		   (:uri "file:///tmp/test/bar.lua")))
[client-notification] Tue Jul 20 11:38:48 2021:
(:jsonrpc "2.0" :method "textDocument/didSave" :params
	  (:text "local foo = require \"foo\"\n\nfoo.baz()\n" :textDocument
		 (:uri "file:///tmp/test/bar.lua")))
[client-notification] Tue Jul 20 11:38:48 2021:
(:jsonrpc "2.0" :method "workspace/didChangeWatchedFiles" :params
	  (:changes
	   [(:uri "file:///tmp/test/bar.lua" :type 2)]))
[client-notification] Tue Jul 20 11:38:48 2021:
(:jsonrpc "2.0" :method "workspace/didChangeWatchedFiles" :params
	  (:changes
	   [(:uri "file:///tmp/test/.%23bar.lua" :type 3)]))
[client-request] (id:17) Tue Jul 20 11:38:48 2021:
(:jsonrpc "2.0" :id 17 :method "textDocument/signatureHelp" :params
	  (:textDocument
	   (:uri "file:///tmp/test/bar.lua")
	   :position
	   (:line 0 :character 11)))
[client-request] (id:18) Tue Jul 20 11:38:48 2021:
(:jsonrpc "2.0" :id 18 :method "textDocument/hover" :params
	  (:textDocument
	   (:uri "file:///tmp/test/bar.lua")
	   :position
	   (:line 0 :character 11)))
[client-request] (id:19) Tue Jul 20 11:38:48 2021:
(:jsonrpc "2.0" :id 19 :method "textDocument/documentHighlight" :params
	  (:textDocument
	   (:uri "file:///tmp/test/bar.lua")
	   :position
	   (:line 0 :character 11)))
[server-reply] (id:17) Tue Jul 20 11:38:48 2021:
(:id 17 :jsonrpc "2.0" :result nil)
[server-reply] (id:18) Tue Jul 20 11:38:48 2021:
(:id 18 :jsonrpc "2.0" :result nil)
[server-reply] (id:19) Tue Jul 20 11:38:48 2021:
(:id 19 :jsonrpc "2.0" :result nil)
[client-request] (id:20) Tue Jul 20 11:38:50 2021:
(:jsonrpc "2.0" :id 20 :method "textDocument/signatureHelp" :params
	  (:textDocument
	   (:uri "file:///tmp/test/bar.lua")
	   :position
	   (:line 2 :character 5)))
[client-request] (id:21) Tue Jul 20 11:38:50 2021:
(:jsonrpc "2.0" :id 21 :method "textDocument/hover" :params
	  (:textDocument
	   (:uri "file:///tmp/test/bar.lua")
	   :position
	   (:line 2 :character 5)))
[client-request] (id:22) Tue Jul 20 11:38:50 2021:
(:jsonrpc "2.0" :id 22 :method "textDocument/documentHighlight" :params
	  (:textDocument
	   (:uri "file:///tmp/test/bar.lua")
	   :position
	   (:line 2 :character 5)))
[server-reply] (id:20) Tue Jul 20 11:38:50 2021:
(:id 20 :jsonrpc "2.0" :result
     (:signatures
      [(:activeParameter 0 :label "function baz()" :parameters
			 [])]))
[server-reply] (id:21) Tue Jul 20 11:38:50 2021:
(:id 21 :jsonrpc "2.0" :result
     (:contents
      (:kind "markdown" :value "```lua\nfunction baz()\n```")
      :range
      (:end
       (:character 7 :line 2)
       :start
       (:character 4 :line 2))))
[server-reply] (id:22) Tue Jul 20 11:38:50 2021:
(:id 22 :jsonrpc "2.0" :result
     [(:kind 2 :range
	     (:end
	      (:character 7 :line 2)
	      :start
	      (:character 4 :line 2)))])
[client-request] (id:23) Tue Jul 20 11:38:52 2021:
(:jsonrpc "2.0" :id 23 :method "textDocument/definition" :params
	  (:textDocument
	   (:uri "file:///tmp/test/bar.lua")
	   :position
	   (:line 2 :character 5)))
[server-reply] (id:23) Tue Jul 20 11:38:52 2021:
(:id 23 :jsonrpc "2.0" :result
     [(:originSelectionRange
       (:end
	(:character 7 :line 2)
	:start
	(:character 4 :line 2))
       :targetRange
       (:end
	(:character 11 :line 0)
	:start
	(:character 8 :line 0))
       :targetSelectionRange
       (:end
	(:character 11 :line 0)
	:start
	(:character 8 :line 0))
       :targetUri "file:///tmp/test/foo.lua")])
[client-request] (id:24) Tue Jul 20 11:38:55 2021:
(:jsonrpc "2.0" :id 24 :method "textDocument/definition" :params
	  (:textDocument
	   (:uri "file:///tmp/test/bar.lua")
	   :position
	   (:line 2 :character 5)))
[server-reply] (id:24) Tue Jul 20 11:38:55 2021:
(:id 24 :jsonrpc "2.0" :result
     [(:originSelectionRange
       (:end
	(:character 7 :line 2)
	:start
	(:character 4 :line 2))
       :targetRange
       (:end
	(:character 11 :line 0)
	:start
	(:character 8 :line 0))
       :targetSelectionRange
       (:end
	(:character 11 :line 0)
	:start
	(:character 8 :line 0))
       :targetUri "file:///tmp/test/foo.lua")])
[server-notification] Tue Jul 20 11:38:55 2021:
(:jsonrpc "2.0" :method "$/status/report" :params
	  (:text "😺Lua" :tooltip "Workspace   : /tmp/test\nCached files: 14/13\nMemory usage: 7M\n"))
[client-request] (id:25) Tue Jul 20 11:38:56 2021:
(:jsonrpc "2.0" :id 25 :method "textDocument/signatureHelp" :params
	  (:textDocument
	   (:uri "file:///tmp/test/bar.lua")
	   :position
	   (:line 2 :character 6)))
[client-request] (id:26) Tue Jul 20 11:38:56 2021:
(:jsonrpc "2.0" :id 26 :method "textDocument/hover" :params
	  (:textDocument
	   (:uri "file:///tmp/test/bar.lua")
	   :position
	   (:line 2 :character 6)))
[client-request] (id:27) Tue Jul 20 11:38:56 2021:
(:jsonrpc "2.0" :id 27 :method "textDocument/documentHighlight" :params
	  (:textDocument
	   (:uri "file:///tmp/test/bar.lua")
	   :position
	   (:line 2 :character 6)))
[server-reply] (id:25) Tue Jul 20 11:38:56 2021:
(:id 25 :jsonrpc "2.0" :result
     (:signatures
      [(:activeParameter 0 :label "function baz()" :parameters
			 [])]))
[server-reply] (id:26) Tue Jul 20 11:38:56 2021:
(:id 26 :jsonrpc "2.0" :result
     (:contents
      (:kind "markdown" :value "```lua\nfunction baz()\n```")
      :range
      (:end
       (:character 7 :line 2)
       :start
       (:character 4 :line 2))))
[server-reply] (id:27) Tue Jul 20 11:38:56 2021:
(:id 27 :jsonrpc "2.0" :result
     [(:kind 2 :range
	     (:end
	      (:character 7 :line 2)
	      :start
	      (:character 4 :line 2)))])
[server-notification] Tue Jul 20 11:41:36 2021:
(:jsonrpc "2.0" :method "$/status/report" :params
	  (:text "😺Lua" :tooltip "Workspace   : /tmp/test\nCached files: 13/13\nMemory usage: 5M\n"))
[server-notification] Tue Jul 20 11:44:41 2021:
(:jsonrpc "2.0" :method "$/status/report" :params
	  (:text "😺Lua" :tooltip "Workspace   : /tmp/test\nCached files: 13/13\nMemory usage: 6M\n"))

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

Debugger entered--Lisp error: (file-error "Read error" "Is a directory" "/tmp/test")
  #<subr insert-file-contents>("")
  apply(#<subr insert-file-contents> "")
  #f(compiled-function (body &rest args) #<bytecode 0x155af57aa6a1>)(#<subr insert-file-contents> "")
  apply(#f(compiled-function (body &rest args) #<bytecode 0x155af57aa6a1>) #<subr insert-file-contents> "")
  insert-file-contents("")
  #f(compiled-function (name uri range) "Like `xref-make-match' but with LSP's NAME, URI and RANGE.\nTry to visit the target file for a richer summary line." #<bytecode 0x155af455431d>)(#("baz" 0 3 (fontified t)) nil nil)
  apply(#f(compiled-function (name uri range) "Like `xref-make-match' but with LSP's NAME, URI and RANGE.\nTry to visit the target file for a richer summary line." #<bytecode 0x155af455431d>) (#("baz" 0 3 (fontified t)) nil nil))
  #f(compiled-function (body &rest args) #<bytecode 0x155af471daa5>)(#f(compiled-function (name uri range) "Like `xref-make-match' but with LSP's NAME, URI and RANGE.\nTry to visit the target file for a richer summary line." #<bytecode 0x155af455431d>) #("baz" 0 3 (fontified t)) nil nil)
  apply(#f(compiled-function (body &rest args) #<bytecode 0x155af471daa5>) #f(compiled-function (name uri range) "Like `xref-make-match' but with LSP's NAME, URI and RANGE.\nTry to visit the target file for a richer summary line." #<bytecode 0x155af455431d>) (#("baz" 0 3 (fontified t)) nil nil))
  eglot--xref-make-match(#("baz" 0 3 (fontified t)) nil nil)
  #f(compiled-function (jsonrpc-lambda-elem7) #<bytecode 0x155af457e459>)((:originSelectionRange (:end (:character 7 :line 2) :start (:character 4 :line 2)) :targetRange (:end (:character 11 :line 0) :start (:character 8 :line 0)) :targetSelectionRange (:end (:character 11 :line 0) :start (:character 8 :line 0)) :targetUri "file:///tmp/test/foo.lua"))
  mapc(#f(compiled-function (jsonrpc-lambda-elem7) #<bytecode 0x155af457e459>) [(:originSelectionRange (:end (:character 7 :line 2) :start (:character 4 :line 2)) :targetRange (:end (:character 11 :line 0) :start (:character 8 :line 0)) :targetSelectionRange (:end (:character 11 :line 0) :start (:character 8 :line 0)) :targetUri "file:///tmp/test/foo.lua")])
  #f(compiled-function (arg1 &rest rest) "Make `xref''s for METHOD, EXTRA-PARAMS, check CAPABILITY." #<bytecode 0x155af46ccc69>)(:textDocument/definition)
  apply(#f(compiled-function (arg1 &rest rest) "Make `xref''s for METHOD, EXTRA-PARAMS, check CAPABILITY." #<bytecode 0x155af46ccc69>) :textDocument/definition)
  #f(compiled-function (body &rest args) #<bytecode 0x155af53d91f1>)(#f(compiled-function (arg1 &rest rest) "Make `xref''s for METHOD, EXTRA-PARAMS, check CAPABILITY." #<bytecode 0x155af46ccc69>) :textDocument/definition)
  apply(#f(compiled-function (body &rest args) #<bytecode 0x155af53d91f1>) #f(compiled-function (arg1 &rest rest) "Make `xref''s for METHOD, EXTRA-PARAMS, check CAPABILITY." #<bytecode 0x155af46ccc69>) :textDocument/definition)
  eglot--lsp-xrefs-for-method(:textDocument/definition)
  #f(compiled-function (backend identifier) #<bytecode 0x155af46cccf1>)(eglot "LSP identifier at point.")
  apply(#f(compiled-function (backend identifier) #<bytecode 0x155af46cccf1>) eglot "LSP identifier at point.")
  #f(compiled-function (arg &rest args) #<bytecode 0x155af46cd1e5>)(eglot "LSP identifier at point.")
  apply(#f(compiled-function (arg &rest args) #<bytecode 0x155af46cd1e5>) (eglot "LSP identifier at point."))
  #f(compiled-function (body &rest args) #<bytecode 0x155af4bdb6c1>)(#f(compiled-function (arg &rest args) #<bytecode 0x155af46cd1e5>) eglot "LSP identifier at point.")
  apply(#f(compiled-function (body &rest args) #<bytecode 0x155af4bdb6c1>) #f(compiled-function (arg &rest args) #<bytecode 0x155af46cd1e5>) (eglot "LSP identifier at point."))
  xref-backend-definitions(eglot "LSP identifier at point.")
  #f(compiled-function () #<bytecode 0x155af5c3450d>)()
  consult-xref(#f(compiled-function () #<bytecode 0x155af5c3450d>) ((window . #<window 3 on bar.lua>) (display-action)))
  xref--show-defs(#f(compiled-function () #<bytecode 0x155af5c3450d>) nil)
  xref--find-definitions("LSP identifier at point." nil)
  xref-find-definitions("LSP identifier at point.")
  funcall-interactively(xref-find-definitions "LSP identifier at point.")
  call-interactively(xref-find-definitions nil nil)
  command-execute(xref-find-definitions)

Minimal configuration (mandatory)

Start emacs with

$ emacs -Q

then run this:

(defvar bootstrap-version)
(let ((bootstrap-file
      (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
     (bootstrap-version 5))
 (unless (file-exists-p bootstrap-file)
   (with-current-buffer
       (url-retrieve-synchronously
        "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
        'silent 'inhibit-cookies)
     (goto-char (point-max))
     (eval-print-last-sexp)))
 (load bootstrap-file nil 'nomessage))

(setq straight-use-package-by-default 't)
(straight-use-package 'use-package)

(use-package project)
(use-package eglot
 :config
 (setq eglot-server-programs
   (append
    '((lua-mode . ("lua-language-server")))
    eglot-server-programs)))
(use-package lua-mode)

then have a folder with two files inside:
foo.lua

return {baz = function () print "baz" end}

and bar.lua

local foo = require "foo"

foo.baz()

Now putting point at foo.b|az() (the | indicates the point), and running M-. should jump to the definition of baz in foo.lua, but it instead errors out with

eglot--xref-make-match: Read error: Is a directory, /tmp/test

I did some digging, and it looks like the issue is here: https://github.com/joaotavora/eglot/blob/master/eglot.el#L2167 . Going off the names, the function appears to expect a Location response to the textDocument/definition request, but instead gets a LocationLink[]. I'm not sure if this is a bug in eglot or in lua-language-server since the spec here: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_definition , says that the LocationLink[] response was only added recently and should be feature tested for, if I am reading it correctly.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions