forked from qt-creator/qt-creator
ClangCodeModel: prevent text mark annotations in non project files
Since non project files get opened in project specific clients now, the check whether we should add annotations needs to make sure that the marks file is part of the client project. Change-Id: I2790d0f7feb39162686efd06bb3542684d289b95 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -385,6 +385,7 @@ ClangBackEnd::DiagnosticContainer convertDiagnostic(const ClangdDiagnostic &src,
|
||||
|
||||
ClangdTextMark::ClangdTextMark(const FilePath &filePath,
|
||||
const Diagnostic &diagnostic,
|
||||
bool isProjectFile,
|
||||
const Client *client)
|
||||
: TextEditor::TextMark(filePath, int(diagnostic.range().start().line() + 1), client->id())
|
||||
, m_lspDiagnostic(diagnostic)
|
||||
@@ -399,7 +400,7 @@ ClangdTextMark::ClangdTextMark(const FilePath &filePath,
|
||||
setPriority(isError ? TextEditor::TextMark::HighPriority
|
||||
: TextEditor::TextMark::NormalPriority);
|
||||
setIcon(isError ? Icons::CODEMODEL_ERROR.icon() : Icons::CODEMODEL_WARNING.icon());
|
||||
if (client->project()) {
|
||||
if (isProjectFile) {
|
||||
setLineAnnotation(diagnostic.message());
|
||||
setColor(isError ? Theme::CodeModel_Error_TextMarkColor
|
||||
: Theme::CodeModel_Warning_TextMarkColor);
|
||||
|
||||
Reference in New Issue
Block a user