Skip to content

Conversation

themkat
Copy link
Collaborator

@themkat themkat commented Aug 30, 2022

Fix issue where implement abstract members code action doesn't show up if you don't mark the entire text. Happens in editors that are not VSCode. The editor I experience it in is Emacs, as discussed in #366. Might be other editors as well, as I've heard from some non-VSCode that they never see any code actions.

if you don't mark the entire text. Happens in editors that are not VSCode
@fwcd
Copy link
Owner

fwcd commented Aug 30, 2022

I think this happens in VSCode too, at least I vaguely recall having to select the entire diagnostic's range to get a quick fix, but it might also have been some other language server. In any case, thanks for looking into this!


fun diagnosticMatch(diagnostic: KotlinDiagnostic, startCursor: Int, endCursor: Int, diagnosticTypes: Set<String>): Boolean =
diagnostic.textRanges.any { it.startOffset == startCursor && it.endOffset == endCursor } && diagnosticTypes.contains(diagnostic.factory.name)
diagnostic.textRanges.any { it.startOffset <= startCursor && it.endOffset >= endCursor } && diagnosticTypes.contains(diagnostic.factory.name)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly here, it might be worth checking if there is a similar function for Kotlin's TextRange, this might be useful in other places too.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I will look further into that in a future PR. Right now I don't see how it will improve the current code without some rewrites. I might be wrong though 🙂

Copy link
Owner

@fwcd fwcd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm, thank you!

@fwcd fwcd merged commit 86fd15d into fwcd:main Sep 14, 2022
@themkat themkat deleted the implement_abstract_members_emacs_fix branch September 15, 2022 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants