mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:47:45 +00:00
CppLanguageServer: Don't suggest inaccessible declarations
Previously, declarations that are not available in the global namespace, such as member functions of a class, would also appear in the autocomplete suggestions list. To fix this, we now only recurse into scopes of namespaces and classes when fetching declarations if we want to retrieve all the available declarations in the document (For the use of Locator & ClassView).
This commit is contained in:
parent
ab8aa591f9
commit
f89f4af0b3
2 changed files with 27 additions and 14 deletions
|
@ -72,15 +72,21 @@ private:
|
|||
bool is_property(const ASTNode&) const;
|
||||
bool is_empty_property(const DocumentData&, const ASTNode&, const Position& autocomplete_position) const;
|
||||
RefPtr<Declaration> find_declaration_of(const DocumentData&, const ASTNode&) const;
|
||||
NonnullRefPtrVector<Declaration> get_available_declarations(const DocumentData&, const ASTNode&) const;
|
||||
|
||||
enum class RecurseIntoScopes {
|
||||
No,
|
||||
Yes
|
||||
};
|
||||
NonnullRefPtrVector<Declaration> get_available_declarations(const DocumentData&, const ASTNode&, RecurseIntoScopes) const;
|
||||
|
||||
struct PropertyInfo {
|
||||
StringView name;
|
||||
RefPtr<Type> type;
|
||||
};
|
||||
Vector<PropertyInfo> properties_of_type(const DocumentData& document, const String& type) const;
|
||||
NonnullRefPtrVector<Declaration> get_global_declarations_including_headers(const DocumentData& document) const;
|
||||
NonnullRefPtrVector<Declaration> get_global_declarations(const ASTNode& node) const;
|
||||
NonnullRefPtrVector<Declaration> get_global_declarations_including_headers(const DocumentData&, RecurseIntoScopes) const;
|
||||
NonnullRefPtrVector<Declaration> get_global_declarations(const DocumentData&, RecurseIntoScopes) const;
|
||||
NonnullRefPtrVector<Declaration> get_declarations_recursive(const ASTNode&) const;
|
||||
|
||||
const DocumentData* get_document_data(const String& file) const;
|
||||
const DocumentData* get_or_create_document_data(const String& file);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue