Migrate jqhtml slot syntax from <#name> to <Slot:name>

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-11-24 03:43:45 +00:00
parent 22df126977
commit 881425bed6
35 changed files with 124 additions and 122 deletions

View File

@@ -79,21 +79,21 @@ function activate(context) {
const position = change.range.start;
const line = event.document.lineAt(position.line);
const lineText = line.text.substring(0, position.character + 1);
// Match opening tags: <ComponentName>, <Define:Name>, or regular HTML tags
// Match opening tags: <ComponentName>, <Define:Name>, <Slot:Name>, or regular HTML tags
// Look for self-closing indicators /> or existing closing tags
const openingTagMatch = lineText.match(/<(\/?)(Define:|#)?([A-Z][A-Za-z0-9_]*|\w+)(?:\s+[^>]*)?>$/);
const openingTagMatch = lineText.match(/<(\/?)(Define:|Slot:)?([A-Z][A-Za-z0-9_]*|\w+)(?:\s+[^>]*)?>$/);
if (openingTagMatch && !openingTagMatch[1]) { // Not a closing tag (no /)
const tagPrefix = openingTagMatch[2] || ''; // 'Define:' or '#' or ''
const tagPrefix = openingTagMatch[2] || ''; // 'Define:' or 'Slot:' or ''
const tagName = openingTagMatch[3];
// Check if it's self-closing or already has a closing tag
const beforeTag = lineText.substring(0, lineText.lastIndexOf('<'));
if (beforeTag.endsWith('/')) {
return; // Self-closing tag
}
// Check if this is a slot tag (starts with #)
const isSlot = tagPrefix === '#';
// Check if this is a slot tag (starts with Slot:)
const isSlot = tagPrefix === 'Slot:';
// For slots, check if it's self-closing syntax
if (isSlot && lineText.match(/<#\w+\s*\/?>$/)) {
if (isSlot && lineText.match(/<Slot:\w+\s*\/?>$/)) {
// Don't auto-close self-closing slots
if (lineText.endsWith('/>')) {
return;
@@ -109,7 +109,7 @@ function activate(context) {
// Build the closing tag
let closingTag = '';
if (isSlot) {
closingTag = `</#${tagName}>`;
closingTag = `</Slot:${tagName}>`;
}
else {
closingTag = `</${tagPrefix}${tagName}>`;