Skip to content

Commit 6c3b0b5

Browse files
committed
fixed error validation only working at startup
1 parent a09ff0b commit 6c3b0b5

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

client/commands/v2/persistent.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,14 +196,14 @@ async def try_initialize(
196196
async def _read_lsp_request(
197197
input_channel: connection.TextReader, output_channel: connection.TextWriter
198198
) -> AsyncIterator[json_rpc.Request]:
199-
LOG.info("** Inside the read lsp function ** ")
199+
# LOG.info("** Inside the read lsp function ** ")
200200
try:
201-
LOG.info("** Inside the try and except ** ")
201+
# LOG.info("** Inside the try and except ** ")
202202
message = await lsp.read_json_rpc(input_channel)
203-
LOG.info(f"** {message} **")
203+
# LOG.info(f"** {message} **")
204204
yield message
205205
except json_rpc.JSONRPCException as json_rpc_error:
206-
LOG.info("** Inside the except ** ")
206+
# LOG.info("** Inside the except ** ")
207207
await lsp.write_json_rpc(
208208
output_channel,
209209
json_rpc.ErrorResponse(

client/commands/v2/pysa_server.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535

3636
LOG: logging.Logger = logging.getLogger(__name__)
3737

38+
PYSA_HANDLER_OBJ = None
39+
3840

3941
class PysaServer:
4042
# I/O Channels
@@ -101,7 +103,7 @@ async def wait_for_exit(self) -> int:
101103
async def process_open_request(
102104
self, parameters: lsp.DidOpenTextDocumentParameters
103105
) -> None:
104-
LOG.info("** Inside process_open_request() **")
106+
# LOG.info("** Inside process_open_request() **")
105107
document_path = parameters.text_document.document_uri().to_file_path()
106108
if document_path is None:
107109
raise json_rpc.InvalidRequestError(
@@ -111,7 +113,7 @@ async def process_open_request(
111113
async def process_close_request(
112114
self, parameters: lsp.DidCloseTextDocumentParameters
113115
) -> None:
114-
LOG.info("** Inside process_close_request() **")
116+
# LOG.info("** Inside process_close_request() **")
115117
document_path = parameters.text_document.document_uri().to_file_path()
116118
if document_path is None:
117119
raise json_rpc.InvalidRequestError(
@@ -126,7 +128,7 @@ async def process_close_request(
126128
async def process_did_save_request(
127129
self, parameters: lsp.DidSaveTextDocumentParameters
128130
) -> None:
129-
LOG.info("** Inside process_did_save_request() **")
131+
# LOG.info("** Inside process_did_save_request() **")
130132
document_path = parameters.text_document.document_uri().to_file_path()
131133
if document_path is None:
132134
raise json_rpc.InvalidRequestError(
@@ -148,7 +150,7 @@ async def run(self) -> int:
148150
)
149151
return await self.wait_for_exit()
150152
elif request.method == "textDocument/didOpen":
151-
LOG.info("** A Document just opened! **")
153+
# LOG.info("** A Document just opened! **")
152154
parameters = request.parameters
153155
if parameters is None:
154156
raise json_rpc.InvalidRequestError(
@@ -160,7 +162,7 @@ async def run(self) -> int:
160162
)
161163
)
162164
elif request.method == "textDocument/didClose":
163-
LOG.info("** A Document just closed! **")
165+
# LOG.info("** A Document just closed! **")
164166
parameters = request.parameters
165167
if parameters is None:
166168
raise json_rpc.InvalidRequestError(
@@ -172,7 +174,7 @@ async def run(self) -> int:
172174
)
173175
)
174176
elif request.method == "textDocument/didSave":
175-
LOG.info("** A Document just saved! **")
177+
# LOG.info("** A Document just saved! **")
176178
parameters = request.parameters
177179
if parameters is None:
178180
raise json_rpc.InvalidRequestError(
@@ -185,13 +187,12 @@ async def run(self) -> int:
185187
)
186188
elif request.id is not None:
187189
raise lsp.RequestCancelledError("Request not supported yet")
188-
else:
189-
LOG.info("** Hmmm I guess nothing seems to be happening **")
190190

191191

192192
async def run_persistent(
193193
binary_location: str, server_identifier: str, pysa_arguments: start.Arguments
194194
) -> int:
195+
global PYSA_HANDLER_OBJ
195196
stdin, stdout = await connection.create_async_stdin_stdout()
196197
while True:
197198
initialize_result = await try_initialize(stdin, stdout)

0 commit comments

Comments
 (0)