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

[Bug]: Format on Save deletes .ads/.adb contents when outside the current project. #1231

Open
pyjarrett opened this issue Dec 30, 2024 · 3 comments
Labels

Comments

@pyjarrett
Copy link

pyjarrett commented Dec 30, 2024

Environment

  • OS and Version: Windows, Linux
  • IDE Version: 1.96.2
  • Ada & SPARK Extension Version: 26.0.202411173

Bug Summary and Reproducer

Bug Summary: Format on Save with GNATformat enabled deletes the contents of .ads and .adb files which are not part of the project. These require being saved with the "File: Save without Formatting" action in VS Code.

Steps to reproduce: This doesn't happen 100%. Create a new Ada File outside of the current project and write some code. "Format on Save" needs to be on, as does the GNATformat being enabled. Save the file and the contents of the file will be deleted. In some cases, the contents will be reverted to an old version (not sure why this other behavior)

Expected behavior: Either - file does not format and remains in place as-is, OR file gets appropriately formatted.

Configuration and Logs

no workspace-specific configuration files

Log from show extension output, I only get this log when I'm able to properly save an Ada file outside the project, but **NOT** when the formatter deletes the file contents.

  Code: -32603 
[Error - 2:10:09 PM] Request textDocument/signatureHelp failed.
  Message: Exception: raised LANGKIT_SUPPORT.ERRORS.PRECONDITION_FAILURE : null node argument
Load address: 0x56223dd98000
[/home/paul/.vscode/extensions/adacore.ada-26.0.202411173-linux-x64/x64/linux/ada_language_server]
0x5622407993a3 Libadalang.Analysis.Kind at libadalang-analysis.adb:12546
0x56223ff52b6f Lsp.Ada_Completions.Parameters.Get_Call_Expr at lsp-ada_completions-parameters.adb:918
0x56223ff58370 Lsp.Ada_Completions.Parameters.Propose_Signatures at lsp-ada_completions-parameters.adb:838
0x56223fff0282 Lsp.Ada_Handlers.On_Signaturehelp_Request.Compute_Response.2 at lsp-ada_handlers.adb:3289
0x56223fff0447 Lsp.Ada_Handlers.On_Signaturehelp_Request at lsp-ada_handlers.adb:3299
0x56223ffde30e Lsp.Ada_Handlers.On_Server_Request at lsp-ada_handlers.adb:3129
0x56223f22ac64 Lsp.Default_Message_Handlers.Execute at lsp-default_message_handlers.adb:85
0x56223f2356df Lsp.Job_Schedulers.Process_Job at lsp-job_schedulers.adb:191
0x56223ffb8bd2 Lsp.Servers.Processing_Task_TypeT at lsp-servers.adb:848
0x56224221474c system__tasking__stages__task_wrapper at ???
[/lib/x86_64-linux-gnu/libc.so.6]
0x7f34ac7491c2
0x7f34ac7c985a
0xfffffffffffffffe

  Code: -32603 
[Error - 2:10:30 PM] Request textDocument/formatting failed.
  Message: Incorrect code can't be formatted
  Code: -32603 
[Error - 2:10:40 PM] Request textDocument/formatting failed.
  Message: Incorrect code can't be formatted
  Code: -32603 
[Error - 2:11:09 PM] Request textDocument/signatureHelp failed.
  Message: Exception: raised LANGKIT_SUPPORT.ERRORS.PRECONDITION_FAILURE : null node argument
Load address: 0x56223dd98000
[/home/paul/.vscode/extensions/adacore.ada-26.0.202411173-linux-x64/x64/linux/ada_language_server]
0x5622407993a3 Libadalang.Analysis.Kind at libadalang-analysis.adb:12546
0x56223ff52b6f Lsp.Ada_Completions.Parameters.Get_Call_Expr at lsp-ada_completions-parameters.adb:918
0x56223ff58370 Lsp.Ada_Completions.Parameters.Propose_Signatures at lsp-ada_completions-parameters.adb:838
0x56223fff0282 Lsp.Ada_Handlers.On_Signaturehelp_Request.Compute_Response.2 at lsp-ada_handlers.adb:3289
0x56223fff0447 Lsp.Ada_Handlers.On_Signaturehelp_Request at lsp-ada_handlers.adb:3299
0x56223ffde30e Lsp.Ada_Handlers.On_Server_Request at lsp-ada_handlers.adb:3129
0x56223f22ac64 Lsp.Default_Message_Handlers.Execute at lsp-default_message_handlers.adb:85
0x56223f2356df Lsp.Job_Schedulers.Process_Job at lsp-job_schedulers.adb:191
0x56223ffb8bd2 Lsp.Servers.Processing_Task_TypeT at lsp-servers.adb:848
0x56224221474c system__tasking__stages__task_wrapper at ???
[/lib/x86_64-linux-gnu/libc.so.6]
0x7f34ac7491c2
0x7f34ac7c985a
0xfffffffffffffffe

  Code: -32603 


### Other VS Code Extensions

_No response_

### Additional context

_No response_
@pyjarrett pyjarrett added the bug label Dec 30, 2024
@pyjarrett pyjarrett changed the title [Bug]: [Bug]: Format on Save deletes .ads/.adb contents when outside the current project. Dec 30, 2024
@reznikmm
Copy link
Member

Could you try the latest pre-release 26.0.202412190 ?

@pyjarrett
Copy link
Author

@reznikmm I've gone back and forth using it but had still seen it on Linux, not sure about any change Windows at the moment.

@AnthonyLeonardoGracio
Copy link
Collaborator

Hi @pyjarrett,

It would be great if you could provide us a simple reproducer with the latest release, because normally it has been fixed in the latest release, and we have a test for that.

Regards,

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

3 participants