Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions src/languageservice/services/yamlFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export class YAMLFormatter {
const prettierOptions: Options = {
parser: 'yaml',
plugins: [yamlPlugin, estreePlugin],
editorConfig: options.editorConfig,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this works (I've tested manually in VS Code and it doesn't seem to work). I don't see editorConfig as a parameter in the documentation. To get it to work, you'll need to fetch the config for the file using https://prettier.io/docs/api#prettierresolveconfigfileurlorpath--options, then use the result from that as the config in the call to format instead of the prettierOptions defined here. (or, somehow handle merging the fetched prettier/editorconfig with what the language server has been told).


// --- FormattingOptions ---
tabWidth: (options.tabWidth as number) || options.tabSize,
Expand Down
1 change: 1 addition & 0 deletions src/languageservice/yamlLanguageService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ export interface SchemaConfiguration {
}

export interface CustomFormatterOptions {
editorConfig?: boolean;
singleQuote?: boolean;
bracketSpacing?: boolean;
trailingComma?: boolean;
Expand Down