Prettier-atom: Tree sitter and default config

Created on 23 Mar 2018  路  5Comments  路  Source: prettier/prettier-atom

The latest version of Atom brought experimental tree sitter support. When enabled, prettier format on save doesn't work. It looks like the grammar names have changed within tree sitter.

I can of course override this & add in the new languages. However when tree sitter eventually becomes default prettier will no longer work out the box.


Atom version: 1.25.0
prettier-atom version: 0.52.0
prettier version: 1.11.1
prettier-eslint version: 8.8.1
prettier-atom configuration: {
"formatOnSaveOptions": {
"enabled": true,
"isDisabledIfNoConfigFile": true,
"respectEslintignore": true,
"showInStatusBar": false,
"excludedGlobs": [],
"whitelistedGlobs": [],
"isDisabledIfNotInPackageJson": false
},
"prettierEslintOptions": {
"prettierLast": true
},
"prettierOptions": {
"bracketSpacing": false,
"singleQuote": true,
"trailingComma": "all",
"semi": true,
"useTabs": false,
"jsxBracketSameLine": false,
"printWidth": 80,
"tabWidth": "auto",
"parser": "babylon",
"arrowParens": "avoid"
},
"useEslint": false,
"useStylelint": false,
"useEditorConfig": true,
"scopes": {
"javascript": [
"source.js",
"source.jsx",
"source.js.jsx",
"source.babel",
"source.js-semantic",
"text.html.basic",
"text.html.vue"
],
"typescript": [
"source.ts",
"source.tsx",
"source.ts.tsx"
],
"css": [
"source.css",
"source.less",
"source.css.less",
"source.scss",
"source.css.scss",
"source.css.postcss"
],
"json": [
"source.json"
],
"graphQl": [
"source.graphql"
],
"markdown": [
"source.md",
"source.gfm",
"text.md"
],
"vue": [
"text.html.vue"
]
}
}

bug enhancement

Most helpful comment

Tree-Sitter will be enabled by default eventually (as per http://blog.atom.io/2018/07/31/atom-1-29.html) so this should be considered sooner rather than later.

All 5 comments

Thanks for the report! Certainly a good thing to catch before the new tree sitter becomes standard.

by grammar names are you referring to atom's scopes? we're talking about removing those altogether and just passing the filename to prettier. We can leave this issue open til that happens

@olsonpm Yeah atom's scopes.

Tree-Sitter will be enabled by default eventually (as per http://blog.atom.io/2018/07/31/atom-1-29.html) so this should be considered sooner rather than later.

We're about to finally release #404 which will move prettier-atom away from relying on scopes. Instead, we just let Prettier tell us whether it's able to format the current file or not.

Was this page helpful?
0 / 5 - 0 ratings