'use strict' ; import { Parser } from './parser/cssParser' ; import { CSSCompletion } from './services/cssCompletion' ; import { CSSHover } from './services/cssHover' ; import { CSSNavigation } from './services/cssNavigation' ; import { CSSCodeActions } from './services/cssCodeActions' ; import { CSSValidation } from './services/cssValidation' ; import { SCSSParser } from './parser/scssParser' ; import { SCSSCompletion } from './services/scssCompletion' ; import { LESSParser } from './parser/lessParser' ; import { LESSCompletion } from './services/lessCompletion' ; import { getFoldingRanges } from './services/cssFolding' ; import { LanguageSettings , ICompletionParticipant , DocumentContext , LanguageServiceOptions , Diagnostic , Position , CompletionList , Hover , Location , DocumentHighlight , DocumentLink , SymbolInformation , Range , CodeActionContext , Command , CodeAction , ColorInformation , Color , ColorPresentation , WorkspaceEdit , FoldingRange , SelectionRange , TextDocument , ICSSDataProvider , CSSDataV1 , HoverSettings , CompletionSettings } from './cssLanguageTypes' ; import { CSSDataManager } from './languageFacts/dataManager' ; import { CSSDataProvider } from './languageFacts/dataProvider' ; import { getSelectionRanges } from './services/cssSelectionRange' ; import { SCSSNavigation } from './services/scssNavigation' ; import { cssData } from './data/webCustomData' ; export type Stylesheet = { } ; export * from './cssLanguageTypes' ; export interface LanguageService { configure ( raw ? ) : void ; setDataProviders ( useDefaultDataProvider , customDataProviders ) : void ; doValidation ( document , stylesheet , documentSettings ? ) : Diagnostic [ ] ; parseStylesheet ( document ) : Stylesheet ; doComplete ( document , position , stylesheet , settings ? ) : CompletionList ; doComplete2 ( document , position , stylesheet , documentContext , settings ? ) : Promise < CompletionList > ; setCompletionParticipants ( registeredCompletionParticipants ) : void ; doHover ( document , position , stylesheet , settings ? ) : Hover | null ; findDefinition ( document , position , stylesheet ) : Location | null ; findReferences ( document , position , stylesheet ) : Location [ ] ; findDocumentHighlights ( document , position , stylesheet ) : DocumentHighlight [ ] ; findDocumentLinks ( document , stylesheet , documentContext ) : DocumentLink [ ] ; /**
     * Return statically resolved links, and dynamically resolved links if `fsProvider` is proved.
     */ findDocumentLinks2 ( document , stylesheet , documentContext ) : Promise < DocumentLink [ ] > ; findDocumentSymbols ( document , stylesheet ) : SymbolInformation [ ] ; doCodeActions ( document , range , context , stylesheet ) : Command [ ] ; doCodeActions2 ( document , range , context , stylesheet ) : CodeAction [ ] ; findDocumentColors ( document , stylesheet ) : ColorInformation [ ] ; getColorPresentations ( document , stylesheet , color , range ) : ColorPresentation [ ] ; doRename ( document , position , newName , stylesheet ) : WorkspaceEdit ; getFoldingRanges ( document , context ? ) : FoldingRange [ ] ; getSelectionRanges ( document , positions , stylesheet ) : SelectionRange [ ] ; } export function getDefaultCSSDataProvider ( ) { return newCSSDataProvider ( cssData ) ; } export function newCSSDataProvider ( data ) { return new CSSDataProvider ( data ) ; } function createFacade ( parser , completion , hover , navigation , codeActions , validation , cssDataManager ) { return { configure : ( settings ) => { validation . configure ( settings ) ; completion . configure ( settings ?. completion ) ; hover . configure ( settings ?. hover ) ; } , setDataProviders : cssDataManager . setDataProviders . bind ( cssDataManager ) , doValidation : validation . doValidation . bind ( validation ) , parseStylesheet : parser . parseStylesheet . bind ( parser ) , doComplete : completion . doComplete . bind ( completion ) , doComplete2 : completion . doComplete2 . bind ( completion ) , setCompletionParticipants : completion . setCompletionParticipants . bind ( completion ) , doHover : hover . doHover . bind ( hover ) , findDefinition : navigation . findDefinition . bind ( navigation ) , findReferences : navigation . findReferences . bind ( navigation ) , findDocumentHighlights : navigation . findDocumentHighlights . bind ( navigation ) , findDocumentLinks : navigation . findDocumentLinks . bind ( navigation ) , findDocumentLinks2 : navigation . findDocumentLinks2 . bind ( navigation ) , findDocumentSymbols : navigation . findDocumentSymbols . bind ( navigation ) , doCodeActions : codeActions . doCodeActions . bind ( codeActions ) , doCodeActions2 : codeActions . doCodeActions2 . bind ( codeActions ) , findDocumentColors : navigation . findDocumentColors . bind ( navigation ) , getColorPresentations : navigation . getColorPresentations . bind ( navigation ) , doRename : navigation . doRename . bind ( navigation ) , getFoldingRanges , getSelectionRanges } ; } const defaultLanguageServiceOptions = { } ; export function getCSSLanguageService ( options = defaultLanguageServiceOptions ) { const cssDataManager = new CSSDataManager ( options ) ; return createFacade ( new Parser ( ) , new CSSCompletion ( null , options , cssDataManager ) , new CSSHover ( options && options . clientCapabilities , cssDataManager ) , new CSSNavigation ( options && options . fileSystemProvider , false ) , new CSSCodeActions ( cssDataManager ) , new CSSValidation ( cssDataManager ) , cssDataManager ) ; } export function getSCSSLanguageService ( options = defaultLanguageServiceOptions ) { const cssDataManager = new CSSDataManager ( options ) ; return createFacade ( new SCSSParser ( ) , new SCSSCompletion ( options , cssDataManager ) , new CSSHover ( options && options . clientCapabilities , cssDataManager ) , new SCSSNavigation ( options && options . fileSystemProvider ) , new CSSCodeActions ( cssDataManager ) , new CSSValidation ( cssDataManager ) , cssDataManager ) ; } export function getLESSLanguageService ( options = defaultLanguageServiceOptions ) { const cssDataManager = new CSSDataManager ( options ) ; return createFacade ( new LESSParser ( ) , new LESSCompletion ( options , cssDataManager ) , new CSSHover ( options && options . clientCapabilities , cssDataManager ) , new CSSNavigation ( options && options . fileSystemProvider , true ) , new CSSCodeActions ( cssDataManager ) , new CSSValidation ( cssDataManager ) , cssDataManager ) ; }