yioneko/vtsls

bug: Request textDocument/signatureHelp keeps randomly failing

Opened this issue · 5 comments

I keep getting an error every time after using Go to definitions it typically appears after navigating down using j as I use neovim btw xD. This specific file is used to setup vtsls.

SCREENSHOT

image

It seems an error caused by the wrong document position requested by the client. Could you provide the LSP log containing the errored signature request? You might need to :lua vim.lsp.set_log_level("debug") in nvim before reproduction. You can also check it locally to see if the requested position (line, character) is valid for the current file.

LspLog

[DEBUG][2024-11-25 22:18:20] ...m/lsp/client.lua:678	"LSP[vtsls]"	"client.request"	3	"textDocument/signatureHelp"	{  position = {    character = 1,    line = 9  },  textDocument = {    uri = "file:///home/itsmenewbie03/Desktop/WareHouse/NodeJS/IPT-SYS/Backend/controllers/userController.js"  }}	<function 1>	7
[DEBUG][2024-11-25 22:18:20] .../vim/lsp/rpc.lua:286	"rpc.send"	{  id = 129,  jsonrpc = "2.0",  method = "textDocument/signatureHelp",  params = {    position = {      character = 1,      line = 9    },    textDocument = {      uri = "file:///home/itsmenewbie03/Desktop/WareHouse/NodeJS/IPT-SYS/Backend/controllers/userController.js"    }  }}
[DEBUG][2024-11-25 22:18:20] ...m/lsp/client.lua:678	"LSP[vtsls]"	"client.request"	3	"textDocument/signatureHelp"	{  position = {    character = 1,    line = 9  },  textDocument = {    uri = "file:///home/itsmenewbie03/Desktop/WareHouse/NodeJS/IPT-SYS/Backend/controllers/userController.js"  }}	<function 1>	7
[DEBUG][2024-11-25 22:18:20] .../vim/lsp/rpc.lua:286	"rpc.send"	{  id = 130,  jsonrpc = "2.0",  method = "textDocument/signatureHelp",  params = {    position = {      character = 1,      line = 9    },    textDocument = {      uri = "file:///home/itsmenewbie03/Desktop/WareHouse/NodeJS/IPT-SYS/Backend/controllers/userController.js"    }  }}
[DEBUG][2024-11-25 22:18:20] ...m/lsp/client.lua:678	"LSP[vtsls]"	"client.request"	3	"textDocument/signatureHelp"	{  position = {    character = 1,    line = 9  },  textDocument = {    uri = "file:///home/itsmenewbie03/Desktop/WareHouse/NodeJS/IPT-SYS/Backend/controllers/userController.js"  }}	<function 1>	7
[DEBUG][2024-11-25 22:18:20] .../vim/lsp/rpc.lua:286	"rpc.send"	{  id = 131,  jsonrpc = "2.0",  method = "textDocument/signatureHelp",  params = {    position = {      character = 1,      line = 9    },    textDocument = {      uri = "file:///home/itsmenewbie03/Desktop/WareHouse/NodeJS/IPT-SYS/Backend/controllers/userController.js"    }  }}
[DEBUG][2024-11-25 22:18:20] ...m/lsp/client.lua:678	"LSP[vtsls]"	"client.request"	3	"textDocument/documentHighlight"	{  position = {    character = 0,    line = 9  },  textDocument = {    uri = "file:///home/itsmenewbie03/Desktop/WareHouse/NodeJS/IPT-SYS/Backend/controllers/userController.js"  }}	<function 1>	7
[DEBUG][2024-11-25 22:18:20] .../vim/lsp/rpc.lua:286	"rpc.send"	{  id = 132,  jsonrpc = "2.0",  method = "textDocument/documentHighlight",  params = {    position = {      character = 0,      line = 9    },    textDocument = {      uri = "file:///home/itsmenewbie03/Desktop/WareHouse/NodeJS/IPT-SYS/Backend/controllers/userController.js"    }  }}
[DEBUG][2024-11-25 22:18:20] .../vim/lsp/rpc.lua:408	"rpc.receive"	{  error = {    code = -32603,    message = "Request textDocument/signatureHelp failed with message: <semantic> TypeScript Server Error (5.6.2)\nDebug Failure. False expression.\nError: Debug Failure. False expression.\n    at computePositionOfLineAndCharacter (/home/itsmenewbie03/.local/share/nvim/mason/packages/vtsls/node_modules/@vtsls/language-server/node_modules/typescript/lib/typescript.js:11566:11)\n    at TextStorage.lineOffsetToPosition (/home/itsmenewbie03/.local/share/nvim/mason/packages/vtsls/node_modules/@vtsls/language-server/node_modules/typescript/lib/typescript.js:182848:59)\n    at ScriptInfo.lineOffsetToPosition (/home/itsmenewbie03/.local/share/nvim/mason/packages/vtsls/node_modules/@vtsls/language-server/node_modules/typescript/lib/typescript.js:183163:29)\n    at IpcIOSession.getPosition (/home/itsmenewbie03/.local/share/nvim/mason/packages/vtsls/node_modules/@vtsls/language-server/node_modules/typescript/lib/typescript.js:191702:66)\n    at IpcIOSession.getSignatureHelpItems (/home/itsmenewbie03/.local/share/nvim/mason/packages/vtsls/node_modules/@vtsls/language-server/node_modules/typescript/lib/typescript.js:191994:27)\n    at signatureHelp (/home/itsmenewbie03/.local/share/nvim/mason/packages/vtsls/node_modules/@vtsls/language-server/node_modules/typescript/lib/typescript.js:190233:43)\n    at /home/itsmenewbie03/.local/share/nvim/mason/packages/vtsls/node_modules/@vtsls/language-server/node_modules/typescript/lib/typescript.js:192655:15\n    at IpcIOSession.executeWithRequestId (/home/itsmenewbie03/.local/share/nvim/mason/packages/vtsls/node_modules/@vtsls/language-server/node_modules/typescript/lib/typescript.js:192644:14)\n    at IpcIOSession.executeCommand (/home/itsmenewbie03/.local/share/nvim/mason/packages/vtsls/node_modules/@vtsls/language-server/node_modules/typescript/lib/typescript.js:192653:29)\n    at IpcIOSession.onMessage (/home/itsmenewbie03/.local/share/nvim/mason/packages/vtsls/node_modules/@vtsls/language-server/node_modules/typescript/lib/typescript.js:192701:68)\n    at process.<anonymous> (/home/itsmenewbie03/.local/share/nvim/mason/packages/vtsls/node_modules/@vtsls/language-server/node_modules/typescript/lib/tsserver.js:525:14)\n    at process.emit (node:events:519:28)\n    at emit (node:internal/child_process:951:14)\n    at process.processTicksAndRejections (node:internal/process/task_queues:83:21)"  },  id = 129,  jsonrpc = "2.0"}
[DEBUG][2024-11-25 22:18:20] .../vim/lsp/rpc.lua:408	"rpc.receive"	{  error = {    code = -32603,    message = "Request textDocument/signatureHelp failed with message: <semantic> TypeScript Server Error (5.6.2)\nDebug Failure. False expression.\nError: Debug Failure. False expression.\n    at computePositionOfLineAndCharacter (/home/itsmenewbie03/.local/share/nvim/mason/packages/vtsls/node_modules/@vtsls/language-server/node_modules/typescript/lib/typescript.js:11566:11)\n    at TextStorage.lineOffsetToPosition (/home/itsmenewbie03/.local/share/nvim/mason/packages/vtsls/node_modules/@vtsls/language-server/node_modules/typescript/lib/typescript.js:182848:59)\n    at ScriptInfo.lineOffsetToPosition (/home/itsmenewbie03/.local/share/nvim/mason/packages/vtsls/node_modules/@vtsls/language-server/node_modules/typescript/lib/typescript.js:183163:29)\n    at IpcIOSession.getPosition (/home/itsmenewbie03/.local/share/nvim/mason/packages/vtsls/node_modules/@vtsls/language-server/node_modules/typescript/lib/typescript.js:191702:66)\n    at IpcIOSession.getSignatureHelpItems (/home/itsmenewbie03/.local/share/nvim/mason/packages/vtsls/node_modules/@vtsls/language-server/node_modules/typescript/lib/typescript.js:191994:27)\n    at signatureHelp (/home/itsmenewbie03/.local/share/nvim/mason/packages/vtsls/node_modules/@vtsls/language-server/node_modules/typescript/lib/typescript.js:190233:43)\n    at /home/itsmenewbie03/.local/share/nvim/mason/packages/vtsls/node_modules/@vtsls/language-server/node_modules/typescript/lib/typescript.js:192655:15\n    at IpcIOSession.executeWithRequestId (/home/itsmenewbie03/.local/share/nvim/mason/packages/vtsls/node_modules/@vtsls/language-server/node_modules/typescript/lib/typescript.js:192644:14)\n    at IpcIOSession.executeCommand (/home/itsmenewbie03/.local/share/nvim/mason/packages/vtsls/node_modules/@vtsls/language-server/node_modules/typescript/lib/typescript.js:192653:29)\n    at IpcIOSession.onMessage (/home/itsmenewbie03/.local/share/nvim/mason/packages/vtsls/node_modules/@vtsls/language-server/node_modules/typescript/lib/typescript.js:192701:68)\n    at process.<anonymous> (/home/itsmenewbie03/.local/share/nvim/mason/packages/vtsls/node_modules/@vtsls/language-server/node_modules/typescript/lib/tsserver.js:525:14)\n    at process.emit (node:events:519:28)\n    at emit (node:internal/child_process:951:14)\n    at process.processTicksAndRejections (node:internal/process/task_queues:83:21)"  },  id = 130,  jsonrpc = "2.0"}
[DEBUG][2024-11-25 22:18:20] .../vim/lsp/rpc.lua:408	"rpc.receive"	{  error = {    code = -32603,    message = "Request textDocument/signatureHelp failed with message: <semantic> TypeScript Server Error (5.6.2)\nDebug Failure. False expression.\nError: Debug Failure. False expression.\n    at computePositionOfLineAndCharacter (/home/itsmenewbie03/.local/share/nvim/mason/packages/vtsls/node_modules/@vtsls/language-server/node_modules/typescript/lib/typescript.js:11566:11)\n    at TextStorage.lineOffsetToPosition (/home/itsmenewbie03/.local/share/nvim/mason/packages/vtsls/node_modules/@vtsls/language-server/node_modules/typescript/lib/typescript.js:182848:59)\n    at ScriptInfo.lineOffsetToPosition (/home/itsmenewbie03/.local/share/nvim/mason/packages/vtsls/node_modules/@vtsls/language-server/node_modules/typescript/lib/typescript.js:183163:29)\n    at IpcIOSession.getPosition (/home/itsmenewbie03/.local/share/nvim/mason/packages/vtsls/node_modules/@vtsls/language-server/node_modules/typescript/lib/typescript.js:191702:66)\n    at IpcIOSession.getSignatureHelpItems (/home/itsmenewbie03/.local/share/nvim/mason/packages/vtsls/node_modules/@vtsls/language-server/node_modules/typescript/lib/typescript.js:191994:27)\n    at signatureHelp (/home/itsmenewbie03/.local/share/nvim/mason/packages/vtsls/node_modules/@vtsls/language-server/node_modules/typescript/lib/typescript.js:190233:43)\n    at /home/itsmenewbie03/.local/share/nvim/mason/packages/vtsls/node_modules/@vtsls/language-server/node_modules/typescript/lib/typescript.js:192655:15\n    at IpcIOSession.executeWithRequestId (/home/itsmenewbie03/.local/share/nvim/mason/packages/vtsls/node_modules/@vtsls/language-server/node_modules/typescript/lib/typescript.js:192644:14)\n    at IpcIOSession.executeCommand (/home/itsmenewbie03/.local/share/nvim/mason/packages/vtsls/node_modules/@vtsls/language-server/node_modules/typescript/lib/typescript.js:192653:29)\n    at IpcIOSession.onMessage (/home/itsmenewbie03/.local/share/nvim/mason/packages/vtsls/node_modules/@vtsls/language-server/node_modules/typescript/lib/typescript.js:192701:68)\n    at process.<anonymous> (/home/itsmenewbie03/.local/share/nvim/mason/packages/vtsls/node_modules/@vtsls/language-server/node_modules/typescript/lib/tsserver.js:525:14)\n    at process.emit (node:events:519:28)\n    at emit (node:internal/child_process:951:14)\n    at process.processTicksAndRejections (node:internal/process/task_queues:83:21)"  },  id = 131,  jsonrpc = "2.0"}

userController.js

// controllers/userController.js
import User from '../models/userModel.js';
import bcrypt from 'bcrypt';
import jwt from 'jsonwebtoken';
import fetch from 'node-fetch'; // For Google OAuth validation
import { OAuth2Client } from 'google-auth-library';

const CLIENT_ID = process.env.GOOGLE_CLIENT_ID;  // Store your Google Client ID in .env
const client = new OAuth2Client(CLIENT_ID);

// Traditional login (email/password)
export const login = async (req, res) => {
// --snip--

I think this error is kind of expected as the requested position (0 based) position = { character = 1, line = 9 } is invalid as the line 9 of the source file is blank. The typescript checks the validity of position here: https://github.com/microsoft/TypeScript/blob/9fe6c3661cd89952d9556ecb14ef366b44076064/src/compiler/scanner.ts#L492-L494

This looks like that a nvim plugin is scheduled to send the lsp signature request on cursor move, but with wrong document position if the current line is blank.

I get the same error on a typescript file, while I am using astronvim. Same occurence, after using some language server functions and then normal movement in the file.

started seeing this as well, but only at one of my TSX files. also randomly