Skip to content

Commit 9b0e2a6

Browse files
committed
fixes, removed logging comments
1 parent 7b964fe commit 9b0e2a6

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

client/commands/v2/pysa_server.py

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ def __init__(
5858
pyre_arguments: start.Arguments,
5959
binary_location: str,
6060
server_identifier: str,
61-
file_tracker: dict,
6261
) -> None:
6362
self.input_channel = input_channel
6463
self.output_channel = output_channel
@@ -69,11 +68,10 @@ def __init__(
6968
self.pyre_connection = api_connection.PyreConnection(
7069
Path(self.pyre_arguments.global_root)
7170
)
72-
self.file_tracker = file_tracker
71+
self.file_tracker = set()
7372

7473
def invalid_model_to_diagnostic(
75-
self,
76-
invalid_model: query.InvalidModel,
74+
self, invalid_model: query.InvalidModel
7775
) -> lsp.Diagnostic:
7876
return lsp.Diagnostic(
7977
range=lsp.Range(
@@ -92,8 +90,7 @@ def invalid_model_to_diagnostic(
9290
)
9391

9492
def invalid_models_to_diagnostics(
95-
self,
96-
invalid_models: Sequence[query.InvalidModel],
93+
self, invalid_models: Sequence[query.InvalidModel]
9794
) -> Dict[Path, List[lsp.Diagnostic]]:
9895
result: Dict[Path, List[lsp.Diagnostic]] = defaultdict(list)
9996
for model in invalid_models:
@@ -107,10 +104,9 @@ def invalid_models_to_diagnostics(
107104

108105
async def update_errors(self) -> None:
109106
# Publishing empty diagnostics to clear errors in VSCode and reset self.file_tracker
110-
for document_path in self.file_tracker.keys():
107+
for document_path in self.file_tracker():
111108
await _publish_diagnostics(self.output_channel, Path(document_path), [])
112-
self.file_tracker = {}
113-
# await self.log_and_show_message_to_client(f"All files cleared: {self.file_tracker}")
109+
self.file_tracker = set()
114110

115111
try:
116112
model_errors = query.get_invalid_taint_models(self.pyre_connection)
@@ -169,8 +165,7 @@ async def process_open_request(
169165
self, parameters: lsp.DidOpenTextDocumentParameters
170166
) -> None:
171167
document_path = parameters.text_document.document_uri().to_file_path()
172-
self.file_tracker[str(document_path)] = True
173-
# await self.log_and_show_message_to_client(f"Tracking Files: {self.file_tracker}")
168+
self.file_tracker.add(str(document_path))
174169

175170
if document_path is None:
176171
raise json_rpc.InvalidRequestError(
@@ -182,8 +177,6 @@ async def process_close_request(
182177
self, parameters: lsp.DidCloseTextDocumentParameters
183178
) -> None:
184179
document_path = parameters.text_document.document_uri().to_file_path()
185-
# self.file_tracker.pop(str(document_path))
186-
# await self.log_and_show_message_to_client(f"Closed a file. Tracking: {self.file_tracker}")
187180

188181
if document_path is None:
189182
raise json_rpc.InvalidRequestError(
@@ -290,7 +283,6 @@ async def run_persistent(
290283
binary_location=binary_location,
291284
server_identifier=server_identifier,
292285
pyre_arguments=pysa_arguments,
293-
file_tracker={},
294286
)
295287
return await server.run()
296288
elif isinstance(initialize_result, InitializationFailure):

0 commit comments

Comments
 (0)