svlad-90 / DLT-Message-Analyzer

"Extended search" plugin for the DLT-viewer
GNU General Public License v3.0
77 stars 13 forks source link

[SEARCH] Add regex group name glossary #218

Closed svlad-90 closed 2 days ago

svlad-90 commented 6 days ago

The DLT Message Analyzer dlt-viewer's plugin heavily uses the regular expression group names feature. The plugin interprets the regex group names to tokenize each regular expression name and the text it contains and uses that data for feature-specific purposes. For example, it gets X and Y data for the plot points, method names for sequence diagram arrows, RGB codes for text highlighting, indexes for grouped view data nesting, etc.

Too many features use this mechanism, so it is hard for the user to remember all supported regular group names without continuously cross-checking with the plugin's documentation. The idea is to add a glossary within the plugin so that the user can reference supported group name templates on the fly.

Please create a context menu item for the regex text input field with a "regex group names" name containing sub-groups with feature names and sub-sub-groups with regular expression group types.

Example:

When the user presses any of the items, the currently selected text in the regex should be wrapped with the corresponding group name.

For example, if the user selects the "regex group names-> Highlighting -> RGB highlighting," the selected text should change to:

(?<RGB_RED_GREEN_BLUE>some_selected_text)

This will make the regex group names interpreter more intuitive for the new users.

Currently, creating the regex, e.g., for Gantt charts, looks like black magic:

(?<PARL_LDREvents_AllEvents>(?<PARType_LDREvents_GANTT>MT:EV))\|EN:(?<PGN_LDREvents_1>(?<VAR_EVENT_TYPE>.*?))\|(?>(?<PGE_LDREvents_1_start>ET:START)|(?<PGE_LDREvents_1_end>ET:END))\|EID:(?<PGEID_LDREvents_1>[\d]+)\|EM:(?<PGMD_LDREvents_1_EM>.*)

We should make the learning curve less steep. Adding the possibility to reference all supported regex group names without cross-checking with documentation would be an excellent first step in the right direction.