Skip to content

Conversation

@bootleq
Copy link
Contributor

@bootleq bootleq commented Sep 29, 2015

Implementation of my proposal at #258.

Usage of ruby_foldable_groups is written in doc (ft-ruby-syntax.txt).

Also prepared example files for checking (manually).

Only have manual test for the time being.
Found some existing problems when using space as delimiter:

- `%Q foo\ \\\ bar ` is not detected as string.
- They can't go across lines, so folding is not needed.
- Add back double quote coverage.
- Remove invalid `%W foo ` syntax.
Aim to test this line:
https://github.com/vim-ruby/vim-ruby/blob/8775819/syntax/ruby.vim#L124

Case of ternary operation (8c1c484) doesn't fold with below format:

```ruby
  /
    foo
    \/
    \\\/
    bar
  /s
```

so test `?` `:` separately.
Aim to test this line:
https://github.com/vim-ruby/vim-ruby/blob/8775819/syntax/ruby.vim#L125

Not sure the purpose, just write case to reproduce the regex.
For multiline 'string' "string" and `shell command`.
It's hard to enumerate every case, so just separate to valid/invalid
section, see example file for detail.
3 types share one example file, but can be config separately.
Put there simple blocks into one `blocks` example.
For `for`, `while` and `for` loops.
Known `=begin xxx` should be valid comment, but seems not detected well
when ruby_no_comment_fold is set.
Should remove `percent` level under 'etc/examples' directory.
@dkearns dkearns added the syntax label Oct 22, 2015
@dkearns
Copy link
Member

dkearns commented Oct 22, 2015

Thanks. I'm happy to merge this or something similar.

Does anyone have any objections?

@dkearns dkearns self-assigned this Nov 7, 2015
@bruno-
Copy link

bruno- commented Jan 30, 2016

Hi,
I'm so glad I found this PR! I was looking for this feature for a long time, awesome work @bootleq

Here are the steps I did to test this locally:

  • cd to local vim-ruby plugin installation
  • $ git fetch origin pull/272/head:foldable to pull this PR
  • $ git checkout foldable

I've tried setting g:ruby_foldable_groups variable to a couple values and all things worked.

👍 for merging this

@janko
Copy link

janko commented Feb 8, 2016

It would be really awesome if this was part of vim-ruby, it really helps when reading code from other gems 👍

@AndrewRadev
Copy link
Member

I'm sorry for taking so long to get around to this PR.

I appreciate your work, @bootleq, and I definitely appreciate you going to extra mile to document it as well. I don't like the duplication with the syntax regions, but I guess it's the best way to implement it, and it's definitely a useful feature.

I notice there's a few files that generate example ruby files. Those are fine, I guess, but it seems like you've also committed the generated files? Could you remove those from the PR? As long as there are instructions on how to generate them, there's no point in having them in the repository.

You'd also need to merge master. It would probably be a conflict in the syntax definitions, I'm afraid. Once you do that, and take care of those example files, I'll go ahead and merge this.

bootleq added 3 commits May 14, 2016 12:40
* master:
  Match much more complicated structures in block's arguments in a very simple way.
  Fix issue with `end`s in multiline ERB output
  Add support for Ruby 2.3 heredoc <<~ syntax
  Add support for RSpec 3.4 to compiler
  Improve rubyMultilineComment performance
  Fix whitespace delimited percent 'strings'
  Don't add second .rb to filenames
  Match RSpec failures with index greater than 9
  Account for new safe navigation operator
  Highlight character literals in Range literals
  Highlight Rational and Complex literals
  Highlight all of the unary methods.
  Don't highlight `.?c` as a "character" literal.
  Set browsefilter for gui_gtk
  Remove ruby_spellcheck_strings related duplication

Conflicts:
	syntax/ruby.vim
- Whitespace delimited `%` literal, a696da8
- Heredoc with `<<~` form, a28f8df
Developer can generate these files if needed, follow instruction in
etc/example/generators.
@bootleq
Copy link
Contributor Author

bootleq commented May 23, 2016

Hi, @AndrewRadev, thank you very much for reviewing.
I've merged master and actually using this branch for days. I think it's ready to prepare merging.

@AndrewRadev
Copy link
Member

👍

@AndrewRadev AndrewRadev merged commit c9f5523 into vim-ruby:master May 25, 2016
@bootleq bootleq deleted the foldable branch May 28, 2016 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants