Hard-code LSP formatting options for now

This is needed for auto-formatting to work properly in TypeScript and JSON

Co-Authored-By: Keith Simmons <keith@zed.dev>
This commit is contained in:
Max Brunsfeld 2022-03-30 17:08:40 -07:00
parent cf9efd7005
commit c280c85ce7
2 changed files with 14 additions and 2 deletions

View file

@ -2046,7 +2046,12 @@ impl Project {
language_server
.request::<lsp::request::Formatting>(lsp::DocumentFormattingParams {
text_document,
options: Default::default(),
options: lsp::FormattingOptions {
tab_size: 4,
insert_spaces: true,
insert_final_newline: Some(true),
..Default::default()
},
work_done_progress_params: Default::default(),
})
.await?
@ -2064,7 +2069,12 @@ impl Project {
lsp::DocumentRangeFormattingParams {
text_document,
range: lsp::Range::new(buffer_start, buffer_end),
options: Default::default(),
options: lsp::FormattingOptions {
tab_size: 4,
insert_spaces: true,
insert_final_newline: Some(true),
..Default::default()
},
work_done_progress_params: Default::default(),
},
)