Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Sorry, but there is no formatter for 'ruby'-files installed. #269

Closed
doudou opened this issue Feb 19, 2018 · 18 comments
Closed

Sorry, but there is no formatter for 'ruby'-files installed. #269

doudou opened this issue Feb 19, 2018 · 18 comments

Comments

@doudou
Copy link
Contributor

doudou commented Feb 19, 2018

Your environment

  • vscode-ruby version: master
  • Ruby version: 2.3.0
  • VS Code version: 1.20.1
  • Operating System: Ubuntu 16.04

Make sure you have ruby, ruby-debug-ide and ruby-debug-basex19 installed before submitting your issue -- thank you !

Expected behavior

I can use rubocop to do formatting

Actual behavior

I get the `sorry, but there is no formatter for 'ruby'-files installed.

Steps to reproduce the problem

On my machine, it is systematic. I've run under a debugger, and the line with registerDocumentFormattingEditProvider is executed.

@universam1
Copy link

same here

@bhoeting
Copy link

This is also happening to me.

@estevaoam
Copy link

Same here. :/

@wingrunr21
Copy link
Collaborator

This will be addressed via #317. Please use that to track progress against it.

@dsomel21
Copy link

Did y'all figure this out?

@jcarlos
Copy link

jcarlos commented May 7, 2018

Same happening here with me, however when I go to View > Command Palette and choose format it formats just fine.

Seems to be related just with my vim shortcut =G to format the whole file or if I select just a few lines and try to format it.

Using ALT+SHIFT+F for now to format the whole document works ok

@andrewheekin
Copy link

seeing the same issue, even with format from view > command palette @jcarlos

@wingrunr21
Copy link
Collaborator

This will be addressed via #317. Until then, if someone else debugs and submits a PR for a fix I'll be happy to take a look/merge.

@jacquescrocker
Copy link

jacquescrocker commented Jul 6, 2018

Anyone have a workaround that they use?

This is sort of a key feature on an ide and this pops up on the google search result when looking for it.

Maybe someone has something working that we can use? Other than opening up Sublime text and using BeautifyRuby (which I hate to admit that I've been doing)

@vaidhyanathan93
Copy link

Same thing to here . If anyone fixes the issues/Found how to rectify this please update

@machty
Copy link

machty commented Oct 4, 2018

I'm a VSCode noob and I just installed the Ruby extension and I'm seeing this error ("There is no selection formatter for 'ruby'-files installed.") whenever I do ==.

I understand progress is being tracked at #317, but I'm wondering if I'm fundamentally missing something here: am I to understand that there is no Ruby plugin in VSCode's ecosystem that knows how how to do basic auto-indentation in Ruby files, and that everyone doing Ruby in VSCode is forced to manually format/indent their code? I understand asking this question runs the risk of broadcasting open-source entitlement, but this is such a strange situation to me that I wonder if I'm somehow just misunderstand the ecosystem or how I'm "supposed" to be using VSCode with Ruby.

@kaiwood
Copy link

kaiwood commented Oct 6, 2018

@machty The Ruby ecosystem in VSCode land is generally somewhat lacking, but its not as bad as one might think at first sight.

I guess you are using the Vim plugin because of ==. That one depends on a formatter that supports selections, which is currently not available (at least not that I'm aware of). But VScode's own indentation rules work fine, that's what triggers indentation when you simply press enter or use Reindent lines from the command palette.

Additionally, this extension here currently supports formatting via Rubocop (somewhat slow). There is also vscode-rufo, a plugin for an external formatter - that one works pretty good for stuff like "Format on save".

What is really non-existing, is proper support for formatting ERB files. (I'm currently working on a plugin for this myself, should be available in the near future, just need some free time to finish my prototype)

@marinhero
Copy link

Thanks for the insight @kaiwood. I ended up remapping == to Reindent lines and that's more than enough for me right now. Hope you get the ERB plugin out soon!

@bjeanes
Copy link

bjeanes commented Jan 18, 2019

Remapping == doesn't seem to be working. Can somebody paste their remapping configuration to make sure I have it right?

    "vim.normalModeKeyBindingsNonRecursive": [{
            "before": ["j"],
            "after": ["g", "j"]
        },
        {
            "before": ["k"],
            "after": ["g", "k"]
        },
        {
            "before": ["=", "="],
            "commands": ["editor.action.reindentselectedlines"]
        }
    ],

I've tried recursive and non-recursive (though it shouldn't make a difference for "commands" maps) as well as reindentlines and reindentselectedlines. My other mappings work so I know that remappings generally are taking effect, however I still get the selection formatter error when hitting ==.

@locofocos
Copy link

Note to random Googlers (correct me if I'm wrong): you can follow this to get ruby formatting working: https://github.com/rubyide/vscode-ruby#formatting

If I understand correctly, #317 is targeted towards making some improvements to how it's implemented.

@wingrunr21
Copy link
Collaborator

#405 is the implementation for most of that ticket

@ignaciosiri
Copy link

Adding this setting in settings.js fixes that!

"files.associations": {
        "*.erb": "erb"
    }

@rehanmunir
Copy link

rvm use (version)@global
gem install htmlbeautifier

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

No branches or pull requests