Skip to content

LSIF confusion #680

@mpickering

Description

@mpickering

I am trying to implement a program which generates the LSIF files as specified in #623 but am struggling to understand how cross-package references are supposed to work.

Question 1

In my mental model, what should happen is that each package generates its own LSIF file. Called lsif.json which contains the indicies for a specific package. Then in a local project, I generate a lsif.json file which includes these lsif.json files from whereever they are stored.

However, is it intended that all these lsif.json files are combined together so that there is one lsif.json file for a project which copies in the lsif.json files from dependencies?

Question 2: URIs

For a single file which exists on disk it is clear the URI should be something like:

file:///home/matt/hie-lsif/test/simple-tests/A.js

However, if an external package distributes an LSIF file what should it declare its URI as?
In the first case our decision is forced because vscode requests information about file://... from the language server. Is this a situation to set the URI to a URL or embed the module content in using data?

Question 3: Confusing example from imports section

In the following example, the observablemap.d.ts module is imported but the node 76 is not used
anywhere in the example so it's not clear what the point of it is. Can this please be clarified?

{ id: 76, type: "vertex", label: "document", uri: "file:///Users/dirkb/samples/node_modules/mobx/lib/types/observablemap.d.ts", languageId: "typescript" }
{ id: 77, type: "vertex", label: "externalImportResult" }
{ id: 61, type: "edge", label: "imports", outV: 59, inV: 60 }
{ id: 80, type: "vertex", label: "range", start: { line: 30, character: 21 }, end: { line: 30, character: 34 }, tag: { type: "definition", text: "ObservableMap", kind: 5, fullRange: {start: { line: 30, character:0 }, end: { line: 81, character:1 } } } }
{ id: 88, type: "vertex", label: "externalImportItem", moniker: "ObservableMap", rangeIds:[80] }
{ id: 89, type: "edge", label: "item", outV: 77, inV: 88 }

cc @dbaeumer

Could you also please provide complete .json dumps of the examples in the specification as it's hard to verify if the JSON produced is correct when only fragments are included.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions