Skip to content

Commit 2da5ecb

Browse files
itamar8910awesomekling
authored andcommitted
LanguageServers/Cpp: Handle autocomplete request on an empty line
1 parent 18a9b66 commit 2da5ecb

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

Userland/DevTools/HackStudio/LanguageServers/Cpp/ParserAutoComplete.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@ ParserAutoComplete::DocumentData::DocumentData(String&& _text)
9797

9898
Vector<GUI::AutocompleteProvider::Entry> ParserAutoComplete::get_suggestions(const String& file, const GUI::TextPosition& autocomplete_position)
9999
{
100-
ASSERT(autocomplete_position.column() > 0);
101-
Cpp::Position position { autocomplete_position.line(), autocomplete_position.column() - 1 };
100+
Cpp::Position position { autocomplete_position.line(), autocomplete_position.column() > 0 ? autocomplete_position.column() - 1 : 0 };
102101

103102
VERBOSE("ParserAutoComplete position {}:{}", position.line, position.column);
104103

0 commit comments

Comments
 (0)