Skip to content

Commit

Permalink
KLS: Don't discard an unresolved empty location during remapping. (ky…
Browse files Browse the repository at this point in the history
…the#2946)

This is a follow-up to kythe#2944. In addition to not throwing away empty spans from
the service, also ensure that when those spans are not discarded when they
don't get moved by remapping.
  • Loading branch information
creachadair committed Aug 20, 2018
1 parent 7866765 commit 8195527
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions kythe/go/languageserver/languageserver.go
Expand Up @@ -307,12 +307,13 @@ func (ls *Server) TextDocumentDefinition(params lsp.TextDocumentPositionParams)
return []lsp.Location{loc}, nil
}

// There definition range doesn't exist anymore
return []lsp.Location{}, nil
// Their definition range doesn't exist anymore, or is empty. If
// it's empty fall through and return the original location Kythe
// reported.
if l.Range.Start != l.Range.End {
return []lsp.Location{}, nil
}
}

log.Printf("Unable to map definition to local location")
// We don't how to map it so we just return the location from Kythe
return []lsp.Location{*l}, nil
}

Expand Down

0 comments on commit 8195527

Please sign in to comment.