Changeset View
Changeset View
Standalone View
Standalone View
plugins/clang/clangsupport.cpp
Show First 20 Lines • Show All 94 Lines • ▼ Show 20 Line(s) | |||||
95 | { | 95 | { | ||
96 | auto pair = lineInDocument(url, position); | 96 | auto pair = lineInDocument(url, position); | ||
97 | 97 | | |||
98 | const QString line = pair.first; | 98 | const QString line = pair.first; | ||
99 | if (line.isEmpty()) | 99 | if (line.isEmpty()) | ||
100 | return {{}, KTextEditor::Range::invalid()}; | 100 | return {{}, KTextEditor::Range::invalid()}; | ||
101 | 101 | | |||
102 | KTextEditor::Range wordRange = ClangUtils::rangeForIncludePathSpec(line, pair.second); | 102 | KTextEditor::Range wordRange = ClangUtils::rangeForIncludePathSpec(line, pair.second); | ||
103 | if (!wordRange.isValid()) { | 103 | if (!wordRange.isValid() || !wordRange.contains(position)) { | ||
104 | return {{}, KTextEditor::Range::invalid()}; | 104 | return {{}, KTextEditor::Range::invalid()}; | ||
105 | } | 105 | } | ||
106 | 106 | | |||
107 | // Since this is called by the editor while editing, use a fast timeout so the editor stays responsive | 107 | // Since this is called by the editor while editing, use a fast timeout so the editor stays responsive | ||
108 | DUChainReadLocker lock(nullptr, 100); | 108 | DUChainReadLocker lock(nullptr, 100); | ||
109 | if (!lock.locked()) { | 109 | if (!lock.locked()) { | ||
110 | clangDebug() << "Failed to lock the du-chain in time"; | 110 | clangDebug() << "Failed to lock the du-chain in time"; | ||
111 | return {TopDUContextPointer(), KTextEditor::Range::invalid()}; | 111 | return {TopDUContextPointer(), KTextEditor::Range::invalid()}; | ||
▲ Show 20 Lines • Show All 329 Lines • Show Last 20 Lines |