Skip to content

Provide an option to clear cache #135

@playdohface

Description

@playdohface

It sometimes happens that JDTLS's starts providing wrong diagnostics or suddenly doesn't give certain completions anymore. This is certainly a problem with JDTLS and it's interactions with Zed, but the remedy is usually to clear the cache and restart the language server and everything works fine again.
The problem is that there is currently no convenient way to do so.

We have get_jdtls_data_path which determines where JDTLS will store its project-level state. Currently, these are unique per worktree-root directory and stored in the system level cache folder. To manage them I see two options that we can use within the current Zed extension limitations:

  • have a config option "cache_key" : int that we use when generating the directory hash. This way we can simply increment the key to get a fresh cache. Cleaning up the old ones remains the system's responsibility. The nice thing here is this can be project-specific config, so you can keep the cache for one project and refresh them for another one
  • have a config option clear_cache_on_startup and manage the jdtls-data-paths inside our extension working directory, and just delete its contents every time language_server_command is called when the option is set.

I haven't done a lot of research if maybe JDTLS offers other ways to do this or if we should perhaps wait for/work on some Zed feature, so this is the place to discuss this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions