Skip to content

[Bug]: Possible regression in 26 vs 25 for pretty print threshold = 1 #1246

Open
@kevlar700

Description

@kevlar700

Environment

  • OS and Version: Linux Devuan (Debian 12)
  • IDE Version: Gnat Studio 26 pre-release
  • Ada & SPARK Extension Version: 14.2.1 Ada 2022 no extensions

Bug Summary and Reproducer

Bug Summary: Format file seems to behave differently with 26 than 25. When calls and specifications have two lines then formatting puts them both on one line with 26 whereas with 25 they would place them on a separate line each. I assume this isn't intentional?

Steps to reproduce:

gprbuild
package Pretty_Printer is
for Default_Switches ("ada") use ("--call-threshold=1",
"--par-threshold=1",
"--vertical-enum-types",
"--vertical-named-aggregates",
"-W8",
"-c5",
"-c4",
"--separate-loop-then",
"--separate-then");
end Pretty_Printer;

Expected behavior:

I would expect as with 25 that these first two would have each parameter on a separate line like the final example also formatted with 26

   procedure Clock_Is_Enabled
     (I2C_Number : Devices.I2C.I2C_T; Output : out Boolean);

   Rx_Is_Empty (SPI_Number => SPI_Number, Output => RX_Empty);

            STM32.Microsecond_Timer.Elapsed
              (Time_Reference => Time_Reference,
               Microseconds   => Timeout_Microsecs,
               Time_Elapsed   => Timeout);

Configuration and Logs

__________________

   ada_ls_log
__________________
[ALS.MAIN] ALS version: 26.0w (20241219)
[ALS.MAIN] Initializing server ...
[ALS.MAIN] GPR PATH: 
[ALS.MAIN] PATH: /sbin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/local/GNAT/CR/gnatstudio/bin:/home/kc/bin:/usr/local/flutter/bin:/home/kc/.local/bin
[ALS.MAIN] Trying config file: /home/kc/.config/als/config.json
[ALS.MAIN] /home/kc/.config/als/config.json doesn't exist
[ALS.MAIN] Trying config file: /mnt/crypt/elansys/code/ada/STM32U073_SVD_FIXED/.als.json
[ALS.MAIN] /mnt/crypt/elansys/code/ada/STM32U073_SVD_FIXED/.als.json doesn't exist
[ALS.MAIN] Ada version used for predefined completion: ADA_2020
[ALS.MAIN] Processing initializationOptions from initialize request
[ALS.MAIN] Processing received workspace/didChangeConfiguration notification
[ALS.MAIN] Scheduling a reload because the project tree is not defined
[ALS.PROJECT] Reload_Project was called. Releasing current project context.
[ALS.PROJECT] Looking for a unique project at the root
[ALS.PROJECT] Found unique project: /mnt/crypt/elansys/code/ada/STM32U073_SVD_FIXED/stm32u073_startup.gpr
[ALS.PROJECT] Loading project: /mnt/crypt/elansys/code/ada/STM32U073_SVD_FIXED/stm32u073_startup.gpr
[ALS.PROJECT] Loading project with GPR2
[ALS.PROJECT] GPR2 messages after load:
   [ALS.PROJECT] embedded_kb/kb: warning: can't find a toolchain for the following configuration: language 'Ada', target 'arm-eabi', runtime 'light-cortex-m0p'
   [ALS.PROJECT] embedded_kb/kb: warning: can't find a toolchain for the following configuration: language 'Asm_Cpp', target 'arm-eabi', default runtime
[ALS.PROJECT] Updating project sources
[ALS.PROJECT] GPR2 messages after updating sources:
   [ALS.PROJECT] embedded_kb/kb: warning: can't find a toolchain for the following configuration: language 'Ada', target 'arm-eabi', runtime 'light-cortex-m0p'
   [ALS.PROJECT] embedded_kb/kb: warning: can't find a toolchain for the following configuration: language 'Asm_Cpp', target 'arm-eabi', default runtime
   [ALS.PROJECT] /mnt/crypt/elansys/code/ada/STM32U073_SVD_FIXED/stm32u073_startup.gpr:6:18: error: stm32g0b1_elansys.adb is not a source of project Stm32u073_Startup
[ALS.PROJECT] Prepend Context Id: file:///mnt/crypt/elansys/code/ada/STM32U073_SVD_FIXED/stm32u073_startup.gpr
[ALS.PROJECT] Project status after loading: 
_ALS.PROJECT_ (PROJECT_TYPE => SINGLE_PROJECT_FOUND,
_ALS.PROJECT_  STATUS => VALID_PROJECT_WITH_WARNING,
_ALS.PROJECT_  PROJECT_FILE => {GNATCOLL.VFS.VIRTUAL_FILE object},
_ALS.PROJECT_  MISSING_ADA_RUNTIME => TRUE,
_ALS.PROJECT_  GPR2_MESSAGES => {GPR2.LOG.OBJECT object})
[ALS.MAIN] Creating fallback context
[ALS.MAIN] In Message_Handler Text_Document_Did_Open URI:
[ALS.MAIN] file:///mnt/crypt/elansys/code/Ada/STM32U073_SVD_FIXED/src/stm32_svd-tim.ads
[ALS.MAIN] Out Message_Handler Text_Document_Did_Open
[ALS.MAIN] In Message_Handler Text_Document_Did_Open URI:
[ALS.MAIN] file:///mnt/crypt/elansys/code/Ada/STM32U073_SVD_FIXED/src/stm32_svd-tamp.ads
[ALS.MAIN] Out Message_Handler Text_Document_Did_Open
[ALS.MAIN] In Message_Handler Text_Document_Did_Open URI:
[ALS.MAIN] file:///mnt/crypt/elansys/code/Ada/STM32U073_SVD_FIXED/src/stm32_svd-tim.ads
[ALS.MAIN] Out Message_Handler Text_Document_Did_Open
[ALS.MAIN] In Message_Handler Text_Document_Did_Open URI:
[ALS.MAIN] file:///mnt/crypt/elansys/code/Ada/STM32U073_SVD_FIXED/src/stm32_svd-tim.ads
[ALS.MAIN] Out Message_Handler Text_Document_Did_Open

__________________

   gpr_ls_log
__________________
[ALS.MAIN] ALS version: 26.0w (20241219)
[ALS.MAIN] Initializing server ...
[ALS.MAIN] GPR PATH: 
[ALS.MAIN] PATH: /sbin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/local/GNAT/CR/gnatstudio/bin:/home/kc/bin:/usr/local/flutter/bin:/home/kc/.local/bin
[ALS.MAIN] Trying config file: /home/kc/.config/als/config.json
[ALS.MAIN] /home/kc/.config/als/config.json doesn't exist
[ALS.MAIN] Trying config file: /mnt/crypt/elansys/code/ada/STM32U073_SVD_FIXED/.als.json
[ALS.MAIN] /mnt/crypt/elansys/code/ada/STM32U073_SVD_FIXED/.als.json doesn't exist
[ALS.MAIN] In Text_Document_Did_Open
[ALS.MAIN] Uri : file:///mnt/crypt/elansys/code/Ada/STM32U073_SVD_FIXED/stm32u073_startup.gpr
[ALS.MAIN] kb: warning: can't find a toolchain for the following configuration: language 'Ada', target 'arm-eabi', runtime 'light-cortex-m0p'
[ALS.MAIN] kb: warning: can't find a toolchain for the following configuration: language 'Asm_Cpp', target 'arm-eabi', default runtime
[ALS.MAIN] stm32u073_startup.gpr:6:18: error: stm32g0b1_elansys.adb is not a source of project Stm32u073_Startup
[ALS.MAIN] Finished Text_Document_Did_Open

Other VS Code Extensions

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions