Remove IntelliJ boot extension prototype

This commit is contained in:
BoykoAlex
2020-08-11 10:51:53 -04:00
parent 0b09b3cd30
commit fa8ee4083e
16 changed files with 0 additions and 783 deletions

View File

@@ -1,4 +0,0 @@
/server/language-server.jar
/.idea
*.iml
*.zip

View File

@@ -1,15 +0,0 @@
# Spring Boot Java Support for IntelliJ IDEA (_Experimental_)
The support is based on IntelliJ LSP client plugin https://github.com/gtache/intellij-lsp
## Dev Instructions
1. Clone and import the project into IntelliJ. ()Project is Scala based hence accept whatever IntelliJ suggests about having Scala)
2. Build `boot-java-language-server` maven project from STS4 (https://github.com/spring-projects/sts4/tree/master/headless-services/boot-java-language-server)
3. Copy the built `jar` file into this project `/resources/server` folder and name it `language-server.jar`
4. Install `LSP Support` plugin into IntelliJ as explained here: https://www.jetbrains.com/help/idea/installing-updating-and-uninstalling-repository-plugins.html
5. For some reason it's not enough for the dev env, hence also download the same plugin from https://www.jetbrains.com/help/idea/installing-updating-and-uninstalling-repository-plugins.html
6. Unzip the downloaded file and copy the folder into IntelliJ `pligins` folder
7. Select `idea-boot-java` project in IntelliJ go to `File -> Project Structure...` and then `Platform Settings -> SDKs`
8. Select `IntelliJ IDEA` in the middle pane. Find `+` in the bottom left corner of the right-most pane and click on it (list of jars within IntelliJ SDK)
9. Find all `Jar`s under the `IntelliJ/plugins/LSP` folder, select all of them and press `Open` in the dialog. This will ensure that your target platform has necessary LSP jars
10. Click on `Run -> Run...`, create new `Plugin` launch config. Select `Use classpath of module` to be `idea-boot-java`, select `JRE` to the `IntelliJ IDEA` SDK from step 8
11. Run the configuration. This should start IntelliJ runtime workbench where `idea-boot-java` LS plugin is available

View File

@@ -1,52 +0,0 @@
plugins {
id "org.jetbrains.intellij" version "0.4.5"
}
repositories {
mavenCentral()
}
intellij {
version '2018.3'
plugins = ['IntelliLang', 'com.github.gtache.lsp:1.5.4']
pluginName 'idea-boot-java'
downloadSources = false
// if you want run with your IDEA installation
//localPath '/opt/ideaIC-2018'
}
patchPluginXml {
untilBuild '193.*'
sinceBuild '183.3647.12'
}
dependencies {
compile 'org.scala-lang:scala-compiler:2.12.7'
compile 'org.scala-lang:scala-library:2.12.7'
}
apply plugin: 'scala'
sourceSets {
main {
scala {
srcDirs = ['src']
}
java {
srcDirs = []
}
resources {
srcDirs = ['resources']
}
}
}
prepareSandbox.doLast {
def pluginServerDir = "${intellij.sandboxDirectory}/plugins/idea-boot-java/lib/server"
mkdir(pluginServerDir)
copy {
from("$project.projectDir/server/language-server.jar")
into(pluginServerDir)
}
}

View File

@@ -1,5 +0,0 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@@ -1,172 +0,0 @@
#!/usr/bin/env sh
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"

View File

@@ -1,84 +0,0 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@@ -1,38 +0,0 @@
<idea-plugin>
<id>org.spring.tools.boot-java.ls</id>
<name>Spring Boot Java Support</name>
<version>1.0</version>
<vendor email="aboyko@pivotal.io" url="https://www.pivotal.io">YourCompany</vendor>
<description><![CDATA[
Enter short description for your plugin here.<br>
<em>most HTML tags may be used</em>
]]></description>
<change-notes><![CDATA[
Add change notes here.<br>
<em>most HTML tags may be used</em>
]]>
</change-notes>
<!-- please see https://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/build_number_ranges.html for description -->
<idea-version since-build="" until-build=""/>
<!-- please see https://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html
on how to target different products -->
<depends>com.intellij.modules.lang</depends>
<depends>com.github.gtache.lsp</depends>
<extensions defaultExtensionNs="com.intellij">
<!-- Add your extensions here -->
<preloadingActivity implementation="org.spring.tools.boot.java.ls.BootJavaPreloadingActivity" id="org.spring.tools.boot.java.ls.BootJavaPreloadingActivity" />
<!--<lang.documentationProvider implementationClass="com.github.gtache.lsp.contributors.LSPDocumentationProvider"-->
<!--id="LSPDocumentationProviderJava" language="JAVA"/>-->
</extensions>
<actions>
<!-- Add your actions here -->
</actions>
</idea-plugin>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 617 B

View File

@@ -1 +0,0 @@
rootProject.name = 'idea-boot-java'

View File

@@ -1,86 +0,0 @@
/*
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.spring.tools.boot.java.ls
import java.io.{BufferedReader, File, InputStreamReader}
import java.lang.ProcessBuilder
import java.net.URI
import java.nio.file.{Files, Paths}
import com.github.gtache.lsp.client.languageserver.serverdefinition.{LanguageServerDefinition, RawCommandServerDefinition}
import com.intellij.openapi.application.PreloadingActivity
import com.intellij.openapi.progress.ProgressIndicator
class BootJavaPreloadingActivity extends PreloadingActivity {
override def preload(indicator: ProgressIndicator): Unit = {
val javaHome: String = /*sys.env.get("java.home").get*/ System.getProperty("java.home")
val javaVersion: String = /*sys.env.get("java.version").get*/ System.getProperty("java.version")
// val v = sys.process.Process(Seq("java", "--version")).!!
if (javaHome == null) {
// TODO throw error?
return
}
val javaPath = Paths.get(javaHome)
val javaExec = javaPath.resolve(Paths.get("bin", if (isWindows()) "java.exe" else "java"))
if (!Files.exists(javaExec)) {
// TODO throw error?
return
}
// search for the server jar near to jar file or class folder
val root = new File(getClass().getResource("/").toURI.getPath)
var classpath = new File(root.getParent, "/server/language-server.jar").getPath()
if (javaVersion.startsWith("1.8")) {
var toolsJar = javaPath.resolve(Paths.get("lib", "tools.jar"))
if (Files.exists(toolsJar)) {
classpath += File.pathSeparator + toolsJar
} else {
toolsJar = javaPath.resolve(Paths.get("..", "lib", "tools.jar"))
if (Files.exists(toolsJar)) {
classpath += File.pathSeparator + toolsJar
} else {
// TODO: tools.jar doesn't exist
}
}
} else if (javaVersion.startsWith("9.")) {
// all good - Java 9 has tools.jar on the classpath
} else {
// Error - not Java 8 or 9
}
// wrap class path for spaces in path
classpath = "\'" + classpath + "\'"
LanguageServerDefinition.register(
new StsServerDefinition("java", Array(
javaExec.toString(),
"-cp",
classpath,
"org.springframework.boot.loader.JarLauncher"
)))
}
def isWindows(): Boolean = {
return System.getProperty("os.name").toLowerCase().startsWith("win")
}
}

View File

@@ -1,53 +0,0 @@
/*******************************************************************************
* Copyright (c) 2017 Pivotal, 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
* https://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Pivotal, Inc. - initial API and implementation
*******************************************************************************/
package org.spring.tools.boot.java.ls;
import java.util.List;
import org.eclipse.lsp4j.CodeLens;
import org.eclipse.lsp4j.TextDocumentIdentifier;
public class HighlightParams {
//TODO: Identical copy of this exists in org.springframework.ide.vscode.commons.languageserver.HighlightParams
// But because that is only built in plain maven jar (not osgi) we can't use it. We should find a solution
// for this somehow (i.e. build a version of some of our 'plain maven' jars as osgi bundles and publish on
// a update site.
private TextDocumentIdentifier doc;
private List<CodeLens> codeLenses;
public HighlightParams() {
}
public HighlightParams(TextDocumentIdentifier doc, List<CodeLens> codeLenses) {
super();
this.doc = doc;
this.codeLenses = codeLenses;
}
public TextDocumentIdentifier getDoc() {
return doc;
}
public void setDoc(TextDocumentIdentifier doc) {
this.doc = doc;
}
public List<CodeLens> getCodeLenses() {
return codeLenses;
}
public void setCodeLenses(List<CodeLens> codeLens) {
this.codeLenses = codeLens;
}
@Override
public String toString() {
return "HighlightParams [doc=" + doc + ", ranges=" + codeLenses + "]";
}
}

View File

@@ -1,89 +0,0 @@
/*******************************************************************************
* Copyright (c) 2016-2017 Pivotal, 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
* https://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Pivotal, Inc. - initial API and implementation
*******************************************************************************/
package org.spring.tools.boot.java.ls;
public class ProgressParams {
/**
* An id representing the enitity for which progress messages are to be shown.
*/
private String id;
/**
* Updates the current statusMsg associated with a given the id. If null, then the message
* is cleared.
*/
private String statusMsg;
public ProgressParams() {
}
public ProgressParams(String id, String statusMsg) {
super();
this.id = id;
this.statusMsg = statusMsg;
}
@Override
public String toString() {
return "ProgressParams [id=" + id + ", statusMsg=" + statusMsg + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((statusMsg == null) ? 0 : statusMsg.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ProgressParams other = (ProgressParams) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
if (statusMsg == null) {
if (other.statusMsg != null)
return false;
} else if (!statusMsg.equals(other.statusMsg))
return false;
return true;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getStatusMsg() {
return statusMsg;
}
public void setStatusMsg(String statusMsg) {
this.statusMsg = statusMsg;
}
}

View File

@@ -1,50 +0,0 @@
/*
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.spring.tools.boot.java.ls;
import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
import com.intellij.openapi.editor.markup.GutterIconRenderer;
import com.intellij.openapi.util.IconLoader;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
/**
* @author Alex Boyko
*/
public class SpringBootGutterIconRenderer extends GutterIconRenderer {
public static SpringBootGutterIconRenderer INSTANCE = new SpringBootGutterIconRenderer();
private Supplier<Icon> icon = Suppliers.memoize(() -> IconLoader.getIcon("/icons/boot-icon.png"));
@Override
public boolean equals(Object o) {
return this == o;
}
@Override
public int hashCode() {
return 0;
}
@NotNull
@Override
public Icon getIcon() {
return icon.get();
}
}

View File

@@ -1,106 +0,0 @@
/*
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.spring.tools.boot.java.ls
import java.awt.Color
import com.github.gtache.lsp.client.LanguageClientImpl
import com.github.gtache.lsp.client.languageserver.wrapper.LanguageServerWrapper
import com.github.gtache.lsp.utils.FileUtils
import com.intellij.codeInsight.daemon.impl.HintRenderer
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.diagnostic.Logger
import com.intellij.openapi.editor.Inlay
import com.intellij.openapi.editor.markup._
import org.eclipse.lsp4j.Range
import org.eclipse.lsp4j.jsonrpc.services.JsonNotification
import org.eclipse.lsp4j.services.LanguageServer
import scala.collection.JavaConversions
import scala.collection.mutable.ListBuffer
/**
* @author Alex Boyko
*/
class StsLanguageClientImpl extends LanguageClientImpl {
private var serverWrapper: LanguageServerWrapper = _
private var rangeHighlights = scala.collection.mutable.Map[String, ListBuffer[RangeHighlighter]]()
private var allInLays = scala.collection.mutable.Map[String, ListBuffer[Inlay[HintRenderer]]]()
private val LOGGER: Logger = Logger.getInstance(StsLanguageClientImpl.getClass)
override def connect(server: LanguageServer, wrapper: LanguageServerWrapper): Unit = {
super.connect(server, wrapper)
this.serverWrapper = wrapper
}
@JsonNotification("sts/highlight")
def publishHints(params: HighlightParams): Unit = {
LOGGER.debug("Highlight MSG")
val uri = FileUtils.sanitizeURI(params.getDoc.getUri)
val editorManager = this.serverWrapper.getEditorManagerFor(uri)
if (editorManager == null || editorManager.editor == null || editorManager.editor.getDocument == null) {
return
}
val doc = editorManager.editor.getDocument
// Similar to Eclipse UI thread execution
ApplicationManager.getApplication.invokeLater(new Runnable {
override def run(): Unit = {
if (rangeHighlights.get(uri).isDefined) {
rangeHighlights.get(uri).get.foreach(h => editorManager.editor.getMarkupModel.removeHighlighter(h))
}
if(allInLays.get(uri).isDefined) {
allInLays.get(uri).get.foreach(i => i.dispose())
}
val highlighters: ListBuffer[RangeHighlighter] = ListBuffer()
val inLays: ListBuffer[Inlay[HintRenderer]] = ListBuffer()
for (l <- JavaConversions.asScalaBuffer(params.getCodeLenses)) {
val r: Range = l.getRange
val startOffset = doc.getLineStartOffset(r.getStart.getLine) + r.getStart.getCharacter
val endOffset = doc.getLineStartOffset(r.getEnd.getLine) + r.getEnd.getCharacter
val attrs = new TextAttributes()
attrs.setEffectType(EffectType.BOXED)
attrs.setEffectColor(StsLanguageClientImpl.SPRING_BOOT_HINT_COLOR)
attrs.setErrorStripeColor(StsLanguageClientImpl.SPRING_BOOT_HINT_COLOR)
val highlighter = editorManager.editor.getMarkupModel.addRangeHighlighter(startOffset, endOffset, HighlighterLayer.ERROR, attrs, HighlighterTargetArea.EXACT_RANGE)
highlighter.setGutterIconRenderer(SpringBootGutterIconRenderer.INSTANCE)
highlighters += highlighter
if(l.getData != null) {
val inlineRenderer = new HintRenderer(l.getData.toString);
inLays += editorManager.editor.getInlayModel.addInlineElement(endOffset, inlineRenderer)
}
}
rangeHighlights += Tuple2(uri, highlighters)
allInLays += Tuple2(uri, inLays)
}
})
}
@JsonNotification("sts/progress")
def progress(progressEvent: ProgressParams): Unit = {
LOGGER.debug("Progress MSG")
}
}
object StsLanguageClientImpl {
val SPRING_BOOT_HINT_COLOR = new Color(0x32, 0xBA, 0x56)
}

View File

@@ -1,28 +0,0 @@
/*
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.spring.tools.boot.java.ls
import com.github.gtache.lsp.client.LanguageClientImpl
import com.github.gtache.lsp.client.languageserver.serverdefinition.{CommandServerDefinition, RawCommandServerDefinition, UserConfigurableServerDefinitionObject}
/**
* @author Alex Boyko
*/
class StsServerDefinition(override val ext: String, override val command: Array[String]) extends RawCommandServerDefinition(ext, command) {
override def createLanguageClient: LanguageClientImpl = new StsLanguageClientImpl
}