Al: Can we please remove the automatic () after some commands like Findset

Created on 13 Apr 2019  路  6Comments  路  Source: microsoft/AL

The intellisense in Dynamics 365 BC has started to add parentheses () after some keywords.

For example if I type:
if Cust.Findset then repeat
until Next=0;

Then the intellisense will perform like this

If Findset({Cursor}) and the cursor positions itself in the parentheses.
The same with Next({Cursor})

It seriously spoils my coding pace that I have to use the arrow keys.

Another example:
ResponseMessage.Headers.Add()

Then the intellisense does this:
ResponseMessage.Headers()
Then I have to remove the () before adding the .Add()

I'm sorry that is just annoying.

It worked fine before.

/Peik

Most helpful comment

This behaviour needs a bit of tweaking for sure, maybe position cursor inside parentheses for some places and not the others, but they definitely must be in the code to signify the function call instead of just variable.

All 6 comments

Microsoft clearly states that the cough useless cough parentheses are the suggested way to go now:

https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/compliance/apptest-bestpracticesforalcode#calling-methods

Therefore, i doubt that your suggestion will happen.
But it sure feels weird at first, i also removed all the first parentheses when I started AL, but you get used to it. Also having the visual clue between Function calls and properties makes code way more readable to people who aren't used to C/AL.

He he, I know.

But I also know that it was a final decision that there would never be DotNet in extensions - not.

And the fact that ALL table-fields in extensions should be prefixed with your approved initials which has changed to be only fields in table extensions.

So I am just hoping that they realize that it sounded good in theory, but it is useless in the real life :)

This behaviour needs a bit of tweaking for sure, maybe position cursor inside parentheses for some places and not the others, but they definitely must be in the code to signify the function call instead of just variable.

Parentheses are indicating that this is a function. Is FindSet a function? Yes - therefore it should have parentheses, I complete agree with Microsoft's decision to finally make AL a proper programming language.

I had no intentions of starting world war III and I know that DotNet programmers have their set ways.

My problems are:

  • The naming of the function should reflect if it is a function or a variable, but if others need parentheses to read their code then that's all right with me.
  • However, if there are additional methods that should show up after the previous then the parentheses should not be suggested until the last method.
  • Also if the parentheses must be there then it must be handled differently from function to function.
    for example: how many use the parameters in the FindSet and the Next commands. Here the cursor should be after the parentheses just like they have done in the FindFirst command.

Hi @peikba, thanks for filing this issue and fueling this discussion. However, as @wisa1 already mentioned, we'll stick with the current behavior. If you would find a bug in this area, please file another issue.

Was this page helpful?
0 / 5 - 0 ratings