diff --git a/README.md b/README.md index 1ba00b1..044010c 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,14 @@ lspconfig.emmet_ls.setup({ -- on_attach = on_attach, capabilities = capabilities, filetypes = { 'html', 'typescriptreact', 'javascriptreact', 'css', 'sass', 'scss', 'less' }, + init_options = { + html = { + options = { + -- For possible options, see: https://github.com/emmetio/emmet/blob/master/src/config.ts#L79-L267 + ["bem.enabled"] = true, + }, + }, + } }) ``` diff --git a/src/server.ts b/src/server.ts index 791ba2f..b459c05 100644 --- a/src/server.ts +++ b/src/server.ts @@ -2,6 +2,7 @@ import { extract, + GlobalConfig, parseMarkup, parseStylesheet, resolveConfig, @@ -30,6 +31,7 @@ const documents: TextDocuments = new TextDocuments(TextDocument); let hasConfigurationCapability: boolean = false; let hasWorkspaceFolderCapability: boolean = false; +let globalConfig: GlobalConfig = {}; connection.onInitialize((params: InitializeParams) => { const capabilities = params.capabilities; @@ -43,6 +45,8 @@ connection.onInitialize((params: InitializeParams) => { capabilities.workspace && !!capabilities.workspace.workspaceFolders ); + globalConfig = params.initializationOptions || {}; + const triggerCharacters = [ ">", ")", @@ -130,18 +134,6 @@ connection.onInitialized(() => { } }); -// The example settings -interface ExampleSettings { - maxNumberOfProblems: number; -} - -// Cache the settings of all open documents -const documentSettings: Map> = new Map(); - -documents.onDidClose((e) => { - documentSettings.delete(e.document.uri); -}); - // For list of language identifiers, see: // https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocumentItem // For list of supported syntax options, see: @@ -196,7 +188,7 @@ connection.onCompletion( "output.field": (index, placeholder) => `\$\{${index}${placeholder ? ":" + placeholder : ""}\}`, }, - }); + }, globalConfig); let textResult = ""; if (!isStylesheet) {