microsoft / AL

Home of the Dynamics 365 Business Central AL Language extension for Visual Studio Code. Used to track issues regarding the latest version of the AL compiler and developer tools available in the Visual Studio Code Marketplace or as part of the AL Developer Preview builds for Dynamics 365 Business Central.
MIT License
718 stars 242 forks source link

Hover window in debugger is placed incorrectly when previous line has comment or empty #7744

Closed MaxFalcone closed 1 month ago

MaxFalcone commented 1 month ago

1. Describe the bug Hover window is placed incorrectly when hovering mouse over variable in debugger and previous line has a comment section If I try to move mouse from its' position to the hover window it will close because mouse crossed empty area between current line and the border of the window.

2. To Reproduce

  1. Put to lines of code like on screenshot. First line is a comment (or empty line), second line is a code line with some variable.
  2. Run debugger and stop/break anywhere in the code.
  3. Hover over variable, e.g. Rec
pageextension 50100 CustomerListExt extends "Customer List"
{
    trigger OnOpenPage();
    begin
        //comment
        Rec.Name := 'test';
        Rec."Name 2" := 'hover';
    end;
}

3. Expected behavior Hover window appears in the line above image

4. Actual behavior Hover window appears two lines above the variable. It hovers above the comment line, not above the line with variable. image

5. Versions:

BazookaMusic commented 1 month ago

This is most likely due to the comment being trivia on the statement, thus we calculate the statement's location incorrectly

thloke commented 1 month ago

We have internally discussed this issue and have decided not to accept this issue to be fixed. The reason for this is that it will require a significant change to how we parse syntax nodes, while the actual issue is fairly minor. So the risk-reward ratio doesn't make sense for us. Thanks for raising the issue though!

MaxFalcone commented 1 month ago

So inability to inspect variable is a minor issue? Because the issue is not with placement of the window. The issue is that it disappears when you try to interact with it if it's placed incorrectly.

thloke commented 1 month ago

You can still inspect the variable in the debug pane, though I agree it's inconvenient to have to go there instead of being able to use the hover. It still doesn't change the risk-reward calculation for us, since changing how we structure the syntax nodes has the potential to cause other issues down the line. This also only happens in the case where you have a comment on the preceding line as well, which reduces its impact. Given that there is a workaround and that this is a special case, it's not something we want to change parsing for.

MaxFalcone commented 1 month ago

By the way, there is another case when it happens. It is when preceding line is empty. Not so rare case I'd say.

nv8adamhe commented 1 month ago

I just ran into the same issue, in the 'empty line' scenario. This is very commonly encountered as part of readable code style and was (is?) part of MSFT's own internal AL style guidelines. Please reconsider a fix for this, it reflects poorly on the dev experience to taunt developers with a hover window they cannot access without changing unrelated non-compiling lines.

MaxFalcone commented 2 weeks ago

Additionally, If you say that it is a problem with a syntax structure, then why other windows are alined perfectly with the same variables in the same condirtions. Look on the screenshots.

The problem is the same as with comment line, but preceeding line is empty. Hower window misaligned. Hint at the bottom of the window suggests to hold Alt, let's try it. image Another hower window is perfectly alligned with the same vartiable. image

So maybe there is something that CAN be done?