-
Notifications
You must be signed in to change notification settings - Fork 63
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
Ada Source Formatter #901
Comments
See this line for formatting registration code. ALS uses gnatpp code for formatting. So it supports all gnatpp option. Just set them in your project file, like this:
|
Thanks. Three issues. First, I may be intentional, but the formatter doesn't abide by VSCode's tab spacing. I think it should use VSCode's default unless it's explicit set in the Default_Switches of the Pretty_Printer package definition. Second, the original error I received about it not finding the formatter has reoccurred when I tried to format the GPR file. I think I was applying it to the GPR file. Third, after adding the switches I'm getting an error message from the Language Server: [Trace - 10:39:22 PM] Received response 'textDocument/formatting - (784)' in 2ms. Request failed: Internal error (-32603). Here's my project generated by ALR: with "config/adb_controller_config.gpr"; for Source_Dirs use ("src"); type Enabled_Kind is ("enabled", "disabled"); type Build_Kind is ("debug", "optimize"); Compile_Checks_Switches := (); Runtime_Checks_Switches := (); Style_Checks_Switches := (); Contracts_Switches := (); Build_Switches := (); package Compiler is package Binder is package Pretty_Printer is end Adb_Controller; |
Any updates on why this error is happening? |
Currently Ada Language Server supports only Ada files (no support for editing GPR files yet). Could you provide a complete self-contained reproducer? |
Hello @Joebeazelman, Note that |
I had given up on trying to format my Ada code in VSCode. There's no mention of it in Ada's documentation. Trying to execute the command resulted in VSCode asking if you'd like to download a formatter for Ada. After looking for alternatives, I was just about to write one until I tested my initial extension code. My extension formatting wasn't loading, so after much investigation I discovered Ada Language server was performing the formatting. It suddenly worked. Not sure what happened. Looking at the VSCode base, I don't see where Ada Language Server registers itself as a code formatter.
The remaining issue is that there's little documentation of this feature even existing and there are no options for setting its formatting options such as formatting comments, line length, number of tabs, etc.
The text was updated successfully, but these errors were encountered: