diff --git a/plugins/properties/src/META-INF/plugin.xml b/plugins/properties/src/META-INF/plugin.xml
index 47a003de27fb..57c8a7108087 100644
--- a/plugins/properties/src/META-INF/plugin.xml
+++ b/plugins/properties/src/META-INF/plugin.xml
@@ -83,6 +83,7 @@
diff --git a/plugins/properties/src/com/intellij/lang/properties/spellchecker/PropertiesSpellcheckingStrategy.java b/plugins/properties/src/com/intellij/lang/properties/spellchecker/PropertiesSpellcheckingStrategy.java
index 6b06ebbee0ea..3ddf1cb5fddb 100644
--- a/plugins/properties/src/com/intellij/lang/properties/spellchecker/PropertiesSpellcheckingStrategy.java
+++ b/plugins/properties/src/com/intellij/lang/properties/spellchecker/PropertiesSpellcheckingStrategy.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2010 JetBrains s.r.o.
+ * Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,9 +15,8 @@
*/
package com.intellij.lang.properties.spellchecker;
-import com.intellij.lang.properties.psi.impl.PropertyImpl;
+import com.intellij.lang.properties.psi.impl.PropertyKeyImpl;
import com.intellij.lang.properties.psi.impl.PropertyValueImpl;
-import com.intellij.openapi.util.TextRange;
import com.intellij.psi.PsiElement;
import com.intellij.spellchecker.inspections.PlainTextSplitter;
import com.intellij.spellchecker.inspections.PropertiesSplitter;
@@ -29,25 +28,25 @@ import org.jetbrains.annotations.NotNull;
public class PropertiesSpellcheckingStrategy extends SpellcheckingStrategy {
- private Tokenizer myPropertyValueTokenizer = TokenizerBase.create(PlainTextSplitter.getInstance());
- private Tokenizer myPropertyTokenizer = new MyPropertyTokenizer();
-
+
+ private final Tokenizer myPropertyValueTokenizer = TokenizerBase.create(PlainTextSplitter.getInstance());
+ private final Tokenizer myPropertyTokenizer = new MyPropertyTokenizer();
+
@NotNull
@Override
public Tokenizer getTokenizer(PsiElement element) {
if (element instanceof PropertyValueImpl) {
return myPropertyValueTokenizer;
}
- if (element instanceof PropertyImpl) {
+ if (element instanceof PropertyKeyImpl) {
return myPropertyTokenizer;
}
return super.getTokenizer(element);
}
- private static class MyPropertyTokenizer extends Tokenizer {
- public void tokenize(@NotNull PropertyImpl element, TokenConsumer consumer) {
- String key = element.getKey();
- consumer.consumeToken(element, key, true, 0, TextRange.allOf(key), PropertiesSplitter.getInstance());
+ private static class MyPropertyTokenizer extends Tokenizer {
+ public void tokenize(@NotNull PropertyKeyImpl element, TokenConsumer consumer) {
+ consumer.consumeToken(element, PropertiesSplitter.getInstance());
}
}
}
diff --git a/plugins/properties/testSrc/com/intellij/lang/properties/PropertiesSpellcheckingTest.java b/plugins/properties/testSrc/com/intellij/lang/properties/PropertiesSpellcheckingTest.java
new file mode 100644
index 000000000000..ad0804dab2f8
--- /dev/null
+++ b/plugins/properties/testSrc/com/intellij/lang/properties/PropertiesSpellcheckingTest.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.lang.properties;
+
+import com.intellij.spellchecker.inspections.SpellCheckingInspection;
+import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
+
+public class PropertiesSpellcheckingTest extends LightCodeInsightFixtureTestCase {
+
+ public void testPropertiesSpellcheckingStrategy() {
+ myFixture.enableInspections(new SpellCheckingInspection());
+
+ myFixture.configureByText("test.properties",
+ "valid.key=value\n" +
+ "# comment is cheked\n" +
+ "validWordBuuundary=value\n" +
+ "i3nvalid.key=i3nvalidValue");
+ myFixture.testHighlighting();
+ }
+}