Skip to content

Commit ee3185a

Browse files
committed
Avoid certain error messages shown in VS Code
This is a workaround around a gopls issue that causes a lot of unnecessary error messages show up in VS Code. Signed-off-by: Tobias Guggenmos <[email protected]>
1 parent b2be2c0 commit ee3185a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Diff for: langserver/notImplemented.go

+10-2
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,11 @@ func (s *server) Symbol(_ context.Context, _ *protocol.WorkspaceSymbolParams) ([
143143

144144
// CodeLens is required by the protocol.Server interface.
145145
func (s *server) CodeLens(_ context.Context, _ *protocol.CodeLensParams) ([]protocol.CodeLens, error) {
146-
return nil, notImplemented("CodeLens")
146+
// As of version 0.4.0 of gopls it is not possible to instruct the language
147+
// client to stop asking for Code Lenses and Document Links. To prevent
148+
// VS Code from showing error messages, this feature is implemented by
149+
// returning empty values.
150+
return nil, nil
147151
}
148152

149153
// ResolveCodeLens is required by the protocol.Server interface.
@@ -173,7 +177,11 @@ func (s *server) Rename(_ context.Context, _ *protocol.RenameParams) (*protocol.
173177

174178
// DocumentLink is required by the protocol.Server interface.
175179
func (s *server) DocumentLink(_ context.Context, _ *protocol.DocumentLinkParams) ([]protocol.DocumentLink, error) {
176-
return nil, notImplemented("DocumentLink")
180+
// As of version 0.4.0 of gopls it is not possible to instruct the language
181+
// client to stop asking for Code Lenses and Document Links. To prevent
182+
// VS Code from showing error messages, this feature is implemented by
183+
// returning empty values.
184+
return nil, nil
177185
}
178186

179187
// ResolveDocumentLink is required by the protocol.Server interface.

0 commit comments

Comments
 (0)