mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 03:57:43 +00:00
LibGUI+HackStudio: Add an opt-in autocompletion interface to TextEditor
...and use that to implement autocomplete in HackStudio. Now everyone can have autocomplete :^)
This commit is contained in:
parent
7e457b98c3
commit
20b74e4ede
19 changed files with 211 additions and 162 deletions
|
@ -35,18 +35,17 @@
|
|||
namespace LanguageServers::Cpp {
|
||||
|
||||
using namespace ::Cpp;
|
||||
using ::HackStudio::AutoCompleteResponse;
|
||||
|
||||
class AutoComplete {
|
||||
public:
|
||||
AutoComplete() = delete;
|
||||
|
||||
static Vector<AutoCompleteResponse> get_suggestions(const String& code, const GUI::TextPosition& autocomplete_position);
|
||||
static Vector<GUI::AutocompleteProvider::Entry> get_suggestions(const String& code, const GUI::TextPosition& autocomplete_position);
|
||||
|
||||
private:
|
||||
static Optional<size_t> token_in_position(const Vector<Cpp::Token>&, const GUI::TextPosition&);
|
||||
static StringView text_of_token(const Vector<String>& lines, const Cpp::Token&);
|
||||
static Vector<AutoCompleteResponse> identifier_prefixes(const Vector<String>& lines, const Vector<Cpp::Token>&, size_t target_token_index);
|
||||
static Vector<GUI::AutocompleteProvider::Entry> identifier_prefixes(const Vector<String>& lines, const Vector<Cpp::Token>&, size_t target_token_index);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue