Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prettier support for .astro files #106

Merged
merged 22 commits into from
Apr 21, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: scaffold prettier plugin
  • Loading branch information
Nate Moore committed Apr 20, 2021
commit d488fc951347c331d7cfea7f4a0f804fce26e7b2
37 changes: 37 additions & 0 deletions prettier-plugin-astro/index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/** @type {Partial<import('prettier').SupportLanguage>[]} */
export const languages = [
{
name: 'astro',
parsers: ['astro'],
extensions: ['.astro'],
vscodeLanguageIds: ['astro'],
},
];

/** @type {Record<string, import('prettier').Parser>} */
export const parsers = {
astro: {
parse: (text) => {

},
locEnd(node) {
return node.locEnd
},
locStart(node) {
return node.locStart
},
astFormat: 'astro-ast',
},
};

/** @type {Record<string, import('prettier').Printer>} */
export const printers = {
'astro-ast': {
print() {
/** @type {any} */
const doc = {};
return doc;
}
},
};

14 changes: 14 additions & 0 deletions prettier-plugin-astro/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions prettier-plugin-astro/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "prettier-plugin-astro",
"version": "0.0.1",
"main": "index.mjs",
"private": true,
"devDependencies": {
"prettier": "^2.2.1"
}
}