summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibGUI/AutocompleteProvider.cpp12
-rw-r--r--Userland/Libraries/LibGUI/AutocompleteProvider.h2
2 files changed, 13 insertions, 1 deletions
diff --git a/Userland/Libraries/LibGUI/AutocompleteProvider.cpp b/Userland/Libraries/LibGUI/AutocompleteProvider.cpp
index b0fc9ae2bb..bc6d8162f1 100644
--- a/Userland/Libraries/LibGUI/AutocompleteProvider.cpp
+++ b/Userland/Libraries/LibGUI/AutocompleteProvider.cpp
@@ -176,7 +176,17 @@ void AutocompleteBox::apply_suggestion()
size_t partial_length = suggestion_index.data((GUI::ModelRole)AutocompleteSuggestionModel::InternalRole::PartialInputLength).to_i64();
VERIFY(suggestion.length() >= partial_length);
- auto completion = suggestion.substring_view(partial_length, suggestion.length() - partial_length);
+ auto completion_view = suggestion.substring_view(partial_length, suggestion.length() - partial_length);
+ auto completion_kind = (GUI::AutocompleteProvider::CompletionKind)suggestion_index.data((GUI::ModelRole)AutocompleteSuggestionModel::InternalRole::Kind).as_uint();
+
+ String completion;
+ if (completion_view.ends_with(".h") && completion_kind == GUI::AutocompleteProvider::CompletionKind::SystemInclude)
+ completion = String::formatted("{}{}", completion_view, ">");
+ else if (completion_view.ends_with(".h") && completion_kind == GUI::AutocompleteProvider::CompletionKind::ProjectInclude)
+ completion = String::formatted("{}{}", completion_view, "\"");
+ else
+ completion = completion_view;
+
m_editor->insert_at_cursor_or_replace_selection(completion);
}
diff --git a/Userland/Libraries/LibGUI/AutocompleteProvider.h b/Userland/Libraries/LibGUI/AutocompleteProvider.h
index 266eae132d..4a455f89a7 100644
--- a/Userland/Libraries/LibGUI/AutocompleteProvider.h
+++ b/Userland/Libraries/LibGUI/AutocompleteProvider.h
@@ -23,6 +23,8 @@ public:
enum class CompletionKind {
Identifier,
PreprocessorDefinition,
+ SystemInclude,
+ ProjectInclude,
};
enum class Language {