Skip to content
This repository has been archived by the owner on Apr 7, 2021. It is now read-only.

Respect LSIF 4.x specification of unique ranges #8

Open
wiwa opened this issue Mar 2, 2021 · 0 comments
Open

Respect LSIF 4.x specification of unique ranges #8

wiwa opened this issue Mar 2, 2021 · 0 comments

Comments

@wiwa
Copy link

wiwa commented Mar 2, 2021

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).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant