1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:48:11 +00:00

HackStudio: Add tokens_info_result() and tokens_info_result() IPC calls

These IPC calls are used in the communication with the language server
to fetch semantic information about the tokens in a code document.
This commit is contained in:
Itamar 2022-02-06 22:28:57 +02:00 committed by Andreas Kling
parent 76000e9137
commit 33043f269d
9 changed files with 130 additions and 2 deletions

View file

@ -120,7 +120,7 @@ void ClientConnection::find_declaration(GUI::AutocompleteProvider::ProjectLocati
void ClientConnection::get_parameters_hint(GUI::AutocompleteProvider::ProjectLocation const& location)
{
dbgln_if(LANGUAGE_SERVER_DEBUG, "GetFunctionParams: {} {}:{}", location.file, location.line, location.column);
dbgln_if(LANGUAGE_SERVER_DEBUG, "GetParametersHint: {} {}:{}", location.file, location.line, location.column);
auto document = m_filedb.get(location.file);
if (!document) {
dbgln("file {} has not been opened", location.file);
@ -143,4 +143,17 @@ void ClientConnection::get_parameters_hint(GUI::AutocompleteProvider::ProjectLoc
async_parameters_hint_result(params->params, params->current_index);
}
void ClientConnection::get_tokens_info(String const& filename)
{
dbgln_if(LANGUAGE_SERVER_DEBUG, "GetTokenInfo: {}", filename);
auto document = m_filedb.get(filename);
if (!document) {
dbgln("file {} has not been opened", filename);
return;
}
auto token_info = m_autocomplete_engine->get_tokens_info(filename);
async_tokens_info_result(move(token_info));
}
}