Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use server factory #1289

Merged
merged 1 commit into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading