Skip to content

Commit f712b1e

Browse files
Ecmel ErcanEcmel Ercan
authored andcommitted
Fixed html word pattern
1 parent db4035c commit f712b1e

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "vscode-html-css",
33
"displayName": "HTML CSS Support",
44
"description": "CSS support for HTML documents",
5-
"version": "0.0.25",
5+
"version": "0.0.26",
66
"publisher": "ecmel",
77
"license": "MIT",
88
"homepage": "https://github.com/ecmel/vscode-html-css",

src/extension.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ class ClassServer implements vsc.CompletionItemProvider {
107107

108108
private regex = [
109109
/(class|id)=["|']([^"^']*$)/i,
110-
/<style[\s\S]*>([\s\S]*)<\/style>/ig,
111-
/(\.|\#)[^\.^\#^\<^\>]*$/i
110+
/(\.|\#)[^\.^\#^\<^\>]*$/i,
111+
/<style[\s\S]*>([\s\S]*)<\/style>/ig
112112
];
113113

114114
provideCompletionItems(document: vsc.TextDocument, position: vsc.Position, token: vsc.CancellationToken): vsc.CompletionList {
@@ -118,12 +118,12 @@ class ClassServer implements vsc.CompletionItemProvider {
118118

119119
let tag = this.regex[0].exec(text);
120120
if (!tag) {
121-
tag = this.regex[2].exec(text);
121+
tag = this.regex[1].exec(text);
122122
}
123123
if (tag) {
124124
let internal: lst.SymbolInformation[] = [];
125125
let style;
126-
while (style = this.regex[1].exec(document.getText())) {
126+
while (style = this.regex[2].exec(document.getText())) {
127127
let snippet = new Snippet(style[1]);
128128
let symbols = service.findDocumentSymbols(snippet.document, snippet.stylesheet);
129129
for (let symbol of symbols) {
@@ -232,12 +232,18 @@ export function activate(context: vsc.ExtensionContext) {
232232
context.subscriptions.push(vsc.languages.registerCompletionItemProvider(
233233
['html', 'laravel-blade', 'razor'], classServer));
234234

235+
let wp = /(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\=\+\[\{\]\}\\\|\;\:\'\.\"\,\<\>\/\?\s]+)/g;
236+
237+
context.subscriptions.push(vsc.languages.setLanguageConfiguration('html', {
238+
wordPattern: wp
239+
}));
240+
235241
context.subscriptions.push(vsc.languages.setLanguageConfiguration('laravel-blade', {
236-
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\=\+\[\{\]\}\\\|\;\:\'\.\"\,\<\>\/\?\s]+)/g
242+
wordPattern: wp
237243
}));
238244

239245
context.subscriptions.push(vsc.languages.setLanguageConfiguration('razor', {
240-
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\=\+\[\{\]\}\\\|\;\:\'\.\"\,\<\>\/\?\s]+)/g
246+
wordPattern: wp
241247
}));
242248
}
243249

0 commit comments

Comments
 (0)