mirror of
https://github.com/dlang-community/DCD.git
synced 2025-04-25 21:00:02 +03:00
fix getSymbolsForCompletion raise exception
should first check if the range `beforeTokens` is empty.
This commit is contained in:
parent
57794ca875
commit
27b1042959
1 changed files with 2 additions and 1 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue