mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 06:37:35 +00:00
CppLanguageServer: Make autocomplete logic consider scopes
When returning autocomplete suggestions, we now consider the scope of the name that is being completed. For example, when requested to complete an expression like 'MyNamespace::', we will only suggest things that are in the 'MyNamespace' namespace. This commit also has some general refactoring of the autocomplete logic.
This commit is contained in:
parent
0e51aea781
commit
c54238f65c
2 changed files with 89 additions and 27 deletions
|
@ -96,10 +96,13 @@ private:
|
|||
String document_path_from_include_path(const StringView& include_path) const;
|
||||
void update_declared_symbols(DocumentData&);
|
||||
GUI::AutocompleteProvider::DeclarationType type_of_declaration(const Declaration&);
|
||||
String scope_of_declaration(const Declaration&);
|
||||
String scope_of_declaration(const Declaration&) const;
|
||||
String scope_of_name_or_identifier(const ASTNode& node) const;
|
||||
Optional<GUI::AutocompleteProvider::ProjectLocation> find_preprocessor_definition(const DocumentData&, const GUI::TextPosition&);
|
||||
|
||||
OwnPtr<DocumentData> create_document_data(String&& text, const String& filename);
|
||||
Optional<Vector<GUI::AutocompleteProvider::Entry>> autocomplete_property(const DocumentData&, const ASTNode&, Optional<Token> containing_token) const;
|
||||
Optional<Vector<GUI::AutocompleteProvider::Entry>> autocomplete_name(const DocumentData&, const ASTNode&, Optional<Token> containing_token) const;
|
||||
|
||||
HashMap<String, OwnPtr<DocumentData>> m_documents;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue