@@ -38,7 +38,15 @@ import util::IDEServices;
3838import ParseTree ;
3939import util ::ParseErrorRecovery ;
4040import util ::Reflective ;
41- import lang ::pico ::\syntax ::Main ;
41+ extend lang ::pico ::\syntax ::Main ;
42+
43+ syntax IdType
44+ = func: Type returnType Id id "(" {IdType "," }* params ")" "=" Expression body ";"
45+ ;
46+
47+ syntax Expression
48+ = call: Id id "(" {Expression "," }* args ")"
49+ ;
4250
4351private Tree (str _input, loc _origin) picoParser (bool allowRecovery ) {
4452 return ParseTree ::parser (#start [Program ], allowRecovery =allowRecovery , filters =allowRecovery ? {createParseErrorFilter (false )} : {});
@@ -57,7 +65,10 @@ set[LanguageService] picoLanguageServer(bool allowRecovery) = {
5765 execution (picoExecutionService ),
5866 inlayHint (picoInlayHintService ),
5967 definition (picoDefinitionService ),
60- codeAction (picoCodeActionService )
68+ codeAction (picoCodeActionService ),
69+ callHierarchy (picoCallHierarchyService ),
70+ incomingCalls (picoIncomingCallsService ),
71+ outgoingCalls (picoOutgoingCallsService )
6172};
6273
6374set [LanguageService ] picoLanguageServer () = picoLanguageServer (false );
@@ -188,6 +199,18 @@ value picoExecutionService(removeDecl(start[Program] program, IdType toBeRemoved
188199 return ("result" : true );
189200}
190201
202+ set [CallHierarchyItem ] picoCallHierarchyService (Focus _:[*_, call :(Expression ) `<Id id > (<{Expression "," }* _> )` , *_])
203+ = {item ("<id > " , function (), call @\loc )};
204+
205+ default set [CallHierarchyItem ] picoCallHierarchyService (Focus _)
206+ = {};
207+
208+ set [loc ] picoIncomingCallsService (Focus focus :[(Expression ) `<Id defId > (<{Expression "," }* _> )` , *_], value _)
209+ = {call @\loc | /call :(Expression ) `<Id callId > (<{Expression "," }* _> )` := focus [-1 ], "<defId > " == "<callId > " };
210+
211+ set [loc ] picoOutgoingCallsService (Focus focus :[(Expression ) `<Id defId > (<{Expression "," }* _> )` , *_], value _)
212+ = {call @\loc | /call :(Expression ) `<Id callId > (<{Expression "," }* _> )` := focus [-1 ], "<defId > " == "<callId > " };
213+
191214@synopsis {The main function registers the Pico language with the IDE}
192215@description {
193216Register the Pico language and the contributions that supply the IDE with features.
0 commit comments