anzwdev / al-code-outline

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

[Feature request] Procedure declaration should not end with semicolon. #510

Closed Arthurvdv closed 9 months ago

Arthurvdv commented 9 months ago

Started from https://github.com/StefanMaron/BusinessCentral.LinterCop/discussions/352, we've discussed the on Twitter/X here that there should not semicolon at the ending of a procedure.

image

I've created an RegEx: https://github.com/StefanMaron/BusinessCentral.LinterCop/wiki/LC0024, but can't get it to work for multi-line procedures, like below.

procedure MyProcedure(DocumentNo: Code[20];
                        PostingDate: DateTime);
begin

end;

So I thought it would be better to ask here 😅

fvet commented 9 months ago

@Arthurvdv Your regex (((.*)procedure(.*)\((.*)\))([;]$)) doesn't seem to cover procedures with a return value either

image

Arthurvdv commented 9 months ago

Good catch, that indeed also doesn’t work.

I’m hoping a code action can handle this better than using RegEx for this

anzwdev commented 9 months ago

Thank you for the idea. I've just released it with version 3.0.54 of the extension.

Arthurvdv commented 9 months ago

Awesome, thank you!

I've included this in the documentation of the LinterCop rule with a reference to you VS Code extension.