vscode-languageserver-node: codeLens resolve request not work

I have try onCodeLensResolve() and onRequest('codeLens/resolve'), behaves like not registered.

When I force the trigger it will throw:

(node:97732) UnhandledPromiseRejectionWarning: Error: Request client/registerCapability failed with message: No feature implementation for codeLens/resolve found. Registration failed.
    at handleResponse (/***/node_modules/vscode-jsonrpc/lib/main.js:449:48)
    at processMessageQueue (/***/node_modules/vscode-jsonrpc/lib/main.js:276:17)
    at Immediate.<anonymous> (/***/node_modules/vscode-jsonrpc/lib/main.js:260:13)
    at processImmediate (internal/timers.js:439:21)
(node:97732) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:97732) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[Info  - 1:53:16 PM] Registering request handler for codeLens/resolve failed.

Reproduce: https://github.com/johnsoncodehk/vscode-extension-samples/tree/codeLens-resolve-bug/lsp-sample

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 22 (12 by maintainers)

Most upvoted comments

Change this

connection.onCodeLens(
	(_textDocumentPosition: CodeLensParams): CodeLens[] => {
		// The pass parameter contains the position of the text document in
		// which code complete got requested. For the example we ignore this
		// info and always provide the same completion items.
		return [
			{
				range: Range.create(0, 0, 0, 0),
				command: {
					title: 'not resolve',
					command: ''
				}
			}
		];
	}
);

too

connection.onCodeLens(
	(_textDocumentPosition: CodeLensParams): CodeLens[] => {
		// The pass parameter contains the position of the text document in
		// which code complete got requested. For the example we ignore this
		// info and always provide the same completion items.
		return [
			{
				range: Range.create(0, 0, 0, 0)
			}
		];
	}
);

Actually there seems to be something missing here. Let me investigate.