|
13 | 13 | import logging |
14 | 14 | from collections import defaultdict |
15 | 15 | from pathlib import Path |
16 | | -from typing import List, Sequence, Dict |
| 16 | +from typing import List, Sequence, Dict, Set |
17 | 17 |
|
18 | 18 | from ....api import query, connection as api_connection |
19 | 19 | from ....api.connection import PyreQueryError |
@@ -68,7 +68,7 @@ def __init__( |
68 | 68 | self.pyre_connection = api_connection.PyreConnection( |
69 | 69 | Path(self.pyre_arguments.global_root) |
70 | 70 | ) |
71 | | - self.file_tracker = set() |
| 71 | + self.file_tracker: Set[Path] = set() |
72 | 72 |
|
73 | 73 | def invalid_model_to_diagnostic( |
74 | 74 | self, invalid_model: query.InvalidModel |
@@ -104,13 +104,17 @@ def invalid_models_to_diagnostics( |
104 | 104 |
|
105 | 105 | async def update_errors(self) -> None: |
106 | 106 | # 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, []) |
109 | 109 | self.file_tracker = set() |
110 | 110 |
|
111 | 111 | try: |
112 | 112 | model_errors = query.get_invalid_taint_models(self.pyre_connection) |
113 | 113 | 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 | + |
114 | 118 | await self.show_model_errors_to_client(diagnostics) |
115 | 119 | except PyreQueryError as e: |
116 | 120 | await self.log_and_show_message_to_client( |
@@ -165,7 +169,6 @@ async def process_open_request( |
165 | 169 | self, parameters: lsp.DidOpenTextDocumentParameters |
166 | 170 | ) -> None: |
167 | 171 | document_path = parameters.text_document.document_uri().to_file_path() |
168 | | - self.file_tracker.add(str(document_path)) |
169 | 172 |
|
170 | 173 | if document_path is None: |
171 | 174 | raise json_rpc.InvalidRequestError( |
|
0 commit comments