AdaCore / ada_language_server

Server implementing the Microsoft Language Protocol for Ada and SPARK
GNU General Public License v3.0
226 stars 54 forks source link

Pre-condition failure in ALS from vscode when writing Ada code #1186

Open stcarrez opened 3 months ago

stcarrez commented 3 months ago

It happens regularly that ALS reports a failure while typing some Ada code. I report the issue here since the vscode plugin seems provided by this project. This creates (multiple) popup on the IDE about the failure.

I guess it occurs probably on some completion action while writing new procedure/function, hence at a stage where the Ada program is of course not valid because being written.

2024-03-10 14:51:49.655 [error] Exception: LANGKIT_SUPPORT.ERRORS.PRECONDITION_FAILURE (null node argument): Error: Exception: LANGKIT_SUPPORT.ERRORS.PRECONDITION_FAILURE (null node argument)
    at lr (/home/ciceron/.vscode/extensions/adacore.ada-24.0.4/out/src/extension.js:36:228)

Let me know if you need more information or if I can enable something to log more information for you. This is the last version available at this date (24.0.4).

AnthonyLeonardoGracio commented 2 months ago

Hello,

We have fixed similar issues recently, mostly due to LSP codeActions that sometimes fail on invalid code.

We plan to release a new VS Code extension version in the coming weeks, would be worth to try again once it's released. If you still face the issue, you can give us the corresponding log: you can find them under your ~/.als directory.

Regards,

stcarrez commented 2 months ago

The issue seems to be present with 24.0.5 but the occurrence seems to have been reduced.

2024-05-01 09:41:11.860 [error] [AdaCore.ada] provider FAILED
2024-05-01 09:41:11.860 [error] Error: Exception: LANGKIT_SUPPORT.ERRORS.PRECONDITION_FAILURE (null node argumen$
        at dr (/home/ciceron/.vscode/extensions/adacore.ada-24.0.5/out/src/extension.js:36:228)
        at xr (/home/ciceron/.vscode/extensions/adacore.ada-24.0.5/out/src/extension.js:35:6240)
        at lr (/home/ciceron/.vscode/extensions/adacore.ada-24.0.5/out/src/extension.js:35:6363)
        at Immediate.<anonymous> (/home/ciceron/.vscode/extensions/adacore.ada-24.0.5/out/src/extension.js:35:61$
        at process.processImmediate (node:internal/timers:476:21)
2024-05-01 09:41:12.556 [error] [AdaCore.ada] provider FAILED
2024-05-01 09:41:12.557 [error] Error: Exception: LANGKIT_SUPPORT.ERRORS.PRECONDITION_FAILURE (null node argumen$
        at dr (/home/ciceron/.vscode/extensions/adacore.ada-24.0.5/out/src/extension.js:36:228)
        at xr (/home/ciceron/.vscode/extensions/adacore.ada-24.0.5/out/src/extension.js:35:6240)
        at lr (/home/ciceron/.vscode/extensions/adacore.ada-24.0.5/out/src/extension.js:35:6363)
        at Immediate.<anonymous> (/home/ciceron/.vscode/extensions/adacore.ada-24.0.5/out/src/extension.js:35:61$
        at process.processImmediate (node:internal/timers:476:21)
2024-05-01 09:41:21.999 [error] [AdaCore.ada] provider FAILED
2024-05-01 09:41:21.999 [error] Error: Exception: LANGKIT_SUPPORT.ERRORS.PRECONDITION_FAILURE (null node argumen$
        at dr (/home/ciceron/.vscode/extensions/adacore.ada-24.0.5/out/src/extension.js:36:228)
        at xr (/home/ciceron/.vscode/extensions/adacore.ada-24.0.5/out/src/extension.js:35:6240)
        at lr (/home/ciceron/.vscode/extensions/adacore.ada-24.0.5/out/src/extension.js:35:6363)
        at Immediate.<anonymous> (/home/ciceron/.vscode/extensions/adacore.ada-24.0.5/out/src/extension.js:35:61$
        at process.processImmediate (node:internal/timers:476:21)
AnthonyLeonardoGracio commented 2 months ago

Hello @stcarrez,

We would need the logs present in your ~/.als folder: these should contain the exception's SLOC, which would help us a lot ir order to fix it.

Regards,

stcarrez commented 2 months ago

There is no ~/.als folder but I've found logs for the ada_language_server daemon in /home/ciceron/.config/Code/logs/20240428T113411/window1/exthost/exthost.log

exthost.log

AnthonyLeonardoGracio commented 2 months ago

Hello @stcarrez,

This is not expected: the Ada Language Server itself should produce logs under the$HOME/.als/ folder (see here for more info).

The logs you have attached are the logs produced by the Ada TypeScript extension, the layer on top of the Ada Language Server that interfaces with VS Code. While these logs can be useful for bugs coming form the TypeScript layer, they aren't that useful for bugs coming from the ALS itself (which is the case here).

Can you double-check to see if some log are present in the folder mentioned above? Otherwise you can create a ~/.als/traces.cfg file manually, as described in the link.

Another option would be to provide a small reproducer if doable.

Regards,

AnthonyLeonardoGracio commented 2 months ago

Normally you should also have access to the logs produced by the ALS by running the Ada: Show Ada Language Server output from the VS Code command palette (ctrl + P key shortcut).