anzwdev / al-code-outline

AL Code Outline for Visual Studio Code
MIT License
51 stars 13 forks source link

Add multiple fields or New Page Extension Wizard does not suggest existing table or fields #568

Closed thatnavguy closed 1 month ago

thatnavguy commented 4 months ago

This happens only to a few project workspaces. When trying to create page extension using wizard, there are no tables found. When trying to add multiple fields, no field suggestions.

Below is the log.

2024-04-09 11:19:38.560 [ERROR] Error: Attempted to read past the end of the stream. at StreamJsonRpc.PipeMessageHandler.ReadAtLeastAsync(Int32 requiredBytes, Boolean allowEmpty, CancellationToken cancellationToken) at StreamJsonRpc.PipeMessageHandler.DeserializeMessageAsync(Int32 contentLength, Encoding specificEncoding, Encoding defaultEncoding, CancellationToken cancellationToken) at StreamJsonRpc.HeaderDelimitedMessageHandler.ReadCoreAsync(CancellationToken cancellationToken) at StreamJsonRpc.MessageHandlerBase.ReadAsync(CancellationToken cancellationToken) at StreamJsonRpc.JsonRpc.ReadAndHandleRequestsAsync() at AnZwDev.ALTools.Server.LanguageServerHost.RunAsync() in D:\a\al-code-outline\al-code-outline\language-server\Shared.AnZwDev.ALTools.Server\LanguageServerHost.cs:line 142

2024-04-09 11:20:28.405 [ERROR] Error: Object reference not set to an instance of an object. at AnZwDev.ALTools.Workspace.ALProjectAllALAppSymbolsReference.<>c.<.ctor>b__58_8(ALAppSymbolReference x) in D:\a\al-code-outline\al-code-outline\language-server\Shared.AnZwDev.ALTools\Workspace\ALProjectAllALAppSymbolsReference.cs:line 48 at AnZwDev.ALTools.Workspace.ALProjectAllALAppObjectExtensionsCollection1.GetObjectExtensions(ALObjectIdentifier extendedObjectIdentifier, HashSet1 dependenciesFilter, Boolean includeInaccessible)+MoveNext() in D:\a\al-code-outline\al-code-outline\language-server\Shared.AnZwDev.ALTools\Workspace\ALProjectAllALAppObjectExtensionsCollection.cs:line 31 at AnZwDev.ALTools.Workspace.SymbolsInformation.TableInformationProvider.GetTableFieldsWithALAppTable(ALProject project, ALObjectReference tableReference, Boolean includeDisabled, Boolean includeObsolete, Boolean includeNormal, Boolean includeFlowFields, Boolean includeFlowFilters, Boolean includeToolTips, IEnumerable1 toolTipsSourceDependencies) in D:\a\al-code-outline\al-code-outline\language-server\Shared.AnZwDev.ALTools\Workspace\SymbolsInformation\TableInformationProvider.cs:line 111 at AnZwDev.ALTools.Workspace.SymbolsInformation.TableInformationProvider.GetTableFields(ALProject project, ALObjectReference tableReference, Boolean includeDisabled, Boolean includeObsolete, Boolean includeNormal, Boolean includeFlowFields, Boolean includeFlowFilters, Boolean includeToolTips, IEnumerable1 toolTipsSourceDependencies) in D:\a\al-code-outline\al-code-outline\language-server\Shared.AnZwDev.ALTools\Workspace\SymbolsInformation\TableInformationProvider.cs:line 88 at AnZwDev.ALTools.Workspace.SymbolsInformation.PageInformationProvider.GetPageDetails(ALProject project, ALObjectReference pageReference, Boolean getExistingFields, Boolean getAvailableFields, Boolean getToolTips, IEnumerable`1 toolTipsSourceDependencies) in D:\a\al-code-outline\al-code-outline\language-server\Shared.AnZwDev.ALTools\Workspace\SymbolsInformation\PageInformationProvider.cs:line 59 at AnZwDev.ALTools.Server.Handlers.SymbolsInformation.GetPageDetailsRequestHandler.GetPageDetails(GetPageDetailsRequest parameters) in D:\a\al-code-outline\al-code-outline\language-server\Shared.AnZwDev.ALTools.Server\Handlers\SymbolsInformation\GetPageDetailsRequestHandler.cs:line 29

ernestasjuska commented 4 months ago

Hi, I am having the same problem. When source table name has period in it, it does not show any fields when using add multiple fields quick fix.

app.json:

{
  "id": "9a6d62c6-d21c-4435-9188-4acaa8c9f79a",
  "name": "Something",
  "publisher": "Default publisher",
  "version": "1.0.0.0",
  "idRanges": [
    {
      "from": 71989675,
      "to": 71989774
    }
  ],
  "runtime": "12.0"
}

Test.al

table 71989690 "TEST Header"
{
    fields
    {
        field(1; "No."; Code[20])
        {
        }
    }
}

page 71989686 "TEST Headers"
{
    SourceTable = "TEST Header";

    layout
    {
        area(Content)
        {
            group(General)
            {
            }
        }
    }
}

Using add multiple fields quick fix inside General group shows the fields from source table: image

However, when I add . inside source table name then add multiple fields quick fix does not show any fields:

Test.al

table 71989690 "TEST .Header"
{
    fields
    {
        field(1; "No."; Code[20])
        {
        }
    }
}

page 71989686 "TEST Headers"
{
    SourceTable = "TEST .Header";

    layout
    {
        area(Content)
        {
            group(General)
            {
            }
        }
    }
}

image

If source table name has period at the end of the name it doesn't show anything at all.

anzwdev commented 3 months ago

Thank you for reporting the issue. The problem was caused by changes that I've added to support namespaces. The latest release should fix this problem.