Allow to configure default prettier
This commit is contained in:
parent
b109075bf2
commit
6ec3927dd3
7 changed files with 60 additions and 13 deletions
|
@ -149,7 +149,13 @@ async function handleMessage(message, prettier) {
|
|||
if (params.options === undefined) {
|
||||
throw new Error(`Message params.options is undefined: ${JSON.stringify(message)}`);
|
||||
}
|
||||
const formattedText = await prettier.prettier.format(params.text, { ...prettier.config, ...params.options });
|
||||
|
||||
const options = {
|
||||
...(params.options.prettierOptions || prettier.config),
|
||||
parser: params.options.parser,
|
||||
path: params.options.path
|
||||
};
|
||||
const formattedText = await prettier.prettier.format(params.text, options);
|
||||
sendResponse({ id, result: { text: formattedText } });
|
||||
} else if (method === 'prettier/clear_cache') {
|
||||
prettier.prettier.clearConfigCache();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue