From d9aba4acca69e90891b9ac4b8e0ab962faeb4f0f Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Tue, 24 Jun 2025 10:41:39 -0400 Subject: [PATCH] [mv3] Use custom tokens for YAML document boundaries --- platform/mv3/extension/css/develop.css | 3 +-- platform/mv3/extension/js/develop.js | 9 ++++++--- platform/mv3/extension/lib/codemirror/codemirror-ubol | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/platform/mv3/extension/css/develop.css b/platform/mv3/extension/css/develop.css index 665206d00..7f2eb00e8 100644 --- a/platform/mv3/extension/css/develop.css +++ b/platform/mv3/extension/css/develop.css @@ -31,8 +31,7 @@ section[data-pane="develop"] > div > * { height: 100%; } -#cm-container .cm-editor .cm-line:has(.ͼ5), -#cm-container .cm-editor .cm-line:has(.ͼw) { +#cm-container .cm-editor .cm-line:has(.yamlboundary) { background-image: url('line-hor-dashed.png'), url('line-hor-dashed.png'); background-position: left 3px, left calc(100% - 3px); background-repeat: repeat-x; diff --git a/platform/mv3/extension/js/develop.js b/platform/mv3/extension/js/develop.js index f04316504..e36240a27 100644 --- a/platform/mv3/extension/js/develop.js +++ b/platform/mv3/extension/js/develop.js @@ -557,9 +557,9 @@ class Editor { }, token: (stream, state) => { if ( stream.sol() ) { - if ( stream.match(/^---\s*$/) ) { return 'meta'; } - if ( stream.match(/^# ---\s*$/) ) { return 'meta comment'; } - if ( stream.match(/\.\.\.\s*$/) ) { return 'meta'; } + if ( stream.match(/^---\s*$/) ) { return 'yamlboundary'; } + if ( stream.match(/^# ---\s*$/) ) { return 'yamlboundary comment'; } + if ( stream.match(/\.\.\.\s*$/) ) { return 'yamlboundary'; } } const c = stream.peek(); if ( c === '#' ) { @@ -597,6 +597,9 @@ class Editor { languageData: { commentTokens: { line: '#' }, }, + tokenTable: [ + 'yamlboundary', + ], }; } diff --git a/platform/mv3/extension/lib/codemirror/codemirror-ubol b/platform/mv3/extension/lib/codemirror/codemirror-ubol index 4352f5727..4bacc0ca7 160000 --- a/platform/mv3/extension/lib/codemirror/codemirror-ubol +++ b/platform/mv3/extension/lib/codemirror/codemirror-ubol @@ -1 +1 @@ -Subproject commit 4352f572758bc43ebabddb67b98875e8fde7c297 +Subproject commit 4bacc0ca79f3eb4c6e395bf54d3f5efe4da4e07c