diff options
author | Itamar <itamar8910@gmail.com> | 2021-04-10 17:34:57 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-04-13 15:16:27 +0200 |
commit | b87791cadae5b4d7784e8176ffbaa4e0036bbc47 (patch) | |
tree | 5124b3ea388ac0c60cd8d88c86a5cfc41ddff7fc /Userland | |
parent | c6c83bd80eb65a2cc4f9fc1fb0c5f15ae5c0d64c (diff) | |
download | serenity-b87791cadae5b4d7784e8176ffbaa4e0036bbc47.zip |
LibCpp: Add 'Namespace' and 'Member' declaration types
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/DevTools/HackStudio/LanguageServers/Cpp/ParserAutoComplete.cpp | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibCpp/AST.h | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/AutocompleteProvider.h | 2 |
3 files changed, 8 insertions, 0 deletions
diff --git a/Userland/DevTools/HackStudio/LanguageServers/Cpp/ParserAutoComplete.cpp b/Userland/DevTools/HackStudio/LanguageServers/Cpp/ParserAutoComplete.cpp index 9ef47ec73a..dd402047f5 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/Cpp/ParserAutoComplete.cpp +++ b/Userland/DevTools/HackStudio/LanguageServers/Cpp/ParserAutoComplete.cpp @@ -486,6 +486,10 @@ GUI::AutocompleteProvider::DeclarationType ParserAutoComplete::type_of_declarati return GUI::AutocompleteProvider::DeclarationType::Function; if (decl.is_variable_declaration()) return GUI::AutocompleteProvider::DeclarationType::Variable; + if (decl.is_namespace()) + return GUI::AutocompleteProvider::DeclarationType::Namespace; + if (decl.is_member()) + return GUI::AutocompleteProvider::DeclarationType::Member; return GUI::AutocompleteProvider::DeclarationType::Variable; } diff --git a/Userland/Libraries/LibCpp/AST.h b/Userland/Libraries/LibCpp/AST.h index d2ada70b8a..3b2e595758 100644 --- a/Userland/Libraries/LibCpp/AST.h +++ b/Userland/Libraries/LibCpp/AST.h @@ -137,6 +137,7 @@ public: virtual bool is_class() const { return false; } virtual bool is_function() const { return false; } virtual bool is_namespace() const { return false; } + virtual bool is_member() const { return false; } const StringView& name() const { return m_name; } StringView m_name; @@ -529,6 +530,7 @@ public: virtual ~MemberDeclaration() override = default; virtual const char* class_name() const override { return "MemberDeclaration"; } virtual void dump(size_t indent) const override; + virtual bool is_member() const override { return true; } MemberDeclaration(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename) : Declaration(parent, start, end, filename) diff --git a/Userland/Libraries/LibGUI/AutocompleteProvider.h b/Userland/Libraries/LibGUI/AutocompleteProvider.h index ca3290bd58..aed7a4d6d9 100644 --- a/Userland/Libraries/LibGUI/AutocompleteProvider.h +++ b/Userland/Libraries/LibGUI/AutocompleteProvider.h @@ -69,6 +69,8 @@ public: Class, Variable, PreprocessorDefinition, + Namespace, + Member, }; struct Declaration { |