Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors and notifications #1173

Open
rocher opened this issue Dec 2, 2023 · 5 comments
Open

Errors and notifications #1173

rocher opened this issue Dec 2, 2023 · 5 comments
Assignees
Labels

Comments

@rocher
Copy link

rocher commented Dec 2, 2023

When working with incomplete or erroneous code I get messages like these in the Output view

[Error - 9:46:56 AM] Request textDocument/codeAction failed.
  Message: Exception: ADA.ASSERTIONS.ASSERTION_ERROR (laltools-common.adb:1713)
  Code: -32603 
[Error - 9:49:46 AM] Request textDocument/formatting failed.
  Message: part_1.adb:9:1: Error formatting node (CompilationUnit). Keeping the initial input selection unchanged
pp-actions.adb:3766 access check failed
[Error - 9:49:55 AM] Request textDocument/formatting failed.
  Message: Incorrect code can't be formatted
  Code: -32603

and a notification A request has failed. See the output....
Last error message can be easily reproduced every time you save incorrect code.

Is it possible to suppress the error messages and the notification?
I already know the code has problems and errors: red-wave underlined code, reports in the Problems view, basic Ada knowledge ..., so I don't need to see them in the output view nor receive the notification, which are really annoying (cancel the notification, toggle the panel).

@reznikmm
Copy link
Contributor

reznikmm commented Dec 2, 2023

It would be better to fix this on ALS side. Could you provide a reproducer?

@rocher
Copy link
Author

rocher commented Dec 2, 2023

It happens to me every time I save an erroneous file, with compilation errors.
Is this something I can solve (or mute) with some vscode setting?? Didn't find any ..

@rocher
Copy link
Author

rocher commented Dec 4, 2023

Could it be because I'm using -gnatX0 and -gnat2022 in alire-toml but the formatter does not use such flags when parsing the file? The formatter complains that incorrect code cannot can't be formatted, but the compiler compiles the file with no single warning.

@jcmoyer
Copy link

jcmoyer commented Dec 14, 2023

The notifications make it hard to work in vscode because the output window steals focus from the terminal window any time there's an LSP error. Some repros that cause formatting to fail if they occur anywhere in a file:

--  works if you add `null;` between `begin` and `end P;`
procedure P is
begin
end P;
--  works if you replace `end B;` with `end A;`
procedure A is
begin
   null;
end B;

@nullfs
Copy link

nullfs commented Dec 14, 2023

Could it be because I'm using -gnatX0 and -gnat2022 in alire-toml but the formatter does not use such flags when parsing the file?

From my experience, the extension just goes out of its way to tell you it broke whenever it tries to process an incorrect file. Here's an example:

with Ada.Command_Line;

procedure Main is
begin
   for Index in 1 .. Ada.Command_Line.Argument_Count loop
      declare
         Argument : String := Ada.Command_Line.Argument (Index);
      begin
         if not Argument -- typing in left parenthesis here does it
      end;
   end loop;
end Main;
[Error - 10:13:36 PM] Request textDocument/signatureHelp failed.
  Message: Exception: LANGKIT_SUPPORT.ERRORS.PRECONDITION_FAILURE (null node argument)
  Code: -32603 

It's been like that for 3 years now, except a few months ago the message said "Imprecise fallback used to compute [...]".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants