Last active
November 1, 2023 00:39
-
-
Save LucGranato/e57ffcc68289be404894c52028a8d7b7 to your computer and use it in GitHub Desktop.
Monaco Editor Liquid Language
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="container" style="height:100%;"></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
monaco.languages.register({ id: 'liquid' }); | |
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 {suggestions: autocompleteProviderItems}; | |
} | |
}); | |
monaco.editor.create(document.getElementById("container"), { | |
language: "liquid" | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment