mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 06:58:11 +00:00
LanguageServers/Cpp: Update client asynchronously about symbols
As a document is parsed, the language server updates the client asynchronously about symbol declarations it finds.
This commit is contained in:
parent
71c7597130
commit
a94b5376bc
12 changed files with 83 additions and 19 deletions
|
@ -40,7 +40,8 @@ ClientConnection::ClientConnection(NonnullRefPtr<Core::LocalSocket> socket, int
|
|||
: IPC::ClientConnection<LanguageClientEndpoint, LanguageServerEndpoint>(*this, move(socket), client_id)
|
||||
{
|
||||
s_connections.set(client_id, *this);
|
||||
m_autocomplete_engine = make<ParserAutoComplete>(m_filedb);
|
||||
m_autocomplete_engine = make<ParserAutoComplete>(*this, m_filedb);
|
||||
m_autocomplete_engine->set_declarations_of_document_callback = &ClientConnection::set_declarations_of_document_callback;
|
||||
}
|
||||
|
||||
ClientConnection::~ClientConnection()
|
||||
|
@ -132,9 +133,9 @@ void ClientConnection::handle(const Messages::LanguageServer::SetAutoCompleteMod
|
|||
dbgln("SetAutoCompleteMode: {}", message.mode());
|
||||
#endif
|
||||
if (message.mode() == "Parser")
|
||||
m_autocomplete_engine = make<ParserAutoComplete>(m_filedb);
|
||||
m_autocomplete_engine = make<ParserAutoComplete>(*this, m_filedb);
|
||||
else
|
||||
m_autocomplete_engine = make<LexerAutoComplete>(m_filedb);
|
||||
m_autocomplete_engine = make<LexerAutoComplete>(*this, m_filedb);
|
||||
}
|
||||
|
||||
void ClientConnection::handle(const Messages::LanguageServer::FindDeclaration& message)
|
||||
|
@ -156,4 +157,9 @@ void ClientConnection::handle(const Messages::LanguageServer::FindDeclaration& m
|
|||
post_message(Messages::LanguageClient::DeclarationLocation(GUI::AutocompleteProvider::ProjectLocation { location.value().file, location.value().line, location.value().column }));
|
||||
}
|
||||
|
||||
void ClientConnection::set_declarations_of_document_callback(ClientConnection& instance, const String& filename, Vector<GUI::AutocompleteProvider::Declaration>&& declarations)
|
||||
{
|
||||
instance.post_message(Messages::LanguageClient::DeclarationsInDocument(filename, move(declarations)));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue