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 ada.selectProject command to select project #1132

Closed TamaMcGlinn closed 1 year ago

TamaMcGlinn commented 1 year ago

This adds a filedialog command called 'Ada Select GPR Project' which lets the user select a .gpr file and puts that into the workspace configuration.

For a test project, see https://github.com/TamaMcGlinn/test_multigpr

Tested this with latest Ada_language_server (23.0.14) and it works beatifully; even if you had no .vscode/settings.json, it is created if you run the command. Note this command is only needed for non-alire projects, as ALS autodetects the right gpr file for alire projects now.

CLAassistant commented 1 year ago

CLA assistant check
All committers have signed the CLA.

TamaMcGlinn commented 1 year ago

Added this note in the readme under VSCode > project support

If there is a single .gpr file in the root of the project, it will be selected automatically. To choose the active project file, use the ada.chooseProject command and select a project file in the file dialog.

reznikmm commented 1 year ago

@TamaMcGlinn I've tried it locally, but when I execute command the setting doesn't save in .vscode/settings.json immediately. So ALS doesn't get didConfigurationChange and "Build current project" task doesn't get project name.

Any idea?

TamaMcGlinn commented 1 year ago

I had not tested that; good find! I will have more time to test this next week, I'll get back to you when I know if I can reproduce and/or fix it.

My own test was using test_multigpr, and just checking from the main.adb where cntrl+click on the Foo function call takes you. With that I could see that the language server was switching as soon as the command had been issued.