Skip to content
Permalink
Browse files

Prevent extension startup in LangServ

  • Loading branch information...
PseudoKnight committed Sep 5, 2019
1 parent 4925614 commit 291befb166d694d94f7a5a4d08b84caff5eda438
Showing with 12 additions and 1 deletion.
  1. +12 −1 src/main/java/com/laytonsmith/tools/langserv/LangServ.java
@@ -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;
@@ -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;
@@ -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 {
@@ -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 {
@@ -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);
}
});

0 comments on commit 291befb

Please sign in to comment.
You can’t perform that action at this time.