python-delphi-lsp 2.2.0__py3-none-any.whl → 2.3.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
delphi_lsp/_version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "2.2.0"
1
+ __version__ = "2.3.0"
delphi_lsp/agent_cache.py CHANGED
@@ -280,6 +280,18 @@ def _safe_metadata_path(root: str | Path, *, create: bool = False) -> Path:
280
280
  return result
281
281
 
282
282
 
283
+ def _safe_navigation_cache_path(root: str | Path, *, create: bool = False) -> Path:
284
+ parent = _safe_metadata_path(root, create=create).parent
285
+ result = parent / "navigation-v1"
286
+ if result.exists() and result.is_symlink():
287
+ raise CacheClientError("unsafe_metadata", "Navigation cache path is unsafe.")
288
+ if create:
289
+ result.mkdir(mode=0o700, exist_ok=True)
290
+ if os.name != "nt":
291
+ os.chmod(result, 0o700)
292
+ return result
293
+
294
+
283
295
  def _metadata_mapping(metadata: CacheMetadata) -> dict[str, object]:
284
296
  return {field.name: getattr(metadata, field.name) for field in fields(metadata)}
285
297
 
@@ -549,6 +561,10 @@ class _CacheService:
549
561
  workers=metadata.workers,
550
562
  worker_memory_budget_bytes=metadata.max_memory_bytes,
551
563
  revision_check_interval_seconds=_CACHE_REVISION_CHECK_INTERVAL_SECONDS,
564
+ navigation_cache_dir=_safe_navigation_cache_path(
565
+ metadata.root,
566
+ create=True,
567
+ ),
552
568
  )
553
569
  self.budget = CacheBudget(metadata.max_memory_bytes)
554
570
  self.stats = CacheStats()
@@ -648,6 +664,8 @@ class _CacheService:
648
664
  "prewarm_seconds": self.prewarm_seconds,
649
665
  "parallel_seconds": self.context.parallel_stats.elapsed_seconds,
650
666
  "parallel_fallbacks": self.stats.parallel_fallbacks,
667
+ "navigation_disk_hits": self.context.navigation_disk_hits,
668
+ "navigation_disk_misses": self.context.navigation_disk_misses,
651
669
  "idle_timeout": self.metadata.idle_timeout, "idle_remaining": max(0.0, self.metadata.idle_timeout - idle),
652
670
  "workspace_revision": self.last_revision,
653
671
  }