Thanks for the input and interest.
np I’m actually just trying to help out
and answer a few questions on the forums, sucking up to Jon, so he’ll give me (get|set)_view_position APIs. Ulterior motives haha.
I plan to have it look forward from the current cursor location, but this is a very early implementation
Only real issue you’ll have is if you decide to use the replacement format string capabilities of view.find_all then you’ll want the interface to be consistent with single selection replace. view.find doesn’t have the replace functionality. You could bisect the view.find_all
regions to find the closest selection to your first selection though (copping the wasted perf on the chin) The other option is integration with find/replace commands somehow. I don’t think that’s viable with the current state of the api though.
May I suggest that rather than using window.show_quick_panel(), just integrating into the Command Palette instead?
what he said You could still use the sublime-settings file though keyed with identifiers for parameters for the case that you want to run a batch (DRY! and all that …)
eg.
{
"replacements": {
"html5_remove_deprecated_type_attr":
{
"find": "<(style|script)^>]+type=(\"|')text/(css|javascript)(\"|')^>]*>",
"replace": "<\\1>",
"greedy": true,
"case": true
}
]
}
}
You could have the RegReplaceCommand accept a list of ids
(declared in the sublime-commands file) to do the lookup.
{
"caption": "Reg Replace: HTML5: Remove deprecated `@type` for script|style",
"command": "reg_replace_menu",
"args" : {"replacements" : "html5_remove_deprecated_type_attr"]}
}
The replacements
list (in either sublime-settings or sublime-commands files) could do sublime-settings lookups on finding a “string” or inline parameterisation for {objects}.