diff options
Diffstat (limited to 'cli/lsp/language_server.rs')
-rw-r--r-- | cli/lsp/language_server.rs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/cli/lsp/language_server.rs b/cli/lsp/language_server.rs index 62cbd58dd..314c9ec14 100644 --- a/cli/lsp/language_server.rs +++ b/cli/lsp/language_server.rs @@ -92,6 +92,7 @@ use crate::args::CaData; use crate::args::CacheSetting; use crate::args::CliOptions; use crate::args::Flags; +use crate::args::UnstableFmtOptions; use crate::factory::CliFactory; use crate::file_fetcher::FileFetcher; use crate::graph_util; @@ -1361,6 +1362,16 @@ impl Inner { .clone(); fmt_options.use_tabs = Some(!params.options.insert_spaces); fmt_options.indent_width = Some(params.options.tab_size as u8); + let maybe_workspace = self + .config + .tree + .data_for_specifier(&specifier) + .map(|d| &d.member_dir.workspace); + let unstable_options = UnstableFmtOptions { + yaml: maybe_workspace + .map(|w| w.has_unstable("fmt-yaml")) + .unwrap_or(false), + }; let document = document.clone(); move || { let format_result = match document.maybe_parsed_source() { @@ -1378,7 +1389,12 @@ impl Inner { .map(|ext| file_path.with_extension(ext)) .unwrap_or(file_path); // it's not a js/ts file, so attempt to format its contents - format_file(&file_path, document.content(), &fmt_options) + format_file( + &file_path, + document.content(), + &fmt_options, + &unstable_options, + ) } }; match format_result { |