Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for optional closing element in group #130

Open
grr opened this issue Jan 27, 2021 · 3 comments
Open

Support for optional closing element in group #130

grr opened this issue Jan 27, 2021 · 3 comments

Comments

@grr
Copy link

grr commented Jan 27, 2021

If b:matchwords has '\<if\>:\<elsif\>:\<else\>' it works when there is if/elsif/else or if/else. But I often use and encounter just if/elsif without a closing else, so matchit/matchup doesn't work on that syntax. Another example is '\<try\>:\<catch\>:\<finally\>'. It doesn't work when there is only try/catch. Is there any way to support this?

@andymass
Copy link
Owner

Is this request intended for python or some other languages?

@grr
Copy link
Author

grr commented Feb 24, 2021

perl

@andymass
Copy link
Owner

The main problem is match-up needs to know where to stop looking for more clauses. And unfortunately, perl is much too difficult to parse using regex.

It would be possible with treesitter, but there is not yet a perl parser for https://github.com/nvim-treesitter/nvim-treesitter.

So it might be a while before this can be supported, unless there is a simple way to determine where the end of the if/else block is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants