Removed JavaDoc highlighting

This commit is contained in:
Akash Yadav
2021-12-05 18:12:42 +05:30
parent 0f286332c4
commit e4f5d395e5
21 changed files with 126 additions and 625 deletions
@@ -1,8 +1,6 @@
/************************************************************************************
* This file is part of AndroidIDE.
*
*
*
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -17,8 +15,6 @@
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*
**************************************************************************************/
package com.itsaky.androidide.language.java;
import com.itsaky.androidide.lsp.LSPProvider;
@@ -54,26 +50,33 @@ public class JavaAutoComplete implements AutoCompleteProvider {
params.setTextDocument(new TextDocumentIdentifier(fileUri));
future = languageServer.getTextDocumentService().completion(params);
if(future.isCancelled()) return new ArrayList<CompletionItem>();
if(future.isCancelled()) {
LOG.debug ("Completion request was cancelled");
return finalizeResults(new ArrayList<CompletionItem>());
}
try {
Either<List<CompletionItem>, CompletionList> either = future.get();
if(either.isLeft())
return sort(either.getLeft());
if(either.isLeft()) {
return finalizeResults(either.getLeft());
}
if(either.isRight())
return sort(either.getRight().getItems());
if(either.isRight()) {
return finalizeResults(either.getRight().getItems());
}
} catch (Throwable th) {
// Ignore this exception. An empty list will be sent after this
// This exeption is thrown probably because the request was cancelled or interrupted
LOG.error("CompletionError", th);
}
} else {
LOG.error("Cannot compute completions for Java file. No LanguageServer implementation found.");
}
return new ArrayList<CompletionItem>();
}
private List<CompletionItem> sort(List<CompletionItem> items) {
private List<CompletionItem> finalizeResults(List<CompletionItem> items) {
Collections.sort(items, RESULT_SORTER);
LOG.debug ("CompletionResults", items);
return items;
}
@@ -1,8 +1,6 @@
/************************************************************************************
* This file is part of AndroidIDE.
*
*
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -17,8 +15,6 @@
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*
**************************************************************************************/
package com.itsaky.androidide.language.java;
import com.itsaky.androidide.lexers.java.JavaLexer;
@@ -1,8 +1,6 @@
/************************************************************************************
* This file is part of AndroidIDE.
*
*
*
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -17,8 +15,6 @@
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*
**************************************************************************************/
package com.itsaky.androidide.lsp;
import com.itsaky.androidide.utils.Logger;
@@ -31,6 +27,7 @@ import java.util.Objects;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import org.eclipse.lsp4j.jsonrpc.Launcher;
import java.util.Locale;
/**
* Launches a client for a Language server and handles connection.
@@ -74,7 +71,7 @@ public abstract class LSPClientLauncher extends Thread {
try {
launch();
} catch (Throwable th) {
// TODO Log this
LOG.error("Error starting language server", th);
}
}
@@ -162,7 +159,9 @@ public abstract class LSPClientLauncher extends Thread {
Writable data = writeQueue.take();
this.out.write(data.data);
this.out.flush();
} catch (Throwable e) { }
} catch (Throwable e) {
LOG.error ("Failed to write to LSP4J socket", e);
}
}
}
@@ -174,7 +173,6 @@ public abstract class LSPClientLauncher extends Thread {
class Writable {
byte[] data;
public Writable(byte[] data) {
this.data = data;
}
@@ -1,8 +1,6 @@
/************************************************************************************
* This file is part of AndroidIDE.
*
*
*
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -17,8 +15,6 @@
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*
**************************************************************************************/
package com.itsaky.androidide.lsp;
import com.blankj.utilcode.util.CloseUtils;
@@ -44,7 +40,7 @@ public class StandardStreamsLauncher extends LSPClientLauncher {
this.out = new BufferedOutputStream( out );
this.langCode = langCode;
}
@Override
protected void launch() {
final Launcher<IDELanguageServer> server = createClientLauncher(languageClient, in, out);
@@ -57,7 +53,11 @@ public class StandardStreamsLauncher extends LSPClientLauncher {
try {
listening.get();
} catch (Throwable th) {
LOG.error (
"---> StandardStreamsLauncher <---",
"An error occured while waiting for language server process to stop",
th
);
}
shutdown();
@@ -74,6 +74,7 @@ public class StandardStreamsLauncher extends LSPClientLauncher {
if (listening != null && !listening.isDone()) {
listening.cancel(true);
}
CloseUtils.closeIO(in, out);
}
}
@@ -1,8 +1,6 @@
/************************************************************************************
* This file is part of AndroidIDE.
*
*
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -17,7 +15,6 @@
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*
**************************************************************************************/
package com.itsaky.androidide.lsp.handlers;
import com.itsaky.androidide.app.StudioApp;
@@ -89,9 +86,11 @@ public class JLSHandler implements LSPHandler {
final IDELanguageServer server = LSPProvider.getServerForLanguage(LSPProvider.LANGUAGE_JAVA);
if (server == null)
if (server == null) {
LOG.error ("Cannot initialize Java Language Server. Server instance is null!");
return Optional.empty();
}
final List<WorkspaceFolder> folders = new ArrayList<>();
final File file = new File(rootPath);
final WorkspaceFolder folder = new WorkspaceFolder();
@@ -119,18 +118,18 @@ public class JLSHandler implements LSPHandler {
}
return Optional.of(result);
} catch (Throwable e) {
LOG.error ("An error occurred while initializing language server.", e);
return Optional.empty();
}
}
@Override
public void initialized() {
final IDELanguageServer server = LSPProvider.getServerForLanguage(LSPProvider.LANGUAGE_JAVA);
if (server == null)
if (server == null) {
return;
}
server.initialized(new InitializedParams());
}
@Override
@@ -146,7 +145,7 @@ public class JLSHandler implements LSPHandler {
readerThread.setDaemon(true);
readerThread.start();
}
private File getOutputFile () {
return new File (FileUtil.getExternalStorageDir(), "ide_xlog/jls_output.txt");
}
@@ -1,8 +1,6 @@
/************************************************************************************
* This file is part of AndroidIDE.
*
*
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -18,7 +16,6 @@
*
**************************************************************************************/
package com.itsaky.androidide.managers;
import com.blankj.utilcode.util.FileIOUtils;
@@ -118,12 +115,10 @@ public class ToolsManager {
}
public static String getArchSpecificAsset (String name) {
LOG.info ("ARCH_SPECIFIC_ASSET: " + ARCH_SPECIFIC_ASSET_DATA_DIR + "/" + name);
return ARCH_SPECIFIC_ASSET_DATA_DIR + "/" + name;
}
public static String getCommonAsset (String name) {
LOG.info ("COMMON_ASSET: " + COMMON_ASSET_DATA_DIR + "/" + name);
return COMMON_ASSET_DATA_DIR + "/" + name;
}
@@ -1,8 +1,6 @@
/************************************************************************************
* This file is part of AndroidIDE.
*
*
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -21,10 +19,10 @@
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.Collections;
import java.util.Comparator;
import java.util.List;
import org.eclipse.lsp4j.Range;
@@ -41,220 +39,7 @@ public class HighlightRangeHelper {
}
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 = LSPUtils.binarySearchStartPosition(ranges, line, column);
if(index >= 0 && index < ranges.size()) {
return index;
}
return -1;
sortHighlights(LSPUtils.RANGE_START_COMPARATOR);
}
public boolean isEnumType(int line, int column) {
@@ -358,4 +143,35 @@ public class HighlightRangeHelper {
}
return false;
}
public void sortHighlights(Comparator<Range> comparator) {
final SemanticHighlight h = this.highlights;
sortAll(comparator,
// Semantic highlights
h.packages,
h.enumTypes,
h.classNames,
h.annotationTypes,
h.interfaces,
h.enums,
h.statics,
h.fields,
h.parameters,
h.locals,
h.exceptionParams,
h.methodDeclarations,
h.methodInvocations,
h.constructors,
h.staticInits,
h.instanceInits,
h.typeParams,
h.resourceVariables);
}
private void sortAll (Comparator<Range> comparator, List<Range>... lists) {
for (List<Range> list : lists) {
Collections.sort(list, comparator);
}
}
}
@@ -1,8 +1,6 @@
/************************************************************************************
* This file is part of AndroidIDE.
*
*
*
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -17,10 +15,8 @@
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*
**************************************************************************************/
package com.itsaky.androidide.syntax.lexer.impls.java;
import androidx.core.util.Pair;
import com.itsaky.androidide.lexers.java.JavaLexer;
import com.itsaky.androidide.models.ConstantsBridge;
import com.itsaky.androidide.syntax.lexer.Lexer;
@@ -31,12 +27,12 @@ import com.itsaky.androidide.utils.LSPUtils;
import com.itsaky.androidide.utils.Logger;
import com.itsaky.lsp.SemanticHighlight;
import com.itsaky.lsp.services.IDELanguageServer;
import io.github.rosemoe.editor.interfaces.EditorLanguage;
import io.github.rosemoe.editor.interfaces.NewlineHandler;
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.text.TextUtils;
@@ -53,7 +49,6 @@ import org.antlr.v4.runtime.CharStreams;
import org.eclipse.lsp4j.Diagnostic;
import org.eclipse.lsp4j.Position;
import org.eclipse.lsp4j.Range;
import io.github.rosemoe.editor.interfaces.EditorLanguage;
public class JavaLexerImpl extends io.github.rosemoe.editor.langs.AbstractCodeAnalyzer {
@@ -392,77 +387,6 @@ 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;
final Indexer indexer = content.getIndexer();
final CharPosition endPos = indexer.getCharPosition(currentToken.getStopIndex());
final Position startPosition = new Position(line, column);
final Position endPosition = new Position(endPos.line, endPos.column);
colors.addCommentRange(line, new Range(startPosition, endPosition));
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) {
}
break;
case JavaLexer.LINE_COMMENT :
type = TokenType.COMMENT;
span = colors.addIfNeeded(line, column, EditorColorScheme.COMMENT);
@@ -51,12 +51,12 @@ public class InputStreamWriter implements Runnable {
try {
final BufferedReader reader = new BufferedReader (new InputStreamReader (in));
while (true) {
final int data = reader.read();
if (data == -1) {
final String data = reader.readLine();
if (data == null) {
break;
}
os.write(data);
os.write(data.concat("\n").getBytes());
os.flush();
}
} catch (Throwable th) {
@@ -1,162 +0,0 @@
/************************************************************************************
* This file is part of AndroidIDE.
*
*
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*
**************************************************************************************/
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,27 +1,23 @@
/************************************************************************************
* This file is part of AndroidIDE.
*
*
*
* AndroidIDE is free software: you can redistribute it and/or modify
* This file is part of Java Language Server (https://github.com/itsaky/java-language-server)
*
* Java Language Server is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* Java Language Server is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
* along with Java Language Server. If not, see <https://www.gnu.org/licenses/>.
*
**************************************************************************************/
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;
@@ -48,38 +44,4 @@ public class SemanticHighlight {
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);
}
}
}
@@ -1,22 +1,23 @@
/************************************************************************************
* This file is part of AndroidIDE.
* This file is part of Java Language Server (https://github.com/itsaky/java-language-server)
*
*
* Copyright (C) 2021 Akash Yadav
*
* AndroidIDE is free software: you can redistribute it and/or modify
* Java Language Server is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* Java Language Server is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
* along with Java Language Server. If not, see <https://www.gnu.org/licenses/>.
*
**************************************************************************************/
package com.itsaky.lsp;
import org.eclipse.lsp4j.TextDocumentIdentifier;
@@ -25,7 +26,6 @@ public class SemanticHighlightsParams {
private TextDocumentIdentifier _textDocument;
public TextDocumentIdentifier getTextDocument() {
return this._textDocument;
}
@@ -1,22 +1,23 @@
/************************************************************************************
* This file is part of AndroidIDE.
* This file is part of Java Language Server (https://github.com/itsaky/java-language-server)
*
*
* Copyright (C) 2021 Akash Yadav
*
* AndroidIDE is free software: you can redistribute it and/or modify
* Java Language Server is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* Java Language Server is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
* along with Java Language Server. If not, see <https://www.gnu.org/licenses/>.
*
**************************************************************************************/
package com.itsaky.lsp.services;
import com.itsaky.lsp.SemanticHighlight;
@@ -1,22 +1,23 @@
/************************************************************************************
* This file is part of AndroidIDE.
* This file is part of Java Language Server (https://github.com/itsaky/java-language-server)
*
*
* Copyright (C) 2021 Akash Yadav
*
* AndroidIDE is free software: you can redistribute it and/or modify
* Java Language Server is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* Java Language Server is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
* along with Java Language Server. If not, see <https://www.gnu.org/licenses/>.
*
**************************************************************************************/
package com.itsaky.lsp.services;
public interface IDELanguageClientAware {
@@ -1,25 +1,27 @@
/************************************************************************************
* This file is part of AndroidIDE.
* This file is part of Java Language Server (https://github.com/itsaky/java-language-server)
*
*
* Copyright (C) 2021 Akash Yadav
*
* AndroidIDE is free software: you can redistribute it and/or modify
* Java Language Server is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* Java Language Server is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
* along with Java Language Server. If not, see <https://www.gnu.org/licenses/>.
*
**************************************************************************************/
package com.itsaky.lsp.services;
import java.util.concurrent.CompletableFuture;
import org.eclipse.lsp4j.InitializeParams;
import org.eclipse.lsp4j.InitializeResult;
import org.eclipse.lsp4j.InitializedParams;
@@ -31,7 +33,7 @@ import org.eclipse.lsp4j.jsonrpc.services.JsonRequest;
/**
* Custom implementation of {@link org.eclipse.lsp4j.services.LanguageServer}.
* This helps providing custom commands and services to AndroidIDE
* This helps providing custom commands and services to Java Language Server
*/
public interface IDELanguageServer {
/**
@@ -116,4 +118,4 @@ public interface IDELanguageServer {
default void setTrace(SetTraceParams params) {
throw new UnsupportedOperationException();
}
}
}
@@ -1,25 +1,26 @@
/************************************************************************************
* This file is part of AndroidIDE.
* This file is part of Java Language Server (https://github.com/itsaky/java-language-server)
*
*
* Copyright (C) 2021 Akash Yadav
*
* AndroidIDE is free software: you can redistribute it and/or modify
* Java Language Server is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* Java Language Server is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
* along with Java Language Server. If not, see <https://www.gnu.org/licenses/>.
*
**************************************************************************************/
package com.itsaky.lsp.services;
import org.eclipse.lsp4j.services.TextDocumentService;
public interface IDETextDocumentService extends TextDocumentService {
}
public interface IDETextDocumentService extends TextDocumentService{
}
@@ -1,22 +1,23 @@
/************************************************************************************
* This file is part of AndroidIDE.
* This file is part of Java Language Server (https://github.com/itsaky/java-language-server)
*
*
* Copyright (C) 2021 Akash Yadav
*
* AndroidIDE is free software: you can redistribute it and/or modify
* Java Language Server is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* Java Language Server is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
* along with Java Language Server. If not, see <https://www.gnu.org/licenses/>.
*
**************************************************************************************/
package com.itsaky.lsp.services;
import java.util.List;
@@ -166,4 +167,4 @@ public interface IDEWorkspaceService {
default void didDeleteFiles(DeleteFilesParams params) {
throw new UnsupportedOperationException();
}
}
}
@@ -1,22 +1,3 @@
/************************************************************************************
* This file is part of AndroidIDE.
*
*
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*
**************************************************************************************/
/*******************************************************************************
* Copyright (c) 2000, 2019 IBM Corporation and others.
*
@@ -1,8 +1,6 @@
/************************************************************************************
* This file is part of AndroidIDE.
*
*
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -122,7 +120,7 @@ public class CommonProcessExecutor implements IProcessExecutor {
try {
proc.waitFor();
} catch (InterruptedException e) {
// ignored
// Ignored
}
listener.onExit(proc.exitValue());
@@ -1,8 +1,6 @@
/************************************************************************************
* This file is part of AndroidIDE.
*
*
*
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -1,8 +1,6 @@
/************************************************************************************
* This file is part of AndroidIDE.
*
*
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -31,16 +29,4 @@ public class ProcessExecutorFactory {
public static IProcessExecutor commonExecutor () {
return executor;
}
public static int exec (ProcessStreamsHolder holder, String ... args) throws InterruptedException, IOException {
return executor.exec(holder, args);
}
public static int exec (ProcessStreamsHolder holder, boolean redirectErr, String ... args) throws InterruptedException, IOException {
return executor.exec(holder, redirectErr, args);
}
public static void execAsync (ProcessStreamsHolder holder, IProcessExitListener exitListener, boolean redirectErr, String ... args) throws IOException {
executor.execAsync(holder, exitListener, redirectErr, args);
}
}