diff --git a/vscode-extensions/commons/commons-language-server/src/main/java/org/springframework/ide/vscode/util/SimpleLanguageServer.java b/vscode-extensions/commons/commons-language-server/src/main/java/org/springframework/ide/vscode/util/SimpleLanguageServer.java index 19a98d073..2db20cf38 100644 --- a/vscode-extensions/commons/commons-language-server/src/main/java/org/springframework/ide/vscode/util/SimpleLanguageServer.java +++ b/vscode-extensions/commons/commons-language-server/src/main/java/org/springframework/ide/vscode/util/SimpleLanguageServer.java @@ -20,14 +20,14 @@ import io.typefox.lsapi.services.WindowService; /** * Abstract base class to implement LanguageServer. Bits and pieces copied from - * the 'JavaLanguageServer' example which seem generally useful / reusable end up in - * here so we can try to keep the subclass itself more 'clutter free' and focus on + * the 'JavaLanguageServer' example which seem generally useful / reusable end up in + * here so we can try to keep the subclass itself more 'clutter free' and focus on * what its really doing and not the 'wiring and plumbing'. */ public abstract class SimpleLanguageServer implements LanguageServer { - + private static final Logger LOG = Logger.getLogger(SimpleLanguageServer.class.getName()); - + private Consumer showMessage = m -> {}; private Path workspaceRoot; @@ -35,16 +35,16 @@ public abstract class SimpleLanguageServer implements LanguageServer { private SimpleTextDocumentService tds; private SimpleWorkspaceService workspace; - + @Override public CompletableFuture initialize(InitializeParams params) { - LOG.info("Initializing"); +// LOG.info("Initializing"); String rootPath = params.getRootPath(); if (rootPath==null) { - LOG.warning("workspaceRoot NOT SET"); +// LOG.warning("workspaceRoot NOT SET"); } else { this.workspaceRoot= Paths.get(rootPath).toAbsolutePath().normalize(); - LOG.info("workspaceRoot = "+workspaceRoot); +// LOG.info("workspaceRoot = "+workspaceRoot); } InitializeResultImpl result = new InitializeResultImpl(); @@ -74,13 +74,13 @@ public abstract class SimpleLanguageServer implements LanguageServer { } }; } - + public void onError(String message, Throwable error) { if (error instanceof ShowMessageException) showMessage.accept(((ShowMessageException) error).message); else { LOG.log(Level.SEVERE, message, error); - + MessageParamsImpl m = new MessageParamsImpl(); m.setMessage(message); @@ -91,7 +91,7 @@ public abstract class SimpleLanguageServer implements LanguageServer { } protected abstract ServerCapabilitiesImpl getServerCapabilities(); - + @Override public void shutdown() { } @@ -128,7 +128,7 @@ public abstract class SimpleLanguageServer implements LanguageServer { } return workspace; } - + @Override public void onTelemetryEvent(Consumer callback) { //TODO: not sure what this is for exactly. We just stub it and do nothing for now. diff --git a/vscode-extensions/vscode-application-yaml/src/main/java/org/springframework/ide/vscode/yaml/YamlLanguageServer.java b/vscode-extensions/vscode-application-yaml/src/main/java/org/springframework/ide/vscode/yaml/ApplicationYamlLanguageServer.java similarity index 95% rename from vscode-extensions/vscode-application-yaml/src/main/java/org/springframework/ide/vscode/yaml/YamlLanguageServer.java rename to vscode-extensions/vscode-application-yaml/src/main/java/org/springframework/ide/vscode/yaml/ApplicationYamlLanguageServer.java index ff3a06964..1172e25e7 100644 --- a/vscode-extensions/vscode-application-yaml/src/main/java/org/springframework/ide/vscode/yaml/YamlLanguageServer.java +++ b/vscode-extensions/vscode-application-yaml/src/main/java/org/springframework/ide/vscode/yaml/ApplicationYamlLanguageServer.java @@ -20,9 +20,7 @@ import com.google.common.collect.ImmutableList; import io.typefox.lsapi.CompletionItem; import io.typefox.lsapi.CompletionItemKind; import io.typefox.lsapi.CompletionList; -import io.typefox.lsapi.Diagnostic; import io.typefox.lsapi.DiagnosticSeverity; -import io.typefox.lsapi.ServerCapabilities; import io.typefox.lsapi.TextDocumentSyncKind; import io.typefox.lsapi.impl.CompletionItemImpl; import io.typefox.lsapi.impl.CompletionListImpl; @@ -32,15 +30,14 @@ import io.typefox.lsapi.impl.PositionImpl; import io.typefox.lsapi.impl.RangeImpl; import io.typefox.lsapi.impl.ServerCapabilitiesImpl; -public class YamlLanguageServer extends SimpleLanguageServer { +public class ApplicationYamlLanguageServer extends SimpleLanguageServer { private Yaml yaml = new Yaml(); - public YamlLanguageServer() { + public ApplicationYamlLanguageServer() { SimpleTextDocumentService documents = getTextDocumentService(); // SimpleWorkspaceService workspace = getWorkspaceService(); documents.onDidChangeContent(params -> { - System.out.println("Document changed: "+params); TextDocument doc = params.getDocument(); validateDocument(documents, doc); }); diff --git a/vscode-extensions/vscode-application-yaml/src/main/java/org/springframework/ide/vscode/yaml/Main.java b/vscode-extensions/vscode-application-yaml/src/main/java/org/springframework/ide/vscode/yaml/Main.java index aceccb3ed..90a575fd1 100644 --- a/vscode-extensions/vscode-application-yaml/src/main/java/org/springframework/ide/vscode/yaml/Main.java +++ b/vscode-extensions/vscode-application-yaml/src/main/java/org/springframework/ide/vscode/yaml/Main.java @@ -79,7 +79,7 @@ public class Main { * When the request stream is closed, wait for 5s for all outstanding responses to compute, then return. */ public static void run(Connection connection) { - YamlLanguageServer server = new YamlLanguageServer(); + ApplicationYamlLanguageServer server = new ApplicationYamlLanguageServer(); LoggingJsonAdapter jsonServer = new LoggingJsonAdapter(server); jsonServer.setMessageLog(new PrintWriter(System.out)); diff --git a/vscode-extensions/vscode-application-yaml/src/test/java/org/springframework/ide/vscode/yaml/AbstractPropsEditorTest.java b/vscode-extensions/vscode-application-yaml/src/test/java/org/springframework/ide/vscode/yaml/AbstractPropsEditorTest.java index 6500c1b29..0a07aab79 100644 --- a/vscode-extensions/vscode-application-yaml/src/test/java/org/springframework/ide/vscode/yaml/AbstractPropsEditorTest.java +++ b/vscode-extensions/vscode-application-yaml/src/test/java/org/springframework/ide/vscode/yaml/AbstractPropsEditorTest.java @@ -30,7 +30,7 @@ public class AbstractPropsEditorTest { @Before public void setup() throws Exception { md = new PropertyIndexHarness(); - harness = new LanguageServerHarness(YamlLanguageServer::new); + harness = new LanguageServerHarness(ApplicationYamlLanguageServer::new); harness.intialize(null); } diff --git a/vscode-extensions/vscode-application-yaml/src/test/java/org/springframework/ide/vscode/yaml/ApplicationYamlEditorTest.java b/vscode-extensions/vscode-application-yaml/src/test/java/org/springframework/ide/vscode/yaml/ApplicationYamlEditorTest.java index 086bef0a4..213621543 100644 --- a/vscode-extensions/vscode-application-yaml/src/test/java/org/springframework/ide/vscode/yaml/ApplicationYamlEditorTest.java +++ b/vscode-extensions/vscode-application-yaml/src/test/java/org/springframework/ide/vscode/yaml/ApplicationYamlEditorTest.java @@ -40,7 +40,7 @@ public class ApplicationYamlEditorTest extends AbstractPropsEditorTest { //////////////////////////////////////////////////////////////////////////////////////// @Test public void linterRunsOnDocumentOpenAndChange() throws Exception { - LanguageServerHarness harness = new LanguageServerHarness(YamlLanguageServer::new); + LanguageServerHarness harness = new LanguageServerHarness(ApplicationYamlLanguageServer::new); harness.intialize(null); Editor editor = newEditor( @@ -252,7 +252,7 @@ public class ApplicationYamlEditorTest extends AbstractPropsEditorTest { System.out.println("<<< testHyperlinkTargets"); } - @Ignore @Test public void testReconcile() throws Exception { + @Test public void testReconcile() throws Exception { defaultTestData(); Editor editor = newEditor( "server:\n" + diff --git a/vscode-extensions/vscode-application-yaml/src/test/java/org/springframework/ide/vscode/yaml/YamlLanguageServerTests.java b/vscode-extensions/vscode-application-yaml/src/test/java/org/springframework/ide/vscode/yaml/ApplicationYamlLanguageServerTests.java similarity index 76% rename from vscode-extensions/vscode-application-yaml/src/test/java/org/springframework/ide/vscode/yaml/YamlLanguageServerTests.java rename to vscode-extensions/vscode-application-yaml/src/test/java/org/springframework/ide/vscode/yaml/ApplicationYamlLanguageServerTests.java index af694eaab..4d980c571 100644 --- a/vscode-extensions/vscode-application-yaml/src/test/java/org/springframework/ide/vscode/yaml/YamlLanguageServerTests.java +++ b/vscode-extensions/vscode-application-yaml/src/test/java/org/springframework/ide/vscode/yaml/ApplicationYamlLanguageServerTests.java @@ -10,7 +10,7 @@ import java.util.List; import org.junit.Test; import org.springframework.ide.vscode.testharness.LanguageServerHarness; import org.springframework.ide.vscode.testharness.TextDocumentInfo; -import org.springframework.ide.vscode.yaml.YamlLanguageServer; +import org.springframework.ide.vscode.yaml.ApplicationYamlLanguageServer; import io.typefox.lsapi.CompletionItem; import io.typefox.lsapi.CompletionList; @@ -18,15 +18,15 @@ import io.typefox.lsapi.InitializeResult; import io.typefox.lsapi.ServerCapabilities; import io.typefox.lsapi.TextDocumentSyncKind; -public class YamlLanguageServerTests { +public class ApplicationYamlLanguageServerTests { public static File getTestResource(String name) throws URISyntaxException { - return Paths.get(YamlLanguageServerTests.class.getResource(name).toURI()).toFile(); + return Paths.get(ApplicationYamlLanguageServerTests.class.getResource(name).toURI()).toFile(); } @Test public void createAndInitializeServerWithWorkspace() throws Exception { - LanguageServerHarness harness = new LanguageServerHarness(YamlLanguageServer::new); + LanguageServerHarness harness = new LanguageServerHarness(ApplicationYamlLanguageServer::new); File workspaceRoot = getTestResource("/workspace/"); assertExpectedInitResult(harness.intialize(workspaceRoot)); } @@ -34,7 +34,7 @@ public class YamlLanguageServerTests { @Test public void createAndInitializeServerWithoutWorkspace() throws Exception { File workspaceRoot = null; - LanguageServerHarness harness = new LanguageServerHarness(YamlLanguageServer::new); + LanguageServerHarness harness = new LanguageServerHarness(ApplicationYamlLanguageServer::new); assertExpectedInitResult(harness.intialize(workspaceRoot)); }