Silence stack overflow error notifications in universal VSIX
Using the current last commit workflow generated universal vsix
SuperBOL, by OCamlPro. https://get-superbol.com. Affero GPL version.
[Info - 11:54:53] Initializing SuperBOL LSP Server
[Info - 11:54:53] Commit: 8de2307a11bef38e677685642a4c5bdfcea7ada0 (2025-05-23 11:46:33 +0200)
[Info - 11:54:53] Version tag: 0.1.5
[Info - 11:54:53] Initial workspace folders: /tmp/gnucobol-3.x-commit-only
[Info - 11:54:53] Negociated server parameters:
{ client_config_watcher: true
client_file_watcher: any pattern }
[Warn - 11:54:53] Failed to read cache /tmp/gnucobol-3.x-commit-only/_superbol/lsp-cache: End_of_file
[Info - 11:54:53] Failed to read cache /tmp/pid-23600/_superbol/lsp-cache: Bad version tag: got a9eb557860882f0d2a89472b258619226bfd34a8, expected 8de2307a11bef38e677685642a4c5bdfcea7ada0
[Info - 11:54:59] Received client configuration: [ { "dialect": "default", "source-format": "auto", "copybooks": [ { "dir": "." } ], "copyexts": [ "cpy", "cbl", "cob" ] } ]
[Error - 11:54:59] Request textDocument/documentSymbol failed.
Message: Lsp_server.Document_not_found { uri = 'file:///tmp/pid-23600/ZOSPD405.COB' }
Code: -32603
[Info - 11:54:59] Received client configuration: [ { "dialect": "default", "source-format": "auto", "copybooks": [ { "dir": "." } ], "copyexts": [ "cpy", "cbl", "cob" ] } ]
[Error - 11:55:02] Request textDocument/foldingRange failed.
Message: Caught exception: Stack overflow
Code: -32603
[Error - 11:55:02] Request textDocument/documentSymbol failed.
Message: Caught exception: Stack overflow
Code: -32603
[Error - 11:55:02] Request textDocument/codeLens failed.
Message: Caught exception: Stack overflow
Code: -32603
[Info - 11:55:02] Getting configuration for project of file:///tmp/gnucobol-3.x-commit-only/NEWS
Reply: { "cobol.dialect": "default", "cobol.source-format": "auto", "cobol.copybooks": [ { "dir": "." } ], "cobol.copyexts": [ "cpy", "cbl", "cob" ] }
[Error - 12:00:56] Request textDocument/hover failed.
Message: Caught exception: Stack overflow
Code: -32603
I have no clue which additional logs may be helpful, but am open to help with logs :-)
I guess the universal LSP has some issues and the client does not check this and results in a stack overflow? In this case the later one should be fixed first...
Note: the "bad version tag" also exists after restarting vscode again, I'd have thought that the cache file would be updated if there's an error (you may want to move that out to a different issue to track).
If these errors only appear when using the universal extension (I assume that's the cas), then they are very likely due to some intrinsic limitations of the JS runtime: idiomatic OCaml (functional style, relying a lot on tail-call optimization) compiled into JS can lead to these issues.
Do these errors only appear in the logs, or do they show up as notifications as well? If yes, then we can employ some mitigation technique in the server to at least silence them in the universal extension (that would just provide no results to some queries though…). Or better: in case of such an error send a one-time notification to users about limitations of the universal extension, with a suggestion to switch to a native version.
For the bad version tag, I think the cache is not saved if the document has not been changed at all. (Also: interactions between cache files for universal and native extensions has not really been tested, so caching may not work properly in some rather unusual circumstances).
they all show up in the UI similar to that one:
I've manually uninstalled the extension, restarted, then installed via command line - the issues in that source seem to be gone. I do get a strange error on another source:
[Error - 12:29:33] Request textDocument/semanticTokens/full failed. Message: Lsp_server.Document_not_found { uri = 'file:///tmp/transpose.cob' } Code: -32603
Note that the file exists and has LSP features.
program-id.t.
data division.
working-storage section.
1 s pic x(99).
1 a.
3 w pic x(20) occurs 7.
3 n pic x(99).
1 p pic 999.
1 pw pic 99.
procedure division.
c.accept s from argument-value on exception goback.
move " " to a
unstring s delimited by " " into w(1)w(2)w(3)w(4)w(5)w(6)w(7).
move 1 to pw p.
d. if p>140 move " " to n(pw:1) add 1 to pw add -139 to p if p = 21 display n go to c.
if a(p:1)<>" " move a(p:1) to n(pw:1) add 1 to pw.
add 20 to p.
go to d.