1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:37:35 +00:00

CppLanguageServer: Add "get_parameters_hint" capability

Given a call site, the C++ language server can now return the declared
parameters of the called function, as well as the index of the
parameter that the cursor is currently at.
This commit is contained in:
Itamar 2021-07-03 11:55:54 +03:00 committed by Andreas Kling
parent 232013c05b
commit 32be65a8b4
9 changed files with 181 additions and 2 deletions

View file

@ -29,6 +29,7 @@ public:
virtual void on_edit(const String& file) override;
virtual void file_opened([[maybe_unused]] const String& file) override;
virtual Optional<GUI::AutocompleteProvider::ProjectLocation> find_declaration_of(const String& filename, const GUI::TextPosition& identifier_position) override;
virtual Optional<FunctionParamsHint> get_function_params_hint(const String&, const GUI::TextPosition&) override;
private:
struct SymbolName {
@ -130,6 +131,7 @@ private:
Optional<Vector<GUI::AutocompleteProvider::Entry>> try_autocomplete_name(const DocumentData&, const ASTNode&, Optional<Token> containing_token) const;
Optional<Vector<GUI::AutocompleteProvider::Entry>> try_autocomplete_include(const DocumentData&, Token include_path_token);
static bool is_symbol_available(const Symbol&, const Vector<StringView>& current_scope, const Vector<StringView>& reference_scope);
Optional<FunctionParamsHint> get_function_params_hint(DocumentData const&, FunctionCall&, size_t argument_index);
template<typename Func>
void for_each_available_symbol(const DocumentData&, Func) const;
@ -171,7 +173,6 @@ void CppComprehensionEngine::for_each_included_document_recursive(const Document
continue;
}
}
}
namespace AK {