diff options
author | Itamar <itamar8910@gmail.com> | 2021-05-21 16:02:05 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-05-22 15:52:11 +0200 |
commit | b50eaf75ebfdf5c101a91f972a0ce765a355db7a (patch) | |
tree | fb97653ddd96fe8af1106a9ac678f98a2cfcf0ea /Userland/DevTools | |
parent | 0522a4360bc7abd5a8c814db9b02d00a24a98ae6 (diff) | |
download | serenity-b50eaf75ebfdf5c101a91f972a0ce765a355db7a.zip |
CppLanguageServer: Rename Optional<> autocomplete* to try_autocomplete*
autocomplete_property => try_autocomplete_property
autocomplete_name => try_autocomplete_name
This makes it more clear that these variants may fail because e.g
the node is not a property / not a name.
Diffstat (limited to 'Userland/DevTools')
-rw-r--r-- | Userland/DevTools/HackStudio/LanguageServers/Cpp/CppComprehensionEngine.cpp | 8 | ||||
-rw-r--r-- | Userland/DevTools/HackStudio/LanguageServers/Cpp/CppComprehensionEngine.h | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/Userland/DevTools/HackStudio/LanguageServers/Cpp/CppComprehensionEngine.cpp b/Userland/DevTools/HackStudio/LanguageServers/Cpp/CppComprehensionEngine.cpp index 286b0ab6e5..4f70cd9a50 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/Cpp/CppComprehensionEngine.cpp +++ b/Userland/DevTools/HackStudio/LanguageServers/Cpp/CppComprehensionEngine.cpp @@ -76,17 +76,17 @@ Vector<GUI::AutocompleteProvider::Entry> CppComprehensionEngine::get_suggestions if (!node->parent()) return {}; - auto results = autocomplete_property(document, *node, containing_token); + auto results = try_autocomplete_property(document, *node, containing_token); if (results.has_value()) return results.value(); - results = autocomplete_name(document, *node, containing_token); + results = try_autocomplete_name(document, *node, containing_token); if (results.has_value()) return results.value(); return {}; } -Optional<Vector<GUI::AutocompleteProvider::Entry>> CppComprehensionEngine::autocomplete_name(const DocumentData& document, const ASTNode& node, Optional<Token> containing_token) const +Optional<Vector<GUI::AutocompleteProvider::Entry>> CppComprehensionEngine::try_autocomplete_name(const DocumentData& document, const ASTNode& node, Optional<Token> containing_token) const { auto partial_text = String::empty(); if (containing_token.has_value() && containing_token.value().type() != Token::Type::ColonColon) { @@ -95,7 +95,7 @@ Optional<Vector<GUI::AutocompleteProvider::Entry>> CppComprehensionEngine::autoc return autocomplete_name(document, node, partial_text); } -Optional<Vector<GUI::AutocompleteProvider::Entry>> CppComprehensionEngine::autocomplete_property(const DocumentData& document, const ASTNode& node, Optional<Token> containing_token) const +Optional<Vector<GUI::AutocompleteProvider::Entry>> CppComprehensionEngine::try_autocomplete_property(const DocumentData& document, const ASTNode& node, Optional<Token> containing_token) const { if (!containing_token.has_value()) return {}; diff --git a/Userland/DevTools/HackStudio/LanguageServers/Cpp/CppComprehensionEngine.h b/Userland/DevTools/HackStudio/LanguageServers/Cpp/CppComprehensionEngine.h index b3f02b970c..5072f45cd1 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/Cpp/CppComprehensionEngine.h +++ b/Userland/DevTools/HackStudio/LanguageServers/Cpp/CppComprehensionEngine.h @@ -101,8 +101,8 @@ private: 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; + Optional<Vector<GUI::AutocompleteProvider::Entry>> try_autocomplete_property(const DocumentData&, const ASTNode&, Optional<Token> containing_token) const; + Optional<Vector<GUI::AutocompleteProvider::Entry>> try_autocomplete_name(const DocumentData&, const ASTNode&, Optional<Token> containing_token) const; HashMap<String, OwnPtr<DocumentData>> m_documents; }; |