Skip to content

Commit

Permalink
feat: use server factory
Browse files Browse the repository at this point in the history
Signed-off-by: azerr <[email protected]>
  • Loading branch information
angelozerr committed Dec 12, 2023
1 parent 138c28b commit 8cc1598
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*******************************************************************************
* Copyright (c) 2023 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution,
* and is available at https://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
package com.redhat.devtools.intellij.quarkus.lsp;

import com.intellij.openapi.project.Project;
import com.redhat.devtools.lsp4ij.LanguageServerFactory;
import com.redhat.devtools.lsp4ij.client.LanguageClientImpl;
import com.redhat.devtools.lsp4ij.server.StreamConnectionProvider;
import org.eclipse.lsp4j.services.LanguageServer;
import org.eclipse.lsp4mp.ls.api.MicroProfileLanguageServerAPI;

/**
* Quarkus language server factory.
*/
public class QuarkusLanguageServerFactory implements LanguageServerFactory {

@Override
public StreamConnectionProvider createConnectionProvider(Project project) {
return new QuarkusServer(project);
}

@Override
public LanguageClientImpl createLanguageClient(Project project) {
return new QuarkusLanguageClient(project);
}

@Override
public Class<? extends LanguageServer> getServerInterface() {
return MicroProfileLanguageServerAPI.class;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*******************************************************************************
* Copyright (c) 2023 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution,
* and is available at https://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
package com.redhat.devtools.intellij.qute.lsp;

import com.intellij.openapi.project.Project;
import com.redhat.devtools.lsp4ij.LanguageServerFactory;
import com.redhat.devtools.lsp4ij.client.LanguageClientImpl;
import com.redhat.devtools.lsp4ij.server.StreamConnectionProvider;
import com.redhat.qute.ls.api.QuteLanguageServerAPI;
import org.eclipse.lsp4j.services.LanguageServer;

/**
* Qute language server factory.
*/
public class QuteLanguageServerFactory implements LanguageServerFactory {

@Override
public StreamConnectionProvider createConnectionProvider(Project project) {
return new QuteServer(project);
}

@Override
public LanguageClientImpl createLanguageClient(Project project) {
return new QuteLanguageClient(project);
}

@Override
public Class<? extends LanguageServer> getServerInterface() {
return QuteLanguageServerAPI.class;
}
}
5 changes: 1 addition & 4 deletions src/main/resources/META-INF/lsp4ij-quarkus.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
<server id="microprofile"
label="Tools for MicroProfile"
icon="com.redhat.devtools.intellij.microprofile.lang.MicroProfileIcons.MicroProfile"
class="com.redhat.devtools.intellij.quarkus.lsp.QuarkusServer"
clientImpl="com.redhat.devtools.intellij.quarkus.lsp.QuarkusLanguageClient"
serverInterface="org.eclipse.lsp4mp.ls.api.MicroProfileLanguageServerAPI"
scope="project">
factoryClass="com.redhat.devtools.intellij.quarkus.lsp.QuarkusLanguageServerFactory">
<description><![CDATA[
The <a href="https://github.com/eclipse/lsp4mp">MicroProfile language server</a> provides <a href="https://microprofile.io/">MicroProfile</a> support in:
<ul>
Expand Down
5 changes: 1 addition & 4 deletions src/main/resources/META-INF/lsp4ij-qute.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
<server id="qute"
label="Qute support"
icon="com.redhat.devtools.intellij.quarkus.lang.QuarkusIcons.Quarkus"
class="com.redhat.devtools.intellij.qute.lsp.QuteServer"
clientImpl="com.redhat.devtools.intellij.qute.lsp.QuteLanguageClient"
serverInterface="com.redhat.qute.ls.api.QuteLanguageServerAPI"
scope="project">
factoryClass="com.redhat.devtools.intellij.qute.lsp.QuteLanguageServerFactory" >
<description><![CDATA[
The <a href="https://github.com/redhat-developer/quarkus-ls">Qute language server</a> provides <a href="https://quarkus.io/guides/qute-reference">Qute</a> support in:
<ul>
Expand Down

0 comments on commit 8cc1598

Please sign in to comment.