huoguangjin / MultiHighlight

Jetbrains IDE plugin: highlight identifiers with custom colors 🎨💡
https://plugins.jetbrains.com/plugin/9511-multihighlight
GNU General Public License v3.0
104 stars 22 forks source link

Not highlighting all matches, plus stack trace on some files #23

Open bedge opened 3 years ago

bedge commented 3 years ago

Here's an example:

ss-2021-20-02_10 20 15

Both local and name were selected, and are not highlighted in the subsequent occurrences.

While I can highlight the other occurrences manually, they are seen as different values as they are in a different color:

Screen Shot 2021-08-02 at 10 23 37

FWIW, these are .tf terraform files.

I'm using version 2.2.0 of the plugin on Intellij:

IntelliJ IDEA 2021.1.2 RC (Ultimate Edition)
Build #IU-211.7442.27, built on May 24, 2021
Runtime version: 11.0.11+9-b1341.57 x86_64
VM: Dynamic Code Evolution 64-Bit Server VM by JetBrains s.r.o.
macOS 10.15.7
GC: G1 Young Generation, G1 Old Generation
Memory: 2038M
Cores: 16
Registry: ide.new.stripes.ui=true, debugger.watches.in.variables=false, ide.balloon.shadow.size=0
Non-Bundled Plugins: Key Promoter X (2021.1.1), MultiHighlight (2.2.0), awesome.console (0.1337.11), com.alayouni.ansiHighlight (1.2.4), com.drinchev.projectlabel (1.0), com.github.mikesafonov.jenkins-linter-idea-plugin (0.5.1), DBN (3.2.4501.0), com.jetbrains.plugins.ini4idea (211.6693.44), com.mallowigi (36.0), dev.meanmail.plugin.nginx-intellij-plugin (2021.2-211), net.sjrx.intellij.plugins.systemdunitfiles (0.3.3), org.intellij.plugins.hcl (0.7.10), mobi.hsz.idea.gitignore (4.1.0), name.kropp.intellij.makefile (211.6693.108), org.yapal.world.commandlinelauncher (2.1.0), ir.msdehghan.plugins.ansible (0.92), org.logtalk (1.0.15), com.perl5 (2021.1.3), pro.bashsupport (2.0.3.211), org.jetbrains.kotlin (211-1.5.21-release-317-IJ7442.40), com.chrisrm.idea.MaterialThemeUI (6.7.2), com.clutcher.comments_highlighter (2.3), org.jetbrains.plugins.ruby (211.7442.9), PlantUML integration (5.5.1), Pythonid (211.7442.45), aws.toolkit (1.29-211), com.intellij.bigdatatools (211.7142.49), ru.adelf.idea.dotenv (2021.2), org.asciidoctor.intellij.asciidoc (0.33.6), org.toml.lang (0.2.152.4026-211)
Kotlin: 211-1.5.21-release-317-IJ7442.40

Here's a stack trace I saw in the idea.log when trying to highlight an unselected word that the cursor was on:


2021-08-02 10:30:07,791 [53961569]  ERROR - pplication.impl.LaterInvocator - Invalid range specified: (-1, -1);
java.lang.IllegalArgumentException: Invalid range specified: (-1, -1);
        at com.intellij.openapi.util.TextRange.assertProperRange(TextRange.java:222)
        at com.intellij.openapi.util.TextRange.assertProperRange(TextRange.java:217)
        at com.intellij.openapi.util.TextRange.assertProperRange(TextRange.java:213)
        at com.intellij.openapi.util.TextRange.<init>(TextRange.java:41)
        at com.intellij.openapi.util.TextRange.<init>(TextRange.java:30)
        at com.intellij.openapi.util.TextRange.create(TextRange.java:148)
        at com.intellij.openapi.util.TextRange.create(TextRange.java:153)
        at top.rammer.multihighlight.highlight.MultiHighlightHandler.isClearHighlights(MultiHighlightHandler.java:248)
        at top.rammer.multihighlight.highlight.MultiHighlightHandler.findSymbols(MultiHighlightHandler.java:139)
        at top.rammer.multihighlight.highlight.MultiHighlightHandler.lambda$invoke$0(MultiHighlightHandler.java:109)
        at com.intellij.openapi.project.DumbService.withAlternativeResolveEnabled(DumbService.java:339)
        at top.rammer.multihighlight.highlight.MultiHighlightHandler.invoke(MultiHighlightHandler.java:108)
        at top.rammer.multihighlight.action.MultiHighlightAction.lambda$actionPerformed$0(MultiHighlightAction.java:40)
        at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:216)
        at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:172)
        at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:162)
        at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:148)
        at top.rammer.multihighlight.action.MultiHighlightAction.actionPerformed(MultiHighlightAction.java:38)
        at com.intellij.openapi.actionSystem.ex.ActionUtil.lambda$performActionDumbAware$5(ActionUtil.java:273)
        at com.intellij.util.SlowOperations.lambda$allowSlowOperations$0(SlowOperations.java:77)
        at com.intellij.util.SlowOperations.allowSlowOperations(SlowOperations.java:64)
        at com.intellij.util.SlowOperations.allowSlowOperations(SlowOperations.java:76)
        at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:273)
        at com.intellij.ide.actions.GotoActionAction.lambda$performAction$2(GotoActionAction.java:108)
        at com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:218)
        at com.intellij.openapi.application.TransactionGuardImpl.access$200(TransactionGuardImpl.java:21)
        at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:200)
        at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:781)
        at com.intellij.openapi.application.impl.ApplicationImpl.lambda$invokeLater$4(ApplicationImpl.java:319)
        at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:84)
        at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:133)
        at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:46)
        at com.intellij.openapi.application.impl.FlushQueue$FlushNow.run(FlushQueue.java:189)
        at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
        at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
        at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746)
        at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:969)
        at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:839)
        at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:449)
        at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:808)
        at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$9(IdeEventQueue.java:448)
        at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:781)
        at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:496)
        at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
        at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
2021-08-02 10:30:07,792 [53961570]  ERROR - pplication.impl.LaterInvocator - IntelliJ IDEA 2021.1.2 RC  Build #IU-211.7442.27
2021-08-02 10:30:07,792 [53961570]  ERROR - pplication.impl.LaterInvocator - JDK: 11.0.11; VM: Dynamic Code Evolution 64-Bit Server VM; Vendor: JetBrains s.r.o.
2021-08-02 10:30:07,792 [53961570]  ERROR - pplication.impl.LaterInvocator - OS: Mac OS X
2021-08-02 10:30:07,792 [53961570]  ERROR - pplication.impl.LaterInvocator - Plugin to blame: MultiHighlight version: 2.2.0
2021-08-02 10:30:07,792 [53961570]  ERROR - pplication.impl.LaterInvocator - Last Action: MultiHighlight

Tried again with the word selected and looks like the identical trace.

Note: these were the same words that did work, at least to highlight the one instance in the screenshot.

The only action I took between the included screenshots and the stack traces was popping in and out of settings to get version data for this ticket.

Note also that the strings are no longer being highlighted at all. This happens periodically as well. I thought it was a file type dependency, but that appears not to be the case as the screenshots I just took at least highlighted something.

Please let me know if there's any other data I can provide

bedge commented 3 years ago

Above does show up as an "IDE error" in Intellij UI, with accompanying suggestion to report here.

bedge commented 3 years ago

Note that switching to another file, the plugin works correctly, ie: all occurrences are highlighted.

This is repeatable, switch to another file, works, back to the attached data.tf, stack trace.

.tf files are not supported on upload, so here's the full file text

data "aws_caller_identity" "main" {}

data "aws_kms_key" "s3_kms_key" {
  key_id = "alias/${local.org_env_code}-s3"
}

data "aws_route53_zone" "zone" {
  name = local.zone_name
}

data "aws_sns_topic" "cloudwatch_topic" {
  name = "${var.org_env}-alerts"
}

data "aws_subnet_ids" "public" {
  vpc_id = data.aws_vpc.main.id
  filter {
    name   = "tag:Name"
    values = ["${local.org_env_code}-public"]
  }
}

data "aws_subnet_ids" "private" {
  vpc_id = data.aws_vpc.main.id
  filter {
    name   = "tag:Name"
    values = ["${local.org_env_code}-private"]
  }
}

data "aws_vpc" "main" {
  filter {
    name   = "tag:Name"
    values = [local.org_env_code]
  }
}

data "aws_security_group" "operations_sg" {
  name = "${local.operations_name}-ALB"
}
bedge commented 3 years ago

Restarting Intellij clears the stack trace behavior. Back to only highlighting the cursor instance of string.

huoguangjin commented 3 years ago

It seems that .tf file is not perfectly supported by IntelliJ IDEA? Do you install any other plugins for terraform files?

bedge commented 3 years ago

It seems that .tf file is not perfectly supported by IntelliJ IDEA? Do you install any other plugins for terraform files?

Yes, there's a terraform plugin: https://plugins.jetbrains.com/plugin/7808-hashicorp-terraform--hcl-language-support