diff options
author | thislooksfun <tlf@thislooks.fun> | 2021-10-26 21:53:49 -0500 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-11-02 17:53:22 +0100 |
commit | f7f9d09e7213b15d5f44346c8368f593e1394102 (patch) | |
tree | bd21f6b54fd40b5fa3532657d5b8bf2fe975c061 /Userland/DevTools | |
parent | f699dbdc3f720b3c69083ba91e4214ea76fce6f8 (diff) | |
download | serenity-f7f9d09e7213b15d5f44346c8368f593e1394102.zip |
LibGUI: Remove GUI::AutocompleteProvider::Entry::kind
The only code using it was removed in the previous commit.
Diffstat (limited to 'Userland/DevTools')
-rw-r--r-- | Userland/DevTools/HackStudio/AutoCompleteResponse.h | 4 | ||||
-rw-r--r-- | Userland/DevTools/HackStudio/LanguageServers/Cpp/CppComprehensionEngine.cpp | 18 |
2 files changed, 11 insertions, 11 deletions
diff --git a/Userland/DevTools/HackStudio/AutoCompleteResponse.h b/Userland/DevTools/HackStudio/AutoCompleteResponse.h index cc4a97a48e..f394fa8ff1 100644 --- a/Userland/DevTools/HackStudio/AutoCompleteResponse.h +++ b/Userland/DevTools/HackStudio/AutoCompleteResponse.h @@ -20,7 +20,6 @@ inline bool encode(IPC::Encoder& encoder, const GUI::AutocompleteProvider::Entry { encoder << response.completion; encoder << (u64)response.partial_input_length; - encoder << (u32)response.kind; encoder << (u32)response.language; encoder << response.display_text; return true; @@ -29,17 +28,14 @@ inline bool encode(IPC::Encoder& encoder, const GUI::AutocompleteProvider::Entry template<> inline bool decode(IPC::Decoder& decoder, GUI::AutocompleteProvider::Entry& response) { - u32 kind = 0; u32 language = 0; u64 partial_input_length = 0; bool ok = decoder.decode(response.completion) && decoder.decode(partial_input_length) - && decoder.decode(kind) && decoder.decode(language) && decoder.decode(response.display_text); if (ok) { - response.kind = static_cast<GUI::AutocompleteProvider::CompletionKind>(kind); response.language = static_cast<GUI::AutocompleteProvider::Language>(language); response.partial_input_length = partial_input_length; } diff --git a/Userland/DevTools/HackStudio/LanguageServers/Cpp/CppComprehensionEngine.cpp b/Userland/DevTools/HackStudio/LanguageServers/Cpp/CppComprehensionEngine.cpp index 0571ce9064..42ead5e2d4 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/Cpp/CppComprehensionEngine.cpp +++ b/Userland/DevTools/HackStudio/LanguageServers/Cpp/CppComprehensionEngine.cpp @@ -165,13 +165,13 @@ Vector<GUI::AutocompleteProvider::Entry> CppComprehensionEngine::autocomplete_na Vector<GUI::AutocompleteProvider::Entry> suggestions; for (auto& symbol : matches) { - suggestions.append({ symbol.name.name, partial_text.length(), GUI::AutocompleteProvider::CompletionKind::Identifier }); + suggestions.append({ symbol.name.name, partial_text.length() }); } if (reference_scope.is_empty()) { for (auto& preprocessor_name : document.preprocessor().definitions().keys()) { if (preprocessor_name.starts_with(partial_text)) { - suggestions.append({ preprocessor_name, partial_text.length(), GUI::AutocompleteProvider::CompletionKind::PreprocessorDefinition }); + suggestions.append({ preprocessor_name, partial_text.length() }); } } } @@ -215,7 +215,7 @@ Vector<GUI::AutocompleteProvider::Entry> CppComprehensionEngine::autocomplete_pr Vector<GUI::AutocompleteProvider::Entry> suggestions; for (auto& prop : properties_of_type(document, type)) { if (prop.name.name.starts_with(partial_text)) { - suggestions.append({ prop.name.name, partial_text.length(), GUI::AutocompleteProvider::CompletionKind::Identifier }); + suggestions.append({ prop.name.name, partial_text.length() }); } } return suggestions; @@ -642,11 +642,15 @@ Optional<Vector<GUI::AutocompleteProvider::Entry>> CppComprehensionEngine::try_a VERIFY(include_path_token.type() == Token::Type::IncludePath); auto partial_include = include_path_token.text().trim_whitespace(); + enum IncludeType { + Project, + System, + } include_type { Project }; + String include_root; - auto include_type = GUI::AutocompleteProvider::CompletionKind::ProjectInclude; if (partial_include.starts_with("<")) { include_root = "/usr/include/"; - include_type = GUI::AutocompleteProvider::CompletionKind::SystemInclude; + include_type = System; } else if (partial_include.starts_with("\"")) { include_root = filedb().project_root(); } else @@ -670,8 +674,8 @@ Optional<Vector<GUI::AutocompleteProvider::Entry>> CppComprehensionEngine::try_a if (!(path.ends_with(".h") || Core::File::is_directory(LexicalPath::join(full_dir, path).string()))) continue; if (path.starts_with(partial_basename)) { - auto completion = include_type == GUI::AutocompleteProvider::CompletionKind::ProjectInclude ? String::formatted("<{}>", path) : String::formatted("\"{}\"", path); - options.append({ completion, partial_basename.length() + 1, include_type, GUI::AutocompleteProvider::Language::Cpp, path }); + auto completion = include_type == System ? String::formatted("<{}>", path) : String::formatted("\"{}\"", path); + options.append({ completion, partial_basename.length() + 1, GUI::AutocompleteProvider::Language::Cpp, path }); } } |