Provide error message if method cannot be overridden

This commit is contained in:
Akash Yadav
2022-05-21 14:51:43 +05:30
parent f873e73c62
commit bd0f1c524e
2 changed files with 7 additions and 3 deletions
@@ -17,6 +17,8 @@
package com.itsaky.lsp.java.models;
import androidx.annotation.NonNull;
import java.nio.file.Path;
import java.util.Collections;
import java.util.Objects;
@@ -59,6 +61,7 @@ public class JavaServerConfiguration {
return Objects.equals(getClassPaths(), that.getClassPaths());
}
@NonNull
@Override
public String toString() {
return "JavaServerConfiguration{" + "classPaths=" + classPaths + '}';
@@ -146,7 +146,7 @@ class ScopeCompletionProvider(
// Override is not possible
return method(task, listOf(method), !endsWithParen, partialName, matchRatio)
}
// Print the method details and the annotations
// Print the method details and the annotations
val indent = EditHelper.indent(FileStore.contents(completingFile), cursor.toInt())
@@ -154,9 +154,10 @@ class ScopeCompletionProvider(
try {
builder = buildMethod(method, types, type)
} catch (error: Throwable) {
log.error("Cannot override method:", method.simpleName)
log.error("Cannot override method:", method.simpleName, error.message)
return method(task, listOf(method), !endsWithParen, partialName, matchRatio)
}
val imports = mutableSetOf<String>()
val methodSpec = builder.build()
var insertText = print(methodSpec, imports, false)
@@ -173,7 +174,7 @@ class ScopeCompletionProvider(
if (item.additionalTextEdits == null) {
item.additionalTextEdits = mutableListOf()
}
imports.removeIf { "java.lang." == it || fileImports.contains(it) || filePackage == it }
if (imports.isNotEmpty()) {
for (className in imports) {