(ctx context.Context, fileName string, position int)
| 16 | ) |
| 17 | |
| 18 | func (l *LanguageService) GetSymbolAtPosition(ctx context.Context, fileName string, position int) (*ast.Symbol, error) { |
| 19 | program, file := l.tryGetProgramAndFile(fileName) |
| 20 | if file == nil { |
| 21 | return nil, fmt.Errorf("%w: %s", ErrNoSourceFile, fileName) |
| 22 | } |
| 23 | node := astnav.GetTokenAtPosition(file, position) |
| 24 | if node == nil { |
| 25 | return nil, fmt.Errorf("%w: %s:%d", ErrNoTokenAtPosition, fileName, position) |
| 26 | } |
| 27 | checker, done := program.GetTypeCheckerForFile(ctx, file) |
| 28 | defer done() |
| 29 | return checker.GetSymbolAtLocation(node), nil |
| 30 | } |
| 31 | |
| 32 | func (l *LanguageService) GetSymbolAtLocation(ctx context.Context, node *ast.Node) *ast.Symbol { |
| 33 | program := l.GetProgram() |
nothing calls this directly
no test coverage detected