| // Copyright 2019 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| package fuchsia.developer.plugin.fidl; |
| |
| import com.intellij.lang.ASTNode; |
| import com.intellij.psi.PsiElement; |
| import com.intellij.spellchecker.tokenizer.SpellcheckingStrategy; |
| import com.intellij.spellchecker.tokenizer.Tokenizer; |
| import fuchsia.developer.plugin.fidl.psi.Types; |
| import org.jetbrains.annotations.NotNull; |
| |
| public class FidlSpellcheckingStrategy extends SpellcheckingStrategy { |
| @NotNull |
| @Override |
| public Tokenizer getTokenizer(PsiElement element) { |
| final ASTNode node = element.getNode(); |
| if (node == null |
| || (node.getElementType() != Types.DOC_COMMENT |
| && node.getElementType() != Types.LINE_COMMENT)) { |
| return EMPTY_TOKENIZER; |
| } |
| |
| return TEXT_TOKENIZER; |
| } |
| } |