@@ -7,7 +7,9 @@ use anyhow::anyhow;
7use helix_core::{find_root, ChangeSet, Rope};
7use helix_core::{find_root, ChangeSet, Rope};
8use jsonrpc_core as jsonrpc;
8use jsonrpc_core as jsonrpc;
9use lsp_types as lsp;
9use lsp_types as lsp;
10+use serde::Deserialize;
10use serde_json::Value;
11use serde_json::Value;
12+use std::collections::HashMap;
11use std::future::Future;
13use std::future::Future;
12use std::process::Stdio;
14use std::process::Stdio;
13use std::sync::{
15use std::sync::{
@@ -693,6 +695,24 @@ impl Client {
694 // TODO: return err::unavailable so we can fall back to tree sitter formatting
696 // TODO: return err::unavailable so we can fall back to tree sitter formatting
698+ // merge FormattingOptions with 'config.format'
699+ let config_format = self
702+ .and_then(|cfg| cfg.get("format"))
703+ .and_then(|fmt| HashMap::<String, lsp::FormattingProperty>::deserialize(fmt).ok());
705+ let options = if let Some(mut properties) = config_format {
706+ // passed in options take precedence over 'config.format'
707+ properties.extend(options.properties);
708+ lsp::FormattingOptions {
696 let params = lsp::DocumentFormattingParams {
716 let params = lsp::DocumentFormattingParams {
697 text_document,
717 text_document,