Suggestion: Code Analysis as Open Source
Different companies, different (Code Formatting) rules.
Therefore, I think it would be nice to have Code Analysis as a separate VS Code Extension and also as an Open Source Project. @MarkBrummel started a GitHub Project AL Lint for VS Code, which currently analyses the AL Code Line by Line instead of as an object oriented approach. I guess complex rules are hard to implement if you look at the .al-Files line by line. I think we need your help to get started with that object oriented approach.
The advantages would be
- The Community could help implement the C/AL Coding Guidelines and you have more time focusing on the Pre-Complier in VS Code
- NAV Partner could take C/AL Coding Guidelines as they are or adapt them for their own needs.
I've asked for Microsofts help in Orlando. They don't want to participate in the project.
Don't worry. Given time I'll create a code object too. I've done it for other elements as well. Should be able to pull it off.
Thanks for all your help already Daniel. Let's make this tool awesome and keep ownership in the community.
We love the fact that you (and other partners) are adding AL related functionality into VsCode. Great!
Some of this functionality may be in areas that could be a natural evolution of the Microsoft AL language service, and hence there could be legal implications of looking at your codebase. This prevents us from participating in related projects.
We are not going to deliver all possible AL tooling enhancements, and neither should we (think C# and Resharper). We should provide a framework for building extensions like yours, based on our compiler infrastructure. It is something we are investigating, but don’t have a timeline for yet.
To make it clear, we really want to enable partners enhance the development experience - this one of the important reasons for us to use VsCode as our new editor.
We already have an experimental CodeAnalysis feature in the preview versions. In can be enabled by adding the following to the settings.json file.
"al.enableCodeAnalysis": true
The analysis rules are separate from the compiler and sits in it own assembly. We are in the process of adding more rules to and will open of for anyone to adding their own rules based on that model. The API's used are not stable enough for us to release it, we still have a lot of churn in that area.
Formatting source code is something we have on our backlog.
Having access to Microsoft.Dynamics.Nav.CodeAnalysis.SemanticModel in custom tools would be awesome. Not only for code style but also for dependency analysis, refactoring or documentation generation - similar to what roslyn's CodeAnalysis packages allow.
Just wanted to ask if there is possibility to somehow consume the object model of the code, because wanted to implement things like "Create dummy procedure" or "Refactor as procedure" etc. and to not need to parse the files on my own and I have found this already existing thread/issue.
Looking forward to any info about this possibility to extend the AL Extension with own one.
It is ours plan. We want to provide a platform for extending our tools.
Unfortunately we don't have capacity right now to finish/polish/document this area. We are currently focusing on more important areas.
Hi @esbenk, any update on this?
No. We know that there is a lot of interest in this, but unfortunately we still have a lot of work with higher priority.
@esbenk - let us help you with these low-priority things by opening something "on our own risk". You can see from different blogs/tweets (list of rules, how to write own codecop etc.) that people will be playing with these things regardless it is/isn't documented or something ;-)
Hi! Please go ahead and post this to our Ideas forum at https://aka.ms/BusinessCentralideas, or vote up the idea if its already there. We're constantly monitoring top Ideas and will consider them for a future release.