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

HackStudio: Move around execution order and prevent crashing

Previously hackstudio tried to synchronize the language server before
executing the command inside the editor.  If sync-command for the server
(for example the CommentLineCommand) is not implemented inside the
function responsible for syncing the language server, the IDE would
crash.

This patch makes it such that the synchronization happens only after IDE
executes the command locally.  If such command is not implemented (as
was the case earlier), it would simply reupdate the content inside the
language server. Even though the reupdate might be expensive, it is
better than crashing hackstudio altogether.

Because of reordering, the relevant function names have been changed to
better reflect the code flow.
This commit is contained in:
iyush 2023-04-14 22:12:54 +02:00 committed by Andreas Kling
parent 4653b38808
commit a268dcb1e2
3 changed files with 5 additions and 5 deletions

View file

@ -542,7 +542,7 @@ void Editor::LanguageServerAidedAutocompleteProvider::provide_completions(Functi
data.value().position.column());
}
void Editor::will_execute(GUI::TextDocumentUndoCommand const& command)
void Editor::after_execute(GUI::TextDocumentUndoCommand const& command)
{
if (!m_language_client)
return;
@ -568,7 +568,7 @@ void Editor::will_execute(GUI::TextDocumentUndoCommand const& command)
return;
}
VERIFY_NOT_REACHED();
flush_file_content_to_langauge_server();
}
void Editor::undo()