Description
Hi. This is a feature request, not a bug.
I recently run into a weird issue with tsserver LSP not working properly in big files. It turned out this plugin forcibly detaches buffers without stopping servers.
I request to make this plugin to be verbose and explicit on which features are disabled, so users can see its actions reported. This may be configurable via silent = false
config.
E.g. of a code snippet that can do reporting:
vim.notify("bigfile.nvim: buffer: LSP servers s are forcibly detached!", vim.log.levels.WARN)
This will make it easier to troubleshoot neovim. Thanks.
If plugin is silent, it's hard to troubleshoot it
Here is an example.
I got an typescript tsserver
Error: No Project.
error that misguided me on the source of the issue. The log says nothing that it has lost connection (buffer got detached) further confusing me. Because of that I run into a wrong issue.
FILE: tsserver.log
Info 0 [12:09:24.718] Starting TS Server
Info 1 [12:09:24.719] Version: 5.2.2
Info 2 [12:09:24.719] Arguments: /home/alex/dotfiles/nvm/.nvm/versions/node/v20.5.0/bin/node ./TypeScript/node_modules/typescript/lib/tsserver.js --serverMode partialSemantic --useInferredProjectPerProjectRoot --disableAutomaticTypingAcquisition --cancellationPipeName /tmp/6eb47b130a698bb88d59be24690b11c3/tscancellation* --logVerbosity normal --logFile /tmp/tsserver/tsserver-log-as5oK1/tsserver.log --locale en --validateDefaultNpmLocation --useNodeIpc
Info 3 [12:09:24.719] Platform: linux NodeVersion: v20.5.0 CaseSensitive: true
Info 4 [12:09:24.719] ServerMode: 1 hasUnknownServerMode: undefined
Info 5 [12:09:24.727] Host information neovim
Info 6 [12:09:24.727] Format host information updated
Info 7 [12:09:26.114] Starting updateGraphWorker: Project: /dev/null/inferredProject1*
Info 8 [12:09:27.359] Finishing updateGraphWorker: Project: /dev/null/inferredProject1* Version: 1 structureChanged: true structureIsReused:: Not Elapsed: 1244.2914890013635ms
Info 9 [12:09:27.359] Project '/dev/null/inferredProject1*' (Inferred)
Info 10 [12:09:27.359] Files (8)
...
Info 18 [12:09:28.150] -----------------------------------------------
Info 18 [12:09:28.150] Open files:
Info 18 [12:09:28.150] After ensureProjectForOpenFiles:
Info 19 [12:09:28.150] Project '/dev/null/inferredProject1*' (Inferred)
Info 19 [12:09:28.150] Files (0)
Info 19 [12:09:28.150] -----------------------------------------------
Info 19 [12:09:28.150] Open files:
Err 19 [12:09:28.165] Exception on executing command {
"seq": 4,
"type": "request",
"command": "navtree",
"arguments": {
"file": "./TypeScript/src/compiler/checker.ts"
}
}:
No Project.
Error: No Project.
at Object.ThrowNoProject (./TypeScript/node_modules/typescript/lib/tsserver.js:174959:11)
at ScriptInfo.getDefaultProject (./TypeScript/node_modules/typescript/lib/tsserver.js:175711:23)
at _ProjectService.doEnsureDefaultProjectForFile (./TypeScript/node_modules/typescript/lib/tsserver.js:178932:36)
at _ProjectService.ensureDefaultProjectForFile (./TypeScript/node_modules/typescript/lib/tsserver.js:178927:75)
at IpcIOSession.getFileAndProjectWorker (./TypeScript/node_modules/typescript/lib/tsserver.js:183899:77)
at IpcIOSession.getFileAndProject (./TypeScript/node_modules/typescript/lib/tsserver.js:183885:17)
at IpcIOSession.getFileAndLanguageServiceForSyntacticOperation (./TypeScript/node_modules/typescript/lib/tsserver.js:183888:36)
at IpcIOSession.getNavigationTree (./TypeScript/node_modules/typescript/lib/tsserver.js:184320:44)
at navtree (./TypeScript/node_modules/typescript/lib/tsserver.js:182604:43)
at ./TypeScript/node_modules/typescript/lib/tsserver.js:184838:69
at IpcIOSession.executeWithRequestId (./TypeScript/node_modules/typescript/lib/tsserver.js:184830:14)
at IpcIOSession.executeCommand (./TypeScript/node_modules/typescript/lib/tsserver.js:184838:29)
at IpcIOSession.onMessage (./TypeScript/node_modules/typescript/lib/tsserver.js:184880:51)
at process.<anonymous> (./TypeScript/node_modules/typescript/lib/tsserver.js:186461:14)
at process.emit (node:events:514:28)
at emit (node:internal/child_process:951:14)
at process.processTicksAndRejections (node:internal/process/task_queues:83:21)
It's easy to reproduce this behavior on any big file where LSP is attached. E.g.:
# run in shell
pushd $(mktemp -d)
git clone --no-tags --depth 1 [email protected]:microsoft/TypeScript.git
pushd TypeScript
rm /tmp/tsserver/tsserver-log-*/*.log
nvim compiler/checker.ts # 50k+ LOC