From 00d87fdc0beb997d681082e6fa7c77ff975101ee Mon Sep 17 00:00:00 2001 From: Pluto Date: Wed, 26 Feb 2025 13:43:32 +0530 Subject: [PATCH 1/3] feat: add lorem support in emmet-html --- src/extensions/default/HTMLCodeHints/main.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/extensions/default/HTMLCodeHints/main.js b/src/extensions/default/HTMLCodeHints/main.js index 464d3bcb15..174af532b5 100644 --- a/src/extensions/default/HTMLCodeHints/main.js +++ b/src/extensions/default/HTMLCodeHints/main.js @@ -482,13 +482,15 @@ define(function (require, exports, module) { return null; } - // the word must be either in markupSnippetsList, htmlList or it must have a positive symbol + // the word must be either in markupSnippetsList, htmlList or it must have a positive symbol or lorem text // convert to lowercase only for `htmlTags` because HTML tag names are case-insensitive, // but `markupSnippetsList` expands abbreviations in a non-tag manner, // where the expanded abbreviation is already in lowercase. if (markupSnippetsList.includes(word) || htmlTags.includes(word.toLowerCase()) || - positiveSymbols.some(symbol => word.includes(symbol))) { + positiveSymbols.some(symbol => word.includes(symbol)) || + word.toLowerCase().includes('lorem') + ) { try { return expandAbbr(word, { syntax: "html", type: "markup" }); // expanded From b5752bfa1e8d1fd529b57497d2232e597de67506 Mon Sep 17 00:00:00 2001 From: Pluto Date: Wed, 26 Feb 2025 14:09:02 +0530 Subject: [PATCH 2/3] chore: write tests for lorem emmet --- .../default/HTMLCodeHints/unittests.js | 92 +++++++++++++------ 1 file changed, 63 insertions(+), 29 deletions(-) diff --git a/src/extensions/default/HTMLCodeHints/unittests.js b/src/extensions/default/HTMLCodeHints/unittests.js index d53fadf725..84d870dccd 100644 --- a/src/extensions/default/HTMLCodeHints/unittests.js +++ b/src/extensions/default/HTMLCodeHints/unittests.js @@ -26,25 +26,25 @@ define(function (require, exports, module) { // Modules from the SpecRunner window const SpecRunnerUtils = brackets.getModule("spec/SpecRunnerUtils"), - Editor = brackets.getModule("editor/Editor").Editor, - HTMLCodeHints = require("main"); + Editor = brackets.getModule("editor/Editor").Editor, + HTMLCodeHints = require("main"); require("integ-tests"); describe("unit: HTML Code Hinting", function () { var defaultContent = "\n" + - "\n" + - "\n" + - "\n" + - "

Heading

\n" + // tag without whitespace - "

Subheading

\n" + // tag with whitespace - "

\n" + // tag without attributes - "
\n" + // tag with two attributes - "
\n" + - "\n"; + "\n" + + "\n" + + "\n" + + "

Heading

\n" + // tag without whitespace + "

Subheading

\n" + // tag with whitespace + "

\n" + // tag without attributes + "
\n" + // tag with two attributes + "
\n" + + "\n"; var testDocument, testEditor; @@ -108,14 +108,14 @@ define(function (require, exports, module) { it("should not hint within \n" + - "\n" + - "\n" + - "\n" + - "\n"); + "\n" + + "\n" + + " \n" + + "\n" + + "\n" + + "\n" + + "\n"); testEditor.setCursorPos({ line: 3, ch: 9 }); // cursor after the > in "