AL
AL copied to clipboard
Hover window in debugger is placed incorrectly when previous line has comment
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
- 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.
- Run debugger and stop/break anywhere in the code.
- 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
4. Actual behavior
Hover window appears two lines above the variable. It hovers above the comment line, not above the line with variable.
5. Versions:
- AL Language: v13.0.1007491
- Visual Studio Code: Version: 1.89.0 (user setup) Commit: b58957e67ee1e712cebf466b995adf4c5307b2bd Date: 2024-05-01T02:09:22.859Z Electron: 28.2.8 ElectronBuildId: 27744544 Chromium: 120.0.6099.291 Node.js: 18.18.2 V8: 12.0.267.19-electron.0 OS: Windows_NT x64 10.0.22631
- Business Central: 23.6
- List of Visual Studio Code extensions that you have installed: AL Language only
This is most likely due to the comment being trivia on the statement, thus we calculate the statement's location incorrectly
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!
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.
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.
By the way, there is another case when it happens. It is when preceding line is empty. Not so rare case I'd say.
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.
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.
Another hower window is perfectly alligned with the same vartiable.
So maybe there is something that CAN be done?