mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 20:08:13 +00:00
LanguageServers/Cpp: Use FileDB and AutoCompleteEngine base class
This commit is contained in:
parent
bed06b13f3
commit
02038a0ede
7 changed files with 126 additions and 97 deletions
|
@ -26,6 +26,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "AutoCompleteEngine.h"
|
||||
#include <AK/String.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <DevTools/HackStudio/AutoCompleteResponse.h>
|
||||
|
@ -36,16 +37,16 @@ namespace LanguageServers::Cpp {
|
|||
|
||||
using namespace ::Cpp;
|
||||
|
||||
class LexerAutoComplete {
|
||||
class LexerAutoComplete : public AutoCompleteEngine {
|
||||
public:
|
||||
LexerAutoComplete() = delete;
|
||||
LexerAutoComplete(const FileDB& filedb);
|
||||
|
||||
static Vector<GUI::AutocompleteProvider::Entry> get_suggestions(const String& code, const GUI::TextPosition& autocomplete_position);
|
||||
virtual Vector<GUI::AutocompleteProvider::Entry> get_suggestions(const String& file, const GUI::TextPosition& autocomplete_position) override;
|
||||
|
||||
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<GUI::AutocompleteProvider::Entry> identifier_prefixes(const Vector<String>& lines, const Vector<Cpp::Token>&, size_t target_token_index);
|
||||
Optional<size_t> token_in_position(const Vector<Cpp::Token>&, const GUI::TextPosition&);
|
||||
StringView text_of_token(const Vector<String>& lines, const Cpp::Token&);
|
||||
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