@@ -86,28 +86,29 @@ class ShareWorkbenchContribution {
86
86
const progressService = accessor . get ( IProgressService ) ;
87
87
const selection = accessor . get ( ICodeEditorService ) . getActiveCodeEditor ( ) ?. getSelection ( ) ?? undefined ;
88
88
89
- const uri = await progressService . withProgress ( {
89
+ const result = await progressService . withProgress ( {
90
90
location : ProgressLocation . Window ,
91
91
detail : localize ( 'generating link' , 'Generating link...' )
92
92
} , async ( ) => shareService . provideShare ( { resourceUri, selection } , new CancellationTokenSource ( ) . token ) ) ;
93
93
94
- if ( uri ) {
95
- const uriText = uri . toString ( ) ;
94
+ if ( result ) {
95
+ const uriText = result . toString ( ) ;
96
+ const isResultText = typeof result === 'string' ;
96
97
await clipboardService . writeText ( uriText ) ;
97
98
98
99
dialogService . prompt (
99
100
{
100
101
type : Severity . Info ,
101
- message : localize ( 'shareSuccess' , 'Copied link to clipboard!' ) ,
102
+ message : isResultText ? localize ( 'shareTextSuccess' , 'Copied text to clipboard!' ) : localize ( 'shareSuccess' , 'Copied link to clipboard!' ) ,
102
103
custom : {
103
104
icon : Codicon . check ,
104
105
markdownDetails : [ {
105
106
markdown : new MarkdownString ( `<div aria-label='${ uriText } '>${ uriText } </div>` , { supportHtml : true } ) ,
106
- classes : [ 'share-dialog-input' ]
107
+ classes : [ isResultText ? 'share-dialog-input-text' : 'share-dialog-input-link ']
107
108
} ]
108
109
} ,
109
110
cancelButton : localize ( 'close' , 'Close' ) ,
110
- buttons : [ { label : localize ( 'open link' , 'Open Link' ) , run : ( ) => { urlService . open ( uri , { openExternal : true } ) ; } } ]
111
+ buttons : isResultText ? [ ] : [ { label : localize ( 'open link' , 'Open Link' ) , run : ( ) => { urlService . open ( result , { openExternal : true } ) ; } } ]
111
112
}
112
113
) ;
113
114
}
0 commit comments