1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-08-29 20:53:09 +02:00

Adding experimental inspection

This commit is contained in:
Alex Plate
2023-01-25 09:21:37 +02:00
parent 772c574149
commit bee82a1941
5 changed files with 100 additions and 0 deletions
src/main
java
com
maddyhome
idea
resources

@@ -0,0 +1,34 @@
/*
* Copyright 2003-2023 The IdeaVim authors
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE.txt file or at
* https://opensource.org/licenses/MIT.
*/
package com.maddyhome.idea.vim.inspections
import com.intellij.codeInspection.LocalInspectionTool
import com.intellij.codeInspection.ProblemsHolder
import com.intellij.openapi.util.TextRange
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiElementVisitor
import com.intellij.psi.PsiFile
import com.intellij.psi.impl.source.tree.LeafPsiElement
class UsePlugSyntaxInspection : LocalInspectionTool() {
override fun getGroupDisplayName(): String {
return "Vim"
}
override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean): PsiElementVisitor {
val file = holder.file
if (file.name != ".ideavimrc" && file.name != "_ideavimrc") return PsiElementVisitor.EMPTY_VISITOR
return object : PsiElementVisitor() {
override fun visitElement(element: PsiElement) {
if (element !is LeafPsiElement) return
holder.registerProblem(element, TextRange.create(10, 20), "Hi there")
}
}
}
}

@@ -92,6 +92,12 @@
<statistics.applicationUsagesCollector implementation="com.maddyhome.idea.vim.statistic.ShortcutConflictState"/>
<statistics.counterUsagesCollector implementationClass="com.maddyhome.idea.vim.statistic.ActionTracker"/>
<!-- <localInspection language="textmate" shortName="UsePlug" bundle="messages.IdeaVimBundle"-->
<!-- key="use.plug.inspection.display.name" groupKey="use.plug.inspection.group.display.name"-->
<!-- enabledByDefault="true" level="WARNING"-->
<!-- implementationClass="com.maddyhome.idea.vim.inspections.UsePlugSyntaxInspection"/>-->
</extensions>
<xi:include href="/META-INF/includes/ApplicationServices.xml" xpointer="xpointer(/idea-plugin/*)"/>

@@ -0,0 +1,29 @@
<!--
~ Copyright 2003-2023 The IdeaVim authors
~
~ Use of this source code is governed by an MIT-style
~ license that can be found in the LICENSE.txt file or at
~ https://opensource.org/licenses/MIT.
-->
<html>
<body>
Write your description here.
Start the description with a verb in 3rd person singular, like reports, detects, highlights.
In the first sentence, briefly explain what exactly the inspection helps you detect.
Make sure the sentence is not very long and complicated.
<p>
The first sentence must be in a dedicated paragraph separated from the rest of the text. This will make the
description easier to read.
Make sure the description doesnt just repeat the inspection title.
</p>
<p>
See https://jetbrains.design/intellij/text/inspections/#descriptions for more information.
</p>
<!-- tooltip end -->
<p>Text after this comment will only be shown in the settings of the inspection.</p>
<p>To open related settings directly from the description, add a link with `settings://$` optionally followed by `?$` to
pre-select a UI element.</p>
</body>
</html>

@@ -0,0 +1,29 @@
<!--
~ Copyright 2003-2023 The IdeaVim authors
~
~ Use of this source code is governed by an MIT-style
~ license that can be found in the LICENSE.txt file or at
~ https://opensource.org/licenses/MIT.
-->
<html>
<body>
Write your description here.
Start the description with a verb in 3rd person singular, like reports, detects, highlights.
In the first sentence, briefly explain what exactly the inspection helps you detect.
Make sure the sentence is not very long and complicated.
<p>
The first sentence must be in a dedicated paragraph separated from the rest of the text. This will make the
description easier to read.
Make sure the description doesnt just repeat the inspection title.
</p>
<p>
See https://jetbrains.design/intellij/text/inspections/#descriptions for more information.
</p>
<!-- tooltip end -->
<p>Text after this comment will only be shown in the settings of the inspection.</p>
<p>To open related settings directly from the description, add a link with `settings://$` optionally followed by `?$` to
pre-select a UI element.</p>
</body>
</html>

@@ -141,3 +141,5 @@ global.command.not.found.g=Pattern not found: {0}
e_interr=Interrupted
progress.title.macro.execution=Macro execution
stop=Stop
use.plug.inspection.group.display.name=Create property
use.plug.inspection.display.name=Create property2