Skip to content

Commit 0e85655

Browse files
committed
feat: read file asynchronously
1 parent 20fc1ad commit 0e85655

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/lsp_client/protocol/client.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
from pathlib import Path
77
from typing import Protocol, runtime_checkable
88

9+
import anyio
10+
911
from lsp_client.utils.types import AnyPath, Notification, Request, Response, lsp_type
1012
from lsp_client.utils.uri import from_local_uri
1113
from lsp_client.utils.workspace import DEFAULT_WORKSPACE_DIR, Workspace
@@ -72,9 +74,9 @@ def from_uri(self, uri: str) -> Path:
7274
"""Convert a URI to an absolute path."""
7375
return from_local_uri(uri)
7476

75-
def read_file(self, file_path: AnyPath) -> str:
77+
async def read_file(self, file_path: AnyPath) -> str:
7678
"""Read the content of a file in the workspace."""
7779

7880
uri = self.as_uri(file_path)
7981
abs_file_path = self.from_uri(uri)
80-
return abs_file_path.read_text()
82+
return await anyio.Path(abs_file_path).read_text()

0 commit comments

Comments
 (0)