| 1 | import prettier from 'prettier' |
| 2 | import { create as createPrettierPlugin } from 'volar-service-prettier' |
| 3 | |
| 4 | export function create() { |
| 5 | return createPrettierPlugin( |
| 6 | prettier, |
| 7 | { |
| 8 | documentSelector: ['yaml'], |
| 9 | async getFormattingOptions(_prettier, _document, formatOptions) { |
| 10 | return { |
| 11 | parser: 'yaml', |
| 12 | tabWidth: formatOptions.tabSize, |
| 13 | useTabs: !formatOptions.insertSpaces, |
| 14 | } |
| 15 | }, |
| 16 | }, |
| 17 | ) |
| 18 | } |
| 19 |