From 55f0bf86ab761570ea1db46e1fe3a5314df7c384 Mon Sep 17 00:00:00 2001 From: Julian Valentin Date: Sun, 10 Nov 2019 17:14:17 +0100 Subject: [PATCH] Use sentence cache size from settings This also decreases the default from 10000 to 2000. --- .../LanguageToolLanguageServer.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/bsplines/languagetool_languageserver/LanguageToolLanguageServer.java b/src/main/java/org/bsplines/languagetool_languageserver/LanguageToolLanguageServer.java index e234bd1a..b9cebe76 100644 --- a/src/main/java/org/bsplines/languagetool_languageserver/LanguageToolLanguageServer.java +++ b/src/main/java/org/bsplines/languagetool_languageserver/LanguageToolLanguageServer.java @@ -39,7 +39,6 @@ public class LanguageToolLanguageServer implements LanguageServer, LanguageClien private JLanguageTool languageTool; private Settings settings = new Settings(); - private static final long resultCacheMaxSize = 10000; private static final int resultCacheExpireAfterMinutes = 10; private static final String acceptSuggestionCodeActionKind = CodeActionKind.QuickFix + ".ltex.acceptSuggestion"; @@ -140,8 +139,8 @@ private void reinitialize() { String motherTongueShortCode = settings.getMotherTongueShortCode(); Language motherTongue = ((motherTongueShortCode != null) ? Languages.getLanguageForShortCode(motherTongueShortCode) : null); - ResultCache resultCache = new ResultCache(resultCacheMaxSize, resultCacheExpireAfterMinutes, - TimeUnit.MINUTES); + ResultCache resultCache = new ResultCache(settings.getSentenceCacheSize(), + resultCacheExpireAfterMinutes, TimeUnit.MINUTES); UserConfig userConfig = new UserConfig(settings.getDictionary()); languageTool = new JLanguageTool(language, motherTongue, resultCache, userConfig);