From 71b8c27eaceb0690d817e977a313a96ae559acad Mon Sep 17 00:00:00 2001 From: electricface Date: Tue, 16 Apr 2024 19:30:48 +0800 Subject: [PATCH] fix some issues reported by dscanner --- source/app.d | 6 ++++-- source/served/extension.d | 14 ++++++++------ source/served/types.d | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/source/app.d b/source/app.d index b74d17b..1106501 100644 --- a/source/app.d +++ b/source/app.d @@ -119,11 +119,13 @@ int main(string[] args) //dfmt off auto argInfo = args.getopt( - "r|require", "Adds a feature set that is required. Unknown feature sets will intentionally crash on startup", &features, + "r|require", "Adds a feature set that is required. Unknown feature sets will intentionally crash on startup", + &features, "p|provide", "Features to let the editor handle for better integration", &provides, "v|version", "Print version of program", &printVer, "logfile", "Output all log into the given file instead of stderr", &setLogFile, - "loglevel", "Change the log level for output logging (" ~ [__traits(allMembers, LogLevel)].join("|") ~ ")", &setLogLevel, + "loglevel", "Change the log level for output logging (" ~ [__traits(allMembers, LogLevel)].join("|") ~ ")", + &setLogLevel, "lang", "Change the language of GUI messages", &lang, "wait", "Wait for a second before starting (for debugging)", &wait); //dfmt on diff --git a/source/served/extension.d b/source/served/extension.d index b6d8d23..f4c5e6e 100644 --- a/source/served/extension.d +++ b/source/served/extension.d @@ -351,7 +351,7 @@ __gshared bool registerDefaultSnippets = false; void ensureStartedUp(UserConfiguration config) { - static __gshared bool startedUp = false; + __gshared bool startedUp = false; if (startedUp) return; startedUp = true; @@ -512,7 +512,7 @@ RootSuggestion[] rootsForProject(string root, bool recursive, string[] blocked, if (recursive) { - PackageDescriptorLoop: foreach (pkg; tryDirEntries(root, "dub.{json,sdl}", fs.SpanMode.breadth)) + foreach (pkg; tryDirEntries(root, "dub.{json,sdl}", fs.SpanMode.breadth)) { auto dir = dirName(pkg); if (dir.canFind(".dub")) @@ -705,8 +705,8 @@ bool[] forceLoadProjects(string[] rootPaths) __gshared bool bundleAskLoads; shared int totalLoadedProjects; string[] skippedRoots; -void delayedProjectActivation(WorkspaceD.Instance instance, string workspaceRoot, string workspaceUri, RootSuggestion root, - bool skipManyProjectsAction = false) +void delayedProjectActivation(WorkspaceD.Instance instance, string workspaceRoot, string workspaceUri, + RootSuggestion root, bool skipManyProjectsAction = false) { import core.atomic; @@ -810,12 +810,14 @@ void delayedProjectActivation(WorkspaceD.Instance instance, string workspaceRoot ); if (res == always) { - rpc.notifyMethod("coded/updateSetting", UpdateSettingParams("forceDownloadDependencies", JsonValue("always"), true)); + rpc.notifyMethod("coded/updateSetting", UpdateSettingParams("forceDownloadDependencies", + JsonValue("always"), true)); goto case DubUpgradeAction.always; } else if (res == never) { - rpc.notifyMethod("coded/updateSetting", UpdateSettingParams("forceDownloadDependencies", JsonValue("never"), true)); + rpc.notifyMethod("coded/updateSetting", UpdateSettingParams("forceDownloadDependencies", + JsonValue("never"), true)); } else if (res == upgrade) { diff --git a/source/served/types.d b/source/served/types.d index 27a5a3e..4d2a04a 100644 --- a/source/served/types.d +++ b/source/served/types.d @@ -47,7 +47,7 @@ import workspaced.api; deprecated("import stdlib_detect directly") public import served.utils.stdlib_detect : parseDmdConfImports, parseDflagsImports; -enum IncludedFeatures = ["d", "workspaces"]; +static immutable IncludedFeatures = ["d", "workspaces"]; __gshared MonoTime startupTime;