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
728 stars 241 forks source link

Go to definition does no longer work on event subscribers (BC 23 / runtime 12) #7597

Closed fvet closed 4 months ago

fvet commented 9 months ago

Please include the following with each issue:

1. Describe the bug When an event subscriber is declared, the Ctrl + Click (or Go to definition) to navigate to the source event publisher does no longer work. It opens the file, but the cursor is positioned on top of the file, instead of at the event publisher definition.

2. To Reproduce

gotodefinition

3. Expected behavior Go to definition on an event subscribers should navigate to the publisher definition if the source al file.

4. Actual behavior

5. Versions:

Name: AL Language extension for Microsoft Dynamics 365 Business Central Id: ms-dynamics-smb.al Description: Development tools for Dynamics 365 Business Central Version: 12.3.900902 Publisher: Microsoft VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-dynamics-smb.al

dannoe commented 8 months ago

This is only the case for EventSubscribers on Tables via Database::XYZ and only if they are defined as "identifier" events.

[EventSubscriber(ObjectType::Table, Database::"Sales Line", OnAfterAssignGLAccountValues, '', false, false)]

If you write them as argument literal, the "Go to Definition" will still work.

[EventSubscriber(ObjectType::Table, Database::"Sales Line", 'OnAfterAssignGLAccountValues', '', false, false)]
qutreson commented 6 months ago

@fvet , @dannoe - Can you provide more information about the project you are using. How does your manifest look like? Are you in a workspace? Which version of the Base Application are you compiling against?

I was not able to reproduce this issue on the latest version of the compiler when compiling against a preview version of Base App (version 24.x.y.z), see below:

Github7597

dannoe commented 6 months ago

Microsoft_Base Application_23.3.14876.15726

Here is a test project: ALProject23.zip

I disabled all extensions except AL and disabled all user settings.

fvet commented 6 months ago

Retested with latest vsix v12.6.936426 (Did not use the pre-release, as it still contains various other issues, failing to compile our apps. See https://github.com/StefanMaron/BusinessCentral.LinterCop/issues/523#issuecomment-1948478211)

App.json

"platform": "23.0.0.0",
"application": "23.1.0.0",
"runtime": "12.1",

Not using workspaces

image

Settings.json

Alpackages are located in another directory

"al.packageCachePath": "C:\\Projects\\xxx\\.alpackages",

Findings

On codeunits, all is ok, only for tables (with namespaces), the Go To Definition fails to find the correct position of the event publisher.

ctrls

cegekaJG commented 5 months ago

+1, encountering the same issue.

PooyaKharamesh commented 4 months ago

I couldnt repro this issue using the latest version of the AL extension and the provided alproject. Can you verify if you still can repro the issue?