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

Add a switch to load configuration from a file. #1108

Closed NicoPy closed 1 year ago

NicoPy commented 1 year ago

As mentioned in another issue, I'm trying to use ALS with Eclipse (without writing a dedicated Eclipse plugin). The Eclipse 'language server' client has, of course, no knowledge of ALS additional configuration parameters. What would be very useful is to be able to add a config (or similar) switch to ALS to provide a file path containing ALS configuration. One could then use ada_language_server --config=<FILE> with 'dumb' language clients.

I thought I could easily work on it and publish a PR but building ALS on Windows is not documented. I tried using Alire but this builds a non working executable (see issue #1103).

AnthonyLeonardoGracio commented 1 year ago

Hello!

That's a very interesting idea indeed. Do you know other language servers that provide this option?

NicoPy commented 1 year ago

Hi,

That's a very interesting idea indeed.

Thanks.

Do you know other language servers that provide this option?

None I'm aware of.

AnthonyLeonardoGracio commented 1 year ago

Ok! In any case, looks like a good idea, we'll add the option.

NicoPy commented 1 year ago

That's good news 😃

NicoPy commented 1 year ago

Just remembered that language servers for VHDL use a configuration file to manage specific configuration parameters (like libraries content, top level entity...).

For example :

NicoPy commented 1 year ago

👍

NicoPy commented 1 year ago

Can you provide a config file example ? I tried many syntaxes/structures. Either ALS complains on bad content or ALS crashes :

Unhandled Exception raised
raised GNATCOLL.VFS.VFS_INVALID_FILE_ERROR : gnatcoll-vfs.adb:340
[Z:\ada\language_server\ada_language_server.exe]
0x7ff7a271d6da
0x7ff7a0d4026d
0x7ff7a0d41a0b
0x7ff7a0d41dd0
0x7ff7a0643dde
0x7ff7a2cb1a59
0x7ff7a064143c
0x7ff7a0641144
[C:\WINDOWS\System32\KERNEL32.DLL]
0x7ffaf6c97612
[C:\WINDOWS\SYSTEM32\ntdll.dll]
0x7ffaf8bc269f
reznikmm commented 1 year ago

the same for me

AnthonyLeonardoGracio commented 1 year ago

Hello @NicoPy ,

Do you have a config that exhibits the issue? I have tested with a simple config file that just sets the projectFile and it seems to work on my side.

AnthonyLeonardoGracio commented 1 year ago

Actually the issue only exists with the ada_language_server packaged with the extension. We are able to reproduce now. Thanks for reporting!