|
| 1 | +package com.cppcxy.ide.setting; |
| 2 | + |
| 3 | +import com.intellij.openapi.application.ApplicationManager; |
| 4 | +import com.intellij.openapi.components.PersistentStateComponent; |
| 5 | +import com.intellij.openapi.components.State; |
| 6 | +import com.intellij.openapi.components.Storage; |
| 7 | +import com.intellij.util.xmlb.XmlSerializerUtil; |
| 8 | +import org.jetbrains.annotations.NotNull; |
| 9 | +import org.jetbrains.annotations.Nullable; |
| 10 | + |
| 11 | +import java.util.ArrayList; |
| 12 | +import java.util.List; |
| 13 | + |
| 14 | +@State( |
| 15 | + name = "EmmyLuaSettings", |
| 16 | + storages = @Storage("emmylua2.xml") |
| 17 | +) |
| 18 | +public class EmmyLuaSettings implements PersistentStateComponent<EmmyLuaSettings> { |
| 19 | + |
| 20 | + // Analyzer location |
| 21 | + private String location = ""; |
| 22 | + |
| 23 | + // Completion settings |
| 24 | + private boolean completionEnable = true; |
| 25 | + private boolean autoRequire = true; |
| 26 | + private String autoRequireFunction = "require"; |
| 27 | + private String autoRequireNamingConvention = "keep"; |
| 28 | + private String autoRequireSeparator = "."; |
| 29 | + private boolean baseFunctionIncludesName = true; |
| 30 | + private boolean callSnippet = false; |
| 31 | + private String postfix = "@"; |
| 32 | + |
| 33 | + // Diagnostic settings |
| 34 | + private boolean diagnosticEnable = true; |
| 35 | + private int diagnosticInterval = 500; |
| 36 | + private List<String> diagnosticDisable = new ArrayList<>(); |
| 37 | + private List<String> diagnosticEnables = new ArrayList<>(); |
| 38 | + private List<String> globalVariables = new ArrayList<>(); |
| 39 | + private List<String> globalsRegex = new ArrayList<>(); |
| 40 | + |
| 41 | + // Hint settings |
| 42 | + private boolean hintEnable = true; |
| 43 | + private boolean enumParamHint = false; |
| 44 | + private boolean indexHint = true; |
| 45 | + private boolean localHint = true; |
| 46 | + private boolean metaCallHint = true; |
| 47 | + private boolean overrideHint = true; |
| 48 | + private boolean paramHint = true; |
| 49 | + |
| 50 | + // Other feature settings |
| 51 | + private boolean codeLensEnable = true; |
| 52 | + private boolean codeActionInsertSpace = false; |
| 53 | + private boolean documentColorEnable = true; |
| 54 | + private boolean hoverEnable = true; |
| 55 | + private boolean inlineValuesEnable = true; |
| 56 | + private boolean referencesEnable = true; |
| 57 | + private boolean referencesFuzzySearch = true; |
| 58 | + private boolean referencesShortStringSearch = false; |
| 59 | + private boolean semanticTokensEnable = true; |
| 60 | + private boolean signatureDetailHelper = true; |
| 61 | + |
| 62 | + // Runtime settings |
| 63 | + private String luaVersion = "LuaLatest"; |
| 64 | + private List<String> extensions = new ArrayList<>(); |
| 65 | + private List<String> frameworkVersions = new ArrayList<>(); |
| 66 | + private List<String> requireLikeFunction = new ArrayList<>(); |
| 67 | + private List<String> requirePattern = new ArrayList<>(); |
| 68 | + |
| 69 | + // Class default call settings |
| 70 | + private boolean classDefaultCallForceNonColon = false; |
| 71 | + private boolean classDefaultCallForceReturnSelf = false; |
| 72 | + private String classDefaultCallFunctionName = ""; |
| 73 | + |
| 74 | + // Doc settings |
| 75 | + private List<String> docKnownTags = new ArrayList<>(); |
| 76 | + private List<String> docPrivateName = new ArrayList<>(); |
| 77 | + |
| 78 | + // Strict settings |
| 79 | + private boolean strictArrayIndex = true; |
| 80 | + private boolean strictDocBaseConstMatchBaseType = true; |
| 81 | + private boolean strictMetaOverrideFileDefine = true; |
| 82 | + private boolean strictRequirePath = false; |
| 83 | + private boolean strictTypeCall = false; |
| 84 | + |
| 85 | + // Workspace settings |
| 86 | + private boolean workspaceEnableReindex = false; |
| 87 | + private String workspaceEncoding = "utf-8"; |
| 88 | + private List<String> workspaceIgnoreDir = new ArrayList<>(); |
| 89 | + private List<String> workspaceIgnoreGlobs = new ArrayList<>(); |
| 90 | + private List<String> workspaceLibrary = new ArrayList<>(); |
| 91 | + private int workspacePreloadFileSize = 0; |
| 92 | + private int workspaceReindexDuration = 5000; |
| 93 | + private List<String> workspaceRoots = new ArrayList<>(); |
| 94 | + |
| 95 | + // Resource settings |
| 96 | + private List<String> resourcePaths = new ArrayList<>(); |
| 97 | + |
| 98 | + public static EmmyLuaSettings getInstance() { |
| 99 | + return ApplicationManager.getApplication().getService(EmmyLuaSettings.class); |
| 100 | + } |
| 101 | + |
| 102 | + @Override |
| 103 | + public @Nullable EmmyLuaSettings getState() { |
| 104 | + return this; |
| 105 | + } |
| 106 | + |
| 107 | + @Override |
| 108 | + public void loadState(@NotNull EmmyLuaSettings state) { |
| 109 | + XmlSerializerUtil.copyBean(state, this); |
| 110 | + } |
| 111 | + |
| 112 | + // Getters and Setters |
| 113 | + public String getLocation() { return location; } |
| 114 | + public void setLocation(String location) { this.location = location; } |
| 115 | + |
| 116 | + // Completion settings |
| 117 | + public boolean isCompletionEnable() { return completionEnable; } |
| 118 | + public void setCompletionEnable(boolean completionEnable) { this.completionEnable = completionEnable; } |
| 119 | + |
| 120 | + public boolean isAutoRequire() { return autoRequire; } |
| 121 | + public void setAutoRequire(boolean autoRequire) { this.autoRequire = autoRequire; } |
| 122 | + |
| 123 | + public String getAutoRequireFunction() { return autoRequireFunction; } |
| 124 | + public void setAutoRequireFunction(String autoRequireFunction) { this.autoRequireFunction = autoRequireFunction; } |
| 125 | + |
| 126 | + public String getAutoRequireNamingConvention() { return autoRequireNamingConvention; } |
| 127 | + public void setAutoRequireNamingConvention(String autoRequireNamingConvention) { this.autoRequireNamingConvention = autoRequireNamingConvention; } |
| 128 | + |
| 129 | + public String getAutoRequireSeparator() { return autoRequireSeparator; } |
| 130 | + public void setAutoRequireSeparator(String autoRequireSeparator) { this.autoRequireSeparator = autoRequireSeparator; } |
| 131 | + |
| 132 | + public boolean isBaseFunctionIncludesName() { return baseFunctionIncludesName; } |
| 133 | + public void setBaseFunctionIncludesName(boolean baseFunctionIncludesName) { this.baseFunctionIncludesName = baseFunctionIncludesName; } |
| 134 | + |
| 135 | + public boolean isCallSnippet() { return callSnippet; } |
| 136 | + public void setCallSnippet(boolean callSnippet) { this.callSnippet = callSnippet; } |
| 137 | + |
| 138 | + public String getPostfix() { return postfix; } |
| 139 | + public void setPostfix(String postfix) { this.postfix = postfix; } |
| 140 | + |
| 141 | + // Diagnostic settings |
| 142 | + public boolean isDiagnosticEnable() { return diagnosticEnable; } |
| 143 | + public void setDiagnosticEnable(boolean diagnosticEnable) { this.diagnosticEnable = diagnosticEnable; } |
| 144 | + |
| 145 | + public int getDiagnosticInterval() { return diagnosticInterval; } |
| 146 | + public void setDiagnosticInterval(int diagnosticInterval) { this.diagnosticInterval = diagnosticInterval; } |
| 147 | + |
| 148 | + public List<String> getDiagnosticDisable() { return diagnosticDisable; } |
| 149 | + public void setDiagnosticDisable(List<String> diagnosticDisable) { this.diagnosticDisable = diagnosticDisable; } |
| 150 | + |
| 151 | + public List<String> getDiagnosticEnables() { return diagnosticEnables; } |
| 152 | + public void setDiagnosticEnables(List<String> diagnosticEnables) { this.diagnosticEnables = diagnosticEnables; } |
| 153 | + |
| 154 | + public List<String> getGlobalVariables() { return globalVariables; } |
| 155 | + public void setGlobalVariables(List<String> globalVariables) { this.globalVariables = globalVariables; } |
| 156 | + |
| 157 | + public List<String> getGlobalsRegex() { return globalsRegex; } |
| 158 | + public void setGlobalsRegex(List<String> globalsRegex) { this.globalsRegex = globalsRegex; } |
| 159 | + |
| 160 | + // Hint settings |
| 161 | + public boolean isHintEnable() { return hintEnable; } |
| 162 | + public void setHintEnable(boolean hintEnable) { this.hintEnable = hintEnable; } |
| 163 | + |
| 164 | + public boolean isEnumParamHint() { return enumParamHint; } |
| 165 | + public void setEnumParamHint(boolean enumParamHint) { this.enumParamHint = enumParamHint; } |
| 166 | + |
| 167 | + public boolean isIndexHint() { return indexHint; } |
| 168 | + public void setIndexHint(boolean indexHint) { this.indexHint = indexHint; } |
| 169 | + |
| 170 | + public boolean isLocalHint() { return localHint; } |
| 171 | + public void setLocalHint(boolean localHint) { this.localHint = localHint; } |
| 172 | + |
| 173 | + public boolean isMetaCallHint() { return metaCallHint; } |
| 174 | + public void setMetaCallHint(boolean metaCallHint) { this.metaCallHint = metaCallHint; } |
| 175 | + |
| 176 | + public boolean isOverrideHint() { return overrideHint; } |
| 177 | + public void setOverrideHint(boolean overrideHint) { this.overrideHint = overrideHint; } |
| 178 | + |
| 179 | + public boolean isParamHint() { return paramHint; } |
| 180 | + public void setParamHint(boolean paramHint) { this.paramHint = paramHint; } |
| 181 | + |
| 182 | + // Other feature settings |
| 183 | + public boolean isCodeLensEnable() { return codeLensEnable; } |
| 184 | + public void setCodeLensEnable(boolean codeLensEnable) { this.codeLensEnable = codeLensEnable; } |
| 185 | + |
| 186 | + public boolean isCodeActionInsertSpace() { return codeActionInsertSpace; } |
| 187 | + public void setCodeActionInsertSpace(boolean codeActionInsertSpace) { this.codeActionInsertSpace = codeActionInsertSpace; } |
| 188 | + |
| 189 | + public boolean isDocumentColorEnable() { return documentColorEnable; } |
| 190 | + public void setDocumentColorEnable(boolean documentColorEnable) { this.documentColorEnable = documentColorEnable; } |
| 191 | + |
| 192 | + public boolean isHoverEnable() { return hoverEnable; } |
| 193 | + public void setHoverEnable(boolean hoverEnable) { this.hoverEnable = hoverEnable; } |
| 194 | + |
| 195 | + public boolean isInlineValuesEnable() { return inlineValuesEnable; } |
| 196 | + public void setInlineValuesEnable(boolean inlineValuesEnable) { this.inlineValuesEnable = inlineValuesEnable; } |
| 197 | + |
| 198 | + public boolean isReferencesEnable() { return referencesEnable; } |
| 199 | + public void setReferencesEnable(boolean referencesEnable) { this.referencesEnable = referencesEnable; } |
| 200 | + |
| 201 | + public boolean isReferencesFuzzySearch() { return referencesFuzzySearch; } |
| 202 | + public void setReferencesFuzzySearch(boolean referencesFuzzySearch) { this.referencesFuzzySearch = referencesFuzzySearch; } |
| 203 | + |
| 204 | + public boolean isReferencesShortStringSearch() { return referencesShortStringSearch; } |
| 205 | + public void setReferencesShortStringSearch(boolean referencesShortStringSearch) { this.referencesShortStringSearch = referencesShortStringSearch; } |
| 206 | + |
| 207 | + public boolean isSemanticTokensEnable() { return semanticTokensEnable; } |
| 208 | + public void setSemanticTokensEnable(boolean semanticTokensEnable) { this.semanticTokensEnable = semanticTokensEnable; } |
| 209 | + |
| 210 | + public boolean isSignatureDetailHelper() { return signatureDetailHelper; } |
| 211 | + public void setSignatureDetailHelper(boolean signatureDetailHelper) { this.signatureDetailHelper = signatureDetailHelper; } |
| 212 | + |
| 213 | + // Runtime settings |
| 214 | + public String getLuaVersion() { return luaVersion; } |
| 215 | + public void setLuaVersion(String luaVersion) { this.luaVersion = luaVersion; } |
| 216 | + |
| 217 | + public List<String> getExtensions() { return extensions; } |
| 218 | + public void setExtensions(List<String> extensions) { this.extensions = extensions; } |
| 219 | + |
| 220 | + public List<String> getFrameworkVersions() { return frameworkVersions; } |
| 221 | + public void setFrameworkVersions(List<String> frameworkVersions) { this.frameworkVersions = frameworkVersions; } |
| 222 | + |
| 223 | + public List<String> getRequireLikeFunction() { return requireLikeFunction; } |
| 224 | + public void setRequireLikeFunction(List<String> requireLikeFunction) { this.requireLikeFunction = requireLikeFunction; } |
| 225 | + |
| 226 | + public List<String> getRequirePattern() { return requirePattern; } |
| 227 | + public void setRequirePattern(List<String> requirePattern) { this.requirePattern = requirePattern; } |
| 228 | + |
| 229 | + // Class default call settings |
| 230 | + public boolean isClassDefaultCallForceNonColon() { return classDefaultCallForceNonColon; } |
| 231 | + public void setClassDefaultCallForceNonColon(boolean classDefaultCallForceNonColon) { this.classDefaultCallForceNonColon = classDefaultCallForceNonColon; } |
| 232 | + |
| 233 | + public boolean isClassDefaultCallForceReturnSelf() { return classDefaultCallForceReturnSelf; } |
| 234 | + public void setClassDefaultCallForceReturnSelf(boolean classDefaultCallForceReturnSelf) { this.classDefaultCallForceReturnSelf = classDefaultCallForceReturnSelf; } |
| 235 | + |
| 236 | + public String getClassDefaultCallFunctionName() { return classDefaultCallFunctionName; } |
| 237 | + public void setClassDefaultCallFunctionName(String classDefaultCallFunctionName) { this.classDefaultCallFunctionName = classDefaultCallFunctionName; } |
| 238 | + |
| 239 | + // Doc settings |
| 240 | + public List<String> getDocKnownTags() { return docKnownTags; } |
| 241 | + public void setDocKnownTags(List<String> docKnownTags) { this.docKnownTags = docKnownTags; } |
| 242 | + |
| 243 | + public List<String> getDocPrivateName() { return docPrivateName; } |
| 244 | + public void setDocPrivateName(List<String> docPrivateName) { this.docPrivateName = docPrivateName; } |
| 245 | + |
| 246 | + // Strict settings |
| 247 | + public boolean isStrictArrayIndex() { return strictArrayIndex; } |
| 248 | + public void setStrictArrayIndex(boolean strictArrayIndex) { this.strictArrayIndex = strictArrayIndex; } |
| 249 | + |
| 250 | + public boolean isStrictDocBaseConstMatchBaseType() { return strictDocBaseConstMatchBaseType; } |
| 251 | + public void setStrictDocBaseConstMatchBaseType(boolean strictDocBaseConstMatchBaseType) { this.strictDocBaseConstMatchBaseType = strictDocBaseConstMatchBaseType; } |
| 252 | + |
| 253 | + public boolean isStrictMetaOverrideFileDefine() { return strictMetaOverrideFileDefine; } |
| 254 | + public void setStrictMetaOverrideFileDefine(boolean strictMetaOverrideFileDefine) { this.strictMetaOverrideFileDefine = strictMetaOverrideFileDefine; } |
| 255 | + |
| 256 | + public boolean isStrictRequirePath() { return strictRequirePath; } |
| 257 | + public void setStrictRequirePath(boolean strictRequirePath) { this.strictRequirePath = strictRequirePath; } |
| 258 | + |
| 259 | + public boolean isStrictTypeCall() { return strictTypeCall; } |
| 260 | + public void setStrictTypeCall(boolean strictTypeCall) { this.strictTypeCall = strictTypeCall; } |
| 261 | + |
| 262 | + // Workspace settings |
| 263 | + public boolean isWorkspaceEnableReindex() { return workspaceEnableReindex; } |
| 264 | + public void setWorkspaceEnableReindex(boolean workspaceEnableReindex) { this.workspaceEnableReindex = workspaceEnableReindex; } |
| 265 | + |
| 266 | + public String getWorkspaceEncoding() { return workspaceEncoding; } |
| 267 | + public void setWorkspaceEncoding(String workspaceEncoding) { this.workspaceEncoding = workspaceEncoding; } |
| 268 | + |
| 269 | + public List<String> getWorkspaceIgnoreDir() { return workspaceIgnoreDir; } |
| 270 | + public void setWorkspaceIgnoreDir(List<String> workspaceIgnoreDir) { this.workspaceIgnoreDir = workspaceIgnoreDir; } |
| 271 | + |
| 272 | + public List<String> getWorkspaceIgnoreGlobs() { return workspaceIgnoreGlobs; } |
| 273 | + public void setWorkspaceIgnoreGlobs(List<String> workspaceIgnoreGlobs) { this.workspaceIgnoreGlobs = workspaceIgnoreGlobs; } |
| 274 | + |
| 275 | + public List<String> getWorkspaceLibrary() { return workspaceLibrary; } |
| 276 | + public void setWorkspaceLibrary(List<String> workspaceLibrary) { this.workspaceLibrary = workspaceLibrary; } |
| 277 | + |
| 278 | + public int getWorkspacePreloadFileSize() { return workspacePreloadFileSize; } |
| 279 | + public void setWorkspacePreloadFileSize(int workspacePreloadFileSize) { this.workspacePreloadFileSize = workspacePreloadFileSize; } |
| 280 | + |
| 281 | + public int getWorkspaceReindexDuration() { return workspaceReindexDuration; } |
| 282 | + public void setWorkspaceReindexDuration(int workspaceReindexDuration) { this.workspaceReindexDuration = workspaceReindexDuration; } |
| 283 | + |
| 284 | + public List<String> getWorkspaceRoots() { return workspaceRoots; } |
| 285 | + public void setWorkspaceRoots(List<String> workspaceRoots) { this.workspaceRoots = workspaceRoots; } |
| 286 | + |
| 287 | + // Resource settings |
| 288 | + public List<String> getResourcePaths() { return resourcePaths; } |
| 289 | + public void setResourcePaths(List<String> resourcePaths) { this.resourcePaths = resourcePaths; } |
| 290 | +} |
0 commit comments