mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-01 22:31:47 +00:00
Optional source map generation (#6894)
This commit is contained in:
parent
15b73bdb8a
commit
eae59cf088
7 changed files with 117 additions and 73 deletions
|
@ -1,16 +1,17 @@
|
|||
use std::cell::Cell;
|
||||
use std::marker::PhantomData;
|
||||
use std::num::NonZeroU8;
|
||||
|
||||
use ruff_text_size::TextRange;
|
||||
#[allow(clippy::enum_glob_use)]
|
||||
use Tag::*;
|
||||
|
||||
use crate::format_element::tag::{Condition, Tag};
|
||||
use crate::prelude::tag::{DedentMode, GroupMode, LabelId};
|
||||
use crate::prelude::*;
|
||||
use crate::{format_element, write, Argument, Arguments, FormatContext, GroupId, TextSize};
|
||||
use crate::{Buffer, VecBuffer};
|
||||
|
||||
use ruff_text_size::TextRange;
|
||||
use std::cell::Cell;
|
||||
use std::marker::PhantomData;
|
||||
use std::num::NonZeroU8;
|
||||
#[allow(clippy::enum_glob_use)]
|
||||
use Tag::*;
|
||||
|
||||
/// A line break that only gets printed if the enclosing `Group` doesn't fit on a single line.
|
||||
/// It's omitted if the enclosing `Group` fits on a single line.
|
||||
/// A soft line break is identical to a hard line break when not enclosed inside of a `Group`.
|
||||
|
@ -283,7 +284,6 @@ impl std::fmt::Debug for StaticText {
|
|||
/// ## Examples
|
||||
///
|
||||
/// ```
|
||||
/// /// ```
|
||||
/// use ruff_formatter::format;
|
||||
/// use ruff_formatter::prelude::*;
|
||||
///
|
||||
|
@ -329,6 +329,7 @@ pub struct SourcePosition(TextSize);
|
|||
impl<Context> Format<Context> for SourcePosition {
|
||||
fn fmt(&self, f: &mut Formatter<Context>) -> FormatResult<()> {
|
||||
f.write_element(FormatElement::SourcePosition(self.0));
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue