From 81eeb942670ac60fa971b126a5bf677d8489b7a3 Mon Sep 17 00:00:00 2001 From: Ram Nadella Date: Sat, 19 Jul 2025 16:30:21 -0400 Subject: [PATCH] fix: correct symbol position in ruff parser MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ruff parser was reporting symbol positions starting at the function/class name instead of the def/class keyword. This fix uses the range of the entire statement to correctly position symbols at the beginning of their definitions. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- pylight/src/parser/ruff.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pylight/src/parser/ruff.rs b/pylight/src/parser/ruff.rs index 6d25b40..96e5d1d 100644 --- a/pylight/src/parser/ruff.rs +++ b/pylight/src/parser/ruff.rs @@ -114,8 +114,8 @@ impl<'a> Visitor<'a> for SymbolExtractor<'a> { // Note: func_def.is_async is available to check if it's async let kind = self.determine_function_kind(); let container = self.build_container_name(); - // Use the name's range to get the line of the actual 'def' keyword - let (line, column) = self.get_line_column(func_def.name.range.start().to_u32()); + // Use the function definition's range to get the position of the 'def' keyword + let (line, column) = self.get_line_column(func_def.range.start().to_u32()); // Get module name from file path let module_path = self @@ -144,8 +144,8 @@ impl<'a> Visitor<'a> for SymbolExtractor<'a> { let name_str = class_def.name.to_string(); let kind = self.determine_class_kind(); let container = self.build_container_name(); - // Use the name's range to get the line of the actual 'class' keyword - let (line, column) = self.get_line_column(class_def.name.range.start().to_u32()); + // Use the class definition's range to get the position of the 'class' keyword + let (line, column) = self.get_line_column(class_def.range.start().to_u32()); // Get module name from file path let module_path = self