diff --git a/agent/lsp/client.py b/agent/lsp/client.py index 9207cb75bdaa..3411f5300b34 100644 --- a/agent/lsp/client.py +++ b/agent/lsp/client.py @@ -56,6 +56,8 @@ from pathlib import Path from typing import Any, Awaitable, Callable, Dict, List, Optional, Set from urllib.parse import quote, unquote +from hermes_cli._subprocess_compat import windows_hide_flags + from agent.lsp.protocol import ( ERROR_CONTENT_MODIFIED, ERROR_METHOD_NOT_FOUND, @@ -294,6 +296,12 @@ class LSPClient: cmd = self._command if sys.platform == "win32": cmd = self._win_wrap_cmd(cmd) + # Suppress the cmd.exe console window that would otherwise flash + # every time we launch a ``.cmd``-wrapped language server + # (e.g. pyright-langserver.CMD) from a console-less host such as + # a VS Code/Zed extension running the ACP adapter. + # windows_hide_flags() is CREATE_NO_WINDOW on Windows, 0 on POSIX. + creationflags = windows_hide_flags() try: # start_new_session=True detaches the LSP server into its own @@ -312,6 +320,7 @@ class LSPClient: env=env, cwd=self._cwd, start_new_session=True, + creationflags=creationflags, ) except FileNotFoundError as e: raise LSPProtocolError( diff --git a/agent/lsp/install.py b/agent/lsp/install.py index 079033b772ad..68a9751e7fa9 100644 --- a/agent/lsp/install.py +++ b/agent/lsp/install.py @@ -35,6 +35,8 @@ import threading from pathlib import Path from typing import Any, Dict, Optional +from hermes_cli._subprocess_compat import windows_hide_flags + logger = logging.getLogger("agent.lsp.install") # Package-name → install-strategy hint registry. Each entry is a @@ -268,6 +270,7 @@ def _install_npm( text=True, timeout=300, stdin=subprocess.DEVNULL, + creationflags=windows_hide_flags(), ) if proc.returncode != 0: logger.warning( @@ -317,6 +320,7 @@ def _install_go(pkg: str, bin_name: str) -> Optional[str]: timeout=600, env=env, stdin=subprocess.DEVNULL, + creationflags=windows_hide_flags(), ) if proc.returncode != 0: logger.warning( diff --git a/contributors/emails/hellofrommorgan@users.noreply.github.com b/contributors/emails/hellofrommorgan@users.noreply.github.com new file mode 100644 index 000000000000..0787203fc7b1 --- /dev/null +++ b/contributors/emails/hellofrommorgan@users.noreply.github.com @@ -0,0 +1 @@ +hellofrommorgan