mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[spelling] Reformat code in SpellCheckingInspection
GitOrigin-RevId: dd0e5170c8d417fd549350707d2137deaba403a1
This commit is contained in:
committed by
intellij-monorepo-bot
parent
727376811c
commit
fa26329b2b
+17
-9
@@ -84,7 +84,7 @@ public final class SpellCheckingInspection extends LocalInspectionTool implement
|
||||
if (!Registry.is("spellchecker.inspection.enabled", true) || InspectionProfileManager.hasTooLowSeverity(session, this)) {
|
||||
return PsiElementVisitor.EMPTY_VISITOR;
|
||||
}
|
||||
final SpellCheckerManager manager = SpellCheckerManager.getInstance(holder.getProject());
|
||||
SpellCheckerManager manager = SpellCheckerManager.getInstance(holder.getProject());
|
||||
var scope = buildAllowedScopes();
|
||||
|
||||
return new PsiElementVisitor() {
|
||||
@@ -99,11 +99,13 @@ public final class SpellCheckingInspection extends LocalInspectionTool implement
|
||||
|
||||
final Language language = element.getLanguage();
|
||||
var strategy = getSpellcheckingStrategy(element, language);
|
||||
if(strategy == null)
|
||||
if (strategy == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(!strategy.elementFitsScope(element, scope))
|
||||
if (!strategy.elementFitsScope(element, scope)) {
|
||||
return;
|
||||
}
|
||||
|
||||
PsiFile containingFile = holder.getFile();
|
||||
if (Boolean.TRUE.equals(containingFile.getUserData(InjectedLanguageManager.FRANKENSTEIN_INJECTION))) {
|
||||
@@ -117,12 +119,15 @@ public final class SpellCheckingInspection extends LocalInspectionTool implement
|
||||
|
||||
private Set<SpellCheckingScope> buildAllowedScopes() {
|
||||
var result = new HashSet<SpellCheckingScope>();
|
||||
if(processLiterals)
|
||||
if (processLiterals) {
|
||||
result.add(SpellCheckingScope.Literals);
|
||||
if(processComments)
|
||||
}
|
||||
if (processComments) {
|
||||
result.add(SpellCheckingScope.Comments);
|
||||
if(processCode)
|
||||
}
|
||||
if (processCode) {
|
||||
result.add(SpellCheckingScope.Code);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -143,7 +148,10 @@ public final class SpellCheckingInspection extends LocalInspectionTool implement
|
||||
tokenize(factoryByLanguage, element, consumer, allowedScopes);
|
||||
}
|
||||
|
||||
private static void tokenize(SpellcheckingStrategy strategy, PsiElement element, TokenConsumer consumer, Set<SpellCheckingScope> allowedScopes) {
|
||||
private static void tokenize(SpellcheckingStrategy strategy,
|
||||
PsiElement element,
|
||||
TokenConsumer consumer,
|
||||
Set<SpellCheckingScope> allowedScopes) {
|
||||
var tokenizer = strategy.getTokenizer(element, allowedScopes);
|
||||
//noinspection unchecked
|
||||
tokenizer.tokenize(element, consumer);
|
||||
@@ -163,8 +171,8 @@ public final class SpellCheckingInspection extends LocalInspectionTool implement
|
||||
SpellcheckingStrategy strategy = getSpellcheckingStrategy(element, element.getLanguage());
|
||||
|
||||
LocalQuickFix[] fixes = strategy != null
|
||||
? strategy.getRegularFixes(element, textRange, useRename, wordWithTypo)
|
||||
: SpellcheckingStrategy.getDefaultRegularFixes(useRename, wordWithTypo, element, textRange);
|
||||
? strategy.getRegularFixes(element, textRange, useRename, wordWithTypo)
|
||||
: SpellcheckingStrategy.getDefaultRegularFixes(useRename, wordWithTypo, element, textRange);
|
||||
|
||||
final ProblemDescriptor problemDescriptor = createProblemDescriptor(element, textRange, fixes, true);
|
||||
holder.registerProblem(problemDescriptor);
|
||||
|
||||
Reference in New Issue
Block a user