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/Style warnings go away after building twice #1162

Closed swork1 closed 11 months ago

swork1 commented 11 months ago

I have a very basic Alire project set up to replicate this issue. Run Build project on the following code

procedure Main is
   S : Integer := 0;
begin
   null;
end Main;

The build output will warn warning: variable "S" is not referenced [-gnatwu] and VSCode will highlight the S which works as expected. The issue appears if you run Build project again as the output is gprbuild: "main.exe" up to date which VSCode will see and un-highlight the S that is still an issue.

Is there a way to have a better sync between errors/warnings so that VSCode is displaying accurate information?

reznikmm commented 11 months ago

There is no issue here as I can see. If gprbuild doesn't report any problem, then VS Code shouldn't display any problem.

If you want to check aa single file for errors/warnings use Check current file task. If you want you project doesn't compile successfully on warnings then append -gnatwe to the compiler flags. If you want get all warnings in the project then force recompilation of the whole project with -f flag of gprbuild.