From 727376811c149f2de3dcaec13d6685ea5d32676c Mon Sep 17 00:00:00 2001 From: Yuriy Artamonov Date: Sat, 22 Mar 2025 19:02:13 +0100 Subject: [PATCH] [spelling] IJPL-156759 Don't show typos for IntelliJ options GitOrigin-RevId: c6315588b9a4a80bb245a1597b1fdb54ed6a1531 --- .../resources/META-INF/SpellCheckerPlugin.xml | 2 ++ .../VmOptionsSpellcheckingStrategy.java | 26 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 spellchecker/src/com/intellij/spellchecker/tokenizer/VmOptionsSpellcheckingStrategy.java diff --git a/spellchecker/resources/META-INF/SpellCheckerPlugin.xml b/spellchecker/resources/META-INF/SpellCheckerPlugin.xml index 791b36118960..baa63a0b3c25 100644 --- a/spellchecker/resources/META-INF/SpellCheckerPlugin.xml +++ b/spellchecker/resources/META-INF/SpellCheckerPlugin.xml @@ -29,7 +29,9 @@ + + diff --git a/spellchecker/src/com/intellij/spellchecker/tokenizer/VmOptionsSpellcheckingStrategy.java b/spellchecker/src/com/intellij/spellchecker/tokenizer/VmOptionsSpellcheckingStrategy.java new file mode 100644 index 000000000000..060f8e3cc4ba --- /dev/null +++ b/spellchecker/src/com/intellij/spellchecker/tokenizer/VmOptionsSpellcheckingStrategy.java @@ -0,0 +1,26 @@ +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +package com.intellij.spellchecker.tokenizer; + +import com.intellij.codeInspection.SuppressQuickFix; +import com.intellij.openapi.project.DumbAware; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiFile; +import org.jetbrains.annotations.NotNull; + +final class VmOptionsSpellcheckingStrategy extends SuppressibleSpellcheckingStrategy implements DumbAware { + @Override + public boolean isMyContext(@NotNull PsiElement element) { + PsiFile file = element.getContainingFile(); + return file != null && file.getName().equals("idea.vmoptions"); + } + + @Override + public boolean isSuppressedFor(@NotNull PsiElement element, @NotNull String name) { + return true; + } + + @Override + public SuppressQuickFix[] getSuppressActions(@NotNull PsiElement element, @NotNull String name) { + return SuppressQuickFix.EMPTY_ARRAY; + } +}