Comments (5)
(I also restarted VS Code so that may have made a difference).
from prettier-plugin-erb.
hey @andyw8
I use VSCode ✌️ Is it a rails app? Is this plugin installed inside of a project? (package.json) Or did you install it globally? npm install -g...
I'm using it in a rails app and it works, so I think there has to be something misconfigured on your side.
FYI The ruby
keyword that you have shown is VSCode's metadata https://code.visualstudio.com/api/references/extension-manifest It makes an extension findable when one writes ruby
into an extension searchbox.
from prettier-plugin-erb.
Thanks for the quick reply. Yes, this is a Rails app, and the plugin is installed in the project.
from prettier-plugin-erb.
- Did you try to reset the vscode? 🙈
- When you try to format .html.erb manually, are there any other formatters to select?
Add this line to your settings "prettier.enableDebugLogs": true
-> restart and and open terminal -> output -> Prettier.
You will see an output like this, is there .html.erb
?
["INFO" - 5:40:13 PM] Enabling Prettier for Workspace test
{
"languageSelector": [
{
"pattern": "test/**/*.{js,_js,bones,cjs,es,es6,frag,gs,jake,jsb,jscad,jsfl,jsm,jss,mjs,njs,pac,sjs,ssjs,xsjs,xsjslib,wxs,js.flow,jsx,ts,tsx,json,avsc,geojson,gltf,har,ice,JSON-tmLanguage,mcmeta,tfstate,tfstate.backup,topojson,webapp,webmanifest,yy,yyp,jsonc,sublime-build,sublime-commands,sublime-completions,sublime-keymap,sublime-macro,sublime-menu,sublime-mousemap,sublime-project,sublime-settings,sublime-theme,sublime-workspace,sublime_metrics,sublime_session,json5,css,wxss,pcss,postcss,less,scss,graphql,gql,graphqls,md,markdown,mdown,mdwn,mkd,mkdn,mkdown,ronn,workbook,mdx,component.html,html,htm,html.hl,inc,st,xht,xhtml,mjml,vue,yml,mir,reek,rviz,sublime-syntax,syntax,yaml,yaml-tmlanguage,yaml.sed,yml.mysql,html.erb,arb,axlsx,builder,eye,fcgi,gemfile,gemspec,god,jb,jbuilder,mspec,opal,pluginspec,podspec,rabl,rake,rb,rbi,rbuild,rbw,rbx,ru,ruby,thor,watchr,rbs,haml}",
"scheme": "file"
},
from prettier-plugin-erb.
I got it working:
Either you can set formatOnSave
for every language:
{
"editor.formatOnSave": true,
"[ruby]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
or you can set it explicitly for [erb]
:
{
"[ruby]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[erb]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
}
}
from prettier-plugin-erb.
Related Issues (20)
- Incorrect treatment of <%== %> in html.erb files
- Migrate to Prettier v3 HOT 3
- Error formatting document: RangeError: Invalid count value HOT 1
- Ruby not formatted if it opens a block
- Please consider marking this library as deprecated HOT 2
- Fails to parse an erb multiline comment with quotes inside HOT 1
- Should exit with non-zero status on error
- Multiline-comment lines containing a colon are indented with each formatter run HOT 2
- Weird formatting on <i> tags with ERB (e.g. used for icons) HOT 3
- Invalid erb output for long blocks HOT 2
- Issues with leading dash in embedded ruby block HOT 2
- Why add whitespace between % and # in comments? HOT 2
- Ruby expressions are getting replaced with <eext> HOT 16
- Handle 2.3 prettier changes HOT 6
- render tag <%=%> replaced with [object Object] when used in img tag HOT 16
- Support file extension .html+*.erb for rails and viewcomponent variants
- <% %> Delete HOT 7
- TypeError: formattedExpression.trim is not a function HOT 9
- Incorrect output </eext8><br/> HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prettier-plugin-erb.