'use strict' ; import * as vscode from 'vscode' ; import CompletionProvider from './completion-item-provider' ; import { StylusDocumentSimbolsProvider } from './symbols-provider' ; import { StylusColorProvider } from './color-provider' ; const DOCUMENT_SELECTOR = { language : 'stylus' , scheme : 'file' } ; export function activate ( context ) { const editorConfig = vscode . workspace . getConfiguration ( 'editor' ) ; console . log ( editorConfig ) ; const config = vscode . workspace . getConfiguration ( 'languageStylus' ) ; const completionItemProvider = new CompletionProvider ( ) ; const completionProviderDisposable = vscode . languages . registerCompletionItemProvider ( DOCUMENT_SELECTOR , completionItemProvider , '\\.' , '$' , '-' , '&' , '@' ) ; context . subscriptions . push ( completionProviderDisposable ) ; vscode . languages . setLanguageConfiguration ( 'stylus' , { wordPattern : /(#?-?\d*\.\d\w*%?)|([$@#!.:]?[\w-?]+%?)|[$@#!.]/g , onEnterRules : [ { beforeText : /^([\s\/]?)+[\.#&@\[:].+[^,]$/gi , action : { indentAction : vscode . IndentAction . Indent } , } , { beforeText : /\s&(.*)[^,]$|&$/gi , action : { indentAction : vscode . IndentAction . Indent } , } , { beforeText : /^(\s?)+\d{1,3}%/gi , action : { indentAction : vscode . IndentAction . Indent } , } , { beforeText : /^(\s?)+for.+in.+$/gi , action : { indentAction : vscode . IndentAction . Indent } , } ] } ) ; const symbolsProvider = new StylusDocumentSimbolsProvider ( ) ; const symbolsProviderDisposable = vscode . languages . registerDocumentSymbolProvider ( DOCUMENT_SELECTOR , symbolsProvider ) ; context . subscriptions . push ( symbolsProviderDisposable ) ; const colorProvider = new StylusColorProvider ( ) ; const colorProviderDisposable = vscode . languages . registerColorProvider ( DOCUMENT_SELECTOR , colorProvider ) ; context . subscriptions . push ( colorProviderDisposable ) ; }