Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Addresses VIM-539
Hello! This is my attempt at emulating matchit.vim, a plugin which extends the
%
motion to match whole words and patterns.My version currently supports jumping with
%
andg%
on matching HTML/XML tags (including HTML found in JavaScript/TypeScript and React files), and Ruby keywords, including Embedded Rubyerb
files. It handles comments and strings like the original plugin.I plan on adding support for more languages in the future. But I think that the HTML jumps alone make this plugin worth adding to IdeaVim. 🙂
I took care to make sure this doesn't break the default
%
motion, and I've included a lot of unit tests.There are a couple of things I'm uncertain about:
The original plugin uses Vim syntax groups to check for comments, strings, and other language features it wants to ignore. I've done the same but with PSI elements. However, I'm not sure how to check the types of Ruby elements since they appear to be defined outside of IntelliJ. I've resorted to checking the debugNames.
Similarly, I wasn't sure how write unit tests just for Ruby files. I added a new
doTest()
method which takes a filetype parameter -- that makes it easy to deal withHTMLFileType
orJavaFileType
. But there's noRubyFileType
, so I needed anotherdoTest
that takes a filename parameter. If a better solution for these Ruby features exists then I'd love to hear it.Thank you for your time, Alex! I look forward to your feedback.