diff options
author | thislooksfun <tlf@thislooks.fun> | 2021-10-27 00:17:00 -0500 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-11-02 17:53:22 +0100 |
commit | 8b3a2cdad9c4f9242e72312cd0e226c9fb0923b6 (patch) | |
tree | d47f2c93a4c42c5c51f66e760c517b142822d1f1 /Userland/DevTools | |
parent | a6a71869d7545bc3f119d6305c45c0bb8a417cbc (diff) | |
download | serenity-8b3a2cdad9c4f9242e72312cd0e226c9fb0923b6.zip |
HackStudio: Correctly handle nested paths
Previously the paths were concatinated incorrectly, so triggering
the autocomplete on `#include "foo/bar"` would never work. Now it
does. :^)
Diffstat (limited to 'Userland/DevTools')
-rw-r--r-- | Userland/DevTools/HackStudio/LanguageServers/Cpp/CppComprehensionEngine.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Userland/DevTools/HackStudio/LanguageServers/Cpp/CppComprehensionEngine.cpp b/Userland/DevTools/HackStudio/LanguageServers/Cpp/CppComprehensionEngine.cpp index f13b6d44ce..8f189bc68b 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/Cpp/CppComprehensionEngine.cpp +++ b/Userland/DevTools/HackStudio/LanguageServers/Cpp/CppComprehensionEngine.cpp @@ -676,7 +676,7 @@ Optional<Vector<GUI::AutocompleteProvider::Entry>> CppComprehensionEngine::try_a include_dir = partial_include.substring_view(1, last_slash.value()); } - auto full_dir = String::formatted("{}{}", include_root, include_dir); + auto full_dir = LexicalPath::join(include_root, include_dir).string(); dbgln_if(CPP_LANGUAGE_SERVER_DEBUG, "searching path: {}, partial_basename: {}", full_dir, partial_basename); Core::DirIterator it(full_dir, Core::DirIterator::Flags::SkipDots); @@ -691,8 +691,8 @@ Optional<Vector<GUI::AutocompleteProvider::Entry>> CppComprehensionEngine::try_a // already typed. auto prefix = include_type == System ? "<" : "\""; auto suffix = include_type == System ? ">" : "\""; - auto completion = String::formatted("{}{}{}", prefix, path, already_has_suffix ? "" : suffix); - options.append({ completion, partial_basename.length() + 1, GUI::AutocompleteProvider::Language::Cpp, path }); + auto completion = String::formatted("{}{}{}{}", prefix, include_dir, path, already_has_suffix ? "" : suffix); + options.append({ completion, include_dir.length() + partial_basename.length() + 1, GUI::AutocompleteProvider::Language::Cpp, path }); } } |