@@ -501,8 +501,8 @@ func (sd *snapshotData) newSignatureResponse(projectID project.Handle, sig *chec
501501 Flags : uint32 (sig .Flags ()),
502502 }
503503
504- if declaration := sig .Declaration (); declaration != nil && ast . GetSourceFileOfNode ( declaration ) != nil {
505- resp .Declaration = sd .nodeHandleFrom (declaration )
504+ if sig .Declaration () != nil {
505+ resp .Declaration = sd .nodeHandleFrom (sig . Declaration () )
506506 }
507507
508508 if len (sig .TypeParameters ()) > 0 {
@@ -2362,7 +2362,11 @@ func (s *Session) handleGetSourceFile(ctx context.Context, params *GetSourceFile
23622362 return nil , err
23632363 }
23642364
2365- return s .encodeSourceFileResponse (program .GetSourceFile (params .File .ToFileName (program .BaseDirectory ())))
2365+ fileName := params .File .ToFileName (program .BaseDirectory ())
2366+ if fileName == checker .SyntheticSignatureFileName {
2367+ return s .encodeSourceFileResponse (checker .GetSyntheticSignatureSourceFile ())
2368+ }
2369+ return s .encodeSourceFileResponse (program .GetSourceFile (fileName ))
23662370}
23672371
23682372// handleGetConfigFileNames returns tsconfig file names associated with the project's command line.
@@ -5029,6 +5033,12 @@ func (sd *snapshotData) resolveNodeHandle(program *compiler.Program, handle Node
50295033 return nil , fmt .Errorf ("%w: invalid node handle %q" , ErrClientError , handle )
50305034 }
50315035 sourceFile := program .GetSourceFileByNodeID (ast .NodeId (nodeID ))
5036+ if sourceFile == nil {
5037+ syntheticFile := checker .GetSyntheticSignatureSourceFile ()
5038+ if sourceFileNodeID (syntheticFile ) == nodeID {
5039+ sourceFile = syntheticFile
5040+ }
5041+ }
50325042 if sourceFile == nil {
50335043 return nil , fmt .Errorf ("%w: node handle %q could not be resolved (file may not be loaded or handle may be stale)" , ErrClientError , handle )
50345044 }
0 commit comments