summaryrefslogtreecommitdiff
path: root/Userland/DevTools/HackStudio/LanguageServers/Cpp/LexerAutoComplete.h
diff options
context:
space:
mode:
authorItamar <itamar8910@gmail.com>2021-02-06 16:25:15 +0200
committerAndreas Kling <kling@serenityos.org>2021-02-08 23:10:38 +0100
commit02038a0edee0f01f76e90c8b4fbdf208592ea262 (patch)
treef25bf2b1cb68396910f681b6dd584595bb74ea9f /Userland/DevTools/HackStudio/LanguageServers/Cpp/LexerAutoComplete.h
parentbed06b13f36618f006543f8ca700003c30deb6d4 (diff)
downloadserenity-02038a0edee0f01f76e90c8b4fbdf208592ea262.zip
LanguageServers/Cpp: Use FileDB and AutoCompleteEngine base class
Diffstat (limited to 'Userland/DevTools/HackStudio/LanguageServers/Cpp/LexerAutoComplete.h')
-rw-r--r--Userland/DevTools/HackStudio/LanguageServers/Cpp/LexerAutoComplete.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/Userland/DevTools/HackStudio/LanguageServers/Cpp/LexerAutoComplete.h b/Userland/DevTools/HackStudio/LanguageServers/Cpp/LexerAutoComplete.h
index e482818cfc..58a836cce2 100644
--- a/Userland/DevTools/HackStudio/LanguageServers/Cpp/LexerAutoComplete.h
+++ b/Userland/DevTools/HackStudio/LanguageServers/Cpp/LexerAutoComplete.h
@@ -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);
};
}