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

Error starting Ada extension #1179

Closed jlots closed 5 months ago

jlots commented 5 months ago

I have been using the Ada extension for several months now with no problems. Since yesterday, I've begun to get this error:

2024-01-11 10:11:54.185 [Ada Extension] INFO     Setting log level to: debug 
2024-01-11 10:11:54.186 [Ada Extension] INFO     Starting Ada extension 
2024-01-11 10:11:54.191 [Ada Extension] ERROR    Error while starting Ada extension.  Cannot read properties of null (reading 'replace') TypeError: Cannot read properties of null (reading 'replace')
    at Gu (/home/XXXXXXX/.vscode/extensions/adacore.ada-24.0.3/out/src/extension.js:75:5911)
    at oS (/home/XXXXXXX/.vscode/extensions/adacore.ada-24.0.3/out/src/extension.js:75:6057)
    at w$ (/home/XXXXXXX/.vscode/extensions/adacore.ada-24.0.3/out/src/extension.js:85:2292)
    at b$ (/home/XXXXXXX/.vscode/extensions/adacore.ada-24.0.3/out/src/extension.js:85:2154)
    at W.ib (/snap/code/148/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:154:13237)
    at W.hb (/snap/code/148/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:154:12951)
    at /snap/code/148/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:154:11080
    at async u.n (/snap/code/148/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:140:6255)
    at async u.m (/snap/code/148/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:140:6218)
    at async u.l (/snap/code/148/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:140:5675)

I've uninstalled and reinstalled the extension with no change. Syntax highlighting still works, but IntelliSense doesn't, nor any of the Ada: XXXX tasks in the Command Palette. The error above points me to a minified Javascript file, so I can't easily troubleshoot the error further.

Using VSCode 1.85.1 Ubuntu 22.04 Ada Extension 24.0.3

AnthonyLeonardoGracio commented 5 months ago

Hello @jlots,

Unfortunately we can't reproduce on our side. Are you able to reproduce with an older version of the extension?

jlots commented 5 months ago

I uninstalled v24.0.3 and installed v23.0.11. The error went away and Intellisense started working on my project.

jlots commented 5 months ago

Just to ensure there wasn't something lingering, I deleted the .vscode folder in my home directory as well as the one in my project directory. I then restarted VSCode, installed v24.0.3, and encountered the error outlined above. I then uninstalled and installed v23.0.11 and the extension started with no errors.

eliericha commented 5 months ago

Hello @jlots . Thank you for reporting this issue. I looked into it and found the probable cause.

Can you check if in your Workspace or User settings you have a terminal.integrated.env.* setting configured with one of the environment variables set to null, e.g. "SOME_VAR": null ?

It looks like our initialization code trips on that case. A workaround for you is to comment that entry (I hope that's acceptable in your setup). On our end we will fix the code to support such entries (they will be interpreted as a removal of the environment variable from the env of the Ada Language Server).

Let me know if that helps.

jlots commented 5 months ago

This solved my problem. I had the following setting in my user settings.json: // "terminal.integrated.env.linux": { // "GTK_PATH": null // }, After commenting this, I was able to install and run v24.0.3 with no errors.

On Wed, Jan 24, 2024 at 6:08 AM Elie Richa @.***> wrote:

Hello @jlots https://github.com/jlots . Thank you for reporting this issue. I looked into it and found the probable cause.

Can you check if in your Workspace or User settings you have a terminal.integrated.env.* setting configured with one of the environment variables set to null, e.g. "SOME_VAR": null ?

It looks like our initialization code trips on that case. A workaround for you is to comment that entry (I hope that's acceptable in your setup). On our end we will fix the code to support such entries (they will be interpreted as a removal of the environment variable from the env of the Ada Language Server).

Let me know if that helps.

— Reply to this email directly, view it on GitHub https://github.com/AdaCore/ada_language_server/issues/1179#issuecomment-1907912021, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGWCGGSGPBMTAWJTONV5AF3YQDTSTAVCNFSM6AAAAABBWVLUMWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBXHEYTEMBSGE . You are receiving this because you were mentioned.Message ID: @.***>

jlots commented 5 months ago

Just to add to this, when I comment the GTK_PATH: null configuration in the terminal, I get the following error when I run my GtkAda project:

/snap/core20/current/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /lib/x86_64-linux-gnu/libproxy.so.1)
Failed to load module: /home/XXX/snap/code/common/.cache/gio-modules/libgiolibproxy.so
/home/XXX/Documents/projects/drawing_manager/bin/drawing_manager: symbol lookup error: /snap/core20/current/lib/x86_64-linux-gnu/libpthread.so.0: undefined symbol: __libc_pthread_init, version GLIBC_PRIVATE

If I run unset GTK_PATH in the terminal each time VSCode starts up, this error goes away. So it seems I can either unset the path every time I start working, or not use ALS with my project, but not both.

echo $GTK_PATH returns /snap/code/149/usr/lib/x86_64-linux-gnu/gtk-3.0 at VSCode startup. This is a GtkAda problem, not an ALS problem, but wanted to raise here in case there's an easier via ALS.