File tree Expand file tree Collapse file tree 5 files changed +73
-2
lines changed
java/com/cedricziel/idea/typo3/codeInspection
test/java/com/cedricziel/idea/typo3/codeInspection
testData/com/cedricziel/idea/typo3/codeInspection Expand file tree Collapse file tree 5 files changed +73
-2
lines changed Original file line number Diff line number Diff line change @@ -12,9 +12,9 @@ buildscript {
1212}
1313
1414plugins {
15- id " org.jetbrains.intellij" version " 0.4.21 "
15+ id " org.jetbrains.intellij" version " 0.4.26 "
1616 id " org.jetbrains.grammarkit" version " ${ grammarKitPluginVersion} "
17- id ' com.palantir.git-version' version " 0.11.0 "
17+ id ' com.palantir.git-version' version " 0.12.3 "
1818}
1919
2020def details = versionDetails()
Original file line number Diff line number Diff line change 1+ package com .cedricziel .idea .typo3 .codeInspection ;
2+
3+ import com .intellij .codeInspection .InspectionSuppressor ;
4+ import com .intellij .codeInspection .SuppressQuickFix ;
5+ import com .intellij .lang .xml .XMLLanguage ;
6+ import com .intellij .psi .PsiElement ;
7+ import com .intellij .psi .xml .XmlAttribute ;
8+ import org .jetbrains .annotations .NotNull ;
9+ import org .jetbrains .annotations .Nullable ;
10+
11+ public class XmlUnusedNamespaceDeclarationSuppressor implements InspectionSuppressor {
12+ @ Override
13+ public boolean isSuppressedFor (@ NotNull PsiElement element , @ NotNull String toolId ) {
14+ if (!(element .getLanguage () instanceof XMLLanguage )) {
15+ return false ;
16+ }
17+
18+ if (!toolId .equals ("XmlUnusedNamespaceDeclaration" )) {
19+ return false ;
20+ }
21+
22+ if (!(element instanceof XmlAttribute )) {
23+ return false ;
24+ }
25+
26+ String namespace = ((XmlAttribute ) element ).getValue ();
27+
28+ return namespace != null && namespace .contains ("typo3.org/ns" );
29+ }
30+
31+ @ NotNull
32+ @ Override
33+ public SuppressQuickFix [] getSuppressActions (@ Nullable PsiElement element , @ NotNull String toolId ) {
34+ return SuppressQuickFix .EMPTY_ARRAY ;
35+ }
36+ }
Original file line number Diff line number Diff line change 186186 <!-- FlexForms -->
187187 <completion .contributor language =" XML"
188188 implementationClass =" com.cedricziel.idea.typo3.flexform.FlexFormCompletionContributionProvider" />
189+
190+ <!-- Fluid -->
191+ <lang .inspectionSuppressor language =" XML"
192+ implementationClass =" com.cedricziel.idea.typo3.codeInspection.XmlUnusedNamespaceDeclarationSuppressor" />
193+ <lang .inspectionSuppressor language =" HTML"
194+ implementationClass =" com.cedricziel.idea.typo3.codeInspection.XmlUnusedNamespaceDeclarationSuppressor" />
195+ <lang .inspectionSuppressor language =" XHTML"
196+ implementationClass =" com.cedricziel.idea.typo3.codeInspection.XmlUnusedNamespaceDeclarationSuppressor" />
189197 </extensions >
190198
191199 <actions >
Original file line number Diff line number Diff line change 1+ package com .cedricziel .idea .typo3 .codeInspection ;
2+
3+ import com .cedricziel .idea .typo3 .AbstractTestCase ;
4+ import com .intellij .codeInsight .daemon .impl .analysis .XmlUnusedNamespaceInspection ;
5+
6+ public class XmlUnusedNamespaceDeclarationSuppressorTest extends AbstractTestCase {
7+ @ Override
8+ protected String getTestDataPath () {
9+ return super .getTestDataPath () + "/codeInspection" ;
10+ }
11+
12+ public void testUnusedNamespacesInspectionIsSuppressed () {
13+ myFixture .enableInspections (new XmlUnusedNamespaceInspection ());
14+
15+ myFixture .testHighlighting ("unused_namespace.html" );
16+ }
17+ }
Original file line number Diff line number Diff line change 1+ < div xmlns ="http://www.w3.org/1999/xhtml " lang ="en "
2+ xmlns:v ="<warning descr= "URI is not registered (Settings | Languages & Frameworks | Schemas and DTDs) "> http://typo3.org/ns/FluidTYPO3/Vhs/ViewHelpers</ warning > "
3+ xmlns:f="< warning descr ="URI is not registered (Settings | Languages & Frameworks | Schemas and DTDs) "> http://typo3.org/ns/TYPO3/Fluid/ViewHelpers</ warning > "
4+ xmlns:flux="< warning descr ="URI is not registered (Settings | Languages & Frameworks | Schemas and DTDs) "> http://typo3.org/ns/FluidTYPO3/Flux/ViewHelpers</ warning > "
5+ xmlns:yp="< warning descr ="URI is not registered (Settings | Languages & Frameworks | Schemas and DTDs) "> http://typo3.org/ns/Vendor/YourPlugin/ViewHelpers</ warning > "
6+
7+ flux:schemaLocation="http://fluidtypo3.org/schemas/flux-7.0.0.xsd"
8+ v:schemaLocation="http://fluidtypo3.org/schemas/vhs-1.8.5.xsd">
9+ <!-- Fluid goes here -->
10+ </ div >
You can’t perform that action at this time.
0 commit comments