From 71c7597130a1c2e4622fc0179eff0cc62ecd4af8 Mon Sep 17 00:00:00 2001 From: Itamar Date: Sat, 27 Feb 2021 09:40:34 +0200 Subject: [PATCH] LanguageServers/Cpp: Add type to Declarations --- Userland/DevTools/HackStudio/AutoCompleteResponse.h | 6 ++++++ Userland/Libraries/LibGUI/AutocompleteProvider.h | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/Userland/DevTools/HackStudio/AutoCompleteResponse.h b/Userland/DevTools/HackStudio/AutoCompleteResponse.h index 6e16e5f4c3d..540022f98dd 100644 --- a/Userland/DevTools/HackStudio/AutoCompleteResponse.h +++ b/Userland/DevTools/HackStudio/AutoCompleteResponse.h @@ -97,6 +97,7 @@ inline bool encode(Encoder& encoder, const GUI::AutocompleteProvider::Declaratio encoder << declaration.name; if (!encode(encoder, declaration.position)) return false; + encoder << (u32)declaration.type; return true; } @@ -108,6 +109,11 @@ inline bool decode(Decoder& decoder, GUI::AutocompleteProvider::Declaration& dec if (!decode(decoder, declaration.position)) return false; + u32 type; + if (!decoder.decode( type)) + return false; + + declaration.type = static_cast(type); return true; } diff --git a/Userland/Libraries/LibGUI/AutocompleteProvider.h b/Userland/Libraries/LibGUI/AutocompleteProvider.h index 2794a3b37d2..3c7fa4cc765 100644 --- a/Userland/Libraries/LibGUI/AutocompleteProvider.h +++ b/Userland/Libraries/LibGUI/AutocompleteProvider.h @@ -62,9 +62,17 @@ public: size_t column { 0 }; }; + enum class DeclarationType { + Function, + Struct, + Class, + Variable + }; + struct Declaration { String name; ProjectLocation position; + DeclarationType type; }; virtual void provide_completions(Function)>) = 0;