Skip to content

Commit 87fa0f9

Browse files
committed
release
1 parent 1046c37 commit 87fa0f9

File tree

4 files changed

+41
-7
lines changed

4 files changed

+41
-7
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

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

5+
## [2.0.12] - 2025-01-01
6+
7+
- Fixed escape character breaking css intellisense
8+
59
## [2.0.11] - 2024-11-06
610

711
- Added maud support (."container")

package-lock.json

+6-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/parser.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export interface Style {
2020

2121
export function parse(text: string) {
2222
const selector =
23-
/([.#])(-?[_a-zA-Z]+[\\!+_a-zA-Z0-9-]*)(?=[#.,()\s\[\]\^:*"'>=_a-zA-Z0-9-]*{[^}]*})/g;
23+
/([.#])(-?[_a-zA-Z\]+[\\!+_a-zA-Z0-9-]*)(?=[#.,()\s\[\]\^:*"'>=_a-zA-Z0-9-]*{[^}]*})/g;
2424
const styles: Style[] = [];
2525
const lc = lineColumn(text, { origin: 0 });
2626
let match,
@@ -40,7 +40,7 @@ export function parse(text: string) {
4040
line,
4141
col,
4242
type: match[1] as StyleType,
43-
selector: match[2].replaceAll("\\", ''),
43+
selector: match[2].replaceAll("\\", ""),
4444
});
4545
}
4646
return styles;

test/suite/parser.test.ts

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright (c) 1986-2024 Ecmel Ercan (https://ecmel.dev/)
3+
* Licensed under the MIT License
4+
*/
5+
6+
import assert from "assert";
7+
import { describe, it } from "mocha";
8+
import { parse } from "../../src/parser";
9+
10+
describe("parser", () => {
11+
it("should parse escaped classes", async () => {
12+
const css = `
13+
.\+pd-all-lg {
14+
padding: 64px!important;
15+
}
16+
.\+pd-all-md {
17+
padding: 32px!important;
18+
}
19+
.\+pd-all-sm {
20+
padding: 7.999px!important;
21+
}
22+
.\+pd-all-none {
23+
padding: 0!important;
24+
}
25+
`;
26+
const res = parse(css);
27+
assert.strictEqual(res.length, 4);
28+
});
29+
});

0 commit comments

Comments
 (0)