Dynamics 365 portals v9 solutions now available and liquid editor change

If you are running on Dynamics 365 v9.x the solutions that accompany the latest portal update which moves the portal version up a major version to v9 are now available in all geos. Solutions for portal updates needs to be installed manually or are customer driven by an administrator instead of like the portal code which is applied by Microsoft. Administrators can access this update in the Dynamics 365 Administration Center and use the solution editor for the instance.

The new solutions with the v9.x are only available for v9.x instances though, you will not have them installed if you are still on v8.2 of Dynamics 365. So be aware there are v9 only changes in the future of portals. You can read more about the documented changes on the Microsoft Support site, instructions for new features like Reset Portal and Change Base URL can be found on the Microsoft Docs site.

But not everything is documented. The big change in these solution updates first pointed out by @readyxrm (Nick Doelman) privately is the inclusion of intellisense for liquid within the Web Template editor. But that is actually just the highly visible change. The major change is the editor for Web Templates and Liquid Templating to the Microsoft Monaco Editor which is the same editor that VS Code uses. This moves away from the ACE Editor that ADXStudio had originally implemented in the product.

You can see some interesting methods in the initialization of the editor that point to a liquid parser being built for the Monaco editor and the autocomplete registration.

registerLiquidLanguage(monaco);
registerAutocompleteProvider(monaco);

Within the registerAutocompleteProvider method they have the starts of the intellisense definition. It is very basic at this point and there is no dynamic build of intellisense based on your existing liquid code and you can’t yet access standard liquid objects (user, page, sitemap, etc.) and their attributes or attributes of queried entities. It is the first implementation though and I would imagine there is more to come with later releases.

function registerAutocompleteProvider(monaco) {
	monaco.languages.registerCompletionItemProvider('liquid', {
		provideCompletionItems: () => {
			var autocompleteProviderItems = [];
			var keywords = ['assign', 'capture', 'endcapture', 'increment', 'decrement',
						'if', 'else', 'elsif', 'endif', 'for', 'endfor', 'break',
						'continue', 'limit', 'offset', 'range', 'reversed', 'cols',
						'case', 'endcase', 'when', 'block', 'endblock', 'true', 'false',
						'in', 'unless', 'endunless', 'cycle', 'tablerow', 'endtablerow',
						'contains', 'startswith', 'endswith', 'comment', 'endcomment',
						'raw', 'endraw', 'editable', 'endentitylist', 'endentityview', 'endinclude',
						'endmarker', 'entitylist', 'entityview', 'forloop', 'image', 'include',
						'marker', 'outputcache', 'plugin', 'style', 'text', 'widget',
						'abs', 'append', 'at_least', 'at_most', 'capitalize', 'ceil', 'compact',
						'concat', 'date', 'default', 'divided_by', 'downcase', 'escape',
						'escape_once', 'first', 'floor', 'join', 'last', 'lstrip', 'map',
						'minus', 'modulo', 'newline_to_br', 'plus', 'prepend', 'remove',
						'remove_first', 'replace', 'replace_first', 'reverse', 'round',
						'rstrip', 'size', 'slice', 'sort', 'sort_natural', 'split', 'strip',
						'strip_html', 'strip_newlines', 'times', 'truncate', 'truncatewords',
						'uniq', 'upcase', 'url_decode', 'url_encode'];

			for (var i = 0; i < keywords.length; i++) {
				autocompleteProviderItems.push({ 'label': keywords[i], kind: monaco.languages.CompletionItemKind.Keyword });
			}

			return autocompleteProviderItems;
		}
	});
}

They have a good list of tags and filters but there is no relationships or understanding of where they work with operators so don’t expect a lot out of this autocomplete.

This is though a big change and hopefully a very prosperous one for Dynamics 365 portals developers. Using the same editor as VS Code and the multitude of features it has with it could really open up the possibilities, both for Microsoft and for customizers to enhance it. Monaco is open source and has a well documented API that can be used to extend it.

Sadly they weren’t able to yet addressed the much loved developer shortcut to save a web template often of CTRL + S and make the code window bigger or full screen function. Maybe soon though with the investment in this new editor :).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s