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

Respect LSIF 4.x specification of unique ranges #8

Description

@wiwa

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions