mirror of
https://gitee.com/zhangsken/AndroidIDE.git
synced 2026-10-16 07:49:44 +08:00
Added JavaDoc syntax highlighting
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
name: CI
|
||||
|
||||
on:
|
||||
@@ -31,7 +29,7 @@ jobs:
|
||||
- name: Build debug apk
|
||||
uses: eskatos/gradle-command-action@v1
|
||||
with:
|
||||
arguments: build
|
||||
arguments: :app:build
|
||||
distributions-cache-enabled: true
|
||||
dependencies-cache-enabled: true
|
||||
configuration-cache-enabled: true
|
||||
|
||||
Binary file not shown.
@@ -1,12 +1,12 @@
|
||||
package com.itsaky.androidide.language.groovy;
|
||||
|
||||
import com.itsaky.androidide.syntax.lexer.impls.groovy.GroovyLexerImpl;
|
||||
import com.itsaky.lsp.SemanticHighlight;
|
||||
import com.itsaky.lsp.services.IDELanguageServer;
|
||||
import io.github.rosemoe.editor.interfaces.CodeAnalyzer;
|
||||
import io.github.rosemoe.editor.text.Content;
|
||||
import io.github.rosemoe.editor.text.TextAnalyzeResult;
|
||||
import io.github.rosemoe.editor.text.TextAnalyzer;
|
||||
import java.io.File;
|
||||
import com.itsaky.lsp.SemanticHighlight;
|
||||
import java.util.Map;
|
||||
import org.eclipse.lsp4j.Diagnostic;
|
||||
|
||||
@@ -15,7 +15,7 @@ public class GroovyAnalyzer extends io.github.rosemoe.editor.langs.AbstractCodeA
|
||||
@Override
|
||||
public void analyze(IDELanguageServer server, File file, CharSequence content, TextAnalyzeResult colors, TextAnalyzer.AnalyzeThread.Delegate delegate) {
|
||||
try {
|
||||
GroovyLexerImpl lexer = new GroovyLexerImpl(content.toString(), colors);
|
||||
GroovyLexerImpl lexer = new GroovyLexerImpl((Content) content, colors);
|
||||
lexer.init();
|
||||
|
||||
// Adding spans, hex colors, block lines and all is handled by JavaLexerImpl
|
||||
|
||||
@@ -316,8 +316,8 @@ public abstract class IDELanguageClientImpl implements IDELanguageClient {
|
||||
|
||||
@Override
|
||||
public void publishDiagnostics(PublishDiagnosticsParams params) {
|
||||
boolean error = params == null || params.getDiagnostics() == null || params.getDiagnostics().isEmpty();
|
||||
activity().handleDiagnosticsResultVisibility(error);
|
||||
boolean error = params == null || params.getDiagnostics() == null;
|
||||
activity().handleDiagnosticsResultVisibility(error || params.getDiagnostics().isEmpty());
|
||||
|
||||
if(error) return;
|
||||
|
||||
@@ -328,7 +328,7 @@ public abstract class IDELanguageClientImpl implements IDELanguageClient {
|
||||
activity().getDiagnosticsList().setAdapter(newDiagnosticsAdapter());
|
||||
|
||||
EditorFragment editor = null;
|
||||
if(activity().getPagerAdapter() != null && (editor = activity().getPagerAdapter().findEditorByFile(new File(URI.create(params.getUri())))) != null) {
|
||||
if(activity().getPagerAdapter() != null && (editor = activity().getPagerAdapter().findEditorByFile(file)) != null) {
|
||||
editor.setDiagnostics(params.getDiagnostics());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ public class ToolsManager {
|
||||
|
||||
private static PreferenceManager prefs;
|
||||
|
||||
public static final int JLS_VERSION = 15;
|
||||
public static final int JLS_VERSION = 18;
|
||||
public static final int LOGSENDER_VERSION = 1;
|
||||
public static final int CLEANER_VERSION = 1;
|
||||
public static final int GRADLE_API_VERSION = 2;
|
||||
|
||||
@@ -6,7 +6,16 @@ public class SchemeAndroidIDE extends EditorColorScheme {
|
||||
|
||||
@Override
|
||||
public void applyDefault() {
|
||||
// Change the default comment color
|
||||
// This will make sure that all javadoc elements
|
||||
// which are not implemented in this scheme are
|
||||
// same as other comments
|
||||
COMMENT_DEFAULT = 0xffbdbdbd;
|
||||
|
||||
// Apply default colors
|
||||
super.applyDefault();
|
||||
|
||||
// Apply customized colors
|
||||
setColor(WHOLE_BACKGROUND, 0xff212121);
|
||||
setColor(LINE_NUMBER_BACKGROUND, 0xff212121);
|
||||
setColor(LINE_DIVIDER, 0xff9e9e9e);
|
||||
@@ -30,7 +39,7 @@ public class SchemeAndroidIDE extends EditorColorScheme {
|
||||
setColor(MATCHED_TEXT_BACKGROUND, 0xffFF8F00);
|
||||
setColor(NON_PRINTABLE_CHAR, 0xffdddddd);
|
||||
setColor(KEYWORD, 0xffff6060);
|
||||
setColor(COMMENT, 0xffbdbdbd);
|
||||
setColor(COMMENT, COMMENT_DEFAULT);
|
||||
setColor(OPERATOR, 0xff4fc3f7);
|
||||
setColor(LITERAL, 0xff8bc34a);
|
||||
setColor(TYPE_NAME, 0xff4fc3f7);
|
||||
@@ -57,10 +66,26 @@ public class SchemeAndroidIDE extends EditorColorScheme {
|
||||
setColor(DIAGNOSTIC_INFO, 0xff4CAF50);
|
||||
setColor(DIAGNOSTIC_HINT, 0xffffffff);
|
||||
|
||||
setColor(JAVADOC_INLINE_TAG, 0xffff6060);
|
||||
setColor(JAVADOC_TAG, 0xffff6060);
|
||||
|
||||
setColor(STDERR, 0xfff44336);
|
||||
setColor(STDOUT, 0xff4CAF50);
|
||||
|
||||
// Common colors for all block and inline tags
|
||||
setJavadocInlineTagColor(0xff92d7ff);
|
||||
setJavadocBlockTagColor(0xffffa9a9);
|
||||
|
||||
// JavaDoc colors for tag members, like, param name and description
|
||||
setColor(JD_PARAM_NAME, 0xffa9b7ff);
|
||||
setColor(JD_PARAM_DESCRIPTION, 0xffbbffc0);
|
||||
setColor(JD_RETURN_DESCRIPTION, 0xffbbffc0);
|
||||
setColor(JD_LITERAL_TEXT, 0xffffef83);
|
||||
setColor(JD_LINK_LABEL, 0xffa9b7ff);
|
||||
setColor(JD_LINK_REFERENCE, 0xff2196f3);
|
||||
setColor(JD_THROWS_TAG, 0xffff2532);
|
||||
setColor(JD_THROWS_NAME, 0xffa9b7ff);
|
||||
setColor(JD_THROWS_DESCRIPTION, 0xffbbffc0);
|
||||
setColor(JD_SEE_REFERENCE, 0xff2196f3);
|
||||
setColor(JD_SUMMARY_MESSAGE, 0xffbbffc0);
|
||||
setColor(JD_HIDDEN_MESSAGE, 0xffbbffc0);
|
||||
setColor(JD_AUTHOR_NAME, 0xfffaff00);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.itsaky.androidide.syntax.lexer.DefaultLexer;
|
||||
import io.github.rosemoe.editor.struct.BlockLine;
|
||||
import io.github.rosemoe.editor.struct.HexColor;
|
||||
import io.github.rosemoe.editor.text.CharPosition;
|
||||
import io.github.rosemoe.editor.text.Content;
|
||||
import io.github.rosemoe.editor.text.TextAnalyzeResult;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -22,7 +23,7 @@ import org.antlr.v4.runtime.Lexer;
|
||||
public abstract class BaseJavaLexer extends DefaultLexer {
|
||||
|
||||
protected Lexer lexer;
|
||||
protected String content;
|
||||
protected Content content;
|
||||
public int lastLine;
|
||||
public int maxSwitch;
|
||||
public int currSwitch;
|
||||
|
||||
+3
-7
@@ -1,26 +1,22 @@
|
||||
package com.itsaky.androidide.syntax.lexer.impls.groovy;
|
||||
|
||||
import android.graphics.Color;
|
||||
import com.itsaky.androidide.language.groovy.lexer.GroovyLexer;
|
||||
import com.itsaky.androidide.syntax.lexer.Lexer;
|
||||
import com.itsaky.androidide.syntax.lexer.impls.BaseJavaLexer;
|
||||
import com.itsaky.androidide.syntax.lexer.tokens.Token;
|
||||
import com.itsaky.androidide.syntax.lexer.tokens.TokenType;
|
||||
import io.github.rosemoe.editor.struct.BlockLine;
|
||||
import io.github.rosemoe.editor.struct.HexColor;
|
||||
import io.github.rosemoe.editor.text.CharPosition;
|
||||
import io.github.rosemoe.editor.text.Content;
|
||||
import io.github.rosemoe.editor.text.TextAnalyzeResult;
|
||||
import io.github.rosemoe.editor.widget.EditorColorScheme;
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import org.antlr.v4.runtime.CharStreams;
|
||||
|
||||
public class GroovyLexerImpl extends BaseJavaLexer implements Lexer {
|
||||
|
||||
public GroovyLexerImpl(String content, TextAnalyzeResult colors) {
|
||||
public GroovyLexerImpl(Content content, TextAnalyzeResult colors) {
|
||||
this.content = content;
|
||||
this.colors = colors;
|
||||
this.maxSwitch = 0;
|
||||
@@ -44,7 +40,7 @@ public class GroovyLexerImpl extends BaseJavaLexer implements Lexer {
|
||||
|
||||
@Override
|
||||
public void init() throws IOException {
|
||||
lexer = new GroovyLexer(CharStreams.fromReader(new StringReader(content)));
|
||||
lexer = new GroovyLexer(CharStreams.fromReader(new StringReader(content.toString())));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+370
@@ -0,0 +1,370 @@
|
||||
package com.itsaky.androidide.syntax.lexer.impls.java;
|
||||
|
||||
import androidx.core.util.Pair;
|
||||
import com.itsaky.androidide.utils.LSPUtils;
|
||||
import com.itsaky.lsp.JavadocHighlights;
|
||||
import com.itsaky.lsp.SemanticHighlight;
|
||||
import java.util.List;
|
||||
import org.eclipse.lsp4j.Range;
|
||||
|
||||
import static io.github.rosemoe.editor.widget.EditorColorScheme.*;
|
||||
|
||||
public class HighlightRangeHelper {
|
||||
|
||||
private final SemanticHighlight highlights;
|
||||
|
||||
public static final int NOT_FOUND = -29291; // Some random integer
|
||||
|
||||
public HighlightRangeHelper(SemanticHighlight highlights) {
|
||||
this.highlights = highlights;
|
||||
}
|
||||
|
||||
public void sort () {
|
||||
highlights.sort(LSPUtils.RANGE_START_COMPARATOR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if have any Javadoc highlight starting at the provided line and column
|
||||
*
|
||||
* @param line The start line
|
||||
* @param column The start column
|
||||
* @return A pair containing the color id as first element
|
||||
* and the found range as the second.
|
||||
*/
|
||||
public Pair<Integer, Range> findJavadocColorSchemeId (int line, int column) {
|
||||
final JavadocHighlights jd = highlights.javadocs;
|
||||
|
||||
int index = -1;
|
||||
|
||||
if((index = containsStartPosition(jd.authorTags, line, column)) != -1) {
|
||||
return Pair.create(JD_AUTHOR_TAG, jd.authorTags.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.authorNames, line, column)) != -1) {
|
||||
return Pair.create(JD_AUTHOR_NAME, jd.authorNames.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.deprecatedTags, line, column)) != -1) {
|
||||
return Pair.create(JD_DEPRECATED_TAG, jd.deprecatedTags.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.deprecatedMessages, line, column)) != -1) {
|
||||
return Pair.create(JD_DEPRECATED_MESSAGE, jd.deprecatedMessages.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.docrootTags, line, column)) != -1) {
|
||||
return Pair.create(JD_DOCROOT_TAG, jd.docrootTags.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.hiddenTags, line, column)) != -1) {
|
||||
return Pair.create(JD_HIDDEN_TAG, jd.hiddenTags.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.hiddenMessages, line, column)) != -1) {
|
||||
return Pair.create(JD_HIDDEN_MESSAGE, jd.hiddenMessages.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.indexTags, line, column)) != -1) {
|
||||
return Pair.create(JD_INDEX_TAG, jd.indexTags.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.indexDescriptions, line, column)) != -1) {
|
||||
return Pair.create(JD_INDEX_DESCRIPTION, jd.indexDescriptions.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.indexSearchTerms, line, column)) != -1) {
|
||||
return Pair.create(JD_INDEX_SEARCH_TERM, jd.indexSearchTerms.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.inheritDocTags, line, column)) != -1) {
|
||||
return Pair.create(JD_INHERITDOC_TAG, jd.inheritDocTags.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.linkTags, line, column)) != -1) {
|
||||
return Pair.create(JD_LINK_TAG, jd.linkTags.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.linkLabels, line, column)) != -1) {
|
||||
return Pair.create(JD_LINK_LABEL, jd.linkLabels.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.linkReferences, line, column)) != -1) {
|
||||
return Pair.create(JD_LINK_REFERENCE, jd.linkReferences.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.literalTags, line, column)) != -1) {
|
||||
return Pair.create(JD_LITERAL_TAG, jd.literalTags.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.literalTexts, line, column)) != -1) {
|
||||
return Pair.create(JD_LITERAL_TEXT, jd.literalTexts.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.paramTags, line, column)) != -1) {
|
||||
return Pair.create(JD_PARAM_TAG, jd.paramTags.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.paramNames, line, column)) != -1) {
|
||||
return Pair.create(JD_PARAM_NAME, jd.paramNames.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.paramDescriptions, line, column)) != -1) {
|
||||
return Pair.create(JD_PARAM_DESCRIPTION, jd.paramDescriptions.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.providesTags, line, column)) != -1) {
|
||||
return Pair.create(JD_PROVIDES_TAG, jd.providesTags.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.providesDescriptions, line, column)) != -1) {
|
||||
return Pair.create(JD_PROVIDES_DESCRIPTION, jd.providesDescriptions.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.providesServiceTypes, line, column)) != -1) {
|
||||
return Pair.create(JD_PROVIDES_SERVICETYPE, jd.providesServiceTypes.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.returnTags, line, column)) != -1) {
|
||||
return Pair.create(JD_RETURN_TAG, jd.returnTags.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.returnDescriptions, line, column)) != -1) {
|
||||
return Pair.create(JD_RETURN_DESCRIPTION, jd.returnDescriptions.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.seeTags, line, column)) != -1) {
|
||||
return Pair.create(JD_SEE_TAG, jd.seeTags.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.seeReferences, line, column)) != -1) {
|
||||
return Pair.create(JD_SEE_REFERENCE, jd.seeReferences.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.serialDataTags, line, column)) != -1) {
|
||||
return Pair.create(JD_SERIALDATA_TAG, jd.serialDataTags.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.serialDataDescriptions, line, column)) != -1) {
|
||||
return Pair.create(JD_SERIALDATA_DESCRIPTION, jd.serialDataDescriptions.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.serialTags, line, column)) != -1) {
|
||||
return Pair.create(JD_SERIAL_TAG, jd.serialTags.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.sinceTags, line, column)) != -1) {
|
||||
return Pair.create(JD_SINCE_TAG, jd.sinceTags.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.sinceBodies, line, column)) != -1) {
|
||||
return Pair.create(JD_SINCE_BODY, jd.sinceBodies.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.summaryTags, line, column)) != -1) {
|
||||
return Pair.create(JD_SUMMARY_TAG, jd.summaryTags.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.summaryMessages, line, column)) != -1) {
|
||||
return Pair.create(JD_SUMMARY_MESSAGE, jd.summaryMessages.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.throwsTags, line, column)) != -1) {
|
||||
return Pair.create(JD_THROWS_TAG, jd.throwsTags.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.throwsNames, line, column)) != -1) {
|
||||
return Pair.create(JD_THROWS_NAME, jd.throwsNames.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.throwsDescriptions, line, column)) != -1) {
|
||||
return Pair.create(JD_THROWS_DESCRIPTION, jd.throwsDescriptions.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.usesTags, line, column)) != -1) {
|
||||
return Pair.create(JD_USES_TAG, jd.usesTags.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.usesDescriptions, line, column)) != -1) {
|
||||
return Pair.create(JD_USES_DESCRIPTION, jd.usesDescriptions.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.usesServiceTypes, line, column)) != -1) {
|
||||
return Pair.create(JD_USES_SERVICETYPE, jd.usesServiceTypes.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.valueTags, line, column)) != -1) {
|
||||
return Pair.create(JD_VALUE_TAG, jd.valueTags.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.valueReferences, line, column)) != -1) {
|
||||
return Pair.create(JD_VALUE_REFERENCE, jd.valueReferences.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.versionTags, line, column)) != -1) {
|
||||
return Pair.create(JD_VERSION_TAG, jd.versionTags.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.versionBodies, line, column)) != -1) {
|
||||
return Pair.create(JD_VERSION_BODY, jd.versionBodies.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.unknownTags, line, column)) != -1) {
|
||||
return Pair.create(JD_UNKNOWN_BLOCKTAG, jd.unknownTags.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.unknownTagContents, line, column)) != -1) {
|
||||
return Pair.create(JD_UNKNOWN_BLOCKTAG_CONTENT, jd.unknownTagContents.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.unknownInlineTags, line, column)) != -1) {
|
||||
return Pair.create(JD_UNKNOWN_INLINETAG, jd.unknownInlineTags.get(index));
|
||||
}
|
||||
|
||||
if((index = containsStartPosition(jd.unknownInlineTagContents, line, column)) != -1) {
|
||||
return Pair.create(JD_UNKNOWN_INLINETAG_CONTENT, jd.unknownInlineTagContents.get(index));
|
||||
}
|
||||
|
||||
return Pair.create(HighlightRangeHelper.NOT_FOUND, null);
|
||||
}
|
||||
|
||||
private int containsStartPosition (List<Range> ranges, int line, int column) {
|
||||
int index = binarySearchTypeFrom(ranges, line, column);
|
||||
if(index >= 0 && index < ranges.size()) {
|
||||
return index;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
private int binarySearchTypeFrom(List<Range> ranges, int line, int column) {
|
||||
|
||||
int left = 0, right = ranges.size() - 1;
|
||||
while (left <= right) {
|
||||
int mid = (left + right) / 2;
|
||||
final Range range = ranges.get(mid);
|
||||
final int l = range.getStart().getLine();
|
||||
final int c = range.getStart().getCharacter();
|
||||
|
||||
// Compare lines
|
||||
if(l < line) {
|
||||
left = mid + 1;
|
||||
} else if(l > line) {
|
||||
right = mid - 1;
|
||||
} else {
|
||||
// Lines are same. Compare by columns
|
||||
if(c < column) {
|
||||
left = mid + 1;
|
||||
} else if (c > column) {
|
||||
right = mid - 1;
|
||||
} else {
|
||||
// Found!
|
||||
return mid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public boolean isEnumType(int line, int column) {
|
||||
if(highlights == null || highlights.enumTypes == null) return false;
|
||||
return isInRange(highlights.enumTypes, line, column);
|
||||
}
|
||||
|
||||
public boolean isAnnotationType(int line, int column) {
|
||||
if(highlights == null || highlights.annotationTypes == null) return false;
|
||||
return isInRange(highlights.annotationTypes, line, column);
|
||||
}
|
||||
|
||||
public boolean isInterface(int line, int column) {
|
||||
if(highlights == null || highlights.interfaces == null) return false;
|
||||
return isInRange(highlights.interfaces, line, column);
|
||||
}
|
||||
|
||||
public boolean isEnum(int line, int column) {
|
||||
if(highlights == null || highlights.enums == null) return false;
|
||||
return isInRange(highlights.enums, line, column);
|
||||
}
|
||||
|
||||
public boolean isParameter(int line, int column) {
|
||||
if(highlights == null || highlights.parameters == null) return false;
|
||||
return isInRange(highlights.parameters, line, column);
|
||||
}
|
||||
|
||||
public boolean isExceptionParam(int line, int column) {
|
||||
if(highlights == null || highlights.exceptionParams == null) return false;
|
||||
return isInRange(highlights.exceptionParams, line, column);
|
||||
}
|
||||
|
||||
public boolean isConstructor(int line, int column) {
|
||||
if(highlights == null || highlights.constructors == null) return false;
|
||||
return isInRange(highlights.constructors, line, column);
|
||||
}
|
||||
|
||||
public boolean isStaticInit(int line, int column) {
|
||||
if(highlights == null || highlights.staticInits == null) return false;
|
||||
return isInRange(highlights.staticInits, line, column);
|
||||
}
|
||||
|
||||
public boolean isInstanceInit(int line, int column) {
|
||||
if(highlights == null || highlights.instanceInits == null) return false;
|
||||
return isInRange(highlights.instanceInits, line, column);
|
||||
}
|
||||
|
||||
public boolean isTypeParam(int line, int column) {
|
||||
if(highlights == null || highlights.typeParams == null) return false;
|
||||
return isInRange(highlights.typeParams, line, column);
|
||||
}
|
||||
|
||||
public boolean isResourceVariable(int line, int column) {
|
||||
if(highlights == null || highlights.resourceVariables == null) return false;
|
||||
return isInRange(highlights.resourceVariables, line, column);
|
||||
}
|
||||
|
||||
public boolean isPackageName(int line, int column) {
|
||||
if(highlights == null || highlights.packages == null) return false;
|
||||
return isInRange(highlights.packages, line, column);
|
||||
}
|
||||
|
||||
public boolean isClassName(int line, int column) {
|
||||
if(highlights == null || highlights.classNames == null) return false;
|
||||
return isInRange(highlights.classNames, line, column);
|
||||
}
|
||||
|
||||
public boolean isField(int line, int column) {
|
||||
if(highlights == null || highlights.fields == null) return false;
|
||||
return isInRange(highlights.fields, line, column);
|
||||
}
|
||||
|
||||
public boolean isStaticField(int line, int column) {
|
||||
if(highlights == null || highlights.statics == null) return false;
|
||||
return isInRange(highlights.statics, line, column);
|
||||
}
|
||||
|
||||
public boolean isMethodDeclaration(int line, int column) {
|
||||
if(highlights == null || highlights.methodDeclarations == null) return false;
|
||||
return isInRange(highlights.methodDeclarations, line, column);
|
||||
}
|
||||
|
||||
public boolean isMethodInvocation(int line, int column) {
|
||||
if(highlights == null || highlights.methodInvocations == null) return false;
|
||||
return isInRange(highlights.methodInvocations, line, column);
|
||||
}
|
||||
|
||||
public boolean isLocal(int line, int column) {
|
||||
if(highlights == null || highlights.locals == null) return false;
|
||||
return isInRange(highlights.locals, line, column);
|
||||
}
|
||||
|
||||
public boolean isInRange(List<Range> ranges, int line, int column) {
|
||||
if(ranges != null && ranges.size() > 0) {
|
||||
for(int i=0;i<ranges.size();i++) {
|
||||
final Range range = ranges.get(i);
|
||||
if(range == null) continue;
|
||||
if(range.getStart().getLine() == line && range.getStart().getCharacter() == column)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+99
-128
@@ -1,10 +1,10 @@
|
||||
package com.itsaky.androidide.syntax.lexer.impls.java;
|
||||
|
||||
import androidx.core.util.Pair;
|
||||
import com.itsaky.androidide.antlr4.java.JavaLexer;
|
||||
import com.itsaky.androidide.models.ConstantsBridge;
|
||||
import com.itsaky.androidide.syntax.lexer.Lexer;
|
||||
import com.itsaky.androidide.syntax.lexer.impls.BaseJavaLexer;
|
||||
import com.itsaky.androidide.syntax.lexer.impls.javadoc.JavaDocLexer;
|
||||
import com.itsaky.androidide.syntax.lexer.tokens.Token;
|
||||
import com.itsaky.androidide.syntax.lexer.tokens.TokenType;
|
||||
import com.itsaky.androidide.utils.LSPUtils;
|
||||
@@ -13,6 +13,9 @@ import com.itsaky.lsp.SemanticHighlight;
|
||||
import com.itsaky.lsp.services.IDELanguageServer;
|
||||
import io.github.rosemoe.editor.struct.BlockLine;
|
||||
import io.github.rosemoe.editor.struct.Span;
|
||||
import io.github.rosemoe.editor.text.CharPosition;
|
||||
import io.github.rosemoe.editor.text.Content;
|
||||
import io.github.rosemoe.editor.text.Indexer;
|
||||
import io.github.rosemoe.editor.text.TextAnalyzeResult;
|
||||
import io.github.rosemoe.editor.text.TextAnalyzer;
|
||||
import io.github.rosemoe.editor.widget.EditorColorScheme;
|
||||
@@ -32,18 +35,19 @@ import org.eclipse.lsp4j.Range;
|
||||
|
||||
public class JavaLexerImpl extends io.github.rosemoe.editor.langs.AbstractCodeAnalyzer {
|
||||
|
||||
private SemanticHighlight highlights;
|
||||
private HighlightRangeHelper helper;
|
||||
private Map<Integer, Map<Integer, Diagnostic>> diagnostics = new HashMap<>();
|
||||
private final Map<Integer, Map<Integer, Diagnostic>> customDiagnostics = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void setSemanticHighlights(SemanticHighlight highlights) {
|
||||
this.highlights = highlights;
|
||||
this.helper = new HighlightRangeHelper(highlights);
|
||||
this.helper.sort();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void analyze(IDELanguageServer languageServer, File file, CharSequence content, TextAnalyzeResult colors, TextAnalyzer.AnalyzeThread.Delegate delegate) throws Exception {
|
||||
final JavaLexerAnalyzer lexer = new JavaLexerAnalyzer(content.toString(), colors, this.highlights);
|
||||
final JavaLexerAnalyzer lexer = new JavaLexerAnalyzer((Content) content, colors, this.helper);
|
||||
lexer.init();
|
||||
while (delegate.shouldAnalyze()) {
|
||||
// null = EOF
|
||||
@@ -107,12 +111,12 @@ public class JavaLexerImpl extends io.github.rosemoe.editor.langs.AbstractCodeAn
|
||||
|
||||
public class JavaLexerAnalyzer extends BaseJavaLexer implements Lexer {
|
||||
|
||||
private final SemanticHighlight highlights;
|
||||
private final HighlightRangeHelper helper;
|
||||
|
||||
public JavaLexerAnalyzer(String content, TextAnalyzeResult colors, SemanticHighlight highlights) {
|
||||
public JavaLexerAnalyzer(Content content, TextAnalyzeResult colors, HighlightRangeHelper helper) {
|
||||
this.content = content;
|
||||
this.colors = colors;
|
||||
this.highlights = highlights;
|
||||
this.helper = helper;
|
||||
this.maxSwitch = 0;
|
||||
this.currSwitch = 0;
|
||||
this.previous = -1;
|
||||
@@ -122,7 +126,7 @@ public class JavaLexerImpl extends io.github.rosemoe.editor.langs.AbstractCodeAn
|
||||
|
||||
@Override
|
||||
public void init() throws IOException {
|
||||
lexer = new JavaLexer(CharStreams.fromReader(new StringReader(content)));
|
||||
lexer = new JavaLexer(CharStreams.fromReader(new StringReader(content.toString())));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -300,6 +304,75 @@ public class JavaLexerImpl extends io.github.rosemoe.editor.langs.AbstractCodeAn
|
||||
wasClassName = true;
|
||||
break;
|
||||
case JavaLexer.BLOCK_COMMENT :
|
||||
|
||||
/**
|
||||
* Comment span must be initially added to
|
||||
* highlight '/**' and starting comment text as a comment.
|
||||
*/
|
||||
type = TokenType.COMMENT;
|
||||
span = colors.addIfNeeded(line, column, EditorColorScheme.COMMENT);
|
||||
wasClassName = false;
|
||||
|
||||
// Walk through the comment
|
||||
final Indexer indexer = content.getIndexer();
|
||||
final CharPosition endPos = indexer.getCharPosition(currentToken.getStopIndex());
|
||||
|
||||
int l = line;
|
||||
int c = column;
|
||||
|
||||
int el = -1;
|
||||
int ec = -1;
|
||||
|
||||
try {
|
||||
scan_comment: while (helper != null) {
|
||||
if(l == endPos.line && c == endPos.column) {
|
||||
// Reached end of comment
|
||||
// Nothing to search for
|
||||
break scan_comment;
|
||||
}
|
||||
|
||||
final Pair<Integer, Range> result = helper.findJavadocColorSchemeId(l, c);
|
||||
final int colorId = result.first;
|
||||
final Range range = result.second;
|
||||
if(colorId != HighlightRangeHelper.NOT_FOUND) {
|
||||
|
||||
// We found a valid start position of a JavaDoc element
|
||||
// Add it to the scheme
|
||||
colors.addIfNeeded(l, c, colorId);
|
||||
|
||||
// Store end line and column
|
||||
el = range.getEnd().getLine();
|
||||
ec = range.getEnd().getCharacter();
|
||||
|
||||
if(el >= content.getLineCount()) {
|
||||
break scan_comment;
|
||||
}
|
||||
|
||||
// Skip to the end line and column
|
||||
l = el;
|
||||
c = ec;
|
||||
|
||||
// Again add the normal comment highlight
|
||||
// After the javadoc element
|
||||
if(ec >= content.getColumnCount(el)) {
|
||||
el ++;
|
||||
ec = 0;
|
||||
}
|
||||
|
||||
colors.addIfNeeded(el, ec, EditorColorScheme.COMMENT);
|
||||
}
|
||||
|
||||
c ++;
|
||||
if(c >= content.getColumnCount(l)) {
|
||||
l ++;
|
||||
c = 0;
|
||||
}
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
LOG.error("Error while highlighting comment", th);
|
||||
}
|
||||
|
||||
break;
|
||||
case JavaLexer.LINE_COMMENT :
|
||||
type = TokenType.COMMENT;
|
||||
span = colors.addIfNeeded(line, column, EditorColorScheme.COMMENT);
|
||||
@@ -329,92 +402,92 @@ public class JavaLexerImpl extends io.github.rosemoe.editor.langs.AbstractCodeAn
|
||||
case JavaLexer.IDENTIFIER :
|
||||
type = TokenType.IDENTIFIER;
|
||||
|
||||
if(isPackageName(line, column)) {
|
||||
if(helper != null && helper.isPackageName(line, column)) {
|
||||
span = colors.addIfNeeded(line, column, EditorColorScheme.PACKAGE_NAME);
|
||||
break;
|
||||
}
|
||||
|
||||
if(isEnumType(line, column)) {
|
||||
if(helper != null && helper.isEnumType(line, column)) {
|
||||
span = colors.addIfNeeded(line, column, EditorColorScheme.ENUM_TYPE);
|
||||
break;
|
||||
}
|
||||
|
||||
if(isClassName(line, column)) {
|
||||
if(helper != null && helper.isClassName(line, column)) {
|
||||
span = colors.addIfNeeded(line, column, EditorColorScheme.TYPE_NAME);
|
||||
break;
|
||||
}
|
||||
|
||||
if(isAnnotationType(line, column)) {
|
||||
if(helper != null && helper.isAnnotationType(line, column)) {
|
||||
span = colors.addIfNeeded(line, column, EditorColorScheme.ANNOTATION);
|
||||
break;
|
||||
}
|
||||
|
||||
if(isInterface(line, column)) {
|
||||
if(helper != null && helper.isInterface(line, column)) {
|
||||
span = colors.addIfNeeded(line, column, EditorColorScheme.INTERFACE);
|
||||
break;
|
||||
}
|
||||
|
||||
if(isEnum(line, column)) {
|
||||
if(helper != null && helper.isEnum(line, column)) {
|
||||
span = colors.addIfNeeded(line, column, EditorColorScheme.ENUM);
|
||||
break;
|
||||
}
|
||||
|
||||
if(isStaticField(line, column)) {
|
||||
if(helper != null && helper.isStaticField(line, column)) {
|
||||
span = colors.addIfNeeded(line, column, EditorColorScheme.STATIC_FIELD);
|
||||
break;
|
||||
}
|
||||
|
||||
if(isField(line, column)) {
|
||||
if(helper != null && helper.isField(line, column)) {
|
||||
span = colors.addIfNeeded(line, column, EditorColorScheme.FIELD);
|
||||
break;
|
||||
}
|
||||
|
||||
if(isParameter(line, column)) {
|
||||
if(helper != null && helper.isParameter(line, column)) {
|
||||
span = colors.addIfNeeded(line, column, EditorColorScheme.PARAMETER);
|
||||
break;
|
||||
}
|
||||
|
||||
if(isLocal(line, column)) {
|
||||
if(helper != null && helper.isLocal(line, column)) {
|
||||
span = colors.addIfNeeded(line, column, EditorColorScheme.LOCAL_VARIABLE);
|
||||
break;
|
||||
}
|
||||
|
||||
if(isExceptionParam(line, column)) {
|
||||
if(helper != null && helper.isExceptionParam(line, column)) {
|
||||
span = colors.addIfNeeded(line, column, EditorColorScheme.EXCEPTION_PARAM);
|
||||
break;
|
||||
}
|
||||
|
||||
if(isMethodDeclaration(line, column)) {
|
||||
if(helper != null && helper.isMethodDeclaration(line, column)) {
|
||||
span = colors.addIfNeeded(line, column, EditorColorScheme.METHOD_DECLARATION);
|
||||
break;
|
||||
}
|
||||
|
||||
if(isMethodInvocation(line, column)) {
|
||||
if(helper != null && helper.isMethodInvocation(line, column)) {
|
||||
span = colors.addIfNeeded(line, column, EditorColorScheme.METHOD_INVOCATION);
|
||||
break;
|
||||
}
|
||||
|
||||
if(isConstructor(line, column)) {
|
||||
if(helper != null && helper.isConstructor(line, column)) {
|
||||
span = colors.addIfNeeded(line, column, EditorColorScheme.CONSTRUCTOR);
|
||||
break;
|
||||
}
|
||||
|
||||
if(isStaticInit(line, column)) {
|
||||
if(helper != null && helper.isStaticInit(line, column)) {
|
||||
span = colors.addIfNeeded(line, column, EditorColorScheme.STATIC_INIT);
|
||||
break;
|
||||
}
|
||||
|
||||
if(isInstanceInit(line, column)) {
|
||||
if(helper != null && helper.isInstanceInit(line, column)) {
|
||||
span = colors.addIfNeeded(line, column, EditorColorScheme.INSTANCE_INIT);
|
||||
break;
|
||||
}
|
||||
|
||||
if(isTypeParam(line, column)) {
|
||||
if(helper != null && helper.isTypeParam(line, column)) {
|
||||
span = colors.addIfNeeded(line, column, EditorColorScheme.TYPE_PARAM);
|
||||
break;
|
||||
}
|
||||
|
||||
if(isResourceVariable(line, column)) {
|
||||
if(helper != null && helper.isResourceVariable(line, column)) {
|
||||
span = colors.addIfNeeded(line, column, EditorColorScheme.RESOURCE_VARIABLE);
|
||||
break;
|
||||
}
|
||||
@@ -466,108 +539,6 @@ public class JavaLexerImpl extends io.github.rosemoe.editor.langs.AbstractCodeAn
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
private boolean isEnumType(int line, int column) {
|
||||
if(highlights == null || highlights.enumTypes == null) return false;
|
||||
return isInRange(highlights.enumTypes, line, column);
|
||||
}
|
||||
|
||||
private boolean isAnnotationType(int line, int column) {
|
||||
if(highlights == null || highlights.annotationTypes == null) return false;
|
||||
return isInRange(highlights.annotationTypes, line, column);
|
||||
}
|
||||
|
||||
private boolean isInterface(int line, int column) {
|
||||
if(highlights == null || highlights.interfaces == null) return false;
|
||||
return isInRange(highlights.interfaces, line, column);
|
||||
}
|
||||
|
||||
private boolean isEnum(int line, int column) {
|
||||
if(highlights == null || highlights.enums == null) return false;
|
||||
return isInRange(highlights.enums, line, column);
|
||||
}
|
||||
|
||||
private boolean isParameter(int line, int column) {
|
||||
if(highlights == null || highlights.parameters == null) return false;
|
||||
return isInRange(highlights.parameters, line, column);
|
||||
}
|
||||
|
||||
private boolean isExceptionParam(int line, int column) {
|
||||
if(highlights == null || highlights.exceptionParams == null) return false;
|
||||
return isInRange(highlights.exceptionParams, line, column);
|
||||
}
|
||||
|
||||
private boolean isConstructor(int line, int column) {
|
||||
if(highlights == null || highlights.constructors == null) return false;
|
||||
return isInRange(highlights.constructors, line, column);
|
||||
}
|
||||
|
||||
private boolean isStaticInit(int line, int column) {
|
||||
if(highlights == null || highlights.staticInits == null) return false;
|
||||
return isInRange(highlights.staticInits, line, column);
|
||||
}
|
||||
|
||||
private boolean isInstanceInit(int line, int column) {
|
||||
if(highlights == null || highlights.instanceInits == null) return false;
|
||||
return isInRange(highlights.instanceInits, line, column);
|
||||
}
|
||||
|
||||
private boolean isTypeParam(int line, int column) {
|
||||
if(highlights == null || highlights.typeParams == null) return false;
|
||||
return isInRange(highlights.typeParams, line, column);
|
||||
}
|
||||
|
||||
private boolean isResourceVariable(int line, int column) {
|
||||
if(highlights == null || highlights.resourceVariables == null) return false;
|
||||
return isInRange(highlights.resourceVariables, line, column);
|
||||
}
|
||||
|
||||
private boolean isPackageName(int line, int column) {
|
||||
if(highlights == null || highlights.packages == null) return false;
|
||||
return isInRange(highlights.packages, line, column);
|
||||
}
|
||||
|
||||
private boolean isClassName(int line, int column) {
|
||||
if(highlights == null || highlights.classNames == null) return false;
|
||||
return isInRange(highlights.classNames, line, column);
|
||||
}
|
||||
|
||||
private boolean isField(int line, int column) {
|
||||
if(highlights == null || highlights.fields == null) return false;
|
||||
return isInRange(highlights.fields, line, column);
|
||||
}
|
||||
|
||||
private boolean isStaticField(int line, int column) {
|
||||
if(highlights == null || highlights.statics == null) return false;
|
||||
return isInRange(highlights.statics, line, column);
|
||||
}
|
||||
|
||||
private boolean isMethodDeclaration(int line, int column) {
|
||||
if(highlights == null || highlights.methodDeclarations == null) return false;
|
||||
return isInRange(highlights.methodDeclarations, line, column);
|
||||
}
|
||||
|
||||
private boolean isMethodInvocation(int line, int column) {
|
||||
if(highlights == null || highlights.methodInvocations == null) return false;
|
||||
return isInRange(highlights.methodInvocations, line, column);
|
||||
}
|
||||
|
||||
private boolean isLocal(int line, int column) {
|
||||
if(highlights == null || highlights.locals == null) return false;
|
||||
return isInRange(highlights.locals, line, column);
|
||||
}
|
||||
|
||||
private boolean isInRange(List<Range> ranges, int line, int column) {
|
||||
if(ranges != null && ranges.size() > 0) {
|
||||
for(int i=0;i<ranges.size();i++) {
|
||||
final Range range = ranges.get(i);
|
||||
if(range == null) continue;
|
||||
if(range.getStart().getLine() == line && range.getStart().getCharacter() == column)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static final Logger LOG = Logger.instance("JavaLexerImpl");
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
package com.itsaky.androidide.syntax.lexer.impls.javadoc;
|
||||
|
||||
import com.itsaky.androidide.antlr4.javadoc.JavadocLexer;
|
||||
import com.itsaky.androidide.antlr4.javadoc.JavadocParserBaseVisitor;
|
||||
import com.itsaky.androidide.utils.Logger;
|
||||
import io.github.rosemoe.editor.text.TextAnalyzeResult;
|
||||
import io.github.rosemoe.editor.widget.EditorColorScheme;
|
||||
import java.io.StringReader;
|
||||
import java.util.List;
|
||||
import org.antlr.v4.runtime.CharStreams;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
|
||||
import static com.itsaky.androidide.antlr4.javadoc.JavadocParser.*;
|
||||
|
||||
public class JavaDocLexer extends JavadocParserBaseVisitor<Void> {
|
||||
|
||||
private final String doc;
|
||||
private final int startLine;
|
||||
private final int startColumn;
|
||||
|
||||
private final TextAnalyzeResult colors;
|
||||
|
||||
private static final Logger LOG = Logger.instance("JavadocLexer");
|
||||
|
||||
public JavaDocLexer(String doc, int startLine, int startColumn, TextAnalyzeResult colors) {
|
||||
this.doc = doc;
|
||||
this.startLine = startLine;
|
||||
this.startColumn = startColumn;
|
||||
this.colors = colors;
|
||||
|
||||
LOG.info("new JavadocLexer (doc=" + doc + ", startLine=" + startLine + ", startColumn=" + startColumn + ", colors=" + colors);
|
||||
}
|
||||
|
||||
public void lex() throws Exception {
|
||||
final JavadocLexer lexer = new JavadocLexer(CharStreams.fromReader(new StringReader(this.doc)));
|
||||
final List<? extends Token> tokens = lexer.getAllTokens();
|
||||
|
||||
boolean inlineOpen = false;
|
||||
int bracesAfterInline = 0;
|
||||
for (int i=0;i<tokens.size();i++) {
|
||||
final Token token = tokens.get(i);
|
||||
final int line = line(token.getLine());
|
||||
final int column = column(line, token.getCharPositionInLine());
|
||||
final int type = token.getType();
|
||||
final String text = token.getText();
|
||||
LOG.info("token.get(i=" + i + ", size=" + tokens.size() + ") [line=" + line + ", column=" + column + ", type=" + type + ", text=" + text + "]");
|
||||
if(type == AT) {
|
||||
// Skip this
|
||||
// '@' must be highlighted only if it is directly followed by a name
|
||||
} else if(type == NAME && i > 0) {
|
||||
Token prev = tokens.get(i - 1);
|
||||
Token prevOfPrev = i > 1 ? tokens.get(i - 2) : null;
|
||||
if(prev.getType() == AT) {
|
||||
if(prevOfPrev != null && prevOfPrev.getType() == BRACE_OPEN) {
|
||||
// Inline tag '{@'
|
||||
// In this case, position of '{' must be considered
|
||||
final int cLine = line(prevOfPrev.getLine());
|
||||
final int cCol = column(cLine, prevOfPrev.getCharPositionInLine());
|
||||
colors.addIfNeeded(cLine, cCol, EditorColorScheme.JAVADOC_INLINE_TAG);
|
||||
} else {
|
||||
// A simple javadoc tag i.e. '@<tagName>'
|
||||
// Position of '@' will be considered
|
||||
final int cLine = line(prev.getLine());
|
||||
final int cCol = column(cLine, prev.getCharPositionInLine());
|
||||
colors.addIfNeeded(cLine, cCol, EditorColorScheme.JAVADOC_TAG);
|
||||
}
|
||||
}
|
||||
} else if(type == BRACE_OPEN) {
|
||||
if(inlineOpen) {
|
||||
bracesAfterInline ++;
|
||||
}
|
||||
} else if (type == BRACE_CLOSE) {
|
||||
if(inlineOpen && bracesAfterInline == 0) {
|
||||
colors.addIfNeeded(line, column, EditorColorScheme.JAVADOC_INLINE_TAG);
|
||||
inlineOpen = false;
|
||||
} else {
|
||||
bracesAfterInline --;
|
||||
}
|
||||
} else {
|
||||
colors.addIfNeeded(line, column, EditorColorScheme.COMMENT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int line(int current) {
|
||||
return startLine + current;
|
||||
}
|
||||
|
||||
private int column(int line, int column) {
|
||||
if (line == 0) {
|
||||
return startColumn + column;
|
||||
}
|
||||
return column;
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import org.eclipse.lsp4j.Diagnostic;
|
||||
import org.eclipse.lsp4j.DiagnosticSeverity;
|
||||
import org.eclipse.lsp4j.Position;
|
||||
import org.eclipse.lsp4j.Range;
|
||||
import java.util.Comparator;
|
||||
|
||||
public class LSPUtils {
|
||||
|
||||
@@ -57,4 +58,43 @@ public class LSPUtils {
|
||||
range.setEnd(new Position(line, column + length));
|
||||
return range;
|
||||
}
|
||||
|
||||
public static final Comparator<Range> RANGE_START_COMPARATOR = new Comparator<Range>() {
|
||||
|
||||
@Override
|
||||
public int compare(Range r1, Range r2) {
|
||||
// Check if ranges are null
|
||||
if(r1 == null && r2 != null) {
|
||||
return 1;
|
||||
} else if (r1 != null && r2 == null) {
|
||||
return -1;
|
||||
} else if (r1 == null && r2 == null) {
|
||||
return 0;
|
||||
} else {
|
||||
final int r1StartLine = r1.getStart().getLine();
|
||||
final int r1StartCol = r1.getStart().getCharacter();
|
||||
final int r2StartLine = r2.getStart().getLine();
|
||||
final int r2StartCol = r2.getStart().getCharacter();
|
||||
|
||||
// Compare by lines
|
||||
if(r1StartLine < r2StartLine) {
|
||||
return -1;
|
||||
} else if (r1StartLine > r2StartLine) {
|
||||
return 1;
|
||||
} else {
|
||||
|
||||
// Lines are same
|
||||
// Compare by columns
|
||||
if(r1StartCol < r2StartCol) {
|
||||
return -1;
|
||||
} else if (r1StartCol > r2StartCol) {
|
||||
return 1;
|
||||
} else {
|
||||
// Both ranges have same start position
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -69,6 +69,11 @@ public interface CodeAnalyzer {
|
||||
*/
|
||||
Map<Integer, Diagnostic> getDiagnosticsAtLine(int line);
|
||||
|
||||
/**
|
||||
* Get any hex color string is present in provided line
|
||||
*/
|
||||
Map<Integer, Integer> getHexColorsInLine (int line);
|
||||
|
||||
/**
|
||||
* Analyze spans for the given input
|
||||
*
|
||||
|
||||
@@ -32,4 +32,9 @@ public abstract class AbstractCodeAnalyzer implements CodeAnalyzer {
|
||||
public Map<Integer, Diagnostic> getDiagnosticsAtLine(int line) {
|
||||
return new HashMap<Integer, Diagnostic>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Integer, Integer> getHexColorsInLine(int line) {
|
||||
return new HashMap<Integer, Integer>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1487,25 +1487,24 @@ public class CodeEditor extends View implements ContentListener, TextAnalyzer.Ca
|
||||
mPaint.setStyle(Paint.Style.STROKE);
|
||||
mPaint.setStrokeWidth(getDpUnit() * 1.4f);
|
||||
final List<Diagnostic> diags = getEditorLanguage().getAnalyzer().findDiagnosticsContainingLine(line);
|
||||
if(diags != null && diags.size() > 0) {
|
||||
for(int i=0;i<diags.size();i++) {
|
||||
Diagnostic d = diags.get(i);
|
||||
if(d == null) continue;
|
||||
int startCol = d.getRange().getStart().getCharacter();
|
||||
int endCol = d.getRange().getEnd().getCharacter();
|
||||
if(line > d.getRange().getStart().getCharacter()) startCol = 0;
|
||||
if(line > d.getRange().getEnd().getCharacter()) endCol = 0;
|
||||
final int paintStart = Math.max(firstVisibleChar, startCol);
|
||||
final int paintEnd = Math.min(lastVisibleChar, endCol);
|
||||
final float width = measureText(mBuffer, paintStart, paintEnd - paintStart);
|
||||
final RectF r = new RectF();
|
||||
r.bottom = getRowBottom(line) - getOffsetY() - mDpUnit * 1;
|
||||
r.top = r.bottom - getRowHeight() * 0.2f;
|
||||
r.left = paintingOffset + measureText(mBuffer, firstVisibleChar, paintStart - firstVisibleChar);
|
||||
r.right = r.left + width;
|
||||
mPaint.setColor(diagnosticColor(d.getSeverity()));
|
||||
drawDiagnostics(r, canvas, mPaint);
|
||||
}
|
||||
final int size = diags == null ? 0 : diags.size();
|
||||
for(int i=0;i<size;i++) {
|
||||
Diagnostic d = diags.get(i);
|
||||
if(d == null) continue;
|
||||
int startCol = d.getRange().getStart().getCharacter();
|
||||
int endCol = d.getRange().getEnd().getCharacter();
|
||||
if(line > d.getRange().getStart().getCharacter()) startCol = 0;
|
||||
if(line > d.getRange().getEnd().getCharacter()) endCol = 0;
|
||||
final int paintStart = Math.max(firstVisibleChar, startCol);
|
||||
final int paintEnd = Math.min(lastVisibleChar, endCol);
|
||||
final float width = measureText(mBuffer, paintStart, paintEnd - paintStart);
|
||||
final RectF r = new RectF();
|
||||
r.bottom = getRowBottom(line) - getOffsetY() - mDpUnit * 1;
|
||||
r.top = r.bottom - getRowHeight() * 0.2f;
|
||||
r.left = paintingOffset + measureText(mBuffer, firstVisibleChar, paintStart - firstVisibleChar);
|
||||
r.right = r.left + width;
|
||||
mPaint.setColor(diagnosticColor(d.getSeverity()));
|
||||
drawDiagnostics(r, canvas, mPaint);
|
||||
}
|
||||
|
||||
mPaint.setStyle(style);
|
||||
@@ -1531,7 +1530,7 @@ public class CodeEditor extends View implements ContentListener, TextAnalyzer.Ca
|
||||
}
|
||||
}
|
||||
|
||||
private void drawDiagnostics(RectF rect, Canvas canvas, Paint paint) {
|
||||
private void drawDiagnostics(final RectF rect, final Canvas canvas, final Paint paint) {
|
||||
final Path path = new Path();
|
||||
final float right = rect.right;
|
||||
final float bottom = rect.bottom;
|
||||
@@ -2221,14 +2220,20 @@ public class CodeEditor extends View implements ContentListener, TextAnalyzer.Ca
|
||||
* @return The width measured
|
||||
*/
|
||||
private float measureText(char[] src, int index, int count) {
|
||||
int tabCount = 0;
|
||||
for (int i = 0; i < count; i++) {
|
||||
if (src[index + i] == '\t') {
|
||||
tabCount++;
|
||||
}
|
||||
}
|
||||
float extraWidth = mFontCache.measureChar(' ', mPaint) * getTabWidth() - mFontCache.measureChar('\t', mPaint);
|
||||
return mFontCache.measureText(src, index, index + count, mPaint) + tabCount * extraWidth;
|
||||
|
||||
// AndroidIDE does not allow tabs
|
||||
// Due to Java Language Server
|
||||
|
||||
// int tabCount = 0;
|
||||
// for (int i = 0; i < count; i++) {
|
||||
// if (src[index + i] == '\t') {
|
||||
// tabCount++;
|
||||
// }
|
||||
// }
|
||||
// float extraWidth = mFontCache.measureChar(' ', mPaint) * getTabWidth() - mFontCache.measureChar('\t', mPaint);
|
||||
// return mFontCache.measureText(src, index, index + count, mPaint) + tabCount * extraWidth;
|
||||
|
||||
return mFontCache.measureText(src, index, index + count, mPaint);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
package io.github.rosemoe.editor.widget;
|
||||
|
||||
import android.util.SparseIntArray;
|
||||
|
||||
import io.github.rosemoe.editor.util.Objects;
|
||||
|
||||
/**
|
||||
@@ -52,8 +51,54 @@ import io.github.rosemoe.editor.util.Objects;
|
||||
*/
|
||||
public class EditorColorScheme {
|
||||
|
||||
public static final int JAVADOC_INLINE_TAG = 57;
|
||||
public static final int JAVADOC_TAG = 56;
|
||||
//------------------- -< JavaDoc >- -----------------------
|
||||
public static final int JD_UNKNOWN_INLINETAG_CONTENT = 102;
|
||||
public static final int JD_UNKNOWN_INLINETAG = 101;
|
||||
public static final int JD_UNKNOWN_BLOCKTAG_CONTENT= 100;
|
||||
public static final int JD_UNKNOWN_BLOCKTAG = 99;
|
||||
public static final int JD_VERSION_BODY = 98;
|
||||
public static final int JD_VERSION_TAG = 97;
|
||||
public static final int JD_VALUE_REFERENCE = 96;
|
||||
public static final int JD_VALUE_TAG = 95;
|
||||
public static final int JD_USES_SERVICETYPE = 94;
|
||||
public static final int JD_USES_DESCRIPTION = 93;
|
||||
public static final int JD_USES_TAG = 92;
|
||||
public static final int JD_THROWS_NAME = 91;
|
||||
public static final int JD_THROWS_DESCRIPTION = 90;
|
||||
public static final int JD_THROWS_TAG = 89;
|
||||
public static final int JD_SUMMARY_MESSAGE = 88;
|
||||
public static final int JD_SUMMARY_TAG = 87;
|
||||
public static final int JD_SINCE_TAG = 86;
|
||||
public static final int JD_SINCE_BODY = 85;
|
||||
public static final int JD_SERIAL_TAG = 84;
|
||||
public static final int JD_SERIALDATA_DESCRIPTION = 83;
|
||||
public static final int JD_SERIALDATA_TAG = 82;
|
||||
public static final int JD_SEE_REFERENCE = 81;
|
||||
public static final int JD_SEE_TAG = 80;
|
||||
public static final int JD_RETURN_DESCRIPTION = 79;
|
||||
public static final int JD_RETURN_TAG = 78;
|
||||
public static final int JD_PROVIDES_SERVICETYPE = 77;
|
||||
public static final int JD_PROVIDES_DESCRIPTION = 76;
|
||||
public static final int JD_PROVIDES_TAG = 75;
|
||||
public static final int JD_PARAM_DESCRIPTION = 74;
|
||||
public static final int JD_PARAM_NAME = 73;
|
||||
public static final int JD_PARAM_TAG = 72;
|
||||
public static final int JD_LITERAL_TEXT = 71;
|
||||
public static final int JD_LITERAL_TAG = 70;
|
||||
public static final int JD_LINK_REFERENCE = 69;
|
||||
public static final int JD_LINK_LABEL = 68;
|
||||
public static final int JD_LINK_TAG = 67;
|
||||
public static final int JD_INHERITDOC_TAG = 66;
|
||||
public static final int JD_INDEX_SEARCH_TERM = 65;
|
||||
public static final int JD_INDEX_DESCRIPTION = 64;
|
||||
public static final int JD_INDEX_TAG = 63;
|
||||
public static final int JD_HIDDEN_TAG = 62;
|
||||
public static final int JD_HIDDEN_MESSAGE = 61;
|
||||
public static final int JD_DOCROOT_TAG = 60;
|
||||
public static final int JD_DEPRECATED_MESSAGE= 59;
|
||||
public static final int JD_DEPRECATED_TAG = 58;
|
||||
public static final int JD_AUTHOR_NAME = 57;
|
||||
public static final int JD_AUTHOR_TAG = 56;
|
||||
|
||||
public static final int DIAGNOSTIC_ERROR = 38;
|
||||
public static final int DIAGNOSTIC_WARNING = 39;
|
||||
@@ -124,6 +169,21 @@ public class EditorColorScheme {
|
||||
public static final int LINE_NUMBER_BACKGROUND = 3;
|
||||
public static final int LINE_NUMBER = 2;
|
||||
public static final int LINE_DIVIDER = 1;
|
||||
|
||||
/**
|
||||
* Default comment color
|
||||
*/
|
||||
protected static int COMMENT_DEFAULT = 0xffa8a8a8;
|
||||
|
||||
/**
|
||||
* Start index of Javadoc related color IDs
|
||||
*/
|
||||
public static final int JD_SCHEME_START = 56;
|
||||
|
||||
/**
|
||||
* End index of Javadoc related color IDs
|
||||
*/
|
||||
public static final int JD_SCHEME_END = 102;
|
||||
|
||||
/**
|
||||
* Min pre-defined color id
|
||||
@@ -133,7 +193,7 @@ public class EditorColorScheme {
|
||||
/**
|
||||
* Max pre-defined color id
|
||||
*/
|
||||
protected static final int END_COLOR_ID = 57;
|
||||
protected static final int END_COLOR_ID = 102;
|
||||
/**
|
||||
* Real color saver
|
||||
*/
|
||||
@@ -187,6 +247,12 @@ public class EditorColorScheme {
|
||||
* @param type The type
|
||||
*/
|
||||
private void applyDefault(int type) {
|
||||
|
||||
// By default, all javadoc syntax will be treated as comments
|
||||
if(type >= JD_SCHEME_START && type <= JD_SCHEME_END) {
|
||||
setColor(type, COMMENT_DEFAULT); // Comment
|
||||
}
|
||||
|
||||
int color;
|
||||
switch (type) {
|
||||
case LINE_DIVIDER:
|
||||
@@ -235,9 +301,7 @@ public class EditorColorScheme {
|
||||
color = 0xFF2196F3;
|
||||
break;
|
||||
case COMMENT:
|
||||
case JAVADOC_INLINE_TAG :
|
||||
case JAVADOC_TAG :
|
||||
color = 0xffa8a8a8;
|
||||
color = COMMENT_DEFAULT;
|
||||
break;
|
||||
case LITERAL:
|
||||
color = 0xFF008080;
|
||||
@@ -311,8 +375,50 @@ public class EditorColorScheme {
|
||||
default:
|
||||
color = 0xffffffff;
|
||||
}
|
||||
|
||||
setColor(type, color);
|
||||
}
|
||||
|
||||
public void setJavadocBlockTagColor(final int color) {
|
||||
for (int i=JD_SCHEME_START;i<=JD_SCHEME_END;i++) {
|
||||
if(isJavadocBlockTag(i)) {
|
||||
setColor(i, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setJavadocInlineTagColor(final int color) {
|
||||
for (int i=JD_SCHEME_START;i<=JD_SCHEME_END;i++) {
|
||||
if(isJavadocInlineTag(i)) {
|
||||
setColor(i, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isJavadocBlockTag (int type) {
|
||||
return type == JD_AUTHOR_TAG
|
||||
|| type == JD_DEPRECATED_TAG
|
||||
|| type == JD_PARAM_TAG
|
||||
|| type == JD_RETURN_TAG
|
||||
|| type == JD_SERIALDATA_TAG
|
||||
|| type == JD_SERIAL_TAG
|
||||
|| type == JD_SINCE_TAG
|
||||
|| type == JD_THROWS_TAG
|
||||
|| type == JD_UNKNOWN_BLOCKTAG
|
||||
|| type == JD_VERSION_TAG
|
||||
|
||||
// In AndroidIDE, @hidden is considered as a block tag
|
||||
|| type == JD_HIDDEN_TAG;
|
||||
}
|
||||
|
||||
public boolean isJavadocInlineTag (int type) {
|
||||
return type == JD_DOCROOT_TAG
|
||||
|| type == JD_INHERITDOC_TAG
|
||||
|| type == JD_LINK_TAG
|
||||
|| type == JD_LITERAL_TAG
|
||||
|| type == JD_UNKNOWN_INLINETAG
|
||||
|| type == JD_VALUE_TAG;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply a new color for the given type
|
||||
|
||||
@@ -0,0 +1,143 @@
|
||||
package com.itsaky.lsp;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import org.eclipse.lsp4j.Range;
|
||||
|
||||
public class JavadocHighlights {
|
||||
|
||||
public final List<Range>
|
||||
|
||||
authorTags = new ArrayList<>(),
|
||||
authorNames = new ArrayList<>(),
|
||||
|
||||
deprecatedTags = new ArrayList<>(),
|
||||
deprecatedMessages = new ArrayList<>(),
|
||||
|
||||
docrootTags = new ArrayList<>(),
|
||||
|
||||
hiddenTags = new ArrayList<>(),
|
||||
hiddenMessages = new ArrayList<>(),
|
||||
|
||||
indexTags = new ArrayList<>(),
|
||||
indexDescriptions = new ArrayList<>(),
|
||||
indexSearchTerms = new ArrayList<>(),
|
||||
|
||||
inheritDocTags = new ArrayList<>(),
|
||||
|
||||
linkTags = new ArrayList<>(),
|
||||
linkLabels = new ArrayList<>(),
|
||||
linkReferences = new ArrayList<>(),
|
||||
|
||||
literalTags = new ArrayList<>(),
|
||||
literalTexts = new ArrayList<>(),
|
||||
|
||||
paramTags = new ArrayList<>(),
|
||||
paramNames = new ArrayList<>(),
|
||||
paramDescriptions = new ArrayList<>(),
|
||||
|
||||
providesTags = new ArrayList<>(),
|
||||
providesServiceTypes = new ArrayList<>(),
|
||||
providesDescriptions = new ArrayList<>(),
|
||||
|
||||
returnTags = new ArrayList<>(),
|
||||
returnDescriptions = new ArrayList<>(),
|
||||
|
||||
seeTags = new ArrayList<>(),
|
||||
seeReferences = new ArrayList<>(),
|
||||
|
||||
serialDataTags = new ArrayList<>(),
|
||||
serialDataDescriptions = new ArrayList<>(),
|
||||
|
||||
serialTags = new ArrayList<>(),
|
||||
|
||||
sinceTags = new ArrayList<>(),
|
||||
sinceBodies = new ArrayList<>(),
|
||||
|
||||
summaryTags = new ArrayList<>(),
|
||||
summaryMessages = new ArrayList<>(),
|
||||
|
||||
throwsTags = new ArrayList<>(),
|
||||
throwsDescriptions = new ArrayList<>(),
|
||||
throwsNames = new ArrayList<>(),
|
||||
|
||||
usesTags = new ArrayList<>(),
|
||||
usesDescriptions = new ArrayList<>(),
|
||||
usesServiceTypes = new ArrayList<>(),
|
||||
|
||||
valueTags = new ArrayList<>(),
|
||||
valueReferences = new ArrayList<>(),
|
||||
|
||||
versionTags = new ArrayList<>(),
|
||||
versionBodies = new ArrayList<>(),
|
||||
|
||||
unknownTags = new ArrayList<>(),
|
||||
unknownTagContents = new ArrayList<>(),
|
||||
|
||||
unknownInlineTags = new ArrayList<>(),
|
||||
unknownInlineTagContents = new ArrayList<>();
|
||||
|
||||
public void sort(Comparator<Range> comparator) {
|
||||
sortAll(comparator, asArray());
|
||||
}
|
||||
|
||||
public List<Range>[] asArray () {
|
||||
return new List[] {
|
||||
authorTags,
|
||||
authorNames,
|
||||
deprecatedTags,
|
||||
deprecatedMessages,
|
||||
docrootTags,
|
||||
hiddenTags,
|
||||
hiddenMessages,
|
||||
indexTags,
|
||||
indexSearchTerms,
|
||||
inheritDocTags,
|
||||
inheritDocTags,
|
||||
linkTags,
|
||||
linkLabels,
|
||||
linkReferences,
|
||||
literalTags,
|
||||
literalTexts,
|
||||
paramTags,
|
||||
paramNames,
|
||||
paramDescriptions,
|
||||
providesTags,
|
||||
providesDescriptions,
|
||||
providesServiceTypes,
|
||||
returnTags,
|
||||
returnDescriptions,
|
||||
seeTags,
|
||||
seeReferences,
|
||||
serialDataTags,
|
||||
serialDataDescriptions,
|
||||
serialTags,
|
||||
sinceTags,
|
||||
sinceBodies,
|
||||
summaryTags,
|
||||
summaryMessages,
|
||||
throwsTags,
|
||||
throwsNames,
|
||||
throwsDescriptions,
|
||||
usesTags,
|
||||
usesDescriptions,
|
||||
usesServiceTypes,
|
||||
valueTags,
|
||||
valueReferences,
|
||||
versionTags,
|
||||
versionBodies,
|
||||
unknownTags,
|
||||
unknownTagContents,
|
||||
unknownInlineTags,
|
||||
unknownInlineTagContents
|
||||
};
|
||||
}
|
||||
|
||||
private void sortAll (Comparator<Range> comparator, List<Range>... lists) {
|
||||
for (List<Range> list : lists) {
|
||||
Collections.sort(list, comparator);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.itsaky.lsp;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import org.eclipse.lsp4j.Range;
|
||||
|
||||
@@ -8,23 +10,57 @@ public class SemanticHighlight {
|
||||
|
||||
public String uri;
|
||||
|
||||
public List<Range>
|
||||
packages = new ArrayList<>(),
|
||||
enumTypes = new ArrayList<>(),
|
||||
classNames = new ArrayList<>(),
|
||||
annotationTypes = new ArrayList<>(),
|
||||
interfaces = new ArrayList<>(),
|
||||
enums = new ArrayList<>(),
|
||||
statics = new ArrayList<>(),
|
||||
fields = new ArrayList<>(),
|
||||
parameters = new ArrayList<>(),
|
||||
locals = new ArrayList<>(),
|
||||
exceptionParams = new ArrayList<>(),
|
||||
methodDeclarations = new ArrayList<>(),
|
||||
methodInvocations = new ArrayList<>(),
|
||||
constructors = new ArrayList<>(),
|
||||
staticInits = new ArrayList<>(),
|
||||
instanceInits = new ArrayList<>(),
|
||||
typeParams = new ArrayList<>(),
|
||||
resourceVariables = new ArrayList<>();
|
||||
public final List<Range>
|
||||
packages = new ArrayList<>(),
|
||||
enumTypes = new ArrayList<>(),
|
||||
classNames = new ArrayList<>(),
|
||||
annotationTypes = new ArrayList<>(),
|
||||
interfaces = new ArrayList<>(),
|
||||
enums = new ArrayList<>(),
|
||||
statics = new ArrayList<>(),
|
||||
fields = new ArrayList<>(),
|
||||
parameters = new ArrayList<>(),
|
||||
locals = new ArrayList<>(),
|
||||
exceptionParams = new ArrayList<>(),
|
||||
methodDeclarations = new ArrayList<>(),
|
||||
methodInvocations = new ArrayList<>(),
|
||||
constructors = new ArrayList<>(),
|
||||
staticInits = new ArrayList<>(),
|
||||
instanceInits = new ArrayList<>(),
|
||||
typeParams = new ArrayList<>(),
|
||||
resourceVariables = new ArrayList<>();
|
||||
|
||||
public final JavadocHighlights javadocs = new JavadocHighlights();
|
||||
|
||||
public void sort(Comparator<Range> comparator) {
|
||||
sortAll(comparator,
|
||||
|
||||
// Semantic highlights
|
||||
packages,
|
||||
enumTypes,
|
||||
classNames,
|
||||
annotationTypes,
|
||||
interfaces,
|
||||
enums,
|
||||
statics,
|
||||
fields,
|
||||
parameters,
|
||||
locals,
|
||||
exceptionParams,
|
||||
methodDeclarations,
|
||||
methodInvocations,
|
||||
constructors,
|
||||
staticInits,
|
||||
instanceInits,
|
||||
typeParams,
|
||||
resourceVariables);
|
||||
|
||||
javadocs.sort(comparator);
|
||||
}
|
||||
|
||||
private void sortAll (Comparator<Range> comparator, List<Range>... lists) {
|
||||
for (List<Range> list : lists) {
|
||||
Collections.sort(list, comparator);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,15 +3,15 @@ package com.itsaky.lsp;
|
||||
import org.eclipse.lsp4j.TextDocumentIdentifier;
|
||||
|
||||
public class SemanticHighlightsParams {
|
||||
|
||||
private TextDocumentIdentifier textDocument;
|
||||
|
||||
public void setTextDocument(TextDocumentIdentifier document) {
|
||||
this.textDocument = document;
|
||||
}
|
||||
|
||||
public TextDocumentIdentifier getDocument() {
|
||||
return this.textDocument;
|
||||
}
|
||||
|
||||
|
||||
private TextDocumentIdentifier _textDocument;
|
||||
|
||||
|
||||
public TextDocumentIdentifier getTextDocument() {
|
||||
return this._textDocument;
|
||||
}
|
||||
|
||||
public void setTextDocument(final TextDocumentIdentifier textDocument) {
|
||||
this._textDocument = textDocument;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user