diff --git a/index.ts b/index.ts index bafeebd..8250839 100644 --- a/index.ts +++ b/index.ts @@ -1,18 +1,32 @@ import type { Plugin, Parser } from "prettier"; import { formatSource, type FormatLanguage } from "muddle/formatter"; -interface Document { formatted: string } +interface Document { + formatted: string; +} const parser = (language: FormatLanguage): Parser => ({ astFormat: "muddle-document", - async parse(source, options) { return { formatted: await formatSource(source, language, options) }; }, + async parse(source, options) { + return { formatted: await formatSource(source, language, options) }; + }, locStart: () => 0, locEnd: (node) => node.formatted.length, }); const plugin: Plugin = { languages: [ - { name: "SPUG", parsers: ["spug"], extensions: [".spug", ".stpug", ".stug"], vscodeLanguageIds: ["spug"] }, - { name: "STCSS", parsers: ["stcss"], extensions: [".stcss"], vscodeLanguageIds: ["stcss"] }, + { + name: "SPUG", + parsers: ["spug"], + extensions: [".spug", ".stpug", ".stug"], + vscodeLanguageIds: ["spug"], + }, + { + name: "STCSS", + parsers: ["stcss"], + extensions: [".stcss"], + vscodeLanguageIds: ["stcss"], + }, ], parsers: { spug: parser("spug"), stcss: parser("stcss") }, printers: { "muddle-document": { print: (path) => path.node.formatted } }, diff --git a/package.json b/package.json index fc124ef..ea90f8a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,10 @@ { - "name": "@muddle/prettier-plugin", - "version": "0.1.0", - "type": "module", - "exports": "./index.ts", - "peerDependencies": { "muddle": "*", "prettier": "^3.0.0" } + "name": "@muddle/prettier-plugin", + "version": "0.1.0", + "type": "module", + "exports": "./index.ts", + "peerDependencies": { + "muddle": "*", + "prettier": "^3.0.0" + } }