MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / selectSymbol

Method selectSymbol

src/plugins/codeeditor/symbol/symbolview.cpp:202–218  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

200}
201
202void SymbolView::selectSymbol(const QString &symbol, int line, int col)
203{
204 const auto &itemList = d->symbolModel.findItems(symbol, Qt::MatchExactly | Qt::MatchRecursive);
205 if (itemList.isEmpty())
206 return;
207
208 auto iter = std::find_if(itemList.crbegin(), itemList.crend(),
209 [&](QStandardItem *item) {
210 const auto &range = item->data(SymbolRangeRole).value<newlsp::Range>();
211 return range.contains({ line, col });
212 });
213
214 if (iter != itemList.crend()) {
215 const auto &index = d->symbolModel.indexFromItem(*iter);
216 d->select(index);
217 }
218}
219
220void SymbolView::expandAll()
221{

Callers 2

curmbItemClickedMethod · 0.80

Calls 5

indexFromItemMethod · 0.80
selectMethod · 0.80
isEmptyMethod · 0.45
dataMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected