yaml-language-server icon indicating copy to clipboard operation
yaml-language-server copied to clipboard

Disable replacing quotes

Open luisdavim opened this issue 5 years ago • 4 comments

In yaml single and double quotes have different meanings (https://yaml-multiline.info/) and I want to be able to auto format my file but keep the quotes as they are. I see an option to choose between single or double quotes but no option to just keep them as they are.

luisdavim avatar Mar 22 '20 14:03 luisdavim

Is it a bug that quotes are being replaced? I'd like yaml-language-server to strictly format my files but it doesn't seem to enforce quotes, even though I have yaml.format.singleQuote set to false. Does this setting only pertain to certain circumstances?

Edit: I believe my problem has to do with #486

ok-nick avatar Aug 22 '22 20:08 ok-nick

Yes, it is a bug that quotes are replaced because the different quote types have different meanings.

luisdavim avatar Jan 17 '23 22:01 luisdavim

I guess it's a feature enhancement that has to be done in the prettier project because the language server simply passes the option to the prettier format function.

https://github.com/redhat-developer/yaml-language-server/blob/cf3f79202524ba979f1f4011636b85d08d81bdcb/src/languageservice/services/yamlFormatter.ts#L40

https://github.com/redhat-developer/yaml-language-server/blob/cf3f79202524ba979f1f4011636b85d08d81bdcb/src/languageservice/services/yamlFormatter.ts#L47

donfiguerres avatar Apr 18 '23 10:04 donfiguerres

Thanks, I've found a related issue there and left a comment https://github.com/prettier/prettier/issues/5350#issuecomment-1513743949

luisdavim avatar Apr 18 '23 20:04 luisdavim