@@ -18,6 +18,12 @@ use crate::daemon::state::PROTOCOL_VERSION;
1818const EXTENSION_STORE_URL : & str =
1919 "https://chromewebstore.google.com/detail/hhcmgoofomhgciiibhipgmgkgnoenaoi" ;
2020
21+ /// Edge Add-ons listing for the browser-skill extension.
22+ const EXTENSION_STORE_URL_EDGE : & str = "https://microsoftedge.microsoft.com/addons/detail/browserskill/emacgiaaaiojkkpkddmmdfhmokgmnikg" ;
23+
24+ /// Store listings highlighted in repair hints, in the order they appear.
25+ const EXTENSION_STORE_URLS : [ & str ; 2 ] = [ EXTENSION_STORE_URL , EXTENSION_STORE_URL_EDGE ] ;
26+
2127/// Status of a single doctor check. `Ok` / `Fail` are the legacy two
2228/// states; `NotApplicable` (review M2) is reported as "N/A" in human
2329/// output and as `"status": "na"` in `--json` output, so a check that
@@ -420,25 +426,25 @@ fn check_extension_connected(status: Option<&StatusResult>) -> CheckResult {
420426 CheckResult :: fail (
421427 name,
422428 "0 browsers connected" ,
423- format ! ( "install the extension from {EXTENSION_STORE_URL} and load it in Chromium" ) ,
429+ format ! (
430+ "install the extension from {EXTENSION_STORE_URL} (Chrome) \
431+ or {EXTENSION_STORE_URL_EDGE} (Edge) and load it in the browser"
432+ ) ,
424433 )
425434 }
426435}
427436
428437/// Highlight known URLs in repair hints for terminal output. Plain
429438/// text is preserved in `--json` and in stored [`CheckResult::hint`].
430439fn style_hint ( hint : & str ) -> String {
431- if !hint. contains ( EXTENSION_STORE_URL ) {
432- return hint. to_string ( ) ;
433- }
434- hint. replace (
435- EXTENSION_STORE_URL ,
436- & style ( EXTENSION_STORE_URL )
437- . cyan ( )
438- . bold ( )
439- . underlined ( )
440- . to_string ( ) ,
441- )
440+ let mut styled = hint. to_string ( ) ;
441+ for url in EXTENSION_STORE_URLS {
442+ if !styled. contains ( url) {
443+ continue ;
444+ }
445+ styled = styled. replace ( url, & style ( url) . cyan ( ) . bold ( ) . underlined ( ) . to_string ( ) ) ;
446+ }
447+ styled
442448}
443449
444450fn render_human ( checks : & [ CheckResult ] ) {
@@ -504,6 +510,26 @@ mod m2_tests {
504510 hint. contains( EXTENSION_STORE_URL ) ,
505511 "hint should include Chrome Web Store URL: {hint}"
506512 ) ;
513+ assert ! (
514+ hint. contains( EXTENSION_STORE_URL_EDGE ) ,
515+ "hint should include Edge Add-ons URL: {hint}"
516+ ) ;
517+ }
518+
519+ #[ test]
520+ fn style_hint_preserves_every_store_url ( ) {
521+ let hint = check_extension_connected ( Some ( & fake_status ( Vec :: new ( ) , Vec :: new ( ) ) ) )
522+ . hint
523+ . expect ( "extension disconnected should include a hint" ) ;
524+ let styled = style_hint ( & hint) ;
525+ // Whether or not the terminal accepts colors, styling must never drop or
526+ // mangle a URL the user has to click.
527+ for url in EXTENSION_STORE_URLS {
528+ assert ! (
529+ styled. contains( url) ,
530+ "styled hint should still contain {url}: {styled}"
531+ ) ;
532+ }
507533 }
508534
509535 #[ test]
0 commit comments