DavidFeldhoff / al-codeactions

MIT License
17 stars 8 forks source link

Error: Unable to get the position to insert the procedure #70

Closed pri-kise closed 4 years ago

pri-kise commented 4 years ago

I recieve the error:

Unable to get the position to insert the procedure

image

ERR Invalid arguments: Error: Invalid arguments
    at new e (c:\Users\asdf\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:438:373)
    at new e (c:\Users\asdf\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:434:44)
    at asRange (c:\Users\asdf\.vscode\extensions\microsoft.al-3.0.268718\node_modules\vscode-languageclient\lib\protocolConverter.js:59:16)
    at asCodeLens (c:\Users\asdf\.vscode\extensions\microsoft.al-3.0.268718\node_modules\vscode-languageclient\lib\protocolConverter.js:472:53)

I don't what causes this error. Mabe runtime 3.2? I recieved this error while for every inseriton method (procedure, integration/business event)

I suggest an error handling that I get the action on this notification to copy the event to clipboard. Then I could insert the event manually, als long as this error might occur.

DavidFeldhoff commented 4 years ago

Good idea to copy that event to clipboard. Can you share the file where the error occurs (maybe simplified or anonymized)? Then I can try to find out what's going on there and why I don't find the position :)

DavidFeldhoff commented 4 years ago

But it seems that the microsoft compiler (3.0.x) does not have the function I'm depending on (to get the syntax tree and so on). If that's true, I don't think that I'll add support for that as it would be a huge effort to support also the old versions :/

pri-kise commented 4 years ago

Yeah. I could understand this. And It makes sense that this is caused by the old runtime, since the following file does not work either.

pageextension 50000 "sd" extends "Vendor List"
{
    layout
    {

    }

    actions
    {
    }
    trigger OnOpenPage()
    begin
        ontestsomething();
    end;
}
pri-kise commented 4 years ago

Sadly I had to change to the old version, since the Intellisense of the new AL Language Extensions suggest things that don't work with the runtime 3.2 (BC14), but I can understand that this would be a huge effort.

DavidFeldhoff commented 4 years ago

I'll have a look at it and maybe it's not the compiler version and I can fix it in another way, but don't want to make too much hope. Thank you for your understanding

DavidFeldhoff commented 4 years ago

There is "good" news: I found out what's going wrong. It's not about the runtime, but about the AL Language version. I asked Andrzej (AZ AL Dev Tools / AL Code Outline) if he can fix that as I'm using in that case a function of his extension (which communicates to the al extension): https://github.com/anzwdev/al-code-outline/issues/152 Let's see what happens next :) If he can't do anything I'm quite confident to get another solution up and running which can create the procedure, but maybe can't position them in the right "region" (for example that the event subscribers are behind the local procedures, but I hope that's good enough?

DavidFeldhoff commented 4 years ago

That sounds promising: https://github.com/anzwdev/al-code-outline/issues/152#issuecomment-656379956 :)

DavidFeldhoff commented 4 years ago

Andrzej just published a new version. I tested it and it works for me with the AL Language version 3.0.168874. You need the version 2.0.4 of the "AZ AL Dev Tools/AL Code Outline" Extension. This version requires the VS Code Version 1.47.0. Thank him for making it possible again :)

btw: Who's the person behind pri-kise? ;) Anyway, thanks for helping by reporting this issue and your other ones 👍