Revert "Allowed add_language to be issued asynchronously"

This reverts commit 2c2fcc6a07.
This commit is contained in:
Dominik Jain authored and Dominik Jain committed 2025-10-30 01:05:53 +01:00
1 parent 2bc8230720
commit aeec47d176
3 files changed
+7 -13

No files matched your search

+2 -9
View File
@@ -544,22 +544,15 @@ class SerenaAgent:
ls_specific_settings=self.serena_config.ls_specific_settings,
)
def add_language(self, language: Language, wait_for_ls_startup: bool = False) -> None:
def add_language(self, language: Language) -> None:
"""
Adds a new language to the active project, spawning the respective language server and updating the project configuration.
The addition is scheduled via the agent's task executor and executed synchronously, i.e. the method returns
when the addition is complete.
:param language: the language to add
:param wait_for_ls_startup: whether to wait for the language server to start up before returning (synchronous execution)
or to just issue the addition task and return immediately (asynchronous execution)
"""
task = lambda: self.get_active_project_or_raise().add_language(language)
task_name = f"AddLanguage:{language.value}"
if wait_for_ls_startup:
self.execute_task(task, name=task_name)
else:
self.issue_task(task, name=task_name)
self.execute_task(lambda: self.get_active_project_or_raise().add_language(language), name=f"AddLanguage:{language.value}")
def remove_language(self, language: Language) -> None:
"""
+1 -1
View File
@@ -331,7 +331,7 @@ class SerenaDashboardAPI:
raise ValueError(f"Invalid language: {request_add_language.language}")
# Add the language to the active project
self._agent.add_language(language, wait_for_ls_startup=False)
self._agent.add_language(language)
def _remove_language(self, request_remove_language: RequestRemoveLanguage) -> None:
from solidlsp.ls_config import Language
+4 -3
View File
@@ -405,9 +405,6 @@ class Project(ToStringMixin):
if language in self.project_config.languages:
log.info(f"Language {language.value} is already present in the project configuration.")
return
# update the project configuration
self.project_config.languages.append(language)
self.save_config()
# start the language server (if the LS manager is active)
if self.language_server_manager is None:
@@ -416,6 +413,10 @@ class Project(ToStringMixin):
log.info("Adding and starting the language server for new language %s ...", language.value)
self.language_server_manager.add_language_server(language)
# update the project configuration
self.project_config.languages.append(language)
self.save_config()
def remove_language(self, language: Language) -> None:
"""
Removes a programming language from the project configuration, stopping the corresponding