Skip to content

Commit

Permalink
Prevent extension startup in LangServ
Browse files Browse the repository at this point in the history
  • Loading branch information
PseudoKnight committed Sep 5, 2019
1 parent 4925614 commit 291befb
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/main/java/com/laytonsmith/tools/langserv/LangServ.java
Expand Up @@ -12,6 +12,7 @@
import com.laytonsmith.core.LogLevel;
import com.laytonsmith.core.MSLog;
import com.laytonsmith.core.MethodScriptCompiler;
import com.laytonsmith.core.MethodScriptFileLocations;
import com.laytonsmith.core.ParseTree;
import com.laytonsmith.core.Profiles;
import com.laytonsmith.core.Security;
Expand All @@ -31,6 +32,7 @@
import com.laytonsmith.core.events.EventList;
import com.laytonsmith.core.exceptions.ConfigCompileException;
import com.laytonsmith.core.exceptions.ConfigCompileGroupException;
import com.laytonsmith.core.extensions.ExtensionManager;
import com.laytonsmith.core.functions.DocumentLinkProvider;
import com.laytonsmith.core.functions.Function;
import com.laytonsmith.core.functions.FunctionBase;
Expand Down Expand Up @@ -163,6 +165,11 @@ public ArgumentParser getArgumentParser() {
.setArgType(ArgumentParser.ArgumentBuilder.BuilderTypeNonFlag.ARRAY_OF_STRINGS));
}

@Override
public boolean startupExtensionManager() {
return false;
}

@Override
@SuppressWarnings("UseSpecificCatch")
public void execute(ArgumentParser.ArgumentParserResults parsedArgs) throws Exception {
Expand All @@ -174,6 +181,10 @@ public void execute(ArgumentParser.ArgumentParserResults parsedArgs) throws Exce
port = parsedArgs.getNumberArgument("port").intValue();
}

ExtensionManager.AddDiscoveryLocation(MethodScriptFileLocations.getDefault().getExtensionsDirectory());
ExtensionManager.Cache(MethodScriptFileLocations.getDefault().getExtensionCacheDirectory());
ExtensionManager.Initialize(ClassDiscovery.getDefaultInstance());

LangServ langserv = new LangServ(useStdio);
langserv.log("Starting up Language Server: " + parsedArgs.getRawArguments(), LogLevel.INFO);
try {
Expand Down Expand Up @@ -503,7 +514,7 @@ public void initialized(InitializedParams params) {
File workspace = new File(f.getUri().replaceFirst("file://", ""));
try {
FileUtil.recursiveFind(workspace, (File f1) -> {
if(f1.isFile() && f1.getName().endsWith(".ms") || f1.getName().endsWith(".msa")) {
if(f1.isFile() && (f1.getName().endsWith(".ms") || f1.getName().endsWith(".msa"))) {
doCompilation(null, lowPriorityProcessors, f1.toURI().toString(), false);
}
});
Expand Down

0 comments on commit 291befb

Please sign in to comment.