Add support for code highlights
Update the highlighparams to latest LSP contract. Signed-off-by: gayanper <gayanper@gmail.com>
This commit is contained in:
@@ -55,8 +55,6 @@ class BootJavaPreloadingActivity extends PreloadingActivity {
|
||||
LanguageServerDefinition.register(
|
||||
new StsServerDefinition("java", Array(
|
||||
javaExec.toString(),
|
||||
"-Xdebug",
|
||||
"-agentlib:jdwp=transport=dt_socket,server=y,address=7999,suspend=n",
|
||||
"-cp",
|
||||
classpath,
|
||||
"org.springframework.boot.loader.JarLauncher"
|
||||
|
||||
@@ -12,7 +12,7 @@ package org.spring.tools.boot.java.ls;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.lsp4j.Range;
|
||||
import org.eclipse.lsp4j.CodeLens;
|
||||
import org.eclipse.lsp4j.TextDocumentIdentifier;
|
||||
|
||||
public class HighlightParams {
|
||||
@@ -23,15 +23,15 @@ public class HighlightParams {
|
||||
// a update site.
|
||||
|
||||
private TextDocumentIdentifier doc;
|
||||
private List<Range> ranges;
|
||||
private List<CodeLens> codeLenses;
|
||||
|
||||
public HighlightParams() {
|
||||
}
|
||||
|
||||
public HighlightParams(TextDocumentIdentifier doc, List<Range> ranges) {
|
||||
public HighlightParams(TextDocumentIdentifier doc, List<CodeLens> codeLenses) {
|
||||
super();
|
||||
this.doc = doc;
|
||||
this.ranges = ranges;
|
||||
this.codeLenses = codeLenses;
|
||||
}
|
||||
public TextDocumentIdentifier getDoc() {
|
||||
return doc;
|
||||
@@ -39,15 +39,15 @@ public class HighlightParams {
|
||||
public void setDoc(TextDocumentIdentifier doc) {
|
||||
this.doc = doc;
|
||||
}
|
||||
public List<Range> getRanges() {
|
||||
return ranges;
|
||||
public List<CodeLens> getCodeLenses() {
|
||||
return codeLenses;
|
||||
}
|
||||
public void setRanges(List<Range> ranges) {
|
||||
this.ranges = ranges;
|
||||
public void setCodeLenses(List<CodeLens> codeLens) {
|
||||
this.codeLenses = codeLens;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "HighlightParams [doc=" + doc + ", ranges=" + ranges + "]";
|
||||
return "HighlightParams [doc=" + doc + ", ranges=" + codeLenses + "]";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,9 @@ class StsLanguageClientImpl extends LanguageClientImpl {
|
||||
rangeHighlights.get(uri).get.foreach(h => editorManager.editor.getMarkupModel.removeHighlighter(h))
|
||||
}
|
||||
val highlighters: ListBuffer[RangeHighlighter] = ListBuffer()
|
||||
for (r <- JavaConversions.asScalaBuffer(params.getRanges)) {
|
||||
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()
|
||||
|
||||
Reference in New Issue
Block a user