mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-03 17:02:56 +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
Notes:
sideshowbarker
2024-07-19 00:23:55 +09:00
Author: https://github.com/alimpfard
Commit: 20b74e4ede
Pull-request: https://github.com/SerenityOS/serenity/pull/4652
Reviewed-by: https://github.com/awesomekling
19 changed files with 211 additions and 162 deletions
|
@ -35,7 +35,7 @@
|
|||
|
||||
namespace LanguageServers::Shell {
|
||||
|
||||
Vector<AutoCompleteResponse> AutoComplete::get_suggestions(const String& code, size_t offset)
|
||||
Vector<GUI::AutocompleteProvider::Entry> AutoComplete::get_suggestions(const String& code, size_t offset)
|
||||
{
|
||||
// FIXME: No need to reparse this every time!
|
||||
auto ast = ::Shell::Parser { code }.parse();
|
||||
|
@ -49,7 +49,7 @@ Vector<AutoCompleteResponse> AutoComplete::get_suggestions(const String& code, s
|
|||
#endif
|
||||
|
||||
auto result = ast->complete_for_editor(m_shell, offset);
|
||||
Vector<AutoCompleteResponse> completions;
|
||||
Vector<GUI::AutocompleteProvider::Entry> completions;
|
||||
for (auto& entry : result) {
|
||||
#ifdef DEBUG_AUTOCOMPLETE
|
||||
dbgln("Suggestion: '{}' starting at {}", entry.text_string, entry.input_offset);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue