ClangCodeModel: Switch to LSP-based UI header approach

Generating ui headers in a well-known path and then including that one
in the compilation database does not work in the presence of multiple ui
files with the same name.
As it turns out, we don't have to generate any files at all; instead, we
pass the file contents directly to clangd, which then uses them when
parsing includes of the respective header.
User-visible behavior change apart from the abovementioned bug fix:
Tooltips and "follow symbol" on the include directive now always use the
actual location of the header provided by the build system.

Fixes: QTCREATORBUG-27584
Change-Id: I6b13e12cb3a365199567b0bc824d12b373117697
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2022-05-31 16:35:10 +02:00
parent 5de18c67f0
commit 01ceb3a3cb
13 changed files with 147 additions and 176 deletions

View File

@@ -136,6 +136,8 @@ public:
void deactivateDocument(TextEditor::TextDocument *document);
bool documentOpen(const TextEditor::TextDocument *document) const;
TextEditor::TextDocument *documentForFilePath(const Utils::FilePath &file) const;
void setShadowDocument(const Utils::FilePath &filePath, const QString &contents);
void removeShadowDocument(const Utils::FilePath &filePath);
void documentContentsSaved(TextEditor::TextDocument *document);
void documentWillSave(Core::IDocument *document);
void documentContentsChanged(TextEditor::TextDocument *document,
@@ -205,6 +207,7 @@ signals:
void capabilitiesChanged(const DynamicCapabilities &capabilities);
void documentUpdated(TextEditor::TextDocument *document);
void workDone(const LanguageServerProtocol::ProgressToken &token);
void shadowDocumentSwitched(const Utils::FilePath &filePath);
void finished();
protected: