mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-13 10:16:00 +00:00
Use deterministic workspace dir for EclipseJDTLS to enable cache reuse (#1214)
* Use deterministic workspace dir for EclipseJDTLS to enable cache reuse Replace uuid.uuid4().hex with a hash of the project path for the JDTLS workspace directory. This allows the workspace cache (project index, shared index, configuration) to be reused across server restarts instead of rebuilding from scratch each time. The random UUID was inherited from microsoft/multilspy (a research/testing library where ephemeral workspaces made sense), but for Serena's use case — long-lived projects with repeated restarts — deterministic workspace paths significantly reduce startup time, especially for large Java projects. * Fix import sort order for ruff lint
This commit is contained in:
1 parent
8c62b0d991
commit
483538a293
1 file changed
+6
-3
@@ -3,12 +3,12 @@ Provides Java specific instantiation of the LanguageServer class. Contains vario
|
||||
"""
|
||||
|
||||
import dataclasses
|
||||
import hashlib
|
||||
import logging
|
||||
import os
|
||||
import pathlib
|
||||
import shutil
|
||||
import threading
|
||||
import uuid
|
||||
from pathlib import PurePath
|
||||
from time import sleep
|
||||
from typing import cast
|
||||
@@ -276,13 +276,16 @@ class EclipseJDTLS(SolidLanguageServer):
|
||||
)
|
||||
|
||||
def create_launch_command(self) -> list[str]:
|
||||
# ws_dir is the workspace directory for the EclipseJDTLS server
|
||||
# ws_dir is the workspace directory for the EclipseJDTLS server.
|
||||
# Use a deterministic hash of the project path so the workspace
|
||||
# (and its cached index) can be reused across restarts.
|
||||
project_hash = hashlib.md5(self._repository_root_path.encode()).hexdigest()
|
||||
ws_dir = str(
|
||||
PurePath(
|
||||
self._solidlsp_settings.ls_resources_dir,
|
||||
"EclipseJDTLS",
|
||||
"workspaces",
|
||||
uuid.uuid4().hex,
|
||||
project_hash,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
Reference in new issue
Block a user