Skip to content

Commit

Permalink
[formatter] Fix missing parser error when running the binary (#20471)
Browse files Browse the repository at this point in the history
  • Loading branch information
damirka authored Nov 29, 2024
1 parent b806afe commit 360e9a2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/soft-days-relate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@mysten/prettier-plugin-move': patch
---

Fixes missing parser for move-parser error
6 changes: 3 additions & 3 deletions external-crates/move/tooling/prettier-move/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const languages: SupportLanguage[] = [
];

export const parsers: { [key: string]: PrettierParser } = {
'move-parse': {
move: {
parse: (text: string): Promise<Node> => {
return (async (): Promise<Node> => {
await Parser.init();
Expand All @@ -52,14 +52,14 @@ export const parsers: { [key: string]: PrettierParser } = {
})();
},

astFormat: 'move-format',
astFormat: 'move',
locStart: () => -1,
locEnd: () => -1,
},
};

export const printers: { [key: string]: Printer } = {
'move-format': { print },
'move': { print },
};

export const options: Record<string, SupportOption> = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ function runSpec(filepath: string, content: string) {
const result = await prettier.format(content, {
// @ts-ignore
plugins: [plugin],
parser: 'move-parse',
parser: 'move',
printWidth: config.printWidth,
tabWidth: config.tabWidth,
wrapComments: config.wrapComments,
Expand Down

0 comments on commit 360e9a2

Please sign in to comment.