mirror of
https://gitee.com/zhangsken/AndroidIDE.git
synced 2026-10-16 07:49:44 +08:00
fix(lsp/java): remove 'label' from JavaSnippet
This commit is contained in:
+2
-2
@@ -295,11 +295,11 @@ abstract class IJavaCompletionProvider(
|
||||
|
||||
protected open fun snippetItem(snippet: JavaSnippet, matchLevel: MatchLevel, partial: String, indent: Int) : CompletionItem {
|
||||
return JavaCompletionItem().apply {
|
||||
this.label = snippet.label
|
||||
this.label = snippet.prefix
|
||||
this.detail = snippet.description
|
||||
this.completionKind = CompletionItemKind.SNIPPET
|
||||
this.matchLevel = matchLevel
|
||||
this.ideSortText = snippet.prefix
|
||||
this.ideSortText = "00000${snippet.prefix}"
|
||||
this.snippetDescription = describeSnippet(snippet.prefix)
|
||||
|
||||
val indentation = indentationString(indent)
|
||||
|
||||
+2
-6
@@ -24,23 +24,20 @@ package com.itsaky.androidide.lsp.java.providers.snippet
|
||||
*/
|
||||
data class JavaSnippet(
|
||||
val prefix: String,
|
||||
val label: String,
|
||||
val description: String,
|
||||
val content: Array<String>
|
||||
) {
|
||||
|
||||
constructor(
|
||||
prefix: String,
|
||||
label: String,
|
||||
description: String,
|
||||
content: () -> Array<String>
|
||||
) : this(prefix, label, description, content())
|
||||
) : this(prefix, description, content())
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other !is JavaSnippet) return false
|
||||
|
||||
if (label != other.label) return false
|
||||
if (description != other.description) return false
|
||||
if (prefix != other.prefix) return false
|
||||
if (!content.contentEquals(other.content)) return false
|
||||
@@ -49,9 +46,8 @@ data class JavaSnippet(
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = label.hashCode()
|
||||
var result = prefix.hashCode()
|
||||
result = 31 * result + description.hashCode()
|
||||
result = 31 * result + prefix.hashCode()
|
||||
result = 31 * result + content.contentHashCode()
|
||||
return result
|
||||
}
|
||||
|
||||
+2
-2
@@ -49,10 +49,10 @@ object JavaSnippetRepository {
|
||||
|
||||
private fun createLocalSnippets(): List<JavaSnippet> {
|
||||
return listOf(
|
||||
JavaSnippet("for", "Indexed for loop", "0 -> count") {
|
||||
JavaSnippet("for", "Indexed for loop") {
|
||||
arrayOf("for (int \${1:i} = 0; \$1 < \${2:count}; ++\$1) {", "\t\$0", "}")
|
||||
},
|
||||
JavaSnippet("forr", "Reverse-indexed for loop", "count-1 -> 0") {
|
||||
JavaSnippet("forr", "Reverse-indexed for loop") {
|
||||
arrayOf("for (int \${1:i} = \${2:count} - 1; \$1 >= 0; --\$1) {", "\t\$0", "}")
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user