intellij-community icon indicating copy to clipboard operation
intellij-community copied to clipboard

Fix identifier highlight in injected languages.

Open Earthcomputer opened this issue 1 year ago • 1 comments

Identifier highlighting was disabled for single-line editors, which accounts for injected languages inside single-line Java string literals. According to git blame, the original intention of this was to disable identifier highlighting in dialog editors, so I switched the check to explicitly check that.

My use case is that I'm developing a plugin which makes use of a MultiHostInjector for a DSL spread across multiple Java string literals. It would significantly improve UX if identifier highlighting was possible in this use case. I could not find any clean workaround which doesn't involve modifying IntelliJ in this way. Besides, I consider this a bug and it's nice to get it fixed :)

Before the fix: image

After the fix: image

Earthcomputer avatar Feb 11 '24 22:02 Earthcomputer

Hi @Earthcomputer , Thank you for your contribution. Could you create a YouTrack issue for this as well? That way it becomes part of the release notes and such.

BasLeijdekkers avatar Feb 16 '24 15:02 BasLeijdekkers

Hi, sorry for the delay, I've been away. I can take a look this evening.

Earthcomputer avatar Feb 18 '24 07:02 Earthcomputer

I addressed the review, and made a YouTrack issue: https://youtrack.jetbrains.com/issue/IDEA-346533/Identifier-highlighting-doesnt-work-in-single-line-language-injections

Earthcomputer avatar Feb 19 '24 00:02 Earthcomputer

Hello, sorry for the delay. Could you squash the two commits into one? That makes it easier to apply the changes to our internal repository.

BasLeijdekkers avatar Feb 26 '24 15:02 BasLeijdekkers

@BasLeijdekkers done

Earthcomputer avatar Feb 26 '24 22:02 Earthcomputer