Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add configuration to use new experimental ondisk cache for lsp-kotlin #4138

Merged
merged 3 commits into from
Oct 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions clients/lsp-kotlin.el
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,17 @@ to Kotlin."
:group 'lsp-kotlin
:package-version '(lsp-mode . "8.0.1"))

;; cache in this case is the dependency cache. Given as an initialization option.
(defcustom lsp-kotlin-ondisk-cache-path nil
"Path to the ondisk cache if used. If lsp-kotlin-ondisk-cache-enabled is t, but path is nil, then the project root is used as a default."
:type 'string
:group 'lsp-kotlin)

(defcustom lsp-kotlin-ondisk-cache-enabled nil
"Specifies whether to enable ondisk cache or not. If nil, in-memory cache will be used."
:type 'boolean
:group 'lsp-kotlin)

(lsp-register-custom-settings
'(("kotlin.externalSources.autoConvertToKotlin" lsp-kotlin-external-sources-auto-convert-to-kotlin t)
("kotlin.externalSources.useKlsScheme" lsp-kotlin-external-sources-use-kls-scheme t)
Expand Down Expand Up @@ -260,6 +271,10 @@ to Kotlin."
:initialized-fn (lambda (workspace)
(with-lsp-workspace workspace
(lsp--set-configuration (lsp-configuration-section "kotlin"))))
:initialization-options (lambda ()
(when lsp-kotlin-ondisk-cache-enabled
(list :storagePath (or lsp-kotlin-ondisk-cache-path
(lsp-workspace-root)))))
:download-server-fn (lambda (_client callback error-callback _update?)
(lsp-package-ensure 'kotlin-language-server callback error-callback))))

Expand Down
Loading