File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
src/Microsoft.SqlTools.ServiceLayer/QueryExecution Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,11 @@ public class CopyResults2RequestParams : SubsetParams
6464 /// </summary>
6565 public class CopyResults2RequestResult
6666 {
67+ /// <summary>
68+ /// The content to be copied to the clipboard.
69+ /// If this is populated, the client is responsible for copying it to the clipboard.
70+ /// </summary>
71+ public string Content { get ; set ; }
6772 }
6873
6974 /// <summary>
Original file line number Diff line number Diff line change @@ -1004,8 +1004,16 @@ internal async Task HandleCopyResults2Request(CopyResults2RequestParams requestP
10041004
10051005 cts . Token . ThrowIfCancellationRequested ( ) ;
10061006
1007- await ClipboardService . SetTextAsync ( content ) ;
1008- await requestContext . SendResult ( new CopyResults2RequestResult ( ) ) ;
1007+ try
1008+ {
1009+ await ClipboardService . SetTextAsync ( content ) ;
1010+ await requestContext . SendResult ( new CopyResults2RequestResult ( ) ) ;
1011+ }
1012+ catch ( Exception )
1013+ {
1014+ // If clipboard copy fails (e.g. missing xsel on Linux), send content back to client
1015+ await requestContext . SendResult ( new CopyResults2RequestResult { Content = content } ) ;
1016+ }
10091017 }
10101018 catch ( OperationCanceledException )
10111019 {
You can’t perform that action at this time.
0 commit comments