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

gopls diagnostics not updated when creating a file in an imported package #550

Open
bcmills opened this issue Oct 9, 2020 · 2 comments
Open

Comments

@bcmills
Copy link

bcmills commented Oct 9, 2020

Configuration

Initial project state (in txtar format):

-- go.mod --
module example.com

go 1.15
-- main.go --
package main

import "example.com/pkg"

func main() {
	var _ pkg.Thing
}

My eglot configuration (.emacs):

(when (require 'company nil 'noerror)
	(global-company-mode))

(when (require 'yasnippet nil 'noerror)
	(yas-global-mode 1))

(when (require 'go-mode nil 'noerror)
	(when (require 'eglot nil 'noerror)
		(add-to-list 'eglot-server-programs '(go-mode . ("gopls" "-rpc.trace" "-logfile=/usr/local/google/home/bcmills/tmp/gopls.log")))
		(add-hook 'go-mode-hook 'eglot-ensure)))

Steps to reproduce:

  1. emacs -nw main.go

  2. Observe that main.go has a gopls diagnostic on the import statement.

  3. M-x find-file ./pkg/pkg.go

  4. In the new buffer, enter the contents:

    package pkg
    
    type Thing struct{}

    and then save the buffer. (Create the subdirectory when prompted.)

  5. Look at the main.go buffer from step (2).

Expected behavior

The error in the main.go buffer should clear when dep/dep.go is saved (or, ideally, when its contents are entered in the buffer).

Observed behavior

The error in the main.go buffer does not clear until I run M-x eglot-reconnect in the main.go buffer.

Some particular points of interest:

  • There do not seem to be any textDocument/didOpen events for pkg/pkg.go, despite the fact that the buffer opens in go-mode.
  • There are no Flymake or ElDoc minor-mode indicators in the pkg.go buffer, which suggests to me that eglot-ensure has not activated eglot for that buffer.

M-x eglot-events-buffer:

[client-request] (id:1) Thu Oct  8 21:02:14 2020:
(:jsonrpc "2.0" :id 1 :method "initialize" :params
					(:processId 533932 :rootPath "/tmp/tmp.KGf0Bi11ak/example.com/" :rootUri "file:///tmp/tmp.KGf0Bi11ak/example.com/" :initializationOptions nil :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)))
												: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"])))
												:formatting
												(:dynamicRegistration :json-false)
												:rangeFormatting
												(:dynamicRegistration :json-false)
												:rename
												(:dynamicRegistration :json-false)
												:publishDiagnostics
												(:relatedInformation :json-false))
											 :experimental nil)))
[server-reply] (id:1) Thu Oct  8 21:02:14 2020:
(:jsonrpc "2.0" :result
					(:capabilities
					 (:textDocumentSync
						(:openClose t :change 2 :save nil)
						:completionProvider
						(:triggerCharacters
						 ["."])
						:hoverProvider t :signatureHelpProvider
						(:triggerCharacters
						 ["(" ","])
						:definitionProvider t :typeDefinitionProvider t :implementationProvider t :referencesProvider t :documentHighlightProvider t :documentSymbolProvider t :codeActionProvider
						(:codeActionKinds
						 ["quickfix" "refactor.extract" "refactor.rewrite" "source.fixAll" "source.organizeImports"])
						:codeLensProvider nil :documentLinkProvider nil :workspaceSymbolProvider t :documentFormattingProvider t :documentOnTypeFormattingProvider
						(:firstTriggerCharacter "")
						:renameProvider t :foldingRangeProvider t :executeCommandProvider
						(:commands
						 ["generate" "fill_struct" "regenerate_cgo" "test" "tidy" "undeclared_name" "upgrade_dependency" "vendor" "extract_variable" "extract_function" "gc_details" "generate_gopls_mod"])
						:callHierarchyProvider t :workspace
						(:workspaceFolders
						 (:supported t :changeNotifications "workspace/didChangeWorkspaceFolders")))
					 :serverInfo
					 (:name "gopls" :version "Build info\n----------\ngolang.org/x/tools/gopls v0.5.1\n    golang.org/x/tools/[email protected] h1:AF3Uh7HF08SZpKFfgJO6zfF3bbxyDXWqdkK4kMXiQ1o=\n    github.com/BurntSushi/[email protected] h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=\n    github.com/google/[email protected] h1:JFrFEBb2xKufg6XkJsJr+WbKb4FQlURi5RUcBveYu9k=\n    github.com/sergi/[email protected] h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=\n    golang.org/x/[email protected] h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=\n    golang.org/x/[email protected] h1:qwRHBd0NqMbJxfbotnDhm2ByMI1Shq4Y6oRJo21SGJA=\n    golang.org/x/[email protected] h1:1R38tQp22dcHpTKJPjgVa16FhlDy/kHEaCM/ndi/FIc=\n    golang.org/x/[email protected] h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=\n    honnef.co/go/[email protected] h1:nI5egYTGJakVyOryqLs1cQO5dO0ksin5XXs2pspk75k=\n    mvdan.cc/[email protected] h1:t8TAw9WgTLghti7RYkpPmqk4JtQ3+wcP5GgZqgWeWLQ=\n    mvdan.cc/xurls/[email protected] h1:NSZPykBXJFCetGZykLAxaL6SIpvbVy/UFEniIfHAa8A=\n"))
					:id 1)
[client-notification] Thu Oct  8 21:02:14 2020:
(:jsonrpc "2.0" :method "initialized" :params #s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8125 data
																														()))
[client-notification] Thu Oct  8 21:02:14 2020:
(:jsonrpc "2.0" :method "textDocument/didOpen" :params
					(:textDocument
					 (:uri "file:///tmp/tmp.KGf0Bi11ak/example.com/main.go" :version 0 :languageId "go" :text "package main\n\nimport \"example.com/pkg\"\n\nfunc main() {\n	var _ pkg.Thing\n}\n")))
[client-notification] Thu Oct  8 21:02:14 2020:
(:jsonrpc "2.0" :method "workspace/didChangeConfiguration" :params
					(:settings nil))
[client-request] (id:2) Thu Oct  8 21:02:14 2020:
(:jsonrpc "2.0" :id 2 :method "textDocument/documentSymbol" :params
					(:textDocument
					 (:uri "file:///tmp/tmp.KGf0Bi11ak/example.com/main.go")))
[server-notification] Thu Oct  8 21:02:14 2020:
(:jsonrpc "2.0" :method "window/showMessage" :params
					(:type 4 :message "Loading packages..."))
[server-request] (id:1) Thu Oct  8 21:02:14 2020:
(:jsonrpc "2.0" :method "workspace/configuration" :params
					(:items
					 [(:scopeUri "file:///tmp/tmp.KGf0Bi11ak/example.com/" :section "gopls")
						(:scopeUri "file:///tmp/tmp.KGf0Bi11ak/example.com/" :section "gopls-example.com")])
					:id 1)
[client-reply] (id:1) Thu Oct  8 21:02:14 2020:
(:jsonrpc "2.0" :id 1 :result
					[nil nil])
[server-request] (id:2) Thu Oct  8 21:02:14 2020:
(:jsonrpc "2.0" :method "client/registerCapability" :params
					(:registrations
					 [(:id "workspace/didChangeWatchedFiles-0" :method "workspace/didChangeWatchedFiles" :registerOptions
								 (:watchers
									[(:globPattern "**/*.{go,mod,sum}" :kind 7)
									 (:globPattern "/tmp/tmp.KGf0Bi11ak/example.com/**/*.{go,mod,sum}" :kind 7)]))])
					:id 2)
[client-reply] (id:2) Thu Oct  8 21:02:14 2020:
(:jsonrpc "2.0" :id 2 :result nil)
[server-notification] Thu Oct  8 21:02:14 2020:
(:jsonrpc "2.0" :method "window/logMessage" :params
					(:type 3 :message "2020/10/08 21:02:14 go env for /tmp/tmp.KGf0Bi11ak/example.com/\n(root /tmp/tmp.KGf0Bi11ak/example.com)\n(go version go version devel +186f0220d0 Mon Oct 5 11:12:24 2020 -0400 linux/amd64\n)\n(valid build configuration = true)\n(build flags: [])\nGOCACHE=/usr/local/google/home/bcmills/.cache/go-build\nGOPROXY=https://proxy.golang.org,direct\nGOROOT=/usr/local/google/home/bcmills/go\nGOSUMDB=sum.golang.org\nGO111MODULE=auto\nGOMOD=/tmp/tmp.KGf0Bi11ak/example.com/go.mod\nGONOSUMDB=\nGOPATH=/usr/local/google/home/bcmills\nGOPRIVATE=\nGOFLAGS=\nGOINSECURE=\nGOMODCACHE=/usr/local/google/home/bcmills/pkg/mod\nGONOPROXY=\n\n"))
[server-notification] Thu Oct  8 21:02:14 2020:
(:jsonrpc "2.0" :method "window/logMessage" :params
					(:type 3 :message "2020/10/08 21:02:14 go/packages.Load\n	snapshot=0\n	directory=/tmp/tmp.KGf0Bi11ak/example.com\n	query=[./... builtin]\n	packages=2\n"))
[server-notification] Thu Oct  8 21:02:14 2020:
(:jsonrpc "2.0" :method "window/logMessage" :params
					(:type 1 :message "2020/10/08 21:02:14 no dep handle: no metadata for example.com/pkg\n	package=\"example.com/pkg\"\n"))
[server-notification] Thu Oct  8 21:02:14 2020:
(:jsonrpc "2.0" :method "window/showMessage" :params
					(:type 3 :message "Finished loading packages."))
[server-request] (id:3) Thu Oct  8 21:02:14 2020:
(:jsonrpc "2.0" :method "workspace/configuration" :params
					(:items
					 [(:scopeUri "file:///tmp/tmp.KGf0Bi11ak/example.com/" :section "gopls")
						(:scopeUri "file:///tmp/tmp.KGf0Bi11ak/example.com/" :section "gopls-example.com")])
					:id 3)
[client-reply] (id:3) Thu Oct  8 21:02:14 2020:
(:jsonrpc "2.0" :id 3 :result
					[nil nil])
[server-reply] (id:2) Thu Oct  8 21:02:14 2020:
(:jsonrpc "2.0" :result
					[(:name "main" :detail "()" :kind 12 :range
									(:start
									 (:line 4 :character 0)
									 :end
									 (:line 6 :character 1))
									:selectionRange
									(:start
									 (:line 4 :character 5)
									 :end
									 (:line 4 :character 9)))]
					:id 2)
[server-notification] Thu Oct  8 21:02:15 2020:
(:jsonrpc "2.0" :method "window/logMessage" :params
					(:type 1 :message "2020/10/08 21:02:14 no dep handle: no metadata for example.com/pkg\n	package=\"example.com/pkg\"\n"))
[server-notification] Thu Oct  8 21:02:15 2020:
(:jsonrpc "2.0" :method "window/logMessage" :params
					(:type 1 :message "2020/10/08 21:02:15 warning: diagnose go.mod: err: exit status 1: stderr: go: finding module for package example.com/pkg\nexample.com imports\n	example.com/pkg: cannot find module providing package example.com/pkg: unrecognized import path \"example.com/pkg\": reading https://example.com/pkg?go-get=1: 404 Not Found\n\n	directory=/tmp/tmp.KGf0Bi11ak/example.com/\n"))
[server-notification] Thu Oct  8 21:02:15 2020:
(:jsonrpc "2.0" :method "textDocument/publishDiagnostics" :params
					(:uri "file:///tmp/tmp.KGf0Bi11ak/example.com/main.go" :diagnostics
								[(:range
									(:start
									 (:line 2 :character 7)
									 :end
									 (:line 2 :character 24))
									:severity 1 :source "compiler" :message "could not import example.com/pkg (no package for import example.com/pkg)")]))
[server-notification] Thu Oct  8 21:02:15 2020:
(:jsonrpc "2.0" :method "window/logMessage" :params
					(:type 1 :message "2020/10/08 21:02:15 warning: diagnose go.mod: err: exit status 1: stderr: go: finding module for package example.com/pkg\nexample.com imports\n	example.com/pkg: cannot find module providing package example.com/pkg: unrecognized import path \"example.com/pkg\": reading https://example.com/pkg?go-get=1: 404 Not Found\n\n	directory=/tmp/tmp.KGf0Bi11ak/example.com/\n"))
[server-notification] Thu Oct  8 21:02:15 2020:
(:jsonrpc "2.0" :method "window/logMessage" :params
					(:type 1 :message "2020/10/08 21:02:15 warning: diagnose go.mod: err: exit status 1: stderr: go: finding module for package example.com/pkg\nexample.com imports\n	example.com/pkg: cannot find module providing package example.com/pkg: unrecognized import path \"example.com/pkg\": reading https://example.com/pkg?go-get=1: 404 Not Found\n\n	directory=/tmp/tmp.KGf0Bi11ak/example.com/\n"))
[client-request] (id:3) Thu Oct  8 21:02:18 2020:
(:jsonrpc "2.0" :id 3 :method "textDocument/signatureHelp" :params
					(:textDocument
					 (:uri "file:///tmp/tmp.KGf0Bi11ak/example.com/main.go")
					 :position
					 (:line 0 :character 0)))
[client-request] (id:4) Thu Oct  8 21:02:18 2020:
(:jsonrpc "2.0" :id 4 :method "textDocument/hover" :params
					(:textDocument
					 (:uri "file:///tmp/tmp.KGf0Bi11ak/example.com/main.go")
					 :position
					 (:line 0 :character 0)))
[client-request] (id:5) Thu Oct  8 21:02:18 2020:
(:jsonrpc "2.0" :id 5 :method "textDocument/documentHighlight" :params
					(:textDocument
					 (:uri "file:///tmp/tmp.KGf0Bi11ak/example.com/main.go")
					 :position
					 (:line 0 :character 0)))
[server-reply] (id:3) Thu Oct  8 21:02:18 2020:
(:jsonrpc "2.0" :result nil :id 3)
[server-notification] Thu Oct  8 21:02:18 2020:
(:jsonrpc "2.0" :method "window/logMessage" :params
					(:type 1 :message "2020/10/08 21:02:18 no signature help: cannot find an enclosing function\n	position={0 0}\n"))
[server-reply] (id:4) Thu Oct  8 21:02:18 2020:
(:jsonrpc "2.0" :result nil :id 4)
[server-reply] (id:5) Thu Oct  8 21:02:18 2020:
(:jsonrpc "2.0" :result
					[]
					:id 5)
[client-request] (id:6) Thu Oct  8 21:02:59 2020:
(:jsonrpc "2.0" :id 6 :method "textDocument/signatureHelp" :params
					(:textDocument
					 (:uri "file:///tmp/tmp.KGf0Bi11ak/example.com/main.go")
					 :position
					 (:line 0 :character 0)))
[client-request] (id:7) Thu Oct  8 21:02:59 2020:
(:jsonrpc "2.0" :id 7 :method "textDocument/hover" :params
					(:textDocument
					 (:uri "file:///tmp/tmp.KGf0Bi11ak/example.com/main.go")
					 :position
					 (:line 0 :character 0)))
[client-request] (id:8) Thu Oct  8 21:02:59 2020:
(:jsonrpc "2.0" :id 8 :method "textDocument/documentHighlight" :params
					(:textDocument
					 (:uri "file:///tmp/tmp.KGf0Bi11ak/example.com/main.go")
					 :position
					 (:line 0 :character 0)))
[server-reply] (id:6) Thu Oct  8 21:02:59 2020:
(:jsonrpc "2.0" :result nil :id 6)
[server-notification] Thu Oct  8 21:02:59 2020:
(:jsonrpc "2.0" :method "window/logMessage" :params
					(:type 1 :message "2020/10/08 21:02:59 no signature help: cannot find an enclosing function\n	position={0 0}\n"))
[server-reply] (id:7) Thu Oct  8 21:02:59 2020:
(:jsonrpc "2.0" :result nil :id 7)
[server-reply] (id:8) Thu Oct  8 21:02:59 2020:
(:jsonrpc "2.0" :result
					[]
					:id 8)
[client-request] (id:9) Thu Oct  8 21:03:03 2020:
(:jsonrpc "2.0" :id 9 :method "shutdown" :params nil)
[server-reply] (id:9) Thu Oct  8 21:03:03 2020:
(:jsonrpc "2.0" :result nil :id 9)
[client-notification] Thu Oct  8 21:03:03 2020:
(:jsonrpc "2.0" :method "exit" :params nil)
[internal] Thu Oct  8 21:03:03 2020:
(:message "Connection state changed" :change "killed\n")

----------b---y---e---b---y---e----------
[stderr] 
[stderr] 
[stderr] nil
[stderr] nil
[stderr] Process EGLOT (example/go-mode) stderr finished
[client-request] (id:1) Thu Oct  8 21:03:03 2020:
(:jsonrpc "2.0" :id 1 :method "initialize" :params
					(:processId 533932 :rootPath "/tmp/tmp.KGf0Bi11ak/example.com/" :rootUri "file:///tmp/tmp.KGf0Bi11ak/example.com/" :initializationOptions nil :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)))
												: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"])))
												:formatting
												(:dynamicRegistration :json-false)
												:rangeFormatting
												(:dynamicRegistration :json-false)
												:rename
												(:dynamicRegistration :json-false)
												:publishDiagnostics
												(:relatedInformation :json-false))
											 :experimental nil)))
[server-reply] (id:1) Thu Oct  8 21:03:03 2020:
(:jsonrpc "2.0" :result
					(:capabilities
					 (:textDocumentSync
						(:openClose t :change 2 :save nil)
						:completionProvider
						(:triggerCharacters
						 ["."])
						:hoverProvider t :signatureHelpProvider
						(:triggerCharacters
						 ["(" ","])
						:definitionProvider t :typeDefinitionProvider t :implementationProvider t :referencesProvider t :documentHighlightProvider t :documentSymbolProvider t :codeActionProvider
						(:codeActionKinds
						 ["quickfix" "refactor.extract" "refactor.rewrite" "source.fixAll" "source.organizeImports"])
						:codeLensProvider nil :documentLinkProvider nil :workspaceSymbolProvider t :documentFormattingProvider t :documentOnTypeFormattingProvider
						(:firstTriggerCharacter "")
						:renameProvider t :foldingRangeProvider t :executeCommandProvider
						(:commands
						 ["generate" "fill_struct" "regenerate_cgo" "test" "tidy" "undeclared_name" "upgrade_dependency" "vendor" "extract_variable" "extract_function" "gc_details" "generate_gopls_mod"])
						:callHierarchyProvider t :workspace
						(:workspaceFolders
						 (:supported t :changeNotifications "workspace/didChangeWorkspaceFolders")))
					 :serverInfo
					 (:name "gopls" :version "Build info\n----------\ngolang.org/x/tools/gopls v0.5.1\n    golang.org/x/tools/[email protected] h1:AF3Uh7HF08SZpKFfgJO6zfF3bbxyDXWqdkK4kMXiQ1o=\n    github.com/BurntSushi/[email protected] h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=\n    github.com/google/[email protected] h1:JFrFEBb2xKufg6XkJsJr+WbKb4FQlURi5RUcBveYu9k=\n    github.com/sergi/[email protected] h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=\n    golang.org/x/[email protected] h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=\n    golang.org/x/[email protected] h1:qwRHBd0NqMbJxfbotnDhm2ByMI1Shq4Y6oRJo21SGJA=\n    golang.org/x/[email protected] h1:1R38tQp22dcHpTKJPjgVa16FhlDy/kHEaCM/ndi/FIc=\n    golang.org/x/[email protected] h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=\n    honnef.co/go/[email protected] h1:nI5egYTGJakVyOryqLs1cQO5dO0ksin5XXs2pspk75k=\n    mvdan.cc/[email protected] h1:t8TAw9WgTLghti7RYkpPmqk4JtQ3+wcP5GgZqgWeWLQ=\n    mvdan.cc/xurls/[email protected] h1:NSZPykBXJFCetGZykLAxaL6SIpvbVy/UFEniIfHAa8A=\n"))
					:id 1)
[client-notification] Thu Oct  8 21:03:03 2020:
(:jsonrpc "2.0" :method "initialized" :params #s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8125 data
																														()))
[client-notification] Thu Oct  8 21:03:03 2020:
(:jsonrpc "2.0" :method "textDocument/didOpen" :params
					(:textDocument
					 (:uri "file:///tmp/tmp.KGf0Bi11ak/example.com/main.go" :version 0 :languageId "go" :text "package main\n\nimport \"example.com/pkg\"\n\nfunc main() {\n	var _ pkg.Thing\n}\n")))
[client-notification] Thu Oct  8 21:03:03 2020:
(:jsonrpc "2.0" :method "workspace/didChangeConfiguration" :params
					(:settings nil))
[server-notification] Thu Oct  8 21:03:03 2020:
(:jsonrpc "2.0" :method "window/showMessage" :params
					(:type 4 :message "Loading packages..."))
[server-request] (id:1) Thu Oct  8 21:03:03 2020:
(:jsonrpc "2.0" :method "workspace/configuration" :params
					(:items
					 [(:scopeUri "file:///tmp/tmp.KGf0Bi11ak/example.com/" :section "gopls")
						(:scopeUri "file:///tmp/tmp.KGf0Bi11ak/example.com/" :section "gopls-example.com")])
					:id 1)
[client-reply] (id:1) Thu Oct  8 21:03:03 2020:
(:jsonrpc "2.0" :id 1 :result
					[nil nil])
[server-request] (id:2) Thu Oct  8 21:03:03 2020:
(:jsonrpc "2.0" :method "client/registerCapability" :params
					(:registrations
					 [(:id "workspace/didChangeWatchedFiles-0" :method "workspace/didChangeWatchedFiles" :registerOptions
								 (:watchers
									[(:globPattern "**/*.{go,mod,sum}" :kind 7)
									 (:globPattern "/tmp/tmp.KGf0Bi11ak/example.com/**/*.{go,mod,sum}" :kind 7)]))])
					:id 2)
[client-reply] (id:2) Thu Oct  8 21:03:03 2020:
(:jsonrpc "2.0" :id 2 :result nil)
[server-notification] Thu Oct  8 21:03:03 2020:
(:jsonrpc "2.0" :method "window/logMessage" :params
					(:type 3 :message "2020/10/08 21:03:03 go env for /tmp/tmp.KGf0Bi11ak/example.com/\n(root /tmp/tmp.KGf0Bi11ak/example.com)\n(go version go version devel +186f0220d0 Mon Oct 5 11:12:24 2020 -0400 linux/amd64\n)\n(valid build configuration = true)\n(build flags: [])\nGOPROXY=https://proxy.golang.org,direct\nGOPATH=/usr/local/google/home/bcmills\nGOINSECURE=\nGOMOD=/tmp/tmp.KGf0Bi11ak/example.com/go.mod\nGOPRIVATE=\nGOROOT=/usr/local/google/home/bcmills/go\nGOSUMDB=sum.golang.org\nGOCACHE=/usr/local/google/home/bcmills/.cache/go-build\nGOFLAGS=\nGONOPROXY=\nGONOSUMDB=\nGO111MODULE=auto\nGOMODCACHE=/usr/local/google/home/bcmills/pkg/mod\n\n"))
[server-notification] Thu Oct  8 21:03:03 2020:
(:jsonrpc "2.0" :method "window/logMessage" :params
					(:type 3 :message "2020/10/08 21:03:03 go/packages.Load\n	snapshot=0\n	directory=/tmp/tmp.KGf0Bi11ak/example.com\n	query=[./... builtin]\n	packages=3\n"))
[server-notification] Thu Oct  8 21:03:03 2020:
(:jsonrpc "2.0" :method "window/showMessage" :params
					(:type 3 :message "Finished loading packages."))
[server-request] (id:3) Thu Oct  8 21:03:03 2020:
(:jsonrpc "2.0" :method "workspace/configuration" :params
					(:items
					 [(:scopeUri "file:///tmp/tmp.KGf0Bi11ak/example.com/" :section "gopls")
						(:scopeUri "file:///tmp/tmp.KGf0Bi11ak/example.com/" :section "gopls-example.com")])
					:id 3)
[client-reply] (id:3) Thu Oct  8 21:03:03 2020:
(:jsonrpc "2.0" :id 3 :result
					[nil nil])
@bcmills
Copy link
Author

bcmills commented Oct 9, 2020

#384 may be related.

@adonovan
Copy link

adonovan commented Mar 18, 2024

I can still reproduce this problem using eglot v1.15 and gopls v0.15. I can also reproduce it with VS Code, so it's definitely at least partly a gopls bug as well.

In particular, I notice that the state change from no package to package doesn't cause the correct invalidation, but introducing and reverting a typo into the package declaration does cause the correct invalidation in both directions.

Also, in Emacs but not in Code, deleting the file has a similar (but inverse) lack of invalidation: the reference pkg.Thing continues to generate hover messages describing the phantom type; it persists until a gopls restart.

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