mirror of
https://gitee.com/zhangsken/AndroidIDE.git
synced 2026-10-16 07:49:44 +08:00
Added edit handler for attribute values
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* 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.androidide.lsp.xml.edits
|
||||
|
||||
import com.itsaky.androidide.lsp.edits.DefaultEditHandler
|
||||
|
||||
/**
|
||||
* Handles insertion of attribute values.
|
||||
*
|
||||
* @author Akash Yadav
|
||||
*/
|
||||
class AttrValueEditHandler : QualifiedValueEditHandler() {
|
||||
|
||||
override fun isPartialPart(c: Char): Boolean {
|
||||
return super.isPartialPart(c) || c in charArrayOf('@', '.', ':', '/')
|
||||
}
|
||||
}
|
||||
+3
-1
@@ -34,6 +34,7 @@ import com.itsaky.androidide.lsp.models.CompletionResult
|
||||
import com.itsaky.androidide.lsp.models.InsertTextFormat.PLAIN_TEXT
|
||||
import com.itsaky.androidide.lsp.models.InsertTextFormat.SNIPPET
|
||||
import com.itsaky.androidide.lsp.models.MatchLevel
|
||||
import com.itsaky.androidide.lsp.xml.edits.AttrValueEditHandler
|
||||
import com.itsaky.androidide.lsp.xml.edits.QualifiedValueEditHandler
|
||||
import com.itsaky.androidide.lsp.xml.edits.TagEditHandler
|
||||
import com.itsaky.androidide.lsp.xml.utils.XmlUtils.NodeType
|
||||
@@ -216,7 +217,8 @@ abstract class IXmlCompletionProvider(private val provider: ICompletionProvider)
|
||||
this.overrideTypeText = type.uppercase()
|
||||
this.sortText = if (pck == ResourceTableRegistry.PCK_ANDROID) "zzz$text" else text
|
||||
this.insertText = text
|
||||
this.editHandler = QualifiedValueEditHandler()
|
||||
this.insertTextFormat = PLAIN_TEXT
|
||||
this.editHandler = AttrValueEditHandler()
|
||||
this.matchLevel = matchLevel
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user