AdaCore / ada_language_server

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

Excluded_Source_Dirs appears to be broken #1131

Closed brownts closed 1 year ago

brownts commented 1 year ago

Starting with v23.0.14, it appears valid paths specified in Excluded_Source_Dirs are considered invalid, causing the project file to fail to be loaded. I assume this is also related to the libgpr2 switch in the latest version.

Attached is a screenshot and reproducer for this issue with a simple project. path_test.zip

excluded_source_dirs

AnthonyLeonardoGracio commented 1 year ago

Hello,

It seems like the problem is how GPR2 handles Project'Project_Dir. Switching from :

for Excluded_Source_Dirs use (Project'Project_Dir & "src/dir2");

to:

for Excluded_Source_Dirs use ("src/dir2");

makes things work. So you ca use that as workaround until we fix the issue in GPR2.

Regards,

brownts commented 1 year ago

Hi @AnthonyLeonardoGracio, thanks for the follow-up. I think your work-around would work for this simple example, however in practice we use this differently. We often have an abstract project which might contain a list of source files, but that list is used in a different project file and used in an Excluded_Source_Dirs declaration there. For example something like this:

abstract project A is
  Xsrc := (Project'Project_Dir & "src/dir2");
end A;

with "../some/where/else/a.gpr";
project B is
  ...
  for Excluded_Source_Dirs use A.Xsrc;
  ...
end B;

In this case we can't rely on the relative path from the project file where the Excluded_Source_Dirs attribute declaration resides as the two project files may be in different directories. That is why we prefix the relative path with Project'Project_Dir.

Do you have a workaround suggestion for this type of situation?

AnthonyLeonardoGracio commented 1 year ago

Hello @brownts,

Unfortunately we don't have any workaround for your use-case. We'll talk to the GPR team to raise the priority on this!

Regards,

AnthonyLeonardoGracio commented 1 year ago

Hello @brownts,

This should now be fixed in the latest version of the extension.

Thanks for the report!