@@ -45,6 +45,7 @@ type ServerOptions struct {
4545 ParseCache * project.ParseCache
4646 NpmInstall func (cwd string , args []string ) ([]byte , error )
4747 ProgressDelay time.Duration // delay before showing progress UI; 0 means no delay
48+ SetParentProcessID func (parentPID int )
4849}
4950
5051func NewServer (opts * ServerOptions ) * Server {
@@ -66,6 +67,7 @@ func NewServer(opts *ServerOptions) *Server {
6667 typingsLocation : opts .TypingsLocation ,
6768 parseCache : opts .ParseCache ,
6869 npmInstall : opts .NpmInstall ,
70+ startWatchdog : opts .SetParentProcessID ,
6971 initComplete : make (chan struct {}),
7072 progressDelay : opts .ProgressDelay ,
7173 }
@@ -204,6 +206,8 @@ type Server struct {
204206
205207 progressDelay time.Duration
206208 projectProgress * projectLoadingProgress
209+
210+ startWatchdog func (parentPID int )
207211}
208212
209213func (s * Server ) Session () * project.Session { return s .session }
@@ -1011,6 +1015,10 @@ func (s *Server) handleInitialize(ctx context.Context, params *lsproto.Initializ
10111015 s .logger .SetVerbose (true )
10121016 }
10131017
1018+ if s .startWatchdog != nil && params .ProcessId .Integer != nil {
1019+ s .startWatchdog (int (* params .ProcessId .Integer ))
1020+ }
1021+
10141022 response := & lsproto.InitializeResult {
10151023 ServerInfo : & lsproto.ServerInfo {
10161024 Name : "typescript-go" ,
0 commit comments