AL
AL copied to clipboard
Procedures that are part of an interface look just like unused procedures
1. Describe the bug My previous ticket probably got misunderstood, since it got partially fixed: https://github.com/microsoft/AL/issues/6510 That is, the interface (object) references themselves improved, but not the procedures of it. We can look up implementations of the procedures of an interface, but references are counted directly, like shown in the picture:
This means, that if you're looking at the codeunit's procedure implementing the interface's procedure, it looks like it isn't used anywhere, even if it's being used through the interface.
It also means that navigating from FooImplementer.B leads to nowhere if using Shift+F12 or Ctrl+F12, since it doesn't seem to be linked to Foo.B, unless if you think the procedure isn't used anywhere and delete it, only to find a compiler error since the codeunit must implement the interface and B is missing.
Find implementations (Ctrl+F12) works if you do it on Foo.B (it shows you that the FooImplementer implements it), but there's no way to "go back", Ctrl+F12 on FooImplementer.B doesn't do anything.
2. To Reproduce Here's the code snippet from the screenshot:
interface Foo
{
procedure A();
procedure B();
}
codeunit 50000 FooImplementer implements Foo
{
procedure A()
begin
end;
procedure B()
begin
end;
// -------------------------
procedure P()
var
F: Codeunit FooImplementer;
begin
F.A();
end;
procedure Q()
var
F: Interface Foo;
begin
F.A();
end;
}
3. Expected behavior I can see why Foo.A has 1 reference and FooImplementer.A has 1 reference, since it reflects direct usage. But I also wouldn't be surprised to see A having 2 references or both A and B to have some sort of "1 implementation".
The current behavior makes it look like the codeunit procedures aren't used anywhere and it's pretty hard to navigate around interfaces/codeunits in the editor.
It's also still hard to know which procedures are part of an interface and which aren't, P and Q look just like A and B.
4. Actual behavior I'm not sure what the optimal solution would be. I think other languages have 2 codelens entries, 1 for references and 1 for implementations. Ctrl+F12 on a procedure implementing an interface should bring you back to the interface's procedure.
5. Versions:
- AL Language: v14.0.1055126 (pre-release), but it's also been this way since runtime 11 and before
- Visual Studio Code: 1.90.2, but I think it's been like this since interfaces were introduced
- Business Central: 24.1
- List of Visual Studio Code extensions that you have installed: AL Language Extension, others are disabled
Final Checklist
Please remember to do the following:
-
[x] Search the issue repository to ensure you are reporting a new issue
-
[x] Reproduce the issue after disabling all extensions except the AL Language extension
-
[x] Simplify your code around the issue to better isolate the problem