fix getSymbolsForCompletion raise exception
should first check if the range `beforeTokens` is empty.
This commit is contained in:
parent
57794ca875
commit
27b1042959
|
@ -147,7 +147,8 @@ SymbolStuff getSymbolsForCompletion(const AutocompleteRequest request,
|
||||||
auto expression = getExpression(beforeTokens);
|
auto expression = getExpression(beforeTokens);
|
||||||
auto symbols = getSymbolsByTokenChain(pair.scope_, expression,
|
auto symbols = getSymbolsByTokenChain(pair.scope_, expression,
|
||||||
request.cursorPosition, type);
|
request.cursorPosition, type);
|
||||||
if (symbols.length == 0 && doUFCSSearch(stringToken(beforeTokens.front), stringToken(beforeTokens.back))) {
|
if (symbols.length == 0 && !beforeTokens.empty &&
|
||||||
|
doUFCSSearch(stringToken(beforeTokens.front), stringToken(beforeTokens.back))) {
|
||||||
// Let search for UFCS, since we got no hit
|
// Let search for UFCS, since we got no hit
|
||||||
symbols ~= getSymbolsByTokenChain(pair.scope_, getExpression([beforeTokens.back]), request.cursorPosition, type);
|
symbols ~= getSymbolsByTokenChain(pair.scope_, getExpression([beforeTokens.back]), request.cursorPosition, type);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue