mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-04 15:06:56 +07:00
[spellchecker] Added SpellCheckerQuickFixFactory to allow custom spellchecking quick fixes in Rider
GitOrigin-RevId: b987bcb82e84f0596e57962df55bb868b92fe23b
This commit is contained in:
committed by
intellij-monorepo-bot
parent
f5235a2cf2
commit
5a8efdfc97
@@ -9,6 +9,7 @@
|
|||||||
<extensionPoint name="spellchecker.dictionary.checker" interface="com.intellij.spellchecker.dictionary.DictionaryChecker" dynamic="true"/>
|
<extensionPoint name="spellchecker.dictionary.checker" interface="com.intellij.spellchecker.dictionary.DictionaryChecker" dynamic="true"/>
|
||||||
<extensionPoint name="spellchecker.builtInDictionariesProvider" interface="com.intellij.spellchecker.settings.BuiltInDictionariesProvider" dynamic="true"/>
|
<extensionPoint name="spellchecker.builtInDictionariesProvider" interface="com.intellij.spellchecker.settings.BuiltInDictionariesProvider" dynamic="true"/>
|
||||||
<extensionPoint name="spellchecker.dictionaryLayersProvider" interface="com.intellij.spellchecker.DictionaryLayersProvider" dynamic="true"/>
|
<extensionPoint name="spellchecker.dictionaryLayersProvider" interface="com.intellij.spellchecker.DictionaryLayersProvider" dynamic="true"/>
|
||||||
|
<extensionPoint name="spellchecker.quickFixFactory" interface="com.intellij.spellchecker.quickfixes.SpellCheckerQuickFixFactory" dynamic="true"/>
|
||||||
</extensionPoints>
|
</extensionPoints>
|
||||||
|
|
||||||
<extensions defaultExtensionNs="com.intellij">
|
<extensions defaultExtensionNs="com.intellij">
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||||
|
package com.intellij.spellchecker.quickfixes
|
||||||
|
|
||||||
|
import com.intellij.codeInspection.LocalQuickFix
|
||||||
|
import com.intellij.openapi.extensions.ExtensionPointName
|
||||||
|
import com.intellij.openapi.util.TextRange
|
||||||
|
import com.intellij.psi.PsiElement
|
||||||
|
import com.intellij.spellchecker.DictionaryLayer
|
||||||
|
import org.jetbrains.annotations.ApiStatus
|
||||||
|
|
||||||
|
abstract class SpellCheckerQuickFixFactory {
|
||||||
|
companion object {
|
||||||
|
val EP_NAME = ExtensionPointName.create<SpellCheckerQuickFixFactory>("com.intellij.spellchecker.quickFixFactory")
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun rename(element: PsiElement): LocalQuickFix {
|
||||||
|
return EP_NAME.extensionList.firstNotNullOfOrNull { it.createRename(element) } ?: RenameTo()
|
||||||
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun changeToVariants(element: PsiElement, rangeInElement: TextRange, word: String): List<LocalQuickFix> {
|
||||||
|
return EP_NAME.extensionList.firstNotNullOfOrNull { it.createChangeToVariantsFixes(element, rangeInElement, word) } ?: ChangeTo(word, element, rangeInElement).getAllAsFixes()
|
||||||
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun saveTo(element: PsiElement, rangeInElement: TextRange, word: String): LocalQuickFix {
|
||||||
|
return saveTo(element, rangeInElement, word, null)
|
||||||
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun saveTo(element: PsiElement, rangeInElement: TextRange, word: String, layer: DictionaryLayer?): LocalQuickFix {
|
||||||
|
return EP_NAME.extensionList.firstNotNullOfOrNull { it.createSaveToFix(element, rangeInElement, word, layer) } ?: SaveTo(word, layer)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
open fun createRename(element: PsiElement): LocalQuickFix? = null
|
||||||
|
open fun createChangeToVariantsFixes(element: PsiElement, rangeInElement: TextRange, word: String): List<LocalQuickFix>? = null
|
||||||
|
open fun createSaveToFix(element: PsiElement, rangeInElement: TextRange, word: String, layer: DictionaryLayer?): LocalQuickFix? = null
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user