1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 05:37:34 +00:00

LanguageServers/Cpp: Add type to Declarations

This commit is contained in:
Itamar 2021-02-27 09:40:34 +02:00 committed by Andreas Kling
parent 4b483071fb
commit 71c7597130
2 changed files with 14 additions and 0 deletions

View file

@ -97,6 +97,7 @@ inline bool encode(Encoder& encoder, const GUI::AutocompleteProvider::Declaratio
encoder << declaration.name; encoder << declaration.name;
if (!encode(encoder, declaration.position)) if (!encode(encoder, declaration.position))
return false; return false;
encoder << (u32)declaration.type;
return true; return true;
} }
@ -108,6 +109,11 @@ inline bool decode(Decoder& decoder, GUI::AutocompleteProvider::Declaration& dec
if (!decode(decoder, declaration.position)) if (!decode(decoder, declaration.position))
return false; return false;
u32 type;
if (!decoder.decode( type))
return false;
declaration.type = static_cast<GUI::AutocompleteProvider::DeclarationType>(type);
return true; return true;
} }

View file

@ -62,9 +62,17 @@ public:
size_t column { 0 }; size_t column { 0 };
}; };
enum class DeclarationType {
Function,
Struct,
Class,
Variable
};
struct Declaration { struct Declaration {
String name; String name;
ProjectLocation position; ProjectLocation position;
DeclarationType type;
}; };
virtual void provide_completions(Function<void(Vector<Entry>)>) = 0; virtual void provide_completions(Function<void(Vector<Entry>)>) = 0;