(doc document.ComposeDocument, params *protocol.PrepareRenameParams)
| 6 | ) |
| 7 | |
| 8 | func PrepareRename(doc document.ComposeDocument, params *protocol.PrepareRenameParams) (*protocol.Range, error) { |
| 9 | highlights, err := DocumentHighlight(doc, params.Position) |
| 10 | if err != nil || len(highlights) == 0 { |
| 11 | return nil, err |
| 12 | } |
| 13 | |
| 14 | for _, highlight := range highlights { |
| 15 | if insideRange(highlight.Range, params.Position.Line, params.Position.Character) { |
| 16 | return &highlight.Range, nil |
| 17 | } |
| 18 | } |
| 19 | return nil, nil |
| 20 | } |