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

Integrated yaml language server #6371

Merged
merged 5 commits into from
Oct 11, 2017
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
33 changes: 33 additions & 0 deletions agents/ls-yaml/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

Copyright (c) 2012-2017 Red Hat, Inc.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html

Contributors:
Red Hat, Inc. - initial API and implementation

-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>che-agents-parent</artifactId>
<groupId>org.eclipse.che</groupId>
<version>5.19.0-SNAPSHOT</version>
</parent>
<artifactId>ls-yaml-agent</artifactId>
<name>Language Server Yaml Agent</name>
<dependencies>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-api-agent-shared</artifactId>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright (c) 2012-2017 Red Hat, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
*/
package org.eclipse.che.api.agent;

import com.google.inject.Inject;
import com.google.inject.Singleton;
import java.io.IOException;
import org.eclipse.che.api.agent.shared.model.Agent;
import org.eclipse.che.api.agent.shared.model.impl.BasicAgent;

/**
* Language server yaml agent.
*
* @see Agent
* @author Joshua Pinkney
*/
@Singleton
public class LSYamlAgent extends BasicAgent {
private static final String AGENT_DESCRIPTOR = "org.eclipse.che.ls.yaml.json";
private static final String AGENT_SCRIPT = "org.eclipse.che.ls.yaml.script.sh";

@Inject
public LSYamlAgent() throws IOException {
super(AGENT_DESCRIPTOR, AGENT_SCRIPT);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"id": "org.eclipse.che.ls.yaml",
"name": "Yaml language server",
"description": "Yaml intellisense",
"dependencies": [],
"properties": {}
}
168 changes: 168 additions & 0 deletions agents/ls-yaml/src/main/resources/org.eclipse.che.ls.yaml.script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
#
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need shebang here? and also set -e ?

Copy link
Contributor

@tolusha tolusha Sep 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No shebang

# Copyright (c) 2012-2017 Red Hat, Inc.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
# Red Hat, Inc. - initial API and implementation
#

is_current_user_root() {
test "$(id -u)" = 0
}

is_current_user_sudoer() {
sudo -n true > /dev/null 2>&1
}

set_sudo_command() {
if is_current_user_sudoer && ! is_current_user_root; then SUDO="sudo -E"; else unset SUDO; fi
}

set_sudo_command
unset PACKAGES
command -v tar >/dev/null 2>&1 || { PACKAGES=${PACKAGES}" tar"; }
command -v curl >/dev/null 2>&1 || { PACKAGES=${PACKAGES}" curl"; }

AGENT_BINARIES_URI=http://download.jboss.org/jbosstools/oxygen/stable/builds/yaml-language-server/yaml-language-server-latest.tar.gz
CHE_DIR=$HOME/che
LS_DIR=${CHE_DIR}/ls-yaml
LS_LAUNCHER=${LS_DIR}/launch.sh

if [ -f /etc/centos-release ]; then
FILE="/etc/centos-release"
LINUX_TYPE=$(cat $FILE | awk '{print $1}')
elif [ -f /etc/redhat-release ]; then
FILE="/etc/redhat-release"
LINUX_TYPE=$(cat $FILE | cut -c 1-8)
else
FILE="/etc/os-release"
LINUX_TYPE=$(cat $FILE | grep ^ID= | tr '[:upper:]' '[:lower:]')
LINUX_VERSION=$(cat $FILE | grep ^VERSION_ID=)
fi

MACHINE_TYPE=$(uname -m)

mkdir -p ${CHE_DIR}
mkdir -p ${LS_DIR}

########################
### Install packages ###
########################

# Red Hat Enterprise Linux 7
############################
if echo ${LINUX_TYPE} | grep -qi "rhel"; then
test "${PACKAGES}" = "" || {
${SUDO} yum install ${PACKAGES};
}

command -v nodejs >/dev/null 2>&1 || {
curl --silent --location https://rpm.nodesource.com/setup_6.x | ${SUDO} bash -;
${SUDO} yum -y install nodejs;
}

# Red Hat Enterprise Linux 6
############################
elif echo ${LINUX_TYPE} | grep -qi "Red Hat"; then
test "${PACKAGES}" = "" || {
${SUDO} yum install ${PACKAGES};
}

command -v nodejs >/dev/null 2>&1 || {
curl --silent --location https://rpm.nodesource.com/setup_6.x | ${SUDO} bash -;
${SUDO} yum -y install nodejs;
}


# Ubuntu 14.04 16.04 / Linux Mint 17
####################################
elif echo ${LINUX_TYPE} | grep -qi "ubuntu"; then
test "${PACKAGES}" = "" || {
${SUDO} apt-get update;
${SUDO} apt-get -y install ${PACKAGES};
}

command -v nodejs >/dev/null 2>&1 || {
{
curl -sL https://deb.nodesource.com/setup_6.x | ${SUDO} bash -;
};

${SUDO} apt-get update;
${SUDO} apt-get install -y nodejs;
}


# Debian 8
##########
elif echo ${LINUX_TYPE} | grep -qi "debian"; then
test "${PACKAGES}" = "" || {
${SUDO} apt-get update;
${SUDO} apt-get -y install ${PACKAGES};
}

command -v nodejs >/dev/null 2>&1 || {
{
curl -sL https://deb.nodesource.com/setup_6.x | ${SUDO} bash -;
};

${SUDO} apt-get update;
${SUDO} apt-get install -y nodejs;
}

# Fedora 23
###########
elif echo ${LINUX_TYPE} | grep -qi "fedora"; then
command -v ps >/dev/null 2>&1 || { PACKAGES=${PACKAGES}" procps-ng"; }
test "${PACKAGES}" = "" || {
${SUDO} dnf -y install ${PACKAGES};
}

command -v nodejs >/dev/null 2>&1 || {
curl --silent --location https://rpm.nodesource.com/setup_6.x | ${SUDO} bash -;
${SUDO} dnf -y install nodejs;
}


# CentOS 7.1 & Oracle Linux 7.1
###############################
elif echo ${LINUX_TYPE} | grep -qi "centos"; then
test "${PACKAGES}" = "" || {
${SUDO} yum -y install ${PACKAGES};
}

command -v nodejs >/dev/null 2>&1 || {
curl --silent --location https://rpm.nodesource.com/setup_6.x | ${SUDO} bash -;
${SUDO} yum -y install nodejs;
}

# openSUSE 13.2
###############
elif echo ${LINUX_TYPE} | grep -qi "opensuse"; then
test "${PACKAGES}" = "" || {
${SUDO} zypper install -y ${PACKAGES};
}

command -v nodejs >/dev/null 2>&1 || {
${SUDO} zypper ar http://download.opensuse.org/repositories/devel:/languages:/nodejs/openSUSE_13.1/ Node.js
${SUDO} zypper in nodejs
}

else
>&2 echo "Unrecognized Linux Type"
>&2 cat $FILE
exit 1
fi


########################
### Install Yaml LS ###
########################

curl -s ${AGENT_BINARIES_URI} | tar xzf - -C ${LS_DIR}

touch ${LS_LAUNCHER}
chmod +x ${LS_LAUNCHER}
echo "nodejs ${LS_DIR}/out/server/src/server.js --stdio" > ${LS_LAUNCHER}
1 change: 1 addition & 0 deletions agents/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,6 @@
<module>ls-typescript</module>
<module>ls-csharp</module>
<module>test-ls</module>
<module>ls-yaml</module>
</modules>
</project>
8 changes: 8 additions & 0 deletions assembly/assembly-ide-war/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,14 @@
<groupId>org.eclipse.che.plugin</groupId>
<artifactId>che-plugin-web-ext-web</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.plugin</groupId>
<artifactId>che-plugin-yaml-ide</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.plugin</groupId>
<artifactId>che-plugin-yaml-shared</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.plugin</groupId>
<artifactId>che-plugin-zend-debugger-ide</artifactId>
Expand Down
8 changes: 8 additions & 0 deletions assembly/assembly-wsagent-war/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,14 @@
<groupId>org.eclipse.che.plugin</groupId>
<artifactId>che-plugin-web-ext-server</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.plugin</groupId>
<artifactId>che-plugin-yaml-server</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.plugin</groupId>
<artifactId>che-plugin-yaml-shared</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.plugin</groupId>
<artifactId>che-plugin-zend-debugger-server</artifactId>
Expand Down
4 changes: 4 additions & 0 deletions assembly/assembly-wsmaster-war/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@
<groupId>org.eclipse.che</groupId>
<artifactId>ls-typescript-agent</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che</groupId>
<artifactId>ls-yaml-agent</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che</groupId>
<artifactId>ssh-agent</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.eclipse.che.api.agent.LSPhpAgent;
import org.eclipse.che.api.agent.LSPythonAgent;
import org.eclipse.che.api.agent.LSTypeScriptAgent;
import org.eclipse.che.api.agent.LSYamlAgent;
import org.eclipse.che.api.agent.SshAgent;
import org.eclipse.che.api.agent.SshAgentLauncher;
import org.eclipse.che.api.agent.UnisonAgent;
Expand Down Expand Up @@ -167,6 +168,7 @@ protected void configure() {
agents.addBinding().to(LSPhpAgent.class);
agents.addBinding().to(LSPythonAgent.class);
agents.addBinding().to(LSJsonAgent.class);
agents.addBinding().to(LSYamlAgent.class);
agents.addBinding().to(LSCSharpAgent.class);
agents.addBinding().to(LSTypeScriptAgent.class);
agents.addBinding().to(GitCredentialsAgent.class);
Expand Down
Loading