@@ -223,20 +223,8 @@ pub(crate) fn indent(checker: &mut Checker, docstring: &Docstring) {
223
223
// We report under-indentation on every line. This isn't great, but enables
224
224
// fix.
225
225
if ( is_last || !is_blank) && line_indent_size < docstring_indent_size {
226
- // Previously, this used `TextRange::empty(line.start())`,
227
- // but this creates an offset immediately after the line
228
- // terminator. Probably, our renderer should create an
229
- // annotation that points to the beginning of the following
230
- // line. But it doesn't at present and this have proved
231
- // difficult to fix without regressing other cases. So for now,
232
- // we work around this by creating a range that points at the
233
- // first codepoint in the corresponding line. This makes the
234
- // renderer do what we want. ---AG
235
- let start = line. start ( ) ;
236
- let end = checker
237
- . locator ( )
238
- . ceil_char_boundary ( start + TextSize :: from ( 1 ) ) ;
239
- let mut diagnostic = Diagnostic :: new ( UnderIndentation , TextRange :: new ( start, end) ) ;
226
+ let mut diagnostic =
227
+ Diagnostic :: new ( UnderIndentation , TextRange :: empty ( line. start ( ) ) ) ;
240
228
diagnostic. set_fix ( Fix :: safe_edit ( Edit :: range_replacement (
241
229
clean_space ( docstring. indentation ) ,
242
230
TextRange :: at ( line. start ( ) , line_indent. text_len ( ) ) ,
@@ -293,16 +281,8 @@ pub(crate) fn indent(checker: &mut Checker, docstring: &Docstring) {
293
281
294
282
// We report over-indentation on every line. This isn't great, but
295
283
// enables the fix capability.
296
- //
297
- // Also, we ensure that our range points to the first character
298
- // of the line instead of the empty spance immediately
299
- // preceding the line. See above for how we handle under
300
- // indentation for more explanation. ---AG
301
- let start = line. start ( ) ;
302
- let end = checker
303
- . locator ( )
304
- . ceil_char_boundary ( start + TextSize :: from ( 1 ) ) ;
305
- let mut diagnostic = Diagnostic :: new ( OverIndentation , TextRange :: new ( start, end) ) ;
284
+ let mut diagnostic =
285
+ Diagnostic :: new ( OverIndentation , TextRange :: empty ( line. start ( ) ) ) ;
306
286
307
287
let edit = if indent. is_empty ( ) {
308
288
// Delete the entire indent.
@@ -344,15 +324,8 @@ pub(crate) fn indent(checker: &mut Checker, docstring: &Docstring) {
344
324
345
325
let is_indent_only = line_indent. len ( ) == last. len ( ) ;
346
326
if last_line_over_indent > 0 && is_indent_only {
347
- // We ensure that our range points to the first character of
348
- // the line instead of the empty spance immediately preceding
349
- // the line. See above for how we handle under indentation for
350
- // more explanation. ---AG
351
- let start = last. start ( ) ;
352
- let end = checker
353
- . locator ( )
354
- . ceil_char_boundary ( start + TextSize :: from ( 1 ) ) ;
355
- let mut diagnostic = Diagnostic :: new ( OverIndentation , TextRange :: new ( start, end) ) ;
327
+ let mut diagnostic =
328
+ Diagnostic :: new ( OverIndentation , TextRange :: empty ( last. start ( ) ) ) ;
356
329
let indent = clean_space ( docstring. indentation ) ;
357
330
let range = TextRange :: at ( last. start ( ) , line_indent. text_len ( ) ) ;
358
331
let edit = if indent. is_empty ( ) {
0 commit comments