1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:17:35 +00:00

LanguageServers: Add function to collect TODO entries in a document

This commit is contained in:
Federico Guerinoni 2021-05-17 22:19:50 +02:00 committed by Linus Groh
parent c397e030f4
commit 26a7356e90
12 changed files with 103 additions and 0 deletions

View file

@ -22,6 +22,9 @@ public:
m_autocomplete_engine->set_declarations_of_document_callback = [this](const String& filename, Vector<GUI::AutocompleteProvider::Declaration>&& declarations) {
async_declarations_in_document(filename, move(declarations));
};
m_autocomplete_engine->set_todo_entries_of_document_callback = [this](const String& filename, Vector<String>&& todo_entries) {
async_todo_entries_in_document(filename, move(todo_entries));
};
}
virtual ~ClientConnection() override = default;

View file

@ -520,6 +520,11 @@ void CppComprehensionEngine::update_declared_symbols(DocumentData& document)
set_declarations_of_document(document.filename(), move(declarations));
}
void CppComprehensionEngine::update_todo_entries(DocumentData& document)
{
set_todo_entries_of_document(document.filename(), document.parser().get_todo_entries());
}
GUI::AutocompleteProvider::DeclarationType CppComprehensionEngine::type_of_declaration(const Declaration& decl)
{
if (decl.is_struct())
@ -574,6 +579,7 @@ OwnPtr<CppComprehensionEngine::DocumentData> CppComprehensionEngine::create_docu
root->dump();
update_declared_symbols(*document_data);
update_todo_entries(*document_data);
return document_data;
}

View file

@ -121,6 +121,7 @@ private:
OwnPtr<DocumentData> create_document_data_for(const String& file);
String document_path_from_include_path(const StringView& include_path) const;
void update_declared_symbols(DocumentData&);
void update_todo_entries(DocumentData&);
GUI::AutocompleteProvider::DeclarationType type_of_declaration(const Declaration&);
Vector<StringView> scope_of_node(const ASTNode&) const;
Vector<StringView> scope_of_reference_to_symbol(const ASTNode&) const;