This repository was archived by the owner on Jan 13, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
feat: implement cross-platform support with TCP fallback #7
Open
observerw
wants to merge
8
commits into
main
Choose a base branch
from
feat/cross-platform-support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
8b75c43
feat: implement cross-platform support with TCP fallback and enhanced CI
observerw beafa67
fix: address lint issues in manager and settings
observerw 9a5059a
fix: address cross-platform type issues and improve test stability
observerw c649c07
[WIP] Implement cross-platform support with TCP fallback (#8)
Copilot ee396be
fix: address cross-platform CI issues on Windows
observerw e76a991
fix: resolve race condition in manager client startup on Windows
observerw 2f14123
fix: ensure ready event is set only after LSP client initializes
observerw 111ed12
fix: restore ready event signaling before server start to prevent tim…
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,31 @@ | ||
| import uvicorn | ||
|
|
||
| from lsp_cli.settings import MANAGER_UDS_PATH | ||
| from lsp_cli.manager.models import ConnectionInfo | ||
| from lsp_cli.settings import IS_WINDOWS, MANAGER_CONN_PATH, MANAGER_UDS_PATH | ||
| from lsp_cli.utils.socket import allocate_port | ||
|
|
||
| from .manager import app | ||
|
|
||
| if __name__ == "__main__": | ||
| MANAGER_UDS_PATH.unlink(missing_ok=True) | ||
| MANAGER_UDS_PATH.parent.mkdir(parents=True, exist_ok=True) | ||
| uvicorn.run(app, uds=str(MANAGER_UDS_PATH)) | ||
| if IS_WINDOWS: | ||
| sock, port = allocate_port() | ||
| try: | ||
| conn = ConnectionInfo(host="127.0.0.1", port=port) | ||
| MANAGER_CONN_PATH.parent.mkdir(parents=True, exist_ok=True) | ||
| MANAGER_CONN_PATH.write_text(conn.model_dump_json()) | ||
| # On Windows, fd is not supported by uvicorn, so we close the socket | ||
| # before starting the server. | ||
| sock.close() | ||
| uvicorn.run(app, host="127.0.0.1", port=port) | ||
| finally: | ||
| # ensure socket is closed if it wasn't already | ||
| try: | ||
| sock.close() | ||
| except Exception: | ||
| pass | ||
| else: | ||
| MANAGER_UDS_PATH.unlink(missing_ok=True) | ||
| MANAGER_UDS_PATH.parent.mkdir(parents=True, exist_ok=True) | ||
| conn = ConnectionInfo(uds_path=MANAGER_UDS_PATH) | ||
| MANAGER_CONN_PATH.write_text(conn.model_dump_json()) | ||
| uvicorn.run(app, uds=str(MANAGER_UDS_PATH)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -6,6 +6,37 @@ | |||||||||||||||||||
| from pydantic import BaseModel, RootModel | ||||||||||||||||||||
|
|
||||||||||||||||||||
|
|
||||||||||||||||||||
| class ConnectionInfo(BaseModel): | ||||||||||||||||||||
| """Connection information for LSP server communication. | ||||||||||||||||||||
|
|
||||||||||||||||||||
| On Unix-like systems, uses Unix Domain Sockets (uds_path). | ||||||||||||||||||||
| On Windows, uses TCP with host and port. | ||||||||||||||||||||
|
|
||||||||||||||||||||
| Security Note: When using TCP (Windows), the server binds to 127.0.0.1 | ||||||||||||||||||||
| (localhost only) without authentication. This means any local process | ||||||||||||||||||||
| can connect to the manager. This is acceptable for a local development | ||||||||||||||||||||
| tool, but should be considered when handling sensitive data. | ||||||||||||||||||||
| """ | ||||||||||||||||||||
|
|
||||||||||||||||||||
| uds_path: Path | None = None | ||||||||||||||||||||
| host: str | None = None | ||||||||||||||||||||
| port: int | None = None | ||||||||||||||||||||
|
|
||||||||||||||||||||
| @property | ||||||||||||||||||||
| def url(self) -> str: | ||||||||||||||||||||
|
||||||||||||||||||||
| def url(self) -> str: | |
| def url(self) -> str: | |
| """ | |
| Return the HTTP URL for this connection. | |
| If both ``host`` and ``port`` are set, this returns | |
| ``"http://{host}:{port}"``. If either value is missing, this | |
| falls back to ``"http://localhost"``. | |
| """ |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential None value: The conn property on Windows returns ConnectionInfo with self._port, but _port is initialized to None and only set during _serve(). If conn is accessed before _serve() is called, it will return ConnectionInfo with port=None, which may cause issues in code expecting a valid port. Consider initializing the port earlier or documenting this constraint.