Currently, lsif-semanticdb does not necessarily generate unique ranges.
Consider this example:
package foo
import bar.B
object A
package bar {
class B
object B
}
This generates the following lines in dump.lsif:
{"id":47,"type":"vertex","label":"range","start":{"line":2,"character":11},"end":{"line":2,"character":12}}
{"id":48,"type":"edge","label":"next","outV":47,"inV":38}
{"id":49,"type":"vertex","label":"range","start":{"line":2,"character":11},"end":{"line":2,"character":12}}
Note that ids 47 and 49 are the exact same range.
This is likely because the semanticdb info from metac (version 2.12.8) generates references for both the class and the companion object:
occurrences {
range {
start_line: 2
start_character: 11
end_line: 2
end_character: 12
}
symbol: "foo/bar/B."
role: REFERENCE
}
occurrences {
range {
start_line: 2
start_character: 11
end_line: 2
end_character: 12
}
symbol: "foo/bar/B#"
role: REFERENCE
}
The solution would likely be something like range((2,11),(2,12)) goes to a resultSet which has a textDocument/definition with 2 items in inVs (one for the class and one for the companion object).
Currently,
lsif-semanticdbdoes not necessarily generate unique ranges.Consider this example:
This generates the following lines in
dump.lsif:{"id":47,"type":"vertex","label":"range","start":{"line":2,"character":11},"end":{"line":2,"character":12}} {"id":48,"type":"edge","label":"next","outV":47,"inV":38} {"id":49,"type":"vertex","label":"range","start":{"line":2,"character":11},"end":{"line":2,"character":12}}Note that
ids47and49are the exact same range.This is likely because the
semanticdbinfo frommetac(version2.12.8) generates references for both the class and the companion object:occurrences { range { start_line: 2 start_character: 11 end_line: 2 end_character: 12 } symbol: "foo/bar/B." role: REFERENCE } occurrences { range { start_line: 2 start_character: 11 end_line: 2 end_character: 12 } symbol: "foo/bar/B#" role: REFERENCE }The solution would likely be something like
range((2,11),(2,12))goes to aresultSetwhich has atextDocument/definitionwith 2 items ininVs(one for the class and one for the companion object).