Skip to content

Commit 8ac4950

Browse files
committed
DOP-1282: Disable the postprocessor in the language server
1 parent 4ceb256 commit 8ac4950

File tree

2 files changed

+28
-18
lines changed

2 files changed

+28
-18
lines changed

snooty/language_server.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,10 @@ def m_initialize(
314314
root_path = Path(rootUri.replace("file://", "", 1))
315315
self.project = Project(root_path, self.backend, {})
316316
self.notify_diagnostics()
317-
self.project.build()
317+
318+
# XXX: Disabling the postprocessor is temporary until we can test
319+
# its usage in the language server more extensively
320+
self.project.build(postprocess=False)
318321

319322
if processId is not None:
320323

snooty/parser.py

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,9 @@ def delete(self, path: PurePath) -> None:
10481048

10491049
self.backend.on_delete(self.get_fileid(path), self.build_identifiers)
10501050

1051-
def build(self, max_workers: Optional[int] = None) -> None:
1051+
def build(
1052+
self, max_workers: Optional[int] = None, postprocess: bool = True
1053+
) -> None:
10521054
all_yaml_diagnostics: Dict[PurePath, List[Diagnostic]] = {}
10531055
pool = multiprocessing.Pool(max_workers)
10541056
with util.PerformanceLogger.singleton().start("parse rst"):
@@ -1107,23 +1109,26 @@ def create_page(filename: str) -> Tuple[Page, EmbeddedRstParser]:
11071109
page, all_yaml_diagnostics.get(page.source_path, [])
11081110
)
11091111

1110-
post_metadata, post_diagnostics = self.pages.flush()
1112+
if postprocess:
1113+
post_metadata, post_diagnostics = self.pages.flush()
11111114

1112-
static_files = {
1113-
"objects.inv": self.targets.generate_inventory("").dumps(
1114-
self.config.name, ""
1115-
)
1116-
}
1117-
post_metadata["static_files"] = static_files
1115+
static_files = {
1116+
"objects.inv": self.targets.generate_inventory("").dumps(
1117+
self.config.name, ""
1118+
)
1119+
}
1120+
post_metadata["static_files"] = static_files
11181121

1119-
for fileid, page in self.pages.items():
1120-
self.backend.on_update(self.prefix, self.build_identifiers, fileid, page)
1121-
for fileid, diagnostics in post_diagnostics.items():
1122-
self.backend.on_diagnostics(fileid, diagnostics)
1122+
for fileid, page in self.pages.items():
1123+
self.backend.on_update(
1124+
self.prefix, self.build_identifiers, fileid, page
1125+
)
1126+
for fileid, diagnostics in post_diagnostics.items():
1127+
self.backend.on_diagnostics(fileid, diagnostics)
11231128

1124-
self.backend.on_update_metadata(
1125-
self.prefix, self.build_identifiers, post_metadata
1126-
)
1129+
self.backend.on_update_metadata(
1130+
self.prefix, self.build_identifiers, post_metadata
1131+
)
11271132

11281133
def _page_updated(self, page: Page, diagnostics: List[Diagnostic]) -> None:
11291134
"""Update any state associated with a parsed page."""
@@ -1233,10 +1238,12 @@ def delete(self, path: PurePath) -> None:
12331238
with self._lock:
12341239
self._project.delete(path)
12351240

1236-
def build(self, max_workers: Optional[int] = None) -> None:
1241+
def build(
1242+
self, max_workers: Optional[int] = None, postprocess: bool = True
1243+
) -> None:
12371244
"""Build the full project."""
12381245
with self._lock:
1239-
self._project.build(max_workers)
1246+
self._project.build(max_workers, postprocess)
12401247

12411248
def stop_monitoring(self) -> None:
12421249
"""Stop the filesystem monitoring thread associated with this project."""

0 commit comments

Comments
 (0)