Skip to content

Commit

Permalink
fix getSymbolsForCompletion raise exception
Browse files Browse the repository at this point in the history
should first check if the range `beforeTokens` is empty.
  • Loading branch information
electricface authored and WebFreak001 committed Apr 17, 2024
1 parent 57794ca commit 27b1042
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/dcd/server/autocomplete/util.d
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ SymbolStuff getSymbolsForCompletion(const AutocompleteRequest request,
auto expression = getExpression(beforeTokens);
auto symbols = getSymbolsByTokenChain(pair.scope_, expression,
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
symbols ~= getSymbolsByTokenChain(pair.scope_, getExpression([beforeTokens.back]), request.cursorPosition, type);
}
Expand Down

0 comments on commit 27b1042

Please sign in to comment.