mirror of
https://github.com/chylex/IntelliJ-Inspection-Lens.git
synced 2025-01-30 21:46:06 +01:00
Compare commits
2 Commits
4c80573375
...
8936f0e5be
Author | SHA1 | Date | |
---|---|---|---|
8936f0e5be | |||
89e71d5301 |
@ -4,6 +4,8 @@ Displays errors, warnings, and other inspections inline. Highlights the backgrou
|
|||||||
|
|
||||||
By default, the plugin shows **Errors**, **Warnings**, **Weak Warnings**, **Server Problems**, **Grammar Errors**, **Typos**, and other inspections with a high enough severity level. Configure visible severities in **Settings | Tools | Inspection Lens**.
|
By default, the plugin shows **Errors**, **Warnings**, **Weak Warnings**, **Server Problems**, **Grammar Errors**, **Typos**, and other inspections with a high enough severity level. Configure visible severities in **Settings | Tools | Inspection Lens**.
|
||||||
|
|
||||||
|
Left-click an inspection to show quick fixes. Middle-click an inspection to navigate to the relevant code in the editor.
|
||||||
|
|
||||||
Inspired by [Error Lens](https://marketplace.visualstudio.com/items?itemName=usernamehw.errorlens) for Visual Studio Code, and [Inline Error](https://plugins.jetbrains.com/plugin/17302-inlineerror) for IntelliJ Platform.
|
Inspired by [Error Lens](https://marketplace.visualstudio.com/items?itemName=usernamehw.errorlens) for Visual Studio Code, and [Inline Error](https://plugins.jetbrains.com/plugin/17302-inlineerror) for IntelliJ Platform.
|
||||||
|
|
||||||
![Inspection Lens Screenshot](.github/readme/intellij.png)
|
![Inspection Lens Screenshot](.github/readme/intellij.png)
|
||||||
|
@ -8,7 +8,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = "com.chylex.intellij.inspectionlens"
|
group = "com.chylex.intellij.inspectionlens"
|
||||||
version = "1.4.1"
|
version = "1.5"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
@ -5,23 +5,19 @@ import com.intellij.codeInsight.hint.HintManager
|
|||||||
import com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler
|
import com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler
|
||||||
import com.intellij.lang.LangBundle
|
import com.intellij.lang.LangBundle
|
||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.intellij.openapi.editor.ScrollType
|
|
||||||
import com.intellij.openapi.project.Project
|
import com.intellij.openapi.project.Project
|
||||||
import com.intellij.psi.PsiDocumentManager
|
import com.intellij.psi.PsiDocumentManager
|
||||||
import com.intellij.psi.PsiFile
|
import com.intellij.psi.PsiFile
|
||||||
import com.intellij.psi.util.PsiUtilBase
|
import com.intellij.psi.util.PsiUtilBase
|
||||||
|
|
||||||
internal object IntentionsPopup {
|
internal object IntentionsPopup {
|
||||||
fun showAt(editor: Editor, offset: Int) {
|
fun show(editor: Editor) {
|
||||||
editor.caretModel.moveToOffset(offset)
|
if (!tryShow(editor)) {
|
||||||
editor.scrollingModel.scrollToCaret(ScrollType.MAKE_VISIBLE)
|
HintManager.getInstance().showInformationHint(editor, LangBundle.message("hint.text.no.context.actions.available.at.this.location"))
|
||||||
|
|
||||||
if (!tryShowPopup(editor)) {
|
|
||||||
HintManager.getInstance().showInformationHint(editor, LangBundle.message("hint.text.no.context.actions.available.at.this.location"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun tryShowPopup(editor: Editor): Boolean {
|
private fun tryShow(editor: Editor): Boolean {
|
||||||
val project = editor.project ?: return false
|
val project = editor.project ?: return false
|
||||||
val file = PsiUtilBase.getPsiFileInEditor(editor, project) ?: return false
|
val file = PsiUtilBase.getPsiFileInEditor(editor, project) ?: return false
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import com.intellij.codeInsight.daemon.impl.HintRenderer
|
|||||||
import com.intellij.codeInsight.hints.presentation.InputHandler
|
import com.intellij.codeInsight.hints.presentation.InputHandler
|
||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.intellij.openapi.editor.Inlay
|
import com.intellij.openapi.editor.Inlay
|
||||||
|
import com.intellij.openapi.editor.ScrollType
|
||||||
import com.intellij.openapi.editor.colors.EditorFontType
|
import com.intellij.openapi.editor.colors.EditorFontType
|
||||||
import com.intellij.openapi.editor.ex.EditorEx
|
import com.intellij.openapi.editor.ex.EditorEx
|
||||||
import com.intellij.openapi.editor.impl.EditorImpl
|
import com.intellij.openapi.editor.impl.EditorImpl
|
||||||
@ -107,12 +108,20 @@ class LensRenderer(private var info: HighlightInfo, settings: LensSettingsState)
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun mousePressed(event: MouseEvent, translated: Point) {
|
override fun mousePressed(event: MouseEvent, translated: Point) {
|
||||||
if (!SwingUtilities.isLeftMouseButton(event) || !isHoveringText(translated)) {
|
if (!isHoveringText(translated)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
event.consume()
|
if (SwingUtilities.isLeftMouseButton(event) || SwingUtilities.isMiddleMouseButton(event)) {
|
||||||
IntentionsPopup.showAt(inlay.editor, info.actualStartOffset)
|
event.consume()
|
||||||
|
|
||||||
|
val editor = inlay.editor
|
||||||
|
moveToOffset(editor, info.actualStartOffset)
|
||||||
|
|
||||||
|
if (SwingUtilities.isLeftMouseButton(event)) {
|
||||||
|
IntentionsPopup.show(editor)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun isHoveringText(point: Point): Boolean {
|
private fun isHoveringText(point: Point): Boolean {
|
||||||
@ -167,5 +176,10 @@ class LensRenderer(private var info: HighlightInfo, settings: LensSettingsState)
|
|||||||
private fun fixBaselineForTextRendering(rect: Rectangle) {
|
private fun fixBaselineForTextRendering(rect: Rectangle) {
|
||||||
rect.y += 1
|
rect.y += 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun moveToOffset(editor: Editor, offset: Int) {
|
||||||
|
editor.caretModel.moveToOffset(offset)
|
||||||
|
editor.scrollingModel.scrollToCaret(ScrollType.MAKE_VISIBLE)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,21 @@
|
|||||||
<br><br>
|
<br><br>
|
||||||
By default, the plugin shows <b>Errors</b>, <b>Warnings</b>, <b>Weak Warnings</b>, <b>Server Problems</b>, <b>Grammar Errors</b>, <b>Typos</b>, and other inspections with a high enough severity level. Configure visible severities in <b>Settings | Tools | Inspection Lens</a>.
|
By default, the plugin shows <b>Errors</b>, <b>Warnings</b>, <b>Weak Warnings</b>, <b>Server Problems</b>, <b>Grammar Errors</b>, <b>Typos</b>, and other inspections with a high enough severity level. Configure visible severities in <b>Settings | Tools | Inspection Lens</a>.
|
||||||
<br><br>
|
<br><br>
|
||||||
|
Left-click an inspection to show quick fixes. Middle-click an inspection to navigate to the relevant code in the editor.
|
||||||
|
<br><br>
|
||||||
Inspired by <a href="https://marketplace.visualstudio.com/items?itemName=usernamehw.errorlens">Error Lens</a> for VS Code, and <a href="https://plugins.jetbrains.com/plugin/17302-inlineerror">Inline Error</a> for IntelliJ Platform.
|
Inspired by <a href="https://marketplace.visualstudio.com/items?itemName=usernamehw.errorlens">Error Lens</a> for VS Code, and <a href="https://plugins.jetbrains.com/plugin/17302-inlineerror">Inline Error</a> for IntelliJ Platform.
|
||||||
]]></description>
|
]]></description>
|
||||||
|
|
||||||
<change-notes><![CDATA[
|
<change-notes><![CDATA[
|
||||||
|
<b>Version 1.5</b>
|
||||||
|
<ul>
|
||||||
|
<li>Added possibility to left-click an inspection to show quick fixes.</li>
|
||||||
|
<li>Added possibility to middle-click an inspection to navigate to relevant code in the editor.</li>
|
||||||
|
<li>Added option to use UI font instead of editor font.</li>
|
||||||
|
<li>Long inspection descriptions are now truncated to 120 characters.</li>
|
||||||
|
<li>Improved descriptions of Kotlin compiler inspections.</li>
|
||||||
|
<li>Fixed visual artifacts in Rendered Doc comments.</li>
|
||||||
|
</ul>
|
||||||
<b>Version 1.4.1</b>
|
<b>Version 1.4.1</b>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Fixed warnings in usage of IntelliJ SDK.</li>
|
<li>Fixed warnings in usage of IntelliJ SDK.</li>
|
||||||
|
Loading…
Reference in New Issue
Block a user