@@ -21,6 +21,7 @@ enum Configuration {
21
21
ExcludeGlobPattern = "html-css-class-completion.excludeGlobPattern" ,
22
22
EnableEmmetSupport = "html-css-class-completion.enableEmmetSupport" ,
23
23
HTMLLanguages = "html-css-class-completion.HTMLLanguages" ,
24
+ HAMLLanguages = "html-css-class-completion.HAMLLanguages" ,
24
25
CSSLanguages = "html-css-class-completion.CSSLanguages" ,
25
26
JavaScriptLanguages = "html-css-class-completion.JavaScriptLanguages" ,
26
27
}
@@ -33,6 +34,7 @@ const completionTriggerChars = ['"', "'", " ", "."];
33
34
let caching = false ;
34
35
35
36
const htmlDisposables : Disposable [ ] = [ ] ;
37
+ const hamlDisposables : Disposable [ ] = [ ] ;
36
38
const cssDisposables : Disposable [ ] = [ ] ;
37
39
const javaScriptDisposables : Disposable [ ] = [ ] ;
38
40
const emmetDisposables : Disposable [ ] = [ ] ;
@@ -144,6 +146,13 @@ const registerHTMLProviders = (disposables: Disposable[]) =>
144
146
disposables . push ( registerCompletionProvider ( extension , / c l a s s = [ " | ' ] ( [ \w - ] * $ ) / ) ) ;
145
147
} ) ;
146
148
149
+ const registerHAMLProviders = ( disposables : Disposable [ ] ) =>
150
+ workspace . getConfiguration ( )
151
+ ?. get < string [ ] > ( Configuration . HAMLLanguages )
152
+ ?. forEach ( ( extension ) => {
153
+ disposables . push ( registerCompletionProvider ( extension , / (? = \. ) ( [ \w - . ] * $ ) / , "" , "." ) ) ;
154
+ } ) ;
155
+
147
156
const registerCSSProviders = ( disposables : Disposable [ ] ) =>
148
157
workspace . getConfiguration ( )
149
158
. get < string [ ] > ( Configuration . CSSLanguages )
@@ -207,6 +216,11 @@ export async function activate(context: ExtensionContext): Promise<void> {
207
216
registerHTMLProviders ( htmlDisposables ) ;
208
217
}
209
218
219
+ if ( e . affectsConfiguration ( Configuration . HAMLLanguages ) ) {
220
+ unregisterProviders ( hamlDisposables ) ;
221
+ registerHAMLProviders ( hamlDisposables ) ;
222
+ }
223
+
210
224
if ( e . affectsConfiguration ( Configuration . CSSLanguages ) ) {
211
225
unregisterProviders ( cssDisposables ) ;
212
226
registerCSSProviders ( cssDisposables ) ;
@@ -246,6 +260,7 @@ export async function activate(context: ExtensionContext): Promise<void> {
246
260
}
247
261
248
262
registerHTMLProviders ( htmlDisposables ) ;
263
+ registerHAMLProviders ( hamlDisposables ) ;
249
264
registerCSSProviders ( cssDisposables ) ;
250
265
registerJavaScriptProviders ( javaScriptDisposables ) ;
251
266
@@ -263,6 +278,7 @@ export async function activate(context: ExtensionContext): Promise<void> {
263
278
264
279
export function deactivate ( ) : void {
265
280
unregisterProviders ( htmlDisposables ) ;
281
+ unregisterProviders ( hamlDisposables ) ;
266
282
unregisterProviders ( cssDisposables ) ;
267
283
unregisterProviders ( javaScriptDisposables ) ;
268
284
unregisterProviders ( emmetDisposables ) ;
0 commit comments