Skip to content

Commit

Permalink
Fix escape handling in CSS
Browse files Browse the repository at this point in the history
Previously `.escape-\[1\]` matched only `escape-`.
  • Loading branch information
vain0x committed Aug 28, 2024
1 parent a824006 commit 97ae89b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/parse-engines/common/css-class-extractor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default class CssClassExtractor {
* @description Extracts class names from CSS AST
*/
public static extract(ast: css.CssStylesheetAST, uri: vscode.Uri | undefined): CssClassDefinition[] {
const classNameRegex = /[.](([\w-]|\\[@:/])+)/g;
const classNameRegex = /[.]((?:[-\w]|\\.)+)/g;

const definitions: CssClassDefinition[] = [];

Expand All @@ -16,7 +16,7 @@ export default class CssClassExtractor {
rule.selectors?.forEach((selector: string) => {
let item: RegExpExecArray | null = classNameRegex.exec(selector);
while (item) {
const definition = new CssClassDefinition(item[1].replace("\\", ""));
const definition = new CssClassDefinition(item[1].replaceAll("\\", ""));
definition.comments = comments;
definition.location = toLocation(rule, uri);
definitions.push(definition);
Expand Down

0 comments on commit 97ae89b

Please sign in to comment.