diff options
| author | mitermayer <mitermayer.reis@gmail.com> | 2020-02-15 08:40:18 +0000 |
|---|---|---|
| committer | mitermayer <mitermayer.reis@gmail.com> | 2020-02-15 08:40:18 +0000 |
| commit | cdf15c260bf90d5052ec02254c091b966dceb9d9 (patch) | |
| tree | 4962b0e726c764d2efe4d8cbaf60babb1f4e9e41 | |
| parent | 23da7f009fd494879c8c95f41127fd56ff5ab4f6 (diff) | |
| download | vim-prettier-cdf15c260bf90d5052ec02254c091b966dceb9d9.tar.xz | |
Adding support for prettier ruby plugin
- Update docker container image to be able to run the prettier ruby
plugin tests
| -rw-r--r-- | Dockerfile | 3 | ||||
| -rw-r--r-- | ftdetect/ruby.vim | 3 | ||||
| -rw-r--r-- | ftplugin/ruby.vim | 10 | ||||
| -rw-r--r-- | tests/__snapshots__/formatting.test.js.snap | 12 | ||||
| -rw-r--r-- | tests/fixtures/foo.rb | 3 |
5 files changed, 31 insertions, 0 deletions
@@ -33,6 +33,9 @@ COPY --from=builder /usr/local/share/vim /usr/local/share/vim ENV PACKAGES="\ bash \ git \ + ruby \ + ruby-dev \ + ruby-json \ python \ python3 \ py-pip \ diff --git a/ftdetect/ruby.vim b/ftdetect/ruby.vim new file mode 100644 index 0000000..773a0d2 --- /dev/null +++ b/ftdetect/ruby.vim @@ -0,0 +1,3 @@ +augroup PrettierFileDetect + autocmd BufNewFile,BufReadPost *.rb setfiletype ruby +augroup end diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim new file mode 100644 index 0000000..c5f62fc --- /dev/null +++ b/ftplugin/ruby.vim @@ -0,0 +1,10 @@ +let b:prettier_ft_default_args = { + \ 'parser': 'ruby', + \ } + +augroup Prettier + autocmd! + if get(g:, 'prettier#autoformat') + autocmd BufWritePre *.ruby call prettier#Autoformat() + endif +augroup end diff --git a/tests/__snapshots__/formatting.test.js.snap b/tests/__snapshots__/formatting.test.js.snap index 205221b..161352f 100644 --- a/tests/__snapshots__/formatting.test.js.snap +++ b/tests/__snapshots__/formatting.test.js.snap @@ -174,6 +174,18 @@ def i18n_patterns(*urls, prefix_default_language=True): pass" `; +exports[`Prettier formats foo.rb file with :Prettier command 1`] = ` +"[1, 2, 3].each do |i| + p i +end" +`; + +exports[`Prettier formats foo.rb file with :PrettierAsync command 1`] = ` +"[1, 2, 3].each do |i| + p i +end" +`; + exports[`Prettier formats foo.scss file with :Prettier command 1`] = ` ".redClass { background: \\"red\\"; diff --git a/tests/fixtures/foo.rb b/tests/fixtures/foo.rb new file mode 100644 index 0000000..29a29b3 --- /dev/null +++ b/tests/fixtures/foo.rb @@ -0,0 +1,3 @@ +for i in [1, 2, 3] do + p i +end |
