[lsp] made start of languageserver implicit after connect()

This commit is contained in:
Sven Efftinge 2016-06-01 10:51:15 +02:00
parent 206b0d4eaf
commit c6aadc834e
3 changed files with 14 additions and 4 deletions

View file

@ -80,7 +80,6 @@ class ServerLauncher {
p2.printStackTrace(System.err)
]
messageAcceptor.connect(stdin, stdout)
messageAcceptor.start
System.err.println("started.")
messageAcceptor.join
while (!hasExitNotification.get) {

View file

@ -25,7 +25,8 @@ class ServerLauncherTest {
@Before
def void setUp() {
this.process = new ProcessBuilder("java","-cp",System.getProperty("java.class.path"), "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=1044", ServerLauncher.name
this.process = new ProcessBuilder("java","-cp",System.getProperty("java.class.path")
, ServerLauncher.name
// ,"debug"
).redirectInput(Redirect.PIPE).redirectOutput(Redirect.PIPE).start
}
@ -35,13 +36,17 @@ class ServerLauncherTest {
process?.destroy
}
@Test(timeout = 5000)
@Test(timeout = 3000)
def void testServerLaunch() {
val client = new JsonBasedLanguageServer()
client.protocol.addErrorListener[p1, p2|
System.err.println(p1)
p2?.printStackTrace
]
client.connect(process.inputStream, process.outputStream)
val msg = client.initialize(new InitializeParamsImpl() => [
rootPath = "."
])
]).get
Assert.assertTrue(msg != null)
}

View file

@ -16,6 +16,8 @@ import org.eclipse.xtext.ide.editor.contentassist.antlr.IContentAssistParser
import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.Lexer
import org.eclipse.xtext.ide.tests.testlanguage.ide.contentassist.antlr.TestLanguageParser
import org.eclipse.xtext.ide.tests.testlanguage.ide.contentassist.antlr.internal.InternalTestLanguageLexer
import org.eclipse.xtext.ide.editor.syntaxcoloring.IEditorHighlightingConfigurationProvider
import org.eclipse.xtext.ide.tests.testlanguage.highlighting.TestLanguageHighlightingProvider
/**
* Use this class to register components to be used at runtime / without the Equinox extension registry.
@ -33,5 +35,9 @@ class TestLanguageRuntimeModule extends AbstractTestLanguageRuntimeModule {
def Class<? extends IContentAssistParser> bindIContentAssistParser() {
TestLanguageParser
}
def Class<? extends IEditorHighlightingConfigurationProvider> bindIEditorHighlightingConfigurationProvider() {
TestLanguageHighlightingProvider
}
}