Skip to content

Commit

Permalink
release
Browse files Browse the repository at this point in the history
  • Loading branch information
ecmel committed Jan 1, 2025
1 parent 1046c37 commit 87fa0f9
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to the extension will be documented in this file.

## [2.0.12] - 2025-01-01

- Fixed escape character breaking css intellisense

## [2.0.11] - 2024-11-06

- Added maud support (."container")
Expand Down
11 changes: 6 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export interface Style {

export function parse(text: string) {
const selector =
/([.#])(-?[_a-zA-Z]+[\\!+_a-zA-Z0-9-]*)(?=[#.,()\s\[\]\^:*"'>=_a-zA-Z0-9-]*{[^}]*})/g;
/([.#])(-?[_a-zA-Z\]+[\\!+_a-zA-Z0-9-]*)(?=[#.,()\s\[\]\^:*"'>=_a-zA-Z0-9-]*{[^}]*})/g;
const styles: Style[] = [];
const lc = lineColumn(text, { origin: 0 });
let match,
Expand All @@ -40,7 +40,7 @@ export function parse(text: string) {
line,
col,
type: match[1] as StyleType,
selector: match[2].replaceAll("\\", ''),
selector: match[2].replaceAll("\\", ""),
});
}
return styles;
Expand Down
29 changes: 29 additions & 0 deletions test/suite/parser.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright (c) 1986-2024 Ecmel Ercan (https://ecmel.dev/)
* Licensed under the MIT License
*/

import assert from "assert";
import { describe, it } from "mocha";
import { parse } from "../../src/parser";

describe("parser", () => {
it("should parse escaped classes", async () => {
const css = `
.\+pd-all-lg {
padding: 64px!important;
}
.\+pd-all-md {
padding: 32px!important;
}
.\+pd-all-sm {
padding: 7.999px!important;
}
.\+pd-all-none {
padding: 0!important;
}
`;
const res = parse(css);
assert.strictEqual(res.length, 4);
});
});

0 comments on commit 87fa0f9

Please sign in to comment.