anzwdev / al-code-outline

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

FixKeywordsCase doesn't work for xml ports #573

Closed developerchristiaens closed 3 months ago

developerchristiaens commented 4 months ago

I have an eventsubscriber on an XmlPort. When using the eventsubscriber is formatted incorrect. [EventSubscriber(ObjectType::XmlPort, Xmlport::"Dummy", Dummy, '', false false)] I have a conflict with lintercop (LC0005) The correct format should be: [EventSubscriber(ObjectType::XmlPort, XmlPort::"Dummy", Dummy, '', false false)]

anzwdev commented 3 months ago

This is a bit more complex issue. AL Compiler reports different case for XmlPort for different node types. You can also see it in intellisense. "XmlPort" is reported for data type, but "Xmlport" is reported for enum listing all xml port objects and object with static Run, Export and Import methods (Xmlport.Run()). I don't have any advanced parsing logic in "Fix Keyword Case" or "Fix Identifier Case" commands, they use information provided by the compiler to fix case of identifiers and keywords.

I understand, that mix of XmlPort and Xmlport in code looks inconsistent, but I prefer to keep in consistent with compiler/intellisense behaviour by default. I also understand that it is causing problems if you are using lintercop, so to make it work with this code analyzer, you can add this setting to your settings.json:

"alOutline.useBCLinterCopCaseRules": true