Index: clangd/ClangdUnit.cpp =================================================================== --- clangd/ClangdUnit.cpp +++ clangd/ClangdUnit.cpp @@ -328,6 +328,8 @@ // to read back. We rely on dynamic index for the comments instead. CI.getPreprocessorOpts().WriteCommentListToPCH = false; + PreambleDiagsEngine->setSuppressAfterFatalError(false); + CppFilePreambleCallbacks SerializedDeclsCollector(FileName, PreambleCallback); if (Inputs.FS->setCurrentWorkingDirectory(Inputs.CompileCommand.Directory)) { log("Couldn't set working directory when building the preamble."); Index: clangd/Compiler.cpp =================================================================== --- clangd/Compiler.cpp +++ clangd/Compiler.cpp @@ -63,6 +63,7 @@ auto Clang = llvm::make_unique(PCHs); Clang->setInvocation(std::move(CI)); Clang->createDiagnostics(&DiagsClient, false); + Clang->getDiagnostics().setSuppressAfterFatalError(false); if (auto VFSWithRemapping = createVFSFromCompilerInvocation( Clang->getInvocation(), Clang->getDiagnostics(), VFS)) Index: test/clangd/missing-includes.test =================================================================== --- test/clangd/missing-includes.test +++ test/clangd/missing-includes.test @@ -0,0 +1,13 @@ +# RUN: clangd -lit-test < %s | FileCheck %s +{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}} +--- +{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///foo.c","languageId":"c","version":1,"text":"#include \n#include \nint x;\n#include \n#include \n"}}} +# CHECK: "method": "textDocument/publishDiagnostics", +# CHECK: "message": "'a' file not found", +# CHECK: "message": "'b' file not found", +# CHECK: "message": "'c' file not found", +# CHECK: "message": "'d' file not found", +--- +{"jsonrpc":"2.0","id":5,"method":"shutdown"} +--- +{"jsonrpc":"2.0","method":"exit"}