@@ -409,29 +409,48 @@ private void UpdateWordAdornments(object threadContext)
409
409
var lineStartPos = SourceBuffer . CurrentSnapshot . GetLineFromPosition ( RequestedPoint ) . Start . Position ;
410
410
var lineCaretPos = RequestedPoint . Position - lineStartPos ;
411
411
412
- var fileStartPos = - 1 ;
413
- var fileEndPos = - 1 ;
412
+ var token = clickLineSelection . IndexOf ( "file://" , StringComparison . Ordinal ) > 0 ?
413
+ "file://" :
414
+ clickLineSelection . IndexOf ( "https://" , StringComparison . Ordinal ) > 0 ?
415
+ "https://" :
416
+ null ;
417
+
418
+ var tokenStartPos = - 1 ;
419
+ var tokenEndPos = - 1 ;
414
420
var foundWord = false ;
415
421
416
- if ( ( fileStartPos = clickLineSelection . IndexOf ( "file://" , StringComparison . Ordinal ) ) > 0 &&
417
- ( fileEndPos = clickLineSelection . IndexOf ( ">" , StringComparison . Ordinal ) ) > 0 &&
418
- fileEndPos > fileStartPos && lineCaretPos > fileStartPos && lineCaretPos < fileEndPos &&
419
- fileStartPos >= 0 && fileEndPos >= 0 )
422
+ if ( ( token != null ) &&
423
+ ( tokenStartPos = clickLineSelection . IndexOf ( token , StringComparison . Ordinal ) ) > 0 &&
424
+ ( tokenEndPos = clickLineSelection . IndexOf ( ">" , StringComparison . Ordinal ) ) > 0 &&
425
+ tokenEndPos > tokenStartPos && lineCaretPos > tokenStartPos && lineCaretPos < tokenEndPos &&
426
+ tokenStartPos >= 0 && tokenEndPos >= 0 )
420
427
{
421
- fileStartPos += "file://" . Length ;
428
+ foundWord = true ;
422
429
423
- var strFilePath = clickLineSelection . Substring ( fileStartPos , fileEndPos - fileStartPos ) ;
424
-
425
- if ( File . Exists ( strFilePath ) )
430
+ switch ( token )
426
431
{
427
- var strExt = Path . GetExtension ( strFilePath ) ;
428
-
429
- foundWord = true ;
430
-
431
- var editorTool = VSDebugProPackage . Context . Settings . GetAssignedTool ( strExt ) ;
432
-
433
- if ( editorTool != string . Empty ) Process . Start ( editorTool , strFilePath ) ;
432
+ case "file://" :
433
+ {
434
+ tokenStartPos += token . Length ;
435
+ var strFilePath = clickLineSelection . Substring ( tokenStartPos , tokenEndPos - tokenStartPos ) ;
436
+ if ( File . Exists ( strFilePath ) )
437
+ {
438
+ var strExt = Path . GetExtension ( strFilePath ) ;
439
+
440
+ var editorTool = VSDebugProPackage . Context . Settings . GetAssignedTool ( strExt ) ;
441
+
442
+ if ( editorTool != string . Empty ) Process . Start ( editorTool , strFilePath ) ;
443
+ }
444
+ }
445
+ break ;
446
+ case "https://" :
447
+ {
448
+ var strUrl = clickLineSelection . Substring ( tokenStartPos , tokenEndPos - tokenStartPos ) ;
449
+ Process . Start ( strUrl ) ;
450
+ }
451
+ break ;
434
452
}
453
+
435
454
}
436
455
437
456
if ( ! foundWord )
@@ -442,8 +461,8 @@ private void UpdateWordAdornments(object threadContext)
442
461
}
443
462
444
463
var currentWord = new SnapshotSpan (
445
- new SnapshotPoint ( SourceBuffer . CurrentSnapshot , lineStartPos + fileStartPos ) ,
446
- new SnapshotPoint ( SourceBuffer . CurrentSnapshot , lineStartPos + fileEndPos ) ) ;
464
+ new SnapshotPoint ( SourceBuffer . CurrentSnapshot , lineStartPos + tokenStartPos ) ,
465
+ new SnapshotPoint ( SourceBuffer . CurrentSnapshot , lineStartPos + tokenEndPos ) ) ;
447
466
448
467
// If this is the same word we currently have, we're done (e.g. caret moved within a word).
449
468
if ( CurrentWord . HasValue && currentWord == CurrentWord )
0 commit comments