Skip to content

Commit

Permalink
Don't append extra newline in BibTeX formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
pfoerster committed Jan 20, 2024
1 parent 88d2a5b commit 2d7f3a1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- Fix parsing commands when they are used with subscript ([#990](https://github.com/latex-lsp/texlab/issues/990))
- Don't append a newline each time a BibTeX document is being formatted ([#996](https://github.com/latex-lsp/texlab/issues/996))

## [5.12.1] - 2024-01-04

Expand Down
6 changes: 3 additions & 3 deletions crates/texlab/src/features/formatting/bibtex_internal.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use base_db::{Document, Workspace};
use lsp_types::{FormattingOptions, TextEdit};
use rowan::{TextLen, TextRange};
use rowan::TextLen;

use crate::util::line_index_ext::LineIndexExt;

Expand All @@ -17,7 +17,7 @@ pub fn format_bibtex_internal(
};

let output = bibfmt::format(&data.root_node(), &document.line_index, &options);
let range = TextRange::new(0.into(), document.text.text_len());
let range = document.line_index.line_col_lsp_range(range)?;
let end = document.line_index.line_col_lsp(document.text.text_len())?;
let range = lsp_types::Range::new(lsp_types::Position::new(0, 0), end);
Some(vec![lsp_types::TextEdit::new(range, output)])
}

0 comments on commit 2d7f3a1

Please sign in to comment.