@@ -4,7 +4,7 @@ use std::collections::HashMap;
44use std:: path:: PathBuf ;
55use std:: sync:: { Mutex , MutexGuard } ;
66
7- use acdc_parser:: { Document , DocumentAttributes , Location } ;
7+ use acdc_parser:: { Document , DocumentAttributes , Location , Position } ;
88use tower_lsp_server:: ls_types:: Diagnostic ;
99
1010/// Owned counterpart to `acdc_parser::Source<'_>`, detached from the parser arena
@@ -238,10 +238,8 @@ pub(crate) fn extract_attribute_defs(text: &str) -> Vec<(String, Location)> {
238238 let line_end = line. len ( ) ;
239239
240240 let mut location = Location :: default ( ) ;
241- location. start . line = line_idx + 1 ;
242- location. start . column = col_offset + 1 ;
243- location. end . line = line_idx + 1 ;
244- location. end . column = line_end;
241+ location. start = Position :: from_line_col ( line_idx + 1 , col_offset + 1 ) ;
242+ location. end = Position :: from_line_col ( line_idx + 1 , line_end) ;
245243 location. absolute_start = this_line_start + col_offset;
246244 location. absolute_end = this_line_start + line_end;
247245
@@ -321,10 +319,8 @@ fn extract_refs_from_line(
321319 let col_end = segment_offset_in_line + close + 1 ;
322320
323321 let mut location = Location :: default ( ) ;
324- location. start . line = line_idx + 1 ;
325- location. start . column = col_in_line + 1 ;
326- location. end . line = line_idx + 1 ;
327- location. end . column = col_end;
322+ location. start = Position :: from_line_col ( line_idx + 1 , col_in_line + 1 ) ;
323+ location. end = Position :: from_line_col ( line_idx + 1 , col_end) ;
328324 location. absolute_start = line_start + col_in_line;
329325 location. absolute_end = line_start + col_end;
330326
@@ -492,10 +488,8 @@ pub(crate) fn extract_includes(text: &str) -> Vec<(String, Location)> {
492488 let target_end = target_start + target. len ( ) ;
493489
494490 let mut location = Location :: default ( ) ;
495- location. start . line = line_idx + 1 ;
496- location. start . column = target_start + 1 ;
497- location. end . line = line_idx + 1 ;
498- location. end . column = target_end;
491+ location. start = Position :: from_line_col ( line_idx + 1 , target_start + 1 ) ;
492+ location. end = Position :: from_line_col ( line_idx + 1 , target_end) ;
499493 location. absolute_start = this_line_start + target_start;
500494 location. absolute_end = this_line_start + target_end;
501495
0 commit comments