Skip to content

Commit 8f64264

Browse files
committed
updated tracking published diagnostic files instead of open ones
1 parent 9b0e2a6 commit 8f64264

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

client/commands/v2/pysa_server.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import logging
1414
from collections import defaultdict
1515
from pathlib import Path
16-
from typing import List, Sequence, Dict
16+
from typing import List, Sequence, Dict, Set
1717

1818
from ....api import query, connection as api_connection
1919
from ....api.connection import PyreQueryError
@@ -68,7 +68,7 @@ def __init__(
6868
self.pyre_connection = api_connection.PyreConnection(
6969
Path(self.pyre_arguments.global_root)
7070
)
71-
self.file_tracker = set()
71+
self.file_tracker: Set[Path] = set()
7272

7373
def invalid_model_to_diagnostic(
7474
self, invalid_model: query.InvalidModel
@@ -104,13 +104,17 @@ def invalid_models_to_diagnostics(
104104

105105
async def update_errors(self) -> None:
106106
# Publishing empty diagnostics to clear errors in VSCode and reset self.file_tracker
107-
for document_path in self.file_tracker():
108-
await _publish_diagnostics(self.output_channel, Path(document_path), [])
107+
for document_path in self.file_tracker:
108+
await _publish_diagnostics(self.output_channel, document_path, [])
109109
self.file_tracker = set()
110110

111111
try:
112112
model_errors = query.get_invalid_taint_models(self.pyre_connection)
113113
diagnostics = self.invalid_models_to_diagnostics(model_errors)
114+
# Keep track of files we publish diagnostics for
115+
for path in diagnostics.keys():
116+
self.file_tracker.add(path)
117+
114118
await self.show_model_errors_to_client(diagnostics)
115119
except PyreQueryError as e:
116120
await self.log_and_show_message_to_client(
@@ -165,7 +169,6 @@ async def process_open_request(
165169
self, parameters: lsp.DidOpenTextDocumentParameters
166170
) -> None:
167171
document_path = parameters.text_document.document_uri().to_file_path()
168-
self.file_tracker.add(str(document_path))
169172

170173
if document_path is None:
171174
raise json_rpc.InvalidRequestError(

0 commit comments

Comments
 (0)