@@ -937,6 +937,7 @@ const invalidPartialSemanticModeCommands: readonly protocol.CommandTypes[] = [
937
937
protocol . CommandTypes . ProvideCallHierarchyIncomingCalls ,
938
938
protocol . CommandTypes . ProvideCallHierarchyOutgoingCalls ,
939
939
protocol . CommandTypes . GetPasteEdits ,
940
+ protocol . CommandTypes . CopilotRelated ,
940
941
] ;
941
942
942
943
const invalidSyntacticModeCommands : readonly protocol . CommandTypes [ ] = [
@@ -2030,7 +2031,6 @@ export class Session<TMessage = string> implements EventSender {
2030
2031
} ;
2031
2032
} ) ;
2032
2033
}
2033
-
2034
2034
private mapCode ( args : protocol . MapCodeRequestArgs ) : protocol . FileCodeEdits [ ] {
2035
2035
const formatOptions = this . getHostFormatOptions ( ) ;
2036
2036
const preferences = this . getHostPreferences ( ) ;
@@ -2051,6 +2051,14 @@ export class Session<TMessage = string> implements EventSender {
2051
2051
return this . mapTextChangesToCodeEdits ( changes ) ;
2052
2052
}
2053
2053
2054
+ private getCopilotRelatedInfo ( args : protocol . FileRequestArgs ) : protocol . CopilotRelatedItems {
2055
+ const { file, project } = this . getFileAndProject ( args ) ;
2056
+
2057
+ return {
2058
+ relatedFiles : project . getLanguageService ( ) . getImports ( file ) ,
2059
+ } ;
2060
+ }
2061
+
2054
2062
private setCompilerOptionsForInferredProjects ( args : protocol . SetCompilerOptionsForInferredProjectsArgs ) : void {
2055
2063
this . projectService . setCompilerOptionsForInferredProjects ( args . options , args . projectRootPath ) ;
2056
2064
}
@@ -3791,6 +3799,9 @@ export class Session<TMessage = string> implements EventSender {
3791
3799
[ protocol . CommandTypes . MapCode ] : ( request : protocol . MapCodeRequest ) => {
3792
3800
return this . requiredResponse ( this . mapCode ( request . arguments ) ) ;
3793
3801
} ,
3802
+ [ protocol . CommandTypes . CopilotRelated ] : ( request : protocol . CopilotRelatedRequest ) => {
3803
+ return this . requiredResponse ( this . getCopilotRelatedInfo ( request . arguments ) ) ;
3804
+ } ,
3794
3805
} ) ) ;
3795
3806
3796
3807
public addProtocolHandler ( command : string , handler : ( request : protocol . Request ) => HandlerResponse ) : void {
0 commit comments