in tsc/src/common/graph.ts [231:483]
contents: value as (lsp.MarkupContent | lsp.MarkedString | lsp.MarkedString[])
}
};
}
}
public declarationResult(): DeclarationResult {
return {
id: this.nextId(),
type: ElementTypes.vertex,
label: VertexLabels.declarationResult
};
}
public definitionResult(): DefinitionResult {
return {
id: this.nextId(),
type: ElementTypes.vertex,
label: VertexLabels.definitionResult
};
}
public typeDefinitionResult(): TypeDefinitionResult {
return {
id: this.nextId(),
type: ElementTypes.vertex,
label: VertexLabels.typeDefinitionResult
};
}
public referencesResult(): ReferenceResult {
return {
id: this.nextId(),
type: ElementTypes.vertex,
label: VertexLabels.referenceResult
};
}
public implementationResult(): ImplementationResult {
return {
id: this.nextId(),
type: ElementTypes.vertex,
label: VertexLabels.implementationResult
};
}
private encodeString(contents: string): string | undefined {
return this.emitSource
? Buffer.from(contents).toString('base64')
: undefined;
}
}
export class EdgeBuilder {
private _options: ResolvedBuilderOptions;
constructor(options: ResolvedBuilderOptions) {
this._options = options;
}
private nextId(): Id {
return this._options.idGenerator();
}
public raw(kind: EdgeLabels, from: Id, to: Id): E<Vertex, Vertex, EdgeLabels> {
return {
id: this.nextId(),
type: ElementTypes.edge,
label: kind,
outV: from,
inV: to
};
}
public contains(from: Project, to: Document[]): contains;
public contains(from: Document, to: Range[]): contains;
public contains(from: Vertex, to: Vertex[]): contains {
return {
id: this.nextId(),
type: ElementTypes.edge,
label: EdgeLabels.contains,
outV: from.id,
inVs: to.map(v => v.id)
};
}
public next(from: Range, to: ResultSet): next;
public next(from: ResultSet, to: ResultSet): next;
public next(from: Range | ResultSet, to: ResultSet): next {
return {
id: this.nextId(),
type: ElementTypes.edge,
label: EdgeLabels.next,
outV: from.id,
inV: to.id
};
}
public moniker(from: ResultSet, to: Moniker): moniker;
public moniker(from: Range, to: Moniker): moniker;
public moniker(from: Range | ResultSet, to: Moniker): moniker {
return {
id: this.nextId(),
type: ElementTypes.edge,
label: EdgeLabels.moniker,
outV: from.id,
inV: to.id
};
}
public packageInformation(from: Moniker, to: PackageInformation): packageInformation {
return {
id: this.nextId(),
type: ElementTypes.edge,
label: EdgeLabels.packageInformation,
outV: from.id,
inV: to.id
};
}
public documentSymbols(from: Document, to: DocumentSymbolResult): textDocument_documentSymbol {
return {
id: this.nextId(),
type: ElementTypes.edge,
label: EdgeLabels.textDocument_documentSymbol,
outV: from.id,
inV: to.id
};
}
public foldingRange(from: Document, to: FoldingRangeResult): textDocument_foldingRange {
return {
id: this.nextId(),
type: ElementTypes.edge,
label: EdgeLabels.textDocument_foldingRange,
outV: from.id,
inV: to.id
};
}
public diagnostic(from: Project | Document, to: DiagnosticResult): textDocument_diagnostic {
return {
id: this.nextId(),
type: ElementTypes.edge,
label: EdgeLabels.textDocument_diagnostic,
outV: from.id,
inV: to.id
};
}
public hover(from: Range | ResultSet, to: HoverResult): textDocument_hover {
return {
id: this.nextId(),
type: ElementTypes.edge,
label: EdgeLabels.textDocument_hover,
outV: from.id,
inV: to.id
};
}
public declaration(from: Range | ResultSet, to: DeclarationResult): textDocument_declaration {
return {
id: this.nextId(),
type: ElementTypes.edge,
label: EdgeLabels.textDocument_declaration,
outV: from.id,
inV: to.id
};
}
public definition(from: Range | ResultSet, to: DefinitionResult): textDocument_definition {
return {
id: this.nextId(),
type: ElementTypes.edge,
label: EdgeLabels.textDocument_definition,
outV: from.id,
inV: to.id
};
}
public typeDefinition(from: Range | ResultSet, to: TypeDefinitionResult): textDocument_typeDefinition {
return {
id: this.nextId(),
type: ElementTypes.edge,
label: EdgeLabels.textDocument_typeDefinition,
outV: from.id,
inV: to.id
};
}
public references(from: Range | ResultSet, to: ReferenceResult): textDocument_references {
return {
id: this.nextId(),
type: ElementTypes.edge,
label: EdgeLabels.textDocument_references,
outV: from.id,
inV: to.id
};
}
public implementation(from: Range | ResultSet, to: ImplementationResult): textDocument_implementation {
return {
id: this.nextId(),
type: ElementTypes.edge,
label: EdgeLabels.textDocument_implementation,
outV: from.id,
inV: to.id
};
}
public item(from: DeclarationResult, to: Range[], shard: Document | Project): item;
public item(from: DefinitionResult, to: Range[], shard: Document | Project): item;
public item(from: TypeDefinitionResult, to: Range[], shard: Document | Project): item;
public item(from: ReferenceResult, to: ReferenceResult[], shard: Document | Project): item;
public item(from: ReferenceResult, to: Range[], shard: Document | Project, property: ItemEdgeProperties.declarations | ItemEdgeProperties.definitions | ItemEdgeProperties.references): item;
public item(from: ReferenceResult, to: Moniker[], shard: Document | Project): item;
public item(from: ImplementationResult, to: Range[], shard: Document | Project): item;
public item(from: ImplementationResult, to: ImplementationResult[], shard: Document | Project): item;
public item(from: DeclarationResult | DefinitionResult | TypeDefinitionResult | ReferenceResult | ImplementationResult, to: Vertex[], shard: Document | Project, property?: ItemEdgeProperties.declarations | ItemEdgeProperties.definitions | ItemEdgeProperties.references): item {
if (to.length === 0) {
const result: item = {
id: this.nextId(),
type: ElementTypes.edge,
label: EdgeLabels.item,
outV: from.id,
inVs: [],
shard: shard.id
};
// We have an empty to array. So treat the empty set as references or use the property provided.
if (from.label === 'referenceResult') {
result.property = property !== undefined ? property : ItemEdgeProperties.references;
}
return result;
}
const toKind = to[0].label;
const result: item = {
id: this.nextId(),
type: ElementTypes.edge,
label: EdgeLabels.item,
outV: from.id,
inVs: to.map(v => v.id),
shard: shard.id
};
switch (from.label) {
case 'declarationResult':
break;
case 'definitionResult':
break;
case 'referenceResult':
switch (toKind) {
case VertexLabels.range:
if (property === undefined) {