diff --git a/source/served/extension.d b/source/served/extension.d index 1fe78711..682ea942 100644 --- a/source/served/extension.d +++ b/source/served/extension.d @@ -948,7 +948,10 @@ void didChangeWorkspaceFolders(DidChangeWorkspaceFoldersParams params) @protocolNotification("textDocument/didOpen") void onDidOpenDocument(DidOpenTextDocumentParams params) { - string lintSetting = config(params.textDocument.uri).d.lintOnFileOpen; + auto config = workspace(params.textDocument.uri).config; + auto document = documents[params.textDocument.uri]; + + string lintSetting = config.d.lintOnFileOpen; bool shouldLint; if (lintSetting == "always") shouldLint = true; @@ -956,9 +959,18 @@ void onDidOpenDocument(DidOpenTextDocumentParams params) shouldLint = workspaceIndex(params.textDocument.uri) != size_t.max; if (shouldLint) + { onDidChangeDocument(DidChangeTextDocumentParams( VersionedTextDocumentIdentifier( params.textDocument.uri, params.textDocument.version_))); + + if (config.d.enableCcdbLinting && document.languageId == "d") + { + import served.linters.ccdb; + + lint(document); + } + } } @protocolNotification("textDocument/didClose")