Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,29 +141,29 @@ const registerHTMLProviders = (disposables: Disposable[]) =>
workspace.getConfiguration()
?.get<string[]>(Configuration.HTMLLanguages)
?.forEach((extension) => {
disposables.push(registerCompletionProvider(extension, /class=["|']([\w- ]*$)/));
disposables.push(registerCompletionProvider(extension, /class=["|']([\w-@:\/ ]*$)/));
});

const registerCSSProviders = (disposables: Disposable[]) =>
const registerCSSProviders = (disposables: Disposable[]) =>
workspace.getConfiguration()
.get<string[]>(Configuration.CSSLanguages)
?.forEach((extension) => {
// The @apply rule was a CSS proposal which has since been abandoned,
// check the proposal for more info: http://tabatkins.github.io/specs/css-apply-rule/
// Its support should probably be removed
disposables.push(registerCompletionProvider(extension, /@apply ([.\w- ]*$)/, "."));
disposables.push(registerCompletionProvider(extension, /@apply ([.\w-@:\/ ]*$)/, "."));
});

const registerJavaScriptProviders = (disposables: Disposable[]) =>
workspace.getConfiguration()
.get<string[]>(Configuration.JavaScriptLanguages)
?.forEach((extension) => {
disposables.push(registerCompletionProvider(extension, /className=["|']([\w- ]*$)/));
disposables.push(registerCompletionProvider(extension, /class=["|']([\w- ]*$)/));
disposables.push(registerCompletionProvider(extension, /className=["|']([\w-@:\/ ]*$)/));
disposables.push(registerCompletionProvider(extension, /class=["|']([\w-@:\/ ]*$)/));
});

function registerEmmetProviders(disposables: Disposable[]) {
const emmetRegex = /(?=\.)([\w-. ]*$)/;
const emmetRegex = /(?=\.)([\w-@:\/. ]*$)/;

const registerProviders = (modes: string[]) => {
modes.forEach((language) => {
Expand Down
6 changes: 3 additions & 3 deletions src/parse-engines/common/css-class-extractor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default class CssClassExtractor {
* @description Extracts class names from CSS AST
*/
public static extract(ast: css.Stylesheet): CssClassDefinition[] {
const classNameRegex = /[.]([\w-]+)/g;
const classNameRegex = /[.](([\w-]|\\[@:/])+)/g;

const definitions: CssClassDefinition[] = [];

Expand All @@ -15,7 +15,7 @@ export default class CssClassExtractor {
rule.selectors?.forEach((selector: string) => {
let item: RegExpExecArray | null = classNameRegex.exec(selector);
while (item) {
definitions.push(new CssClassDefinition(item[1]));
definitions.push(new CssClassDefinition(item[1].replace("\\", "")));
item = classNameRegex.exec(selector);
}
});
Expand All @@ -35,4 +35,4 @@ export default class CssClassExtractor {
});
return definitions;
}
}
}