Commit 4d7435ee authored by Igor Kushnir's avatar Igor Kushnir Committed by Nicolás Alvarez
Browse files

DUChain::documentRenamed: don't warn about invalid URL

The "renamed" document's URL can be invalid in a common scenario
described in the added comment. Nothing to warn the user about.

Cache the result of a call to virtual IDocument::url().
parent cf4d309c
Pipeline #95960 passed with stage
in 35 minutes and 32 seconds
......@@ -1664,11 +1664,11 @@ void DUChain::documentRenamed(KDevelop::IDocument* doc)
if (sdDUChainPrivate->m_destroyed)
return;
if (!doc->url().isValid()) {
///Maybe this happens when a file was deleted?
qCWarning(LANGUAGE) << "Strange, url of renamed document is invalid!";
} else {
ICore::self()->languageController()->backgroundParser()->addDocument(IndexedString(doc->url()),
const auto url = doc->url();
// url is invalid when a file open in KDevelop is deleted externally, then the user
// closes the file by clicking the Close File button on KTextEditor's prompt.
if (url.isValid()) {
ICore::self()->languageController()->backgroundParser()->addDocument(IndexedString{url},
TopDUContext::AllDeclarationsContextsAndUses
| TopDUContext::ForceUpdate);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment