Skip to content

Commit f9badeb

Browse files
pi-anlclaude
andcommitted
lib/lvgl: Update documentation to show source file references in stubs.
Updated examples and features list to demonstrate the new source reference functionality that includes file:line references in generated docstrings. πŸ€– Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent de3c8f6 commit f9badeb

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

β€ŽDOCSTRING_PARSING.mdβ€Ž

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ class label:
166166
167167
Args:
168168
text (str): '\0' terminated character string. NULL to refresh with the current text.
169+
170+
Source: src/widgets/label/lv_label.h:88
169171
"""
170172
...
171173

@@ -178,6 +180,8 @@ class label:
178180
- If Widget is not scrolled return 0.
179181
- If scrolled return > 0.
180182
- If scrolled inside (elastic scroll) return < 0.
183+
184+
Source: src/core/lv_obj_scroll.h:122
181185
"""
182186
...
183187
```
@@ -190,6 +194,8 @@ def task_handler() -> int:
190194
191195
Returns:
192196
time till next timer should run
197+
198+
Source: src/core/lv_timer.h:77
193199
"""
194200
...
195201
```
@@ -199,8 +205,9 @@ def task_handler() -> int:
199205
- **Autocompletion**: Full function and method suggestions
200206
- **Type Hints**: Proper Python type annotations for all parameters
201207
- **Documentation**: Rich docstrings with parameter descriptions
208+
- **Source Navigation**: File:line references for quick access to C implementation
202209
- **Error Prevention**: Type checking catches incorrect parameter types
203-
- **Navigation**: Jump to definition support in modern IDEs
210+
- **Code Understanding**: Easy navigation between Python API and LVGL internals
204211

205212
## 8. **Key Features**
206213

@@ -210,6 +217,7 @@ def task_handler() -> int:
210217
- **🎯 Smart**: Handles class methods vs static methods appropriately
211218
- **πŸ“Š Type-aware**: Converts C types to Python type hints
212219
- **🎨 IDE-friendly**: Generates standard Python docstring format
220+
- **πŸ”— Source Navigation**: File:line references to original C implementation
213221
- **⚑ Custom Implementation**: Uses regex-based parsing, no external dependencies
214222
- **πŸ”§ Separate Build**: Optional target that doesn't slow down main builds
215223

@@ -228,6 +236,12 @@ The Doxygen comment parsing is implemented entirely with Python's built-in `re`
228236
- `parse_doxygen_comment()`: Main parser using string splitting and pattern matching
229237
- `find_function_docs_in_sources()`: O(1) lookup in pre-built documentation index
230238

239+
### Source Reference Generation
240+
- Captures source file path and line number during documentation extraction
241+
- Cleans paths to show relative LVGL paths (e.g., `src/widgets/label/lv_label.h:88`)
242+
- Adds `Source: file:line` reference at end of each docstring
243+
- Uses 1-based line numbering for editor compatibility
244+
231245
### Supported Doxygen Tags
232246
- `@param name description` - Function parameters
233247
- `@return description` - Return value documentation (with bullet point formatting)
@@ -246,6 +260,7 @@ The Doxygen comment parsing is implemented entirely with Python's built-in `re`
246260
The result is that Python developers get:
247261
- **Full IDE autocompletion** for all LVGL functions and methods
248262
- **Rich documentation** automatically extracted from C source comments
263+
- **Source navigation** with direct file:line references to C implementation
249264
- **Proper type hints** for better code quality and error prevention
250265
- **Fast build times** with documentation generation as separate optional step
251266
- **Professional development experience** matching modern Python libraries

0 commit comments

Comments
Β (0)