-
Notifications
You must be signed in to change notification settings - Fork 840
hrw4u: Add support for += / add-header #12588
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for the += operator (add-header functionality) in hrw4u and refactors the table definitions to use a type-safe MapParams class instead of tuples. The changes improve code readability and maintainability while extending the language's capabilities.
Key changes:
- Introduces
+=operator for adding headers to existing header values - Replaces tuple-based table definitions with
MapParamstype class for better code clarity - Updates grammar to support
PLUSEQUALtoken
Reviewed Changes
Copilot reviewed 20 out of 21 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/hrw4u/grammar/hrw4u.g4 | Adds PLUSEQUAL token and statement rule for += operator |
| tools/hrw4u/src/types.py | Defines new MapParams class and ADD_HEADER magic string |
| tools/hrw4u/src/visitor.py | Implements handling for += assignments |
| tools/hrw4u/src/tables.py | Refactors all table definitions to use MapParams instead of tuples |
| tools/hrw4u/src/symbols.py | Updates symbol resolution logic for new MapParams structure and adds += support |
| tools/hrw4u/src/symbols_base.py | Updates type signatures to use MapParams |
| tools/hrw4u/src/hrw_symbols.py | Adapts reverse symbol resolution for MapParams and add-header |
| tools/hrw4u/src/common.py | Adds ADD_OPERATION constant |
| tools/hrw4u/src/suggestions.py | Updates suggestion logic for MapParams |
| tools/hrw4u/src/lsp/*.py | Updates LSP features (hover, completions) for MapParams |
| tools/hrw4u/src/kg_visitor.py | Updates knowledge graph generation for MapParams |
| tools/hrw4u/src/generators.py | Updates reverse mapping generators for MapParams |
| tools/hrw4u/tests/data/hooks/remap.* | Test data for += operator usage |
| tools/hrw4u/tests/data/ops/* | Test data updates for QSA and boolean handling |
| doc/admin-guide/configuration/hrw4u.en.rst | Documentation for += operator usage |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
This also cleans up the maps.py Maps definitions, including moving most of the parameter values into a type class. This makes for more readable code, even though it adds a bit additional code.
|
I resolved the nitpick comments from CoPilot. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems cool
This also cleans up the maps.py Maps definitions, including moving most of the parameter values into a type class. This makes for more readable code, even though it adds a bit additional code.