make langauge server symbol cache directory configurable
This commit is contained in:
@@ -10,6 +10,8 @@
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.vscode.boot.app;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
@@ -103,7 +105,7 @@ public class BootLanguagServerBootApp {
|
||||
@Bean
|
||||
SymbolCache symbolCache(BootLsConfigProperties props) {
|
||||
if (props.isSymbolCacheEnabled()) {
|
||||
return new SymbolCacheOnDisc();
|
||||
return new SymbolCacheOnDisc(new File(props.getSymbolCacheDir()));
|
||||
} else {
|
||||
return new SymbolCacheVoid();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2019 Pivotal, Inc.
|
||||
* Copyright (c) 2019, 2021 Pivotal, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
@@ -10,6 +10,8 @@
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.vscode.boot.app;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
@ConfigurationProperties("languageserver.boot")
|
||||
@@ -42,4 +44,19 @@ public class BootLsConfigProperties {
|
||||
public void setSymbolCacheEnabled(boolean symbolCacheEnabled) {
|
||||
this.symbolCacheEnabled = symbolCacheEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* The path to the cache directory where the language server stores
|
||||
* symbol information
|
||||
*/
|
||||
private String symbolCacheDir = System.getProperty("user.home") + File.separatorChar + ".sts4" + File.separatorChar + ".symbolCache";
|
||||
|
||||
public String getSymbolCacheDir() {
|
||||
return symbolCacheDir;
|
||||
}
|
||||
|
||||
public void setSymbolCacheDir(String symbolCacheDir) {
|
||||
this.symbolCacheDir = symbolCacheDir;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2019 2020 Pivotal, Inc.
|
||||
* Copyright (c) 2019 2021 Pivotal, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
@@ -61,10 +61,6 @@ public class SymbolCacheOnDisc implements SymbolCache {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(SymbolCacheOnDisc.class);
|
||||
|
||||
public SymbolCacheOnDisc() {
|
||||
this(new File(System.getProperty("user.home") + File.separatorChar + ".sts4" + File.separatorChar + ".symbolCache"));
|
||||
}
|
||||
|
||||
public SymbolCacheOnDisc(File cacheDirectory) {
|
||||
this.cacheDirectory = cacheDirectory;
|
||||
this.stores = new ConcurrentHashMap<>();
|
||||
|
||||
Reference in New Issue
Block a user