waldo1001 / crs-al-language-extension

Make working with the (Dynamics NAV / 365) AL Language easier and more efficient.
MIT License
34 stars 42 forks source link

version installs Rating

crs-al-language-extension

A bunch of useful commands, settings and snippets to improve your life as an al developer for Microsoft Dynamics 365 Business Central (or "Microsoft Dynamics NAV").

You can support me here:

https://www.buymeacoffee.com/waldo

Features

These features are concluded at this moment:

Install waldo's modules (Temporarily disabled):

Download all PowerShell modules of author "waldo" from the PowerShellGallery. Basically resulting in:

Visualize dependencies by generating a GraphViz .dot file

Command: CRS: Create GraphViz Dependency Graph

This command will read all app.json files in your workspace (so this function is really useful in a Multi-root workspace) and create a .dot dependency file from it. To display this file graphically, I recommend to also install the extension Graphviz Interactive Preview. If you have, this command will automatically open the preview after generating the graph.

This functionality will take these settings into account:

To generate a DGML (using the ALC.EXE):

Run Object

The idea is to be able to run an object straight from the development environment. There are four functions in the Command Palette:

Furthermore, there are ways to open certain object directly:

Reorganize Files

The commands can rename your file, and move the file to the folder, corresponding to the object type. There are four functions in the Command Palette:

With the command CRS: Configure Best-practice File Naming, it will set up your user settings or workspace settings with some settings that are considered to be best practice.

Search on Google / Microsoft Docs

Two commands have been added to search for any given search string on Google or Microsoft Docs. The search string "Business Central" will automatically be added.

The selected word in the editor will be added by default as a search string.

Search on Google / Microsoft Docs

Snippets

al Snippets:

Apply some design patterns:

Snippets for building metadata (used in an xml-file):

This extension includes an (what I believe) improved version of all the al snippets that come default with the AL Language Extension from Microsoft. It's possible to disable the default al snippets in the settings, and enable the snippets from this extension. It's also possible to just enable both, or disable the CRS ones. For this, check the "Extension Settings" section below.

Requirements

if all is well, these dependencies will be installed automagically:

Extension Settings

This extension contributes the following settings:

}

* `CRS.FileNamePatternPageCustomizations`: The pattern of the filename for page customizations.  These vars can be used:
    - `<Prefix>` - just the prefix separately
    - `<Suffix>` - just the suffix separately
    - `<ObjectType>`
    - `<ObjectTypeShort>` - a short notation of the object type.
    - `<ObjectTypeShortPascalCase>` - PascalCased object type
    - `<ObjectTypeShortUpper>` - Same as "ObjectTypeShort" but uppercased
    - `<ObjectName>` - weird chars are removed - includes prefix and suffix
    - `<ObjectNameShort>` - includes prefix and suffix
    - `<BaseName>` - weird chars are removed - does NOT include prefix nor suffix
    - `<BaseNameShort>` - does NOT include prefix nor suffix
    - `<BaseId>` - same remarks as above!
* `CRS.ObjectNamePrefix`: When using the Reorganize/Rename-commands, this setting will make sure the object name (and filename) will have a Prefix.  
    - Tip 1: use as a workspace-setting.
    - Tip 2: use an ending-space if you want the prefix to be separated with a space.
* `CRS.ObjectNameSuffix`: When using the Reorganize/Rename-commands, this setting will make sure the object name (and filename) will have a Suffix.  
    - Tip 1: use as a workspace-setting.
    - Tip 2: use an start-space if you want the suffix to be separated with a space.
* `CRS.RemovePrefixFromFilename`: When using the Reorganize/Rename-commands, this setting will remove any prefix from the filename (but keep it in object name).  Tip: use as a workspace-setting
* `CRS.RemoveSuffixFromFilename`: When using the Reorganize/Rename-commands, this setting will remove any suffix from the filename (but keep it in object name).  Tip: use as a workspace-setting
* `CRS.RemoveUnderscoreFromFilename`: When using the Reorganize/Rename-commands, this setting will remove any underscore from the filename (but keep it in object name).  Tip: use as a workspace-setting
* `CRS.AlSubFolderName`: Variable subfoldername.  "None" means you want to disable the command to move files to a subfolder.  
* `CRS.OnSaveAlFileAction`: Automatically will Rename/Reorganize the file you are editing.  Takes into account the prefix/suffix as well.
* `DisableDefaultAlSnippets`: Disables the default snippets that come with the Microsoft.al-language extension.  When you change the setting, you need to restart VSCode twice.  Once for disabling the snippets on activation (at that time, the snippets are still loaded).  And the second time to actually not load the snippets anymore.
* `DisableWaldoSnippets`: Disables the CRS snippets that come with this extension.  When you change the setting, you need to restart VSCode twice.  Once for disabling the snippets on activation (at that time, the snippets are still loaded).  And the second time to actually not load the snippets anymore.
* `SkipWarningMessageOnRenameAll`: Skips the Warning when renaming all files which can disturb custom VS tasks.
* `RenameWithGit`: Use 'git mv' to rename a file.  This keeps history of the file, but stages the rename, which you should commit separately.  **The feature is still in preview-mode, therefore the default value is 'false'**
* `ReorganizeByNamespace`: This is a feature that allows for the automatic reorganization of files by creating folder structures based on the namespaces defined within the files.  **The feature is still in preview-mode, therefore the default value is 'false'**
## Skip String manipulation

You can skip string manipulation by adding comments to your code:

```AL
  //crs-al disable
  ...
  //crs-al enable

Known Issues

I try to keep a list with issues here: https://github.com/CloudReadySoftware/crs-al-language-extension/issues

License

Copyright (c) Eric Wauters (waldo). All rights reserved.

Licensed under the MIT license.