AdaCore / ada_language_server

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

[Bug]: project file loaded too late (#1189 REOPEN) #1207

Open PaulCayard opened 1 month ago

PaulCayard commented 1 month ago

Environment

Bug Summary and Reproducer

Bug Summary: Issue #1189 is occured again after updating to v25.0.20240915. I cannot reopen Issue #1189. See Issue #1189 for further details.

Steps to reproduce: See Issue #1189.

Expected behavior: See Issue #1189.

Configuration and Logs

See Issue #1189.

Other VS Code Extensions

No response

Additional context

No response

AnthonyLeonardoGracio commented 2 weeks ago

Hello,

We are currently revamping the way we load projects, hopefully this will be fixed in the next version of the extension.

Regards,

PaulCayard commented 1 week ago

Hi, problem is fixed in v25.0.20241014, but error message is still present. (): "No project found in root directory. Please create a project file and add it to the configuration."

Thanks for the fix!

AnthonyLeonardoGracio commented 1 week ago

Hi, problem is fixed in v25.0.20241014, but error message is still present. (): "No project found in root directory. Please create a project file and add it to the configuration."

Thanks for the fix!

Hello, have you specified the ada.projectFile setting for your workspace? Otherwise this warning is expected.

PaulCayard commented 1 week ago

Yes, in "settings.json": "ada.projectFile": ".vscode/sysco.gpr",

AnthonyLeonardoGracio commented 1 week ago

Yes, in "settings.json": "ada.projectFile": ".vscode/sysco.gpr",

Ok, strange. Can you share the log file corresponding to that session? You should find them under the ~/.als directory

PaulCayard commented 1 week ago

Yes! (PATH content is omitted) ada_ls_log.2024-10-18T164845.log

[ALS.MAIN] ALS version: 25.0 (20241014)
[ALS.MAIN] Initializing server ...
[ALS.MAIN] GPR PATH: 
[ALS.MAIN] PATH: 
[...]
[ALS.MAIN] Ada version used for predefined completion: ADA_2020
[ALS.MAIN] In Message_Handler Text_Document_Did_Open URI:
[ALS.MAIN] file:///d%3A/Serena/CMDP/4_CODE/CMDP_SYSCO/src/ofp/DB/DB.Manager.adb
[ALS.MAIN] Looking for a project... Root:
[ALS.MAIN] file:///d%3A/Serena/CMDP/4_CODE/CMDP_SYSCO
[ALS.MAIN] Loading the implicit project because NO_PROJECT
[ALS.MAIN] Loading the implicit project because NO_PROJECT
[ALS.MAIN] Diag: 
_ALS.MAIN_ (PROJECT_TYPE => IMPLICIT_PROJECT,
_ALS.MAIN_  STATUS => NO_PROJECT,
_ALS.MAIN_  PROJECT_FILE => {GNATCOLL.VFS.VIRTUAL_FILE object},
_ALS.MAIN_  MISSING_ADA_RUNTIME => FALSE,
_ALS.MAIN_  GPR2_MESSAGES => {GPR2.LOG.OBJECT object})
[ALS.MAIN] Out Message_Handler Text_Document_Did_Open
[ALS.MAIN] GPR2 Log Messages:
[ALS.MAIN] Prepend Context Id: file:///D%3A/Serena/CMDP/4_CODE/CMDP_SYSCO/.vscode/sysco.gpr
AnthonyLeonardoGracio commented 1 week ago

Yes! (PATH content is omitted) ada_ls_log.2024-10-18T164845.log

[ALS.MAIN] ALS version: 25.0 (20241014)
[ALS.MAIN] Initializing server ...
[ALS.MAIN] GPR PATH: 
[ALS.MAIN] PATH: 
[...]
[ALS.MAIN] Ada version used for predefined completion: ADA_2020
[ALS.MAIN] In Message_Handler Text_Document_Did_Open URI:
[ALS.MAIN] file:///d%3A/Serena/CMDP/4_CODE/CMDP_SYSCO/src/ofp/DB/DB.Manager.adb
[ALS.MAIN] Looking for a project... Root:
[ALS.MAIN] file:///d%3A/Serena/CMDP/4_CODE/CMDP_SYSCO
[ALS.MAIN] Loading the implicit project because NO_PROJECT
[ALS.MAIN] Loading the implicit project because NO_PROJECT
[ALS.MAIN] Diag: 
_ALS.MAIN_ (PROJECT_TYPE => IMPLICIT_PROJECT,
_ALS.MAIN_  STATUS => NO_PROJECT,
_ALS.MAIN_  PROJECT_FILE => {GNATCOLL.VFS.VIRTUAL_FILE object},
_ALS.MAIN_  MISSING_ADA_RUNTIME => FALSE,
_ALS.MAIN_  GPR2_MESSAGES => {GPR2.LOG.OBJECT object})
[ALS.MAIN] Out Message_Handler Text_Document_Did_Open
[ALS.MAIN] GPR2 Log Messages:
[ALS.MAIN] Prepend Context Id: file:///D%3A/Serena/CMDP/4_CODE/CMDP_SYSCO/.vscode/sysco.gpr

Actually we load the project specified in ada.projectFile after receiving the didChangeConfiguration request from the client: would you be able to share the lines related to this request and the corresponding GPR2 messages?

PaulCayard commented 1 week ago

In the previous post I've omitted "[ALS.MAIN] PATH: [...]" line only. How can I help you?

AnthonyLeonardoGracio commented 1 week ago

Ah sorry, you will need to add the following lines to the ~/.als/ada_ls_traces.cfg file:

ALS.IN=yes
ALS.OUT=yes

This will trace all the in/out communication between the client and the server, including the didChangeConfiguration request.

PaulCayard commented 1 week ago

I've attached an extract of the log. log.txt