Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HackStudio: Do not create a new LanguageClient unless needed
Previously, whenever Editor::set_document() was called, we destroyed the previous LanguageClient instance of the editor and created a new one. We now check if the language of the existing LanguageClient matches the new document, and if so we do not create a new LanguageClient instance. This fixes an issue where doing "goto definition" would crash HackStudio. This was probably introduced in 44418cb. The crash occurred because when doing "goto definition", we called a AK::Function callback from the LanguageClient, which internally called Editor::set_document(). Editor::set_document() destroyed the existing LanguageClient, which cased a VERIFY in Function::clear() to fail because we were trying to destroy the AK::Function object while executing inside it.
- Loading branch information