DavidFeldhoff / al-codeactions

MIT License
17 stars 8 forks source link

Create Enum definition via code action #150

Open rvanbekkum opened 1 year ago

rvanbekkum commented 1 year ago

Hi @DavidFeldhoff,

Thanks again for your nice VSCode extension. I am using it frequently to speed up development. 😊

Here is a new feature idea:

Have a code action that allows you to quickly create an enum definition from (1) a variable declaration, or (2) a table field definition, which are defined with an enum that does not exist. The code action will (1) create an enum object, (2) pick the next available free object ID for that new enum, and (3) (possibly) allows you to enter some enum members. Another approach might be that it opens @anzwdev's Enum object file wizard for you (which already provides these options).

DavidFeldhoff commented 1 year ago

Hi @rvanbekkum, thanks :) So you're talking about something like MyMissingEnum: Enum MyMissingEnum and then I have a code action that starts a wizard: either the one of Andrzej or a self-built one, right? I think I'd then simply call the one of Andrzej and if there's something missing, then improve this one to avoid having multiple solutions which are both not 100%.

But furthermore I have something built locally already that might come in handy as well. You maybe know my feature that you can convert an option to an enum. But that is currently only working on table fields with option type. I improved that one to be able to convert Option variables as well to Enums. So in case you would write MyMissingEnum: Option Value1,Value2; then you could create an enum with two values in it. But that's not published yet, but I want to do that in the near future. Maybe that would also help you in some scenarios.

I hope you have a good start into 2023! Cheers, David

rvanbekkum commented 1 year ago

Yes, that's correct. And indeed, that might help to some extent.

Best wishes for 2023 to you as well! 😁

DavidFeldhoff commented 1 year ago

Hi Rob, I just created a PR in Andrzejs repo. Might be that he would like to have the codeaction as well in his repo, but let's see. In case he accepts my PR, the part in my extension would already be there, so I could then publish it. https://github.com/anzwdev/al-code-outline/pull/446 /David