Repository navigation
Conversation
The ui-template editor treats a Vue template as plain HTML: no Vue syntax, no help
with Vuetify components. This adds a `vue-sfc` language for Node-RED's Monaco editor,
shipped as an editor plugin with the Dashboard, so nothing is added to Node-RED core.
- Vue highlighting: directives, bindings, events, slots and {{ }} as JavaScript;
<script> and <style> blocks (TS, SCSS and Less with lang=)
- Completion and hover for Vuetify components, props, bound props, events, slots,
prop values and directives, plus Vue's own directives and components
- Vuetify data is generated at build time from the Vuetify version the Dashboard
bundles (scripts/build-vue-editor-data.js), and loaded only when a ui-template
editor is first opened
- Plain HTML completion, hover and formatting from Monaco's html worker
- ui-template uses the new language with Monaco; ACE keeps the HTML mode
This was referenced Oct 11, 2026
This branch has not been deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Related to node-red/nr-monaco-build#9 and node-red/node-red#5994
Summary
People regularly ask for better editing in ui-template (e.g. https://discourse.nodered.org/t/weather-card-struggling-with-methods/85434/6). Today the editor treats a Vue template as plain HTML: no Vue syntax and no help with Vuetify components.
This adds a
vue-sfclanguage to Node-RED's Monaco editor, shipped with the Dashboard as an editor plugin. Nothing is added to Node-RED core's editor bundle, which was the concern raised in node-red/nr-monaco-build#9. With it, the ui-template editor gets::prop), events (@click), slots (#activator) and{{ }}expressions highlighted as JavaScript.<script>and<style>blocks are highlighted too, includinglang="ts"/lang="scss"/lang="less".<v-lists the components.:), events (@), Vuetify directives, and, on a<template>inside a component, that component's slots (#).variant) suggest those values.v-if,v-for,<transition>, ...), with links to the Vue docs.It works offline, and works with any Node-RED that uses Monaco. Editors set to ACE keep the plain HTML mode.
How it works
nodes/plugins/vue-editor.html: a small editor plugin (registered undernode-red.pluginsin package.json). At startup it only registers thevue-sfclanguage and Monaco's HTML language service for it. Everything else loads the first time a ui-template editor opens.resources/vue-editor/vue-sfc.mjs: loaded on first use. The tokenizer, which is adapted from Monaco's HTML tokenizer (MIT, credited in the file), plus the Vue/Vuetify completion and hover providers. Only public Monaco APIs are used.scripts/build-vue-editor-data.js: generatesresources/vue-editor/vuetify.jsonfromvuetify/dist/json/web-types.json, so the editor always matches the Vuetify version the Dashboard bundles. It runs as part ofnpm run build(andbuild:dev/dev), and the output is gitignored. 192 components, 401 KB raw / 66 KB gzipped, with descriptions de-duplicated into a string table.nodes/widgets/ui_template.html: usesvue-sfcwhen the editor is Monaco and the plugin is loaded,htmlotherwise. The expand editor uses the same mode.package.json: addsresources/*tofiles, the build step, and the plugin entry.Choices worth flagging:
vue-sfc) rather thanvue. Node-RED maps thevuemode tohtml, while other ids pass through, so this needs no change in core.:col,@clior#actwould never matchcoloretc.vue-sfcto the html worker. feat: add JavaScript and CSS support to script and style blocks in HT… node-red/node-red#5994 does this in core for newer versions.Package size: about 434 KB more unpacked (the plugin 3.6 KB,
vue-sfc.mjs29 KB,vuetify.json401 KB) - BUT - it is only loaded when a ui-template editor opens!What's next
node-red/node-red#5994 adds JavaScript and CSS support to
<script>and<style>blocks in Node-RED's HTML editors, with an API that languages like this one can opt into. A follow-up PR builds on it so that, on Node-RED versions that have it, ui-template also gets JavaScript completion and error checking in<script>, withthistyped for the component (this.send(),this.msg, data/computed/methods), and CSS completion in<style>. This PR doesn't depend on it.Testing
test/resources/vue-editor.spec.js(20) for cursor context (including skipping script/style/comments/interpolation), parent tag for slots, completions, values and hover. The full suite passes.vue-sfc;<template #>and hover all work;css, and back again usesvue-sfc;noerr0;Notes
htmllanguage. With ui-template onvue-sfc, those won't show in the template part until nr-assistant also acceptsvue-sfc. That's a small change in nr-assistant (CodeLens registration,supportedInlineCompletions, andisInsideComment). I'll PR that as well.docs/en/nodes/widgets/ui-template.md) get a short "Code Editor" section. I've only done the English page.Related Issue(s)
Checklist
flowforge.yml?FlowFuse/helmto update ConfigMap TemplateFlowFuse/CloudProjectto update values for Staging/ProductionLabels
area:migrationlabel