Skip to content

Commit 26db0cc

Browse files
committed
lint CCDB on file open
1 parent 2cf589f commit 26db0cc

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

source/served/extension.d

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -948,17 +948,29 @@ void didChangeWorkspaceFolders(DidChangeWorkspaceFoldersParams params)
948948
@protocolNotification("textDocument/didOpen")
949949
void onDidOpenDocument(DidOpenTextDocumentParams params)
950950
{
951-
string lintSetting = config(params.textDocument.uri).d.lintOnFileOpen;
951+
auto config = workspace(params.textDocument.uri).config;
952+
auto document = documents[params.textDocument.uri];
953+
954+
string lintSetting = config.d.lintOnFileOpen;
952955
bool shouldLint;
953956
if (lintSetting == "always")
954957
shouldLint = true;
955958
else if (lintSetting == "project")
956959
shouldLint = workspaceIndex(params.textDocument.uri) != size_t.max;
957960

958961
if (shouldLint)
962+
{
959963
onDidChangeDocument(DidChangeTextDocumentParams(
960964
VersionedTextDocumentIdentifier(
961965
params.textDocument.uri, params.textDocument.version_)));
966+
967+
if (config.d.enableCcdbLinting && document.languageId == "d")
968+
{
969+
import served.linters.ccdb;
970+
971+
lint(document);
972+
}
973+
}
962974
}
963975

964976
@protocolNotification("textDocument/didClose")

0 commit comments

Comments
 (0)