@@ -966,6 +966,7 @@ const invalidSyntacticModeCommands: readonly protocol.CommandTypes[] = [
966
966
protocol . CommandTypes . NavtoFull ,
967
967
protocol . CommandTypes . DocumentHighlights ,
968
968
protocol . CommandTypes . DocumentHighlightsFull ,
969
+ protocol . CommandTypes . PreparePasteEdits ,
969
970
] ;
970
971
971
972
export interface SessionOptions {
@@ -2966,6 +2967,10 @@ export class Session<TMessage = string> implements EventSender {
2966
2967
return project . getLanguageService ( ) . getMoveToRefactoringFileSuggestions ( file , this . extractPositionOrRange ( args , scriptInfo ) , this . getPreferences ( file ) ) ;
2967
2968
}
2968
2969
2970
+ private preparePasteEdits ( args : protocol . PreparePasteEditsRequestArgs ) : boolean {
2971
+ const { file, project } = this . getFileAndProject ( args ) ;
2972
+ return project . getLanguageService ( ) . preparePasteEditsForFile ( file , args . copiedTextSpan . map ( copies => this . getRange ( { file, startLine : copies . start . line , startOffset : copies . start . offset , endLine : copies . end . line , endOffset : copies . end . offset } , this . projectService . getScriptInfoForNormalizedPath ( file ) ! ) ) ) ;
2973
+ }
2969
2974
private getPasteEdits ( args : protocol . GetPasteEditsRequestArgs ) : protocol . PasteEditsAction | undefined {
2970
2975
const { file, project } = this . getFileAndProject ( args ) ;
2971
2976
const copiedFrom = args . copiedFrom
@@ -3716,6 +3721,9 @@ export class Session<TMessage = string> implements EventSender {
3716
3721
[ protocol . CommandTypes . GetMoveToRefactoringFileSuggestions ] : ( request : protocol . GetMoveToRefactoringFileSuggestionsRequest ) => {
3717
3722
return this . requiredResponse ( this . getMoveToRefactoringFileSuggestions ( request . arguments ) ) ;
3718
3723
} ,
3724
+ [ protocol . CommandTypes . PreparePasteEdits ] : ( request : protocol . PreparePasteEditsRequest ) => {
3725
+ return this . requiredResponse ( this . preparePasteEdits ( request . arguments ) ) ;
3726
+ } ,
3719
3727
[ protocol . CommandTypes . GetPasteEdits ] : ( request : protocol . GetPasteEditsRequest ) => {
3720
3728
return this . requiredResponse ( this . getPasteEdits ( request . arguments ) ) ;
3721
3729
} ,
0 commit comments