'use strict' ; import * as vscode from 'vscode' ; import SassCompletion from './sassAutocomplete' ; export function activate ( context ) { setSassLanguageConfiguration ( ) ; const sassCompletion = new SassCompletion ( ) ; const sassCompletionRegister = vscode . languages . registerCompletionItemProvider ( [ { language : 'sass' , scheme : 'file' } , { language : 'sass' , scheme : 'untitled' } ] , sassCompletion , '\\.' , '@' ) ; context . subscriptions . push ( vscode . workspace . onDidChangeConfiguration ( ( config ) => { if ( config . affectsConfiguration ( 'sass' ) ) { setSassLanguageConfiguration ( ) ; } } ) ) ; context . subscriptions . push ( sassCompletionRegister ) ; } function setSassLanguageConfiguration ( ) { const disableAutoIndent = vscode . workspace . getConfiguration ( 'sass' ) . get ( 'disableAutoIndent' ) ; vscode . languages . setLanguageConfiguration ( 'sass' , { wordPattern : /(#?-?\d*\.\d\w*%?)|([$@#!.:]?[\w-?]+%?)|[$@#!.]/g , onEnterRules : [ { beforeText : /^((?!^(\/n|\s+|.*: .*|.*@.*|.*,|\s+\+.*)$).*|.*@media(?!^\s+$).*)$/ , action : { indentAction : disableAutoIndent ? vscode . IndentAction . None : vscode . IndentAction . Indent } } ] } ) ; } export function deactivate ( ) { }