lsif-protocol
Advanced tools
Comparing version 0.5.0-next.5 to 0.5.1
import * as lsp from 'vscode-languageserver-protocol'; | ||
interface Validator<T> { | ||
(value: T | undefined | null): boolean; | ||
} | ||
declare enum PropertyFlags { | ||
none = 0, | ||
optional = 1, | ||
undefined = 2, | ||
null = 4 | ||
} | ||
declare namespace PropertyFlags { | ||
function isOptional(value: PropertyFlags): boolean; | ||
function isUndefined(value: PropertyFlags): boolean; | ||
function isNull(value: PropertyFlags): boolean; | ||
} | ||
declare class Property<T> { | ||
protected readonly validator: Validator<T>; | ||
readonly flags: PropertyFlags; | ||
constructor(validator: Validator<T>, flags?: PropertyFlags); | ||
validate(value: T | undefined | null): boolean; | ||
} | ||
declare class StringEnumProperty extends Property<string> { | ||
constructor(values: Set<string | undefined | null>, flags?: PropertyFlags); | ||
} | ||
declare class VertexLabelsProperty extends Property<VertexLabels> { | ||
constructor(valueOrFlags?: VertexLabels | PropertyFlags, flags?: PropertyFlags); | ||
} | ||
declare class EdgeLabelsProperty extends Property<EdgeLabels> { | ||
constructor(valueOrFlags?: EdgeLabels | PropertyFlags, flags?: PropertyFlags); | ||
} | ||
declare type NotUndefined<T> = T extends undefined ? never : T; | ||
declare type _objectDescription<T extends Object> = { | ||
readonly [P in keyof T]-?: T[P] extends VertexLabels ? VertexLabelsProperty : T[P] extends EdgeLabels ? EdgeLabelsProperty : Property<NotUndefined<T[P]>>; | ||
}; | ||
declare type ObjectDescription<T extends Object> = Omit<_objectDescription<T>, '__brand'>; | ||
declare class ObjectDescriptor<T extends Object> { | ||
readonly description: ObjectDescription<T>; | ||
constructor(description: ObjectDescription<T>); | ||
validate(value: T | undefined | null): boolean; | ||
} | ||
/** | ||
* Defines an unsigned integer in the range of 0 to 2^31 - 1. | ||
*/ | ||
export declare type uinteger = number; | ||
export declare namespace uinteger { | ||
const MIN_VALUE = 0; | ||
const MAX_VALUE = 2147483647; | ||
function is(value: any): value is uinteger; | ||
} | ||
/** | ||
* An `Id` to identify a vertex or an edge. | ||
*/ | ||
export declare type Id = number | string; | ||
export declare type Id = uinteger | string; | ||
export declare namespace Id { | ||
function property(flags?: PropertyFlags): Property<uinteger | string>; | ||
function is(value: any): value is Id; | ||
} | ||
export declare enum ElementTypes { | ||
vertex = "vertex", | ||
edge = "edge" | ||
} | ||
export declare namespace ElementTypes { | ||
function property(flags?: PropertyFlags): StringEnumProperty; | ||
function is(value: any): value is ElementTypes; | ||
} | ||
/** | ||
@@ -13,5 +73,6 @@ * An element in the graph. | ||
} | ||
export declare enum ElementTypes { | ||
vertex = "vertex", | ||
edge = "edge" | ||
export declare namespace Element { | ||
const descriptor: ObjectDescriptor<Element>; | ||
function is(value: any): value is Element; | ||
function getDescriptor(element: Element): VertexDescriptor<V> | EdgeDescriptor<E<V, V, EdgeLabels>>; | ||
} | ||
@@ -43,2 +104,6 @@ /** | ||
} | ||
export declare namespace VertexLabels { | ||
function property(valueOrFlags?: VertexLabels | PropertyFlags, flags?: PropertyFlags): VertexLabelsProperty; | ||
function is(value: any): value is VertexLabels; | ||
} | ||
/** | ||
@@ -52,2 +117,9 @@ * Uris are currently stored as strings. | ||
} | ||
export declare class VertexDescriptor<T extends V> extends ObjectDescriptor<T> { | ||
constructor(description: ObjectDescription<T>); | ||
} | ||
export declare namespace V { | ||
const descriptor: VertexDescriptor<V>; | ||
function is(value: any): value is V; | ||
} | ||
/** | ||
@@ -60,2 +132,6 @@ * The event kinds | ||
} | ||
export declare namespace EventKind { | ||
function property(flags?: PropertyFlags): StringEnumProperty; | ||
function is(value: any): value is EventKind; | ||
} | ||
/** | ||
@@ -70,2 +146,6 @@ * The event scopes | ||
} | ||
export declare namespace EventScope { | ||
function property(flags?: PropertyFlags): StringEnumProperty; | ||
function is(value: any): value is EventScope; | ||
} | ||
export interface Event extends V { | ||
@@ -86,14 +166,34 @@ label: VertexLabels.event; | ||
} | ||
export declare namespace Event { | ||
const descriptor: VertexDescriptor<Required<Event>>; | ||
function is(value: any): value is Event; | ||
} | ||
export interface GroupEvent extends Event { | ||
scope: EventScope.group; | ||
} | ||
export declare namespace GroupEvent { | ||
const descriptor: VertexDescriptor<Required<GroupEvent>>; | ||
function is(value: any): value is GroupEvent; | ||
} | ||
export interface ProjectEvent extends Event { | ||
scope: EventScope.project; | ||
} | ||
export declare namespace ProjectEvent { | ||
const descriptor: VertexDescriptor<Required<ProjectEvent>>; | ||
function is(value: any): value is ProjectEvent; | ||
} | ||
export interface DocumentEvent extends Event { | ||
scope: EventScope.document; | ||
} | ||
export declare namespace DocumentEvent { | ||
const descriptor: VertexDescriptor<Required<DocumentEvent>>; | ||
function is(value: any): value is DocumentEvent; | ||
} | ||
export interface MonikerAttachEvent extends Event { | ||
scope: EventScope.monikerAttach; | ||
} | ||
export declare namespace MonikerAttachEvent { | ||
const descriptor: VertexDescriptor<Required<MonikerAttachEvent>>; | ||
function is(value: any): value is MonikerAttachEvent; | ||
} | ||
/** | ||
@@ -106,2 +206,6 @@ * A result set acts as a hub to share n LSP request results | ||
} | ||
export declare namespace ResultSet { | ||
const descriptor: VertexDescriptor<Required<ResultSet>>; | ||
function is(value: any): value is ResultSet; | ||
} | ||
/** | ||
@@ -116,2 +220,6 @@ * All know range tag literal types. | ||
} | ||
export declare namespace RangeTagTypes { | ||
function property(flags?: PropertyFlags): StringEnumProperty; | ||
function is(value: any): value is RangeTagTypes; | ||
} | ||
/** | ||
@@ -147,2 +255,6 @@ * The range represents a declaration. | ||
} | ||
export declare namespace DeclarationTag { | ||
const descriptor: ObjectDescriptor<Required<DeclarationTag>>; | ||
function is(value: any): value is DeclarationTag; | ||
} | ||
/** | ||
@@ -178,2 +290,6 @@ * The range represents a definition | ||
} | ||
export declare namespace DefinitionTag { | ||
const descriptor: ObjectDescriptor<Required<DefinitionTag>>; | ||
function is(value: any): value is DefinitionTag; | ||
} | ||
/** | ||
@@ -192,2 +308,6 @@ * The range represents a reference. | ||
} | ||
export declare namespace ReferenceTag { | ||
const descriptor: ObjectDescriptor<Required<ReferenceTag>>; | ||
function is(value: any): value is ReferenceTag; | ||
} | ||
/** | ||
@@ -206,2 +326,6 @@ * The type of the range is unknown. | ||
} | ||
export declare namespace UnknownTag { | ||
const descriptor: ObjectDescriptor<Required<UnknownTag>>; | ||
function is(value: any): value is UnknownTag; | ||
} | ||
/** | ||
@@ -211,2 +335,6 @@ * All available range tag types. | ||
export declare type RangeTag = DefinitionTag | DeclarationTag | ReferenceTag | UnknownTag; | ||
export declare namespace RangeTag { | ||
function property(flags?: PropertyFlags): Property<RangeTag>; | ||
function is(value: any): value is RangeTag; | ||
} | ||
/** | ||
@@ -222,2 +350,6 @@ * A vertex representing a range inside a document. | ||
} | ||
export declare namespace Range { | ||
const descriptor: VertexDescriptor<Required<Range>>; | ||
function is(value: any): value is Range; | ||
} | ||
/** | ||
@@ -236,2 +368,6 @@ * The id type of the range is a normal id. | ||
} | ||
export declare namespace DefinitionRange { | ||
const descriptor: VertexDescriptor<Required<DefinitionRange>>; | ||
function is(value: any): value is DefinitionRange; | ||
} | ||
/** | ||
@@ -246,2 +382,6 @@ * A range representing a declaration. | ||
} | ||
export declare namespace DeclarationRange { | ||
const descriptor: VertexDescriptor<Required<DeclarationRange>>; | ||
function is(value: any): value is DeclarationRange; | ||
} | ||
/** | ||
@@ -256,2 +396,6 @@ * A range representing a reference. | ||
} | ||
export declare namespace ReferenceRange { | ||
const descriptor: VertexDescriptor<Required<ReferenceRange>>; | ||
function is(value: any): value is ReferenceRange; | ||
} | ||
/** | ||
@@ -272,2 +416,30 @@ * A location emittable in LSIF. It has no uri since | ||
} | ||
export declare namespace Location { | ||
const descriptor: VertexDescriptor<Required<Location>>; | ||
function is(value: any): value is Location; | ||
} | ||
export interface ToolInfo { | ||
name: string; | ||
version?: string; | ||
args?: string[]; | ||
} | ||
export declare namespace ToolInfo { | ||
const descriptor: ObjectDescriptor<Required<ToolInfo>>; | ||
function property(flags?: PropertyFlags): Property<ToolInfo>; | ||
function is(value: any): value is ToolInfo; | ||
} | ||
export interface ToolState { | ||
/** | ||
* A data field that can be used to store a key identifying the dump. | ||
* The length of the string is limited to 512 characters. So usually | ||
* tools should use some sort of hashing algorithm to compute that | ||
* value. | ||
*/ | ||
data?: string; | ||
} | ||
export declare namespace ToolState { | ||
const descriptor: ObjectDescriptor<Required<ToolState>>; | ||
function property(flags?: PropertyFlags): Property<ToolState>; | ||
function is(value: any): value is ToolState; | ||
} | ||
/** | ||
@@ -294,8 +466,31 @@ * The meta data vertex. | ||
*/ | ||
toolInfo?: { | ||
name: string; | ||
version?: string; | ||
args?: string[]; | ||
}; | ||
toolInfo?: ToolInfo; | ||
/** | ||
* Additional information a tool can store to identify some | ||
* state with the created dump | ||
*/ | ||
toolState?: ToolState; | ||
} | ||
export declare namespace MetaData { | ||
const descriptor: VertexDescriptor<MetaData>; | ||
} | ||
export interface RepositoryInfo { | ||
/** | ||
* The repository type. For example GIT | ||
*/ | ||
type: string; | ||
/** | ||
* The URL to the repository | ||
*/ | ||
url: string; | ||
/** | ||
* A commitId if available. | ||
*/ | ||
commitId?: string; | ||
} | ||
export declare namespace RepositoryInfo { | ||
const descriptor: ObjectDescriptor<RepositoryInfo>; | ||
function is(value: any): value is RepositoryInfo; | ||
function property(flags?: PropertyFlags): Property<RepositoryInfo>; | ||
} | ||
export interface Group extends V { | ||
@@ -334,13 +529,8 @@ /** | ||
*/ | ||
repository?: { | ||
/** | ||
* The repository type. For example GIT | ||
*/ | ||
type: string; | ||
/** | ||
* The URL to the repository | ||
*/ | ||
url: string; | ||
}; | ||
repository?: RepositoryInfo; | ||
} | ||
export declare namespace Group { | ||
const descriptor: VertexDescriptor<Group>; | ||
function is(value: any): value is Group; | ||
} | ||
/** | ||
@@ -372,2 +562,6 @@ * A project vertex. | ||
} | ||
export declare namespace Project { | ||
const descriptor: VertexDescriptor<Project>; | ||
function is(value: any): value is Project; | ||
} | ||
export declare type DocumentId = Id; | ||
@@ -396,2 +590,6 @@ /** | ||
} | ||
export declare namespace Document { | ||
const descriptor: VertexDescriptor<Document>; | ||
function is(value: any): value is Document; | ||
} | ||
/** | ||
@@ -415,2 +613,6 @@ * The moniker kind. | ||
} | ||
export declare namespace MonikerKind { | ||
function property(flags?: PropertyFlags): StringEnumProperty; | ||
function is(value: any): value is MonikerKind; | ||
} | ||
export declare enum UniquenessLevel { | ||
@@ -434,6 +636,10 @@ /** | ||
/** | ||
* The moniker is gloabally unique | ||
* The moniker is globally unique | ||
*/ | ||
global = "global" | ||
} | ||
export declare namespace UniquenessLevel { | ||
function property(flags?: PropertyFlags): StringEnumProperty; | ||
function is(value: any): value is UniquenessLevel; | ||
} | ||
export interface Moniker extends V { | ||
@@ -459,2 +665,6 @@ label: VertexLabels.moniker; | ||
} | ||
export declare namespace Moniker { | ||
const descriptor: VertexDescriptor<Moniker>; | ||
function is(value: any): value is Moniker; | ||
} | ||
export interface PackageInformation extends V { | ||
@@ -485,17 +695,8 @@ label: VertexLabels.packageInformation; | ||
*/ | ||
repository?: { | ||
/** | ||
* The repository type. For example GIT | ||
*/ | ||
type: string; | ||
/** | ||
* The URL to the repository | ||
*/ | ||
url: string; | ||
/** | ||
* A commitId if available. | ||
*/ | ||
commitId?: string; | ||
}; | ||
repository?: RepositoryInfo; | ||
} | ||
export declare namespace PackageInformation { | ||
const descriptor: VertexDescriptor<PackageInformation>; | ||
function is(value: any): value is PackageInformation; | ||
} | ||
/** | ||
@@ -516,2 +717,6 @@ * A range based document symbol. This allows to reuse already | ||
} | ||
export declare namespace RangeBasedDocumentSymbol { | ||
const descriptor: ObjectDescriptor<RangeBasedDocumentSymbol>; | ||
function is(value: any): value is RangeBasedDocumentSymbol; | ||
} | ||
/** | ||
@@ -524,2 +729,6 @@ * A vertex representing the document symbol result. | ||
} | ||
export declare namespace DocumentSymbolResult { | ||
const descriptor: VertexDescriptor<DocumentSymbolResult>; | ||
function is(value: any): value is DocumentSymbolResult; | ||
} | ||
/** | ||
@@ -538,2 +747,6 @@ * A vertex representing a diagnostic result. | ||
} | ||
export declare namespace DiagnosticResult { | ||
const descriptor: VertexDescriptor<DiagnosticResult>; | ||
function is(value: any): value is DiagnosticResult; | ||
} | ||
/** | ||
@@ -552,2 +765,6 @@ * A vertex representing a folding range result. | ||
} | ||
export declare namespace FoldingRangeResult { | ||
const descriptor: VertexDescriptor<FoldingRangeResult>; | ||
function is(value: any): value is FoldingRangeResult; | ||
} | ||
/** | ||
@@ -566,2 +783,6 @@ * A vertex representing a document link result. | ||
} | ||
export declare namespace DocumentLinkResult { | ||
const descriptor: VertexDescriptor<DocumentLinkResult>; | ||
function is(value: any): value is DocumentLinkResult; | ||
} | ||
export interface DeclarationResult extends V { | ||
@@ -573,2 +794,6 @@ /** | ||
} | ||
export declare namespace DeclarationResult { | ||
const descriptor: VertexDescriptor<DeclarationResult>; | ||
function is(value: any): value is DeclarationResult; | ||
} | ||
/** | ||
@@ -583,2 +808,6 @@ * A vertex representing a definition result. | ||
} | ||
export declare namespace DefinitionResult { | ||
const descriptor: VertexDescriptor<DefinitionResult>; | ||
function is(value: any): value is DefinitionResult; | ||
} | ||
/** | ||
@@ -593,2 +822,6 @@ * A vertex representing a type definition result. | ||
} | ||
export declare namespace TypeDefinitionResult { | ||
const descriptor: VertexDescriptor<TypeDefinitionResult>; | ||
function is(value: any): value is TypeDefinitionResult; | ||
} | ||
/** | ||
@@ -603,2 +836,6 @@ * A vertex representing a reference result. | ||
} | ||
export declare namespace ReferenceResult { | ||
const descriptor: VertexDescriptor<ReferenceResult>; | ||
function is(value: any): value is ReferenceResult; | ||
} | ||
/** | ||
@@ -613,2 +850,6 @@ * A vertex representing an implementation result. | ||
} | ||
export declare namespace ImplementationResult { | ||
const descriptor: VertexDescriptor<ImplementationResult>; | ||
function is(value: any): value is ImplementationResult; | ||
} | ||
/** | ||
@@ -629,2 +870,6 @@ * A vertex representing a Hover. | ||
} | ||
export declare namespace HoverResult { | ||
const descriptor: VertexDescriptor<HoverResult>; | ||
function is(value: any): value is HoverResult; | ||
} | ||
/** | ||
@@ -634,2 +879,5 @@ * All available vertex types | ||
export declare type Vertex = MetaData | Event | Project | Group | Document | Moniker | PackageInformation | ResultSet | Range | DocumentSymbolResult | FoldingRangeResult | DocumentLinkResult | DiagnosticResult | DefinitionResult | DeclarationResult | TypeDefinitionResult | HoverResult | ReferenceResult | ImplementationResult; | ||
export declare namespace Vertex { | ||
function getDescriptor(vertexOrVertexLabel: Vertex | VertexLabels): VertexDescriptor<V>; | ||
} | ||
export declare enum EdgeLabels { | ||
@@ -654,2 +902,17 @@ contains = "contains", | ||
} | ||
export declare namespace EdgeLabels { | ||
function property(flags?: PropertyFlags): StringEnumProperty; | ||
function property(value: EdgeLabels, flags?: PropertyFlags): Property<EdgeLabels>; | ||
function is(value: any): value is EdgeLabels; | ||
} | ||
export declare enum Cardinality { | ||
'one2one' = "1:1", | ||
'one2many' = "1:N", | ||
'many2many' = "N:N" | ||
} | ||
export declare class EdgeDescriptor<T> extends ObjectDescriptor<T> { | ||
readonly edgeDescriptions: [VertexDescriptor<V>, VertexDescriptor<V>][]; | ||
readonly cardinality: Cardinality; | ||
constructor(description: ObjectDescription<T>, cardinality: Cardinality, edgeDescriptions: [VertexDescriptor<V>, VertexDescriptor<V>][]); | ||
} | ||
/** | ||
@@ -661,3 +924,3 @@ * A common base type of all edge types. The type parameters `S` and `T` are for typing and | ||
export interface E11<S extends V, T extends V, K extends EdgeLabels> extends Element { | ||
_?: [S, T]; | ||
__brand?: [S, T]; | ||
id: Id; | ||
@@ -675,4 +938,7 @@ type: ElementTypes.edge; | ||
} | ||
export declare namespace E11 { | ||
const descriptor: EdgeDescriptor<E11<V, V, EdgeLabels>>; | ||
} | ||
export interface E1N<S extends V, T extends V, K extends EdgeLabels> extends Element { | ||
_?: [S, T]; | ||
__brand?: [S, T]; | ||
id: Id; | ||
@@ -690,2 +956,5 @@ type: ElementTypes.edge; | ||
} | ||
export declare namespace E1N { | ||
const descriptor: EdgeDescriptor<E1N<V, V, EdgeLabels>>; | ||
} | ||
export declare type E<S extends V, T extends V, K extends EdgeLabels> = E11<S, T, K> | E1N<S, T, K>; | ||
@@ -701,2 +970,6 @@ export declare enum ItemEdgeProperties { | ||
} | ||
export declare namespace ItemEdgeProperties { | ||
function property(flags?: PropertyFlags): Property<ItemEdgeProperties>; | ||
function is(value: any): value is EdgeLabels; | ||
} | ||
export interface ItemEdge<S extends V, T extends V> extends E1N<S, T, EdgeLabels.item> { | ||
@@ -713,2 +986,6 @@ shard: Id; | ||
export declare type contains = E1N<Project, Document, EdgeLabels.contains> | E1N<Document, Range, EdgeLabels.contains>; | ||
export declare namespace contains { | ||
const descriptor: EdgeDescriptor<contains>; | ||
function is(value: any): value is attach; | ||
} | ||
/** | ||
@@ -721,2 +998,6 @@ * An edge associating a range with a result set or a result set with another result set. The relationship exists between: | ||
export declare type next = E11<Range, ResultSet, EdgeLabels.next> | E11<ResultSet, ResultSet, EdgeLabels.next>; | ||
export declare namespace next { | ||
const descriptor: EdgeDescriptor<next>; | ||
function is(value: any): value is attach; | ||
} | ||
/** | ||
@@ -729,2 +1010,6 @@ * An edge representing a item in a result set. The relationship exists between: | ||
export declare type item = ItemEdge<DeclarationResult, Range> | ItemEdge<DefinitionResult, Range> | ItemEdge<TypeDefinitionResult, Range> | ItemEdge<ReferenceResult, Range> | ItemEdge<ReferenceResult, ReferenceResult> | ItemEdge<ReferenceResult, Moniker> | ItemEdge<ImplementationResult, Range> | ItemEdge<ImplementationResult, ImplementationResult> | ItemEdge<ImplementationResult, Moniker>; | ||
export declare namespace item { | ||
const descriptor: EdgeDescriptor<item>; | ||
function is(value: any): value is attach; | ||
} | ||
/** | ||
@@ -742,2 +1027,6 @@ * An edge associating a range with a moniker. The relationship exists between: | ||
export declare type moniker = E11<Range, Moniker, EdgeLabels.moniker> | E11<ResultSet, Moniker, EdgeLabels.moniker> | E11<DeclarationResult, Moniker, EdgeLabels.moniker> | E11<DefinitionResult, Moniker, EdgeLabels.moniker> | E11<TypeDefinitionResult, Moniker, EdgeLabels.moniker> | E11<ReferenceResult, Moniker, EdgeLabels.moniker> | E11<ImplementationResult, Moniker, EdgeLabels.moniker>; | ||
export declare namespace moniker { | ||
const descriptor: EdgeDescriptor<moniker>; | ||
function is(value: any): value is attach; | ||
} | ||
/** | ||
@@ -749,2 +1038,6 @@ * An edge associating a moniker with another moniker. The relationship exists between: | ||
export declare type attach = E11<Moniker, Moniker, EdgeLabels.attach>; | ||
export declare namespace attach { | ||
const descriptor: EdgeDescriptor<attach>; | ||
function is(value: any): value is attach; | ||
} | ||
/** | ||
@@ -756,2 +1049,6 @@ * An edge associating a moniker with a package information. The relationship exists between: | ||
export declare type packageInformation = E11<Moniker, PackageInformation, EdgeLabels.packageInformation>; | ||
export declare namespace packageInformation { | ||
const descriptor: EdgeDescriptor<packageInformation>; | ||
function is(value: any): value is attach; | ||
} | ||
/** | ||
@@ -763,2 +1060,6 @@ * An edge associating a project with a group. The relationship exists between: | ||
export declare type belongsTo = E11<Project, Group, EdgeLabels.belongsTo>; | ||
export declare namespace belongsTo { | ||
const descriptor: EdgeDescriptor<belongsTo>; | ||
function is(value: any): value is attach; | ||
} | ||
/** | ||
@@ -770,2 +1071,6 @@ * An edge representing a `textDocument/documentSymbol` relationship. The relationship exists between: | ||
export declare type textDocument_documentSymbol = E11<Document, DocumentSymbolResult, EdgeLabels.textDocument_documentSymbol>; | ||
export declare namespace textDocument_documentSymbol { | ||
const descriptor: EdgeDescriptor<textDocument_documentSymbol>; | ||
function is(value: any): value is attach; | ||
} | ||
/** | ||
@@ -777,2 +1082,6 @@ * An edge representing a `textDocument/foldingRange` relationship. The relationship exists between: | ||
export declare type textDocument_foldingRange = E11<Document, FoldingRangeResult, EdgeLabels.textDocument_foldingRange>; | ||
export declare namespace textDocument_foldingRange { | ||
const descriptor: EdgeDescriptor<textDocument_foldingRange>; | ||
function is(value: any): value is attach; | ||
} | ||
/** | ||
@@ -784,2 +1093,6 @@ * An edge representing a `textDocument/documentLink` relationship. The relationship exists between: | ||
export declare type textDocument_documentLink = E11<Document, DocumentLinkResult, EdgeLabels.textDocument_documentLink>; | ||
export declare namespace textDocument_documentLink { | ||
const descriptor: EdgeDescriptor<textDocument_documentLink>; | ||
function is(value: any): value is attach; | ||
} | ||
/** | ||
@@ -792,2 +1105,6 @@ * An edge representing a `textDocument/diagnostic` relationship. The relationship exists between: | ||
export declare type textDocument_diagnostic = E11<Project, DiagnosticResult, EdgeLabels.textDocument_diagnostic> | E11<Document, DiagnosticResult, EdgeLabels.textDocument_diagnostic>; | ||
export declare namespace textDocument_diagnostic { | ||
const descriptor: EdgeDescriptor<textDocument_diagnostic>; | ||
function is(value: any): value is attach; | ||
} | ||
/** | ||
@@ -800,2 +1117,6 @@ * An edge representing a declaration relationship. The relationship exists between: | ||
export declare type textDocument_declaration = E11<Range, DeclarationResult, EdgeLabels.textDocument_declaration> | E11<ResultSet, DeclarationResult, EdgeLabels.textDocument_declaration>; | ||
export declare namespace textDocument_declaration { | ||
const descriptor: EdgeDescriptor<textDocument_declaration>; | ||
function is(value: any): value is attach; | ||
} | ||
/** | ||
@@ -808,2 +1129,6 @@ * An edge representing a definition relationship. The relationship exists between: | ||
export declare type textDocument_definition = E11<Range, DefinitionResult, EdgeLabels.textDocument_definition> | E11<ResultSet, DefinitionResult, EdgeLabels.textDocument_definition>; | ||
export declare namespace textDocument_definition { | ||
const descriptor: EdgeDescriptor<textDocument_definition>; | ||
function is(value: any): value is attach; | ||
} | ||
/** | ||
@@ -816,2 +1141,6 @@ * An edge representing a type definition relations ship. The relationship exists between: | ||
export declare type textDocument_typeDefinition = E11<Range, TypeDefinitionResult, EdgeLabels.textDocument_typeDefinition> | E11<ResultSet, TypeDefinitionResult, EdgeLabels.textDocument_typeDefinition>; | ||
export declare namespace textDocument_typeDefinition { | ||
const descriptor: EdgeDescriptor<textDocument_typeDefinition>; | ||
function is(value: any): value is attach; | ||
} | ||
/** | ||
@@ -824,2 +1153,6 @@ * An edge representing a hover relationship. The relationship exists between: | ||
export declare type textDocument_hover = E11<Range, HoverResult, EdgeLabels.textDocument_hover> | E11<ResultSet, HoverResult, EdgeLabels.textDocument_hover>; | ||
export declare namespace textDocument_hover { | ||
const descriptor: EdgeDescriptor<textDocument_hover>; | ||
function is(value: any): value is attach; | ||
} | ||
/** | ||
@@ -832,2 +1165,6 @@ * An edge representing a references relationship. The relationship exists between: | ||
export declare type textDocument_references = E11<Range, ReferenceResult, EdgeLabels.textDocument_references> | E11<ResultSet, ReferenceResult, EdgeLabels.textDocument_references>; | ||
export declare namespace textDocument_references { | ||
const descriptor: EdgeDescriptor<textDocument_references>; | ||
function is(value: any): value is attach; | ||
} | ||
/** | ||
@@ -840,2 +1177,6 @@ * An edge representing a implementation relationship. The relationship exists between: | ||
export declare type textDocument_implementation = E11<Range, ImplementationResult, EdgeLabels.textDocument_implementation> | E11<ResultSet, ImplementationResult, EdgeLabels.textDocument_implementation>; | ||
export declare namespace textDocument_implementation { | ||
const descriptor: EdgeDescriptor<textDocument_implementation>; | ||
function is(value: any): value is attach; | ||
} | ||
/** | ||
@@ -853,2 +1194,4 @@ * | ||
}); | ||
function getDescriptor(edgeOrEdgeLabel: Edge | EdgeLabels): EdgeDescriptor<E<V, V, EdgeLabels>>; | ||
} | ||
export {}; |
1106
lib/protocol.js
@@ -7,3 +7,190 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Edge = exports.ItemEdgeProperties = exports.EdgeLabels = exports.UniquenessLevel = exports.MonikerKind = exports.RangeTagTypes = exports.EventScope = exports.EventKind = exports.VertexLabels = exports.ElementTypes = void 0; | ||
exports.Edge = exports.textDocument_implementation = exports.textDocument_references = exports.textDocument_hover = exports.textDocument_typeDefinition = exports.textDocument_definition = exports.textDocument_declaration = exports.textDocument_diagnostic = exports.textDocument_documentLink = exports.textDocument_foldingRange = exports.textDocument_documentSymbol = exports.belongsTo = exports.packageInformation = exports.attach = exports.moniker = exports.item = exports.next = exports.contains = exports.ItemEdgeProperties = exports.E1N = exports.E11 = exports.EdgeDescriptor = exports.Cardinality = exports.EdgeLabels = exports.Vertex = exports.HoverResult = exports.ImplementationResult = exports.ReferenceResult = exports.TypeDefinitionResult = exports.DefinitionResult = exports.DeclarationResult = exports.DocumentLinkResult = exports.FoldingRangeResult = exports.DiagnosticResult = exports.DocumentSymbolResult = exports.RangeBasedDocumentSymbol = exports.PackageInformation = exports.Moniker = exports.UniquenessLevel = exports.MonikerKind = exports.Document = exports.Project = exports.Group = exports.RepositoryInfo = exports.MetaData = exports.ToolState = exports.ToolInfo = exports.Location = exports.ReferenceRange = exports.DeclarationRange = exports.DefinitionRange = exports.Range = exports.RangeTag = exports.UnknownTag = exports.ReferenceTag = exports.DefinitionTag = exports.DeclarationTag = exports.RangeTagTypes = exports.ResultSet = exports.MonikerAttachEvent = exports.DocumentEvent = exports.ProjectEvent = exports.GroupEvent = exports.Event = exports.EventScope = exports.EventKind = exports.V = exports.VertexDescriptor = exports.VertexLabels = exports.Element = exports.ElementTypes = exports.Id = exports.uinteger = void 0; | ||
const lsp = require("vscode-languageserver-protocol"); | ||
var Is; | ||
(function (Is) { | ||
function boolean(value) { | ||
return value === true || value === false; | ||
} | ||
Is.boolean = boolean; | ||
function string(value) { | ||
return typeof value === 'string' || value instanceof String; | ||
} | ||
Is.string = string; | ||
function isStringArray(value) { | ||
if (!Array.isArray(value)) { | ||
return false; | ||
} | ||
const candidate = value; | ||
for (const str of candidate) { | ||
if (!string(str)) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
Is.isStringArray = isStringArray; | ||
function number(value) { | ||
return typeof value === 'number' || value instanceof Number; | ||
} | ||
Is.number = number; | ||
function symbolKind(value) { | ||
return typeof value === 'number' || value instanceof Number; | ||
} | ||
Is.symbolKind = symbolKind; | ||
})(Is || (Is = {})); | ||
var PropertyFlags; | ||
(function (PropertyFlags) { | ||
PropertyFlags[PropertyFlags["none"] = 0] = "none"; | ||
PropertyFlags[PropertyFlags["optional"] = 1] = "optional"; | ||
PropertyFlags[PropertyFlags["undefined"] = 2] = "undefined"; | ||
PropertyFlags[PropertyFlags["null"] = 4] = "null"; | ||
})(PropertyFlags || (PropertyFlags = {})); | ||
(function (PropertyFlags) { | ||
function isOptional(value) { | ||
return (value & PropertyFlags.optional) !== 0; | ||
} | ||
PropertyFlags.isOptional = isOptional; | ||
function isUndefined(value) { | ||
return (value & PropertyFlags.undefined) !== 0; | ||
} | ||
PropertyFlags.isUndefined = isUndefined; | ||
function isNull(value) { | ||
return (value & PropertyFlags.null) !== 0; | ||
} | ||
PropertyFlags.isNull = isNull; | ||
})(PropertyFlags || (PropertyFlags = {})); | ||
class Property { | ||
constructor(validator, flags = PropertyFlags.none) { | ||
this.validator = validator; | ||
this.flags = flags; | ||
} | ||
validate(value) { | ||
if (PropertyFlags.isUndefined(this.flags) && value === undefined) { | ||
return true; | ||
} | ||
if (PropertyFlags.isNull(this.flags) && value === null) { | ||
return true; | ||
} | ||
return this.validator(value); | ||
} | ||
} | ||
class BooleanProperty extends Property { | ||
constructor(flags = PropertyFlags.none) { | ||
super(Is.boolean, flags); | ||
} | ||
} | ||
class StringProperty extends Property { | ||
constructor(flags = PropertyFlags.none) { | ||
super(Is.string, flags); | ||
} | ||
} | ||
class UriProperty extends StringProperty { | ||
constructor(flags = PropertyFlags.none) { | ||
super(flags); | ||
} | ||
} | ||
class ArrayProperty extends Property { | ||
constructor(validator, flags = PropertyFlags.none) { | ||
super(value => { | ||
if (!Array.isArray(value)) { | ||
return false; | ||
} | ||
for (const item of value) { | ||
if (!validator(item)) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
}, flags); | ||
} | ||
} | ||
class StringArrayProperty extends Property { | ||
constructor(flags = PropertyFlags.none) { | ||
super(Is.isStringArray, flags); | ||
} | ||
} | ||
var StringEnum; | ||
(function (StringEnum) { | ||
function values(enumeration) { | ||
const result = new Set(); | ||
for (const item in enumeration) { | ||
result.add(enumeration[item]); | ||
} | ||
return result; | ||
} | ||
StringEnum.values = values; | ||
})(StringEnum || (StringEnum = {})); | ||
class StringEnumProperty extends Property { | ||
constructor(values, flags = PropertyFlags.none) { | ||
super(value => values.has(value), flags); | ||
} | ||
} | ||
class VertexLabelsProperty extends Property { | ||
constructor(valueOrFlags, flags) { | ||
if (typeof valueOrFlags === 'string') { | ||
super(value => value === valueOrFlags, flags); | ||
} | ||
else { | ||
super(VertexLabels.is, flags); | ||
} | ||
} | ||
} | ||
class EdgeLabelsProperty extends Property { | ||
constructor(valueOrFlags, flags) { | ||
if (typeof valueOrFlags === 'string') { | ||
super(value => value === valueOrFlags, flags); | ||
} | ||
else { | ||
super(EdgeLabels.is, flags); | ||
} | ||
} | ||
} | ||
class ObjectDescriptor { | ||
constructor(description) { | ||
this.description = description; | ||
} | ||
validate(value) { | ||
if (value === undefined || value === null) { | ||
return false; | ||
} | ||
const properties = Object.keys(this.description); | ||
for (const propertyName of properties) { | ||
const property = this.description[propertyName]; | ||
const propValue = value[propertyName]; | ||
if (PropertyFlags.isOptional(property.flags) && propValue === undefined) { | ||
continue; | ||
} | ||
if (!property.validate(propValue)) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
} | ||
var uinteger; | ||
(function (uinteger) { | ||
uinteger.MIN_VALUE = 0; | ||
uinteger.MAX_VALUE = 2147483647; | ||
function is(value) { | ||
return value !== undefined && value !== null && Number.isInteger(value) && value >= 0 && value <= 2147483647; | ||
} | ||
uinteger.is = is; | ||
})(uinteger = exports.uinteger || (exports.uinteger = {})); | ||
var Id; | ||
(function (Id) { | ||
class _Property extends Property { | ||
constructor(flags = PropertyFlags.none) { | ||
super(Id.is, flags); | ||
} | ||
} | ||
function property(flags = PropertyFlags.none) { | ||
return new _Property(flags); | ||
} | ||
Id.property = property; | ||
function is(value) { | ||
return Is.string(value) || uinteger.is(value); | ||
} | ||
Id.is = is; | ||
})(Id = exports.Id || (exports.Id = {})); | ||
var ElementTypes; | ||
@@ -14,2 +201,33 @@ (function (ElementTypes) { | ||
})(ElementTypes = exports.ElementTypes || (exports.ElementTypes = {})); | ||
(function (ElementTypes) { | ||
const values = StringEnum.values(ElementTypes); | ||
function property(flags = PropertyFlags.none) { | ||
return new StringEnumProperty(values, flags); | ||
} | ||
ElementTypes.property = property; | ||
function is(value) { | ||
return values.has(value); | ||
} | ||
ElementTypes.is = is; | ||
})(ElementTypes = exports.ElementTypes || (exports.ElementTypes = {})); | ||
var Element; | ||
(function (Element) { | ||
Element.descriptor = new ObjectDescriptor({ | ||
id: Id.property(), | ||
type: ElementTypes.property() | ||
}); | ||
function is(value) { | ||
return Element.descriptor.validate(value); | ||
} | ||
Element.is = is; | ||
function getDescriptor(element) { | ||
switch (element.type) { | ||
case ElementTypes.vertex: | ||
return Vertex.getDescriptor(element); | ||
case ElementTypes.edge: | ||
return Edge.getDescriptor(element); | ||
} | ||
} | ||
Element.getDescriptor = getDescriptor; | ||
})(Element = exports.Element || (exports.Element = {})); | ||
/** | ||
@@ -41,2 +259,41 @@ * All know vertices label values. | ||
})(VertexLabels = exports.VertexLabels || (exports.VertexLabels = {})); | ||
(function (VertexLabels) { | ||
const values = StringEnum.values(VertexLabels); | ||
function property(valueOrFlags, flags) { | ||
return new VertexLabelsProperty(valueOrFlags, flags); | ||
} | ||
VertexLabels.property = property; | ||
function is(value) { | ||
return values.has(value); | ||
} | ||
VertexLabels.is = is; | ||
})(VertexLabels = exports.VertexLabels || (exports.VertexLabels = {})); | ||
var Uri; | ||
(function (Uri) { | ||
function property(flags = PropertyFlags.none) { | ||
return new StringProperty(flags); | ||
} | ||
Uri.property = property; | ||
function is(value) { | ||
return Is.string(value); | ||
} | ||
Uri.is = is; | ||
})(Uri || (Uri = {})); | ||
class VertexDescriptor extends ObjectDescriptor { | ||
constructor(description) { | ||
super(description); | ||
} | ||
} | ||
exports.VertexDescriptor = VertexDescriptor; | ||
var V; | ||
(function (V) { | ||
V.descriptor = new VertexDescriptor(Object.assign({}, Element.descriptor.description, { | ||
type: new Property(value => value === ElementTypes.vertex), | ||
label: VertexLabels.property() | ||
})); | ||
function is(value) { | ||
return V.descriptor.validate(value); | ||
} | ||
V.is = is; | ||
})(V = exports.V || (exports.V = {})); | ||
/** | ||
@@ -50,2 +307,13 @@ * The event kinds | ||
})(EventKind = exports.EventKind || (exports.EventKind = {})); | ||
(function (EventKind) { | ||
const values = StringEnum.values(EventKind); | ||
function property(flags = PropertyFlags.none) { | ||
return new StringEnumProperty(values, flags); | ||
} | ||
EventKind.property = property; | ||
function is(value) { | ||
return values.has(value); | ||
} | ||
EventKind.is = is; | ||
})(EventKind = exports.EventKind || (exports.EventKind = {})); | ||
/** | ||
@@ -61,2 +329,76 @@ * The event scopes | ||
})(EventScope = exports.EventScope || (exports.EventScope = {})); | ||
(function (EventScope) { | ||
const values = StringEnum.values(EventScope); | ||
function property(flags = PropertyFlags.none) { | ||
return new StringEnumProperty(values, flags); | ||
} | ||
EventScope.property = property; | ||
function is(value) { | ||
return values.has(value); | ||
} | ||
EventScope.is = is; | ||
})(EventScope = exports.EventScope || (exports.EventScope = {})); | ||
var Event; | ||
(function (Event) { | ||
Event.descriptor = new VertexDescriptor(Object.assign({}, V.descriptor.description, { | ||
label: VertexLabels.property(VertexLabels.event), | ||
scope: EventScope.property(), | ||
kind: EventKind.property(), | ||
data: Id.property() | ||
})); | ||
function is(value) { | ||
return Event.descriptor.validate(value); | ||
} | ||
Event.is = is; | ||
})(Event = exports.Event || (exports.Event = {})); | ||
var GroupEvent; | ||
(function (GroupEvent) { | ||
GroupEvent.descriptor = new VertexDescriptor(Object.assign({}, Event.descriptor.description, { | ||
scope: new Property(value => value === EventScope.group), | ||
})); | ||
function is(value) { | ||
return GroupEvent.descriptor.validate(value); | ||
} | ||
GroupEvent.is = is; | ||
})(GroupEvent = exports.GroupEvent || (exports.GroupEvent = {})); | ||
var ProjectEvent; | ||
(function (ProjectEvent) { | ||
ProjectEvent.descriptor = new VertexDescriptor(Object.assign({}, Event.descriptor.description, { | ||
scope: new Property(value => value === EventScope.project), | ||
})); | ||
function is(value) { | ||
return ProjectEvent.descriptor.validate(value); | ||
} | ||
ProjectEvent.is = is; | ||
})(ProjectEvent = exports.ProjectEvent || (exports.ProjectEvent = {})); | ||
var DocumentEvent; | ||
(function (DocumentEvent) { | ||
DocumentEvent.descriptor = new VertexDescriptor(Object.assign({}, Event.descriptor.description, { | ||
scope: new Property(value => value === EventScope.document), | ||
})); | ||
function is(value) { | ||
return DocumentEvent.descriptor.validate(value); | ||
} | ||
DocumentEvent.is = is; | ||
})(DocumentEvent = exports.DocumentEvent || (exports.DocumentEvent = {})); | ||
var MonikerAttachEvent; | ||
(function (MonikerAttachEvent) { | ||
MonikerAttachEvent.descriptor = new VertexDescriptor(Object.assign({}, Event.descriptor.description, { | ||
scope: new Property(value => value === EventScope.monikerAttach), | ||
})); | ||
function is(value) { | ||
return MonikerAttachEvent.descriptor.validate(value); | ||
} | ||
MonikerAttachEvent.is = is; | ||
})(MonikerAttachEvent = exports.MonikerAttachEvent || (exports.MonikerAttachEvent = {})); | ||
var ResultSet; | ||
(function (ResultSet) { | ||
ResultSet.descriptor = new VertexDescriptor(Object.assign({}, V.descriptor.description, { | ||
label: VertexLabels.property(VertexLabels.resultSet) | ||
})); | ||
function is(value) { | ||
return ResultSet.descriptor.validate(value); | ||
} | ||
ResultSet.is = is; | ||
})(ResultSet = exports.ResultSet || (exports.ResultSet = {})); | ||
/** | ||
@@ -72,2 +414,242 @@ * All know range tag literal types. | ||
})(RangeTagTypes = exports.RangeTagTypes || (exports.RangeTagTypes = {})); | ||
(function (RangeTagTypes) { | ||
const values = StringEnum.values(RangeTagTypes); | ||
function property(flags = PropertyFlags.none) { | ||
return new StringEnumProperty(values, flags); | ||
} | ||
RangeTagTypes.property = property; | ||
function is(value) { | ||
return values.has(value); | ||
} | ||
RangeTagTypes.is = is; | ||
})(RangeTagTypes = exports.RangeTagTypes || (exports.RangeTagTypes = {})); | ||
var DeclarationTag; | ||
(function (DeclarationTag) { | ||
DeclarationTag.descriptor = new ObjectDescriptor({ | ||
type: new Property(value => value === RangeTagTypes.declaration), | ||
text: new StringProperty(), | ||
kind: new Property(Is.symbolKind), | ||
deprecated: new BooleanProperty(PropertyFlags.optional), | ||
fullRange: new Property(lsp.Range.is), | ||
detail: new StringProperty(PropertyFlags.optional) | ||
}); | ||
function is(value) { | ||
return DeclarationTag.descriptor.validate(value); | ||
} | ||
DeclarationTag.is = is; | ||
})(DeclarationTag = exports.DeclarationTag || (exports.DeclarationTag = {})); | ||
var DefinitionTag; | ||
(function (DefinitionTag) { | ||
DefinitionTag.descriptor = new ObjectDescriptor({ | ||
type: new Property(value => value === RangeTagTypes.definition), | ||
text: new StringProperty(), | ||
kind: new Property(Is.symbolKind), | ||
deprecated: new BooleanProperty(PropertyFlags.optional), | ||
fullRange: new Property(lsp.Range.is), | ||
detail: new StringProperty(PropertyFlags.optional) | ||
}); | ||
function is(value) { | ||
return DefinitionTag.descriptor.validate(value); | ||
} | ||
DefinitionTag.is = is; | ||
})(DefinitionTag = exports.DefinitionTag || (exports.DefinitionTag = {})); | ||
var ReferenceTag; | ||
(function (ReferenceTag) { | ||
ReferenceTag.descriptor = new ObjectDescriptor({ | ||
type: new Property(value => value === RangeTagTypes.reference), | ||
text: new StringProperty() | ||
}); | ||
function is(value) { | ||
return ReferenceTag.descriptor.validate(value); | ||
} | ||
ReferenceTag.is = is; | ||
})(ReferenceTag = exports.ReferenceTag || (exports.ReferenceTag = {})); | ||
var UnknownTag; | ||
(function (UnknownTag) { | ||
UnknownTag.descriptor = new ObjectDescriptor({ | ||
type: new Property(value => value === RangeTagTypes.unknown), | ||
text: new StringProperty() | ||
}); | ||
function is(value) { | ||
return UnknownTag.descriptor.validate(value); | ||
} | ||
UnknownTag.is = is; | ||
})(UnknownTag = exports.UnknownTag || (exports.UnknownTag = {})); | ||
var RangeTag; | ||
(function (RangeTag) { | ||
function property(flags = PropertyFlags.none) { | ||
return new Property(RangeTag.is, flags); | ||
} | ||
RangeTag.property = property; | ||
function is(value) { | ||
const candidate = value; | ||
if (!RangeTagTypes.is(candidate.type)) { | ||
return false; | ||
} | ||
switch (candidate.type) { | ||
case RangeTagTypes.definition: | ||
return DefinitionTag.is(value); | ||
case RangeTagTypes.declaration: | ||
return DeclarationTag.is(value); | ||
case RangeTagTypes.reference: | ||
return ReferenceTag.is(value); | ||
case RangeTagTypes.unknown: | ||
return UnknownTag.is(value); | ||
} | ||
} | ||
RangeTag.is = is; | ||
})(RangeTag = exports.RangeTag || (exports.RangeTag = {})); | ||
var Range; | ||
(function (Range) { | ||
Range.descriptor = new VertexDescriptor(Object.assign({}, V.descriptor.description, { | ||
label: VertexLabels.property(VertexLabels.range), | ||
tag: RangeTag.property(PropertyFlags.optional), | ||
start: new Property(lsp.Position.is), | ||
end: new Property(lsp.Position.is) | ||
})); | ||
function is(value) { | ||
return Range.descriptor.validate(value); | ||
} | ||
Range.is = is; | ||
})(Range = exports.Range || (exports.Range = {})); | ||
var DefinitionRange; | ||
(function (DefinitionRange) { | ||
DefinitionRange.descriptor = new VertexDescriptor(Object.assign({}, Range.descriptor.description, { | ||
tag: new Property(DefinitionTag.is) | ||
})); | ||
function is(value) { | ||
return DefinitionRange.descriptor.validate(value); | ||
} | ||
DefinitionRange.is = is; | ||
})(DefinitionRange = exports.DefinitionRange || (exports.DefinitionRange = {})); | ||
var DeclarationRange; | ||
(function (DeclarationRange) { | ||
DeclarationRange.descriptor = new VertexDescriptor(Object.assign({}, Range.descriptor.description, { | ||
tag: new Property(DeclarationRange.is) | ||
})); | ||
function is(value) { | ||
return DeclarationRange.descriptor.validate(value); | ||
} | ||
DeclarationRange.is = is; | ||
})(DeclarationRange = exports.DeclarationRange || (exports.DeclarationRange = {})); | ||
var ReferenceRange; | ||
(function (ReferenceRange) { | ||
ReferenceRange.descriptor = new VertexDescriptor(Object.assign({}, Range.descriptor.description, { | ||
tag: new Property(ReferenceRange.is) | ||
})); | ||
function is(value) { | ||
return ReferenceRange.descriptor.validate(value); | ||
} | ||
ReferenceRange.is = is; | ||
})(ReferenceRange = exports.ReferenceRange || (exports.ReferenceRange = {})); | ||
var Location; | ||
(function (Location) { | ||
Location.descriptor = new VertexDescriptor(Object.assign({}, V.descriptor.description, { | ||
label: VertexLabels.property(VertexLabels.location), | ||
range: new Property(value => lsp.Range.is(value)) | ||
})); | ||
function is(value) { | ||
return Location.descriptor.validate(value); | ||
} | ||
Location.is = is; | ||
})(Location = exports.Location || (exports.Location = {})); | ||
var ToolInfo; | ||
(function (ToolInfo) { | ||
ToolInfo.descriptor = new ObjectDescriptor({ | ||
name: new StringProperty(), | ||
version: new StringProperty(PropertyFlags.optional), | ||
args: new StringArrayProperty(PropertyFlags.optional) | ||
}); | ||
function property(flags = PropertyFlags.none) { | ||
return new Property(ToolInfo.is, flags); | ||
} | ||
ToolInfo.property = property; | ||
function is(value) { | ||
return ToolInfo.descriptor.validate(value); | ||
} | ||
ToolInfo.is = is; | ||
})(ToolInfo = exports.ToolInfo || (exports.ToolInfo = {})); | ||
var ToolState; | ||
(function (ToolState) { | ||
ToolState.descriptor = new ObjectDescriptor({ | ||
data: new StringProperty(PropertyFlags.optional) | ||
}); | ||
function property(flags = PropertyFlags.none) { | ||
return new Property(ToolState.is, flags); | ||
} | ||
ToolState.property = property; | ||
function is(value) { | ||
return ToolState.descriptor.validate(value); | ||
} | ||
ToolState.is = is; | ||
})(ToolState = exports.ToolState || (exports.ToolState = {})); | ||
var MetaData; | ||
(function (MetaData) { | ||
MetaData.descriptor = new VertexDescriptor(Object.assign({}, V.descriptor.description, { | ||
label: VertexLabels.property(VertexLabels.metaData), | ||
version: new StringProperty(), | ||
positionEncoding: new Property(value => value === 'utf-16'), | ||
toolInfo: ToolInfo.property(PropertyFlags.optional), | ||
toolState: ToolState.property(PropertyFlags.optional) | ||
})); | ||
})(MetaData = exports.MetaData || (exports.MetaData = {})); | ||
var RepositoryInfo; | ||
(function (RepositoryInfo) { | ||
RepositoryInfo.descriptor = new ObjectDescriptor({ | ||
type: new StringProperty(), | ||
url: new StringProperty(), | ||
commitId: new StringProperty(PropertyFlags.optional) | ||
}); | ||
function is(value) { | ||
return RepositoryInfo.descriptor.validate(value); | ||
} | ||
RepositoryInfo.is = is; | ||
function property(flags = PropertyFlags.none) { | ||
return new Property(RepositoryInfo.is, flags); | ||
} | ||
RepositoryInfo.property = property; | ||
})(RepositoryInfo = exports.RepositoryInfo || (exports.RepositoryInfo = {})); | ||
var Group; | ||
(function (Group) { | ||
Group.descriptor = new VertexDescriptor(Object.assign({}, V.descriptor.description, { | ||
label: VertexLabels.property(VertexLabels.group), | ||
uri: new StringProperty(), | ||
conflictResolution: new Property(value => value === 'takeDump' || value === 'takeDB'), | ||
name: new StringProperty(), | ||
rootUri: new UriProperty(), | ||
description: new StringProperty(PropertyFlags.optional), | ||
repository: RepositoryInfo.property(PropertyFlags.optional) | ||
})); | ||
function is(value) { | ||
return Group.descriptor.validate(value); | ||
} | ||
Group.is = is; | ||
})(Group = exports.Group || (exports.Group = {})); | ||
var Project; | ||
(function (Project) { | ||
Project.descriptor = new VertexDescriptor(Object.assign({}, V.descriptor.description, { | ||
label: VertexLabels.property(VertexLabels.project), | ||
kind: new StringProperty(), | ||
name: new StringProperty(), | ||
resource: new UriProperty(PropertyFlags.optional), | ||
contents: new StringProperty(PropertyFlags.optional) | ||
})); | ||
function is(value) { | ||
return Project.descriptor.validate(value); | ||
} | ||
Project.is = is; | ||
})(Project = exports.Project || (exports.Project = {})); | ||
var Document; | ||
(function (Document) { | ||
Document.descriptor = new VertexDescriptor(Object.assign({}, V.descriptor.description, { | ||
label: VertexLabels.property(VertexLabels.document), | ||
uri: new StringProperty(), | ||
languageId: new StringProperty(), | ||
contents: new StringProperty(PropertyFlags.optional) | ||
})); | ||
function is(value) { | ||
return Document.descriptor.validate(value); | ||
} | ||
Document.is = is; | ||
})(Document = exports.Document || (exports.Document = {})); | ||
/** | ||
@@ -92,2 +674,13 @@ * The moniker kind. | ||
})(MonikerKind = exports.MonikerKind || (exports.MonikerKind = {})); | ||
(function (MonikerKind) { | ||
const values = StringEnum.values(MonikerKind); | ||
function property(flags = PropertyFlags.none) { | ||
return new StringEnumProperty(values, flags); | ||
} | ||
MonikerKind.property = property; | ||
function is(value) { | ||
return values.has(value); | ||
} | ||
MonikerKind.is = is; | ||
})(MonikerKind = exports.MonikerKind || (exports.MonikerKind = {})); | ||
var UniquenessLevel; | ||
@@ -112,6 +705,222 @@ (function (UniquenessLevel) { | ||
/** | ||
* The moniker is gloabally unique | ||
* The moniker is globally unique | ||
*/ | ||
UniquenessLevel["global"] = "global"; | ||
})(UniquenessLevel = exports.UniquenessLevel || (exports.UniquenessLevel = {})); | ||
(function (UniquenessLevel) { | ||
const values = StringEnum.values(UniquenessLevel); | ||
function property(flags = PropertyFlags.none) { | ||
return new StringEnumProperty(values, flags); | ||
} | ||
UniquenessLevel.property = property; | ||
function is(value) { | ||
return values.has(value); | ||
} | ||
UniquenessLevel.is = is; | ||
})(UniquenessLevel = exports.UniquenessLevel || (exports.UniquenessLevel = {})); | ||
var Moniker; | ||
(function (Moniker) { | ||
Moniker.descriptor = new VertexDescriptor(Object.assign({}, V.descriptor.description, { | ||
label: VertexLabels.property(VertexLabels.moniker), | ||
scheme: new StringProperty(), | ||
identifier: new StringProperty(), | ||
unique: UniquenessLevel.property(), | ||
kind: MonikerKind.property(PropertyFlags.optional) | ||
})); | ||
function is(value) { | ||
return Moniker.descriptor.validate(value); | ||
} | ||
Moniker.is = is; | ||
})(Moniker = exports.Moniker || (exports.Moniker = {})); | ||
var PackageInformation; | ||
(function (PackageInformation) { | ||
PackageInformation.descriptor = new VertexDescriptor(Object.assign({}, V.descriptor.description, { | ||
label: VertexLabels.property(VertexLabels.packageInformation), | ||
name: new StringProperty(), | ||
manager: new StringProperty(), | ||
uri: new UriProperty(PropertyFlags.optional), | ||
contents: new StringProperty(PropertyFlags.optional), | ||
version: new StringProperty(PropertyFlags.optional), | ||
repository: RepositoryInfo.property(PropertyFlags.optional) | ||
})); | ||
function is(value) { | ||
return PackageInformation.descriptor.validate(value); | ||
} | ||
PackageInformation.is = is; | ||
})(PackageInformation = exports.PackageInformation || (exports.PackageInformation = {})); | ||
var RangeBasedDocumentSymbol; | ||
(function (RangeBasedDocumentSymbol) { | ||
RangeBasedDocumentSymbol.descriptor = new ObjectDescriptor({ | ||
id: Id.property(), | ||
children: new Property(value => { | ||
if (!Array.isArray(value)) { | ||
return false; | ||
} | ||
for (const element of value) { | ||
if (!RangeBasedDocumentSymbol.is(element)) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
}, PropertyFlags.optional) | ||
}); | ||
function is(value) { | ||
return RangeBasedDocumentSymbol.descriptor.validate(value); | ||
} | ||
RangeBasedDocumentSymbol.is = is; | ||
})(RangeBasedDocumentSymbol = exports.RangeBasedDocumentSymbol || (exports.RangeBasedDocumentSymbol = {})); | ||
var DocumentSymbolResult; | ||
(function (DocumentSymbolResult) { | ||
DocumentSymbolResult.descriptor = new VertexDescriptor(Object.assign({}, V.descriptor.description, { | ||
label: VertexLabels.property(VertexLabels.documentSymbolResult), | ||
result: new Property(value => { | ||
if (!Array.isArray(value)) { | ||
return false; | ||
} | ||
if (value.length === 0) { | ||
return true; | ||
} | ||
const first = value[0]; | ||
const validator = first.id !== undefined | ||
? RangeBasedDocumentSymbol.is | ||
: lsp.DocumentSymbol.is; | ||
for (const item of value) { | ||
if (!validator(item)) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
}) | ||
})); | ||
function is(value) { | ||
return DocumentSymbolResult.descriptor.validate(value); | ||
} | ||
DocumentSymbolResult.is = is; | ||
})(DocumentSymbolResult = exports.DocumentSymbolResult || (exports.DocumentSymbolResult = {})); | ||
var DiagnosticResult; | ||
(function (DiagnosticResult) { | ||
DiagnosticResult.descriptor = new VertexDescriptor(Object.assign({}, V.descriptor.description, { | ||
label: VertexLabels.property(VertexLabels.diagnosticResult), | ||
result: new ArrayProperty(lsp.Diagnostic.is) | ||
})); | ||
function is(value) { | ||
return DiagnosticResult.descriptor.validate(value); | ||
} | ||
DiagnosticResult.is = is; | ||
})(DiagnosticResult = exports.DiagnosticResult || (exports.DiagnosticResult = {})); | ||
var FoldingRangeResult; | ||
(function (FoldingRangeResult) { | ||
FoldingRangeResult.descriptor = new VertexDescriptor(Object.assign({}, V.descriptor.description, { | ||
label: VertexLabels.property(VertexLabels.foldingRangeResult), | ||
result: new ArrayProperty(lsp.FoldingRange.is) | ||
})); | ||
function is(value) { | ||
return FoldingRangeResult.descriptor.validate(value); | ||
} | ||
FoldingRangeResult.is = is; | ||
})(FoldingRangeResult = exports.FoldingRangeResult || (exports.FoldingRangeResult = {})); | ||
var DocumentLinkResult; | ||
(function (DocumentLinkResult) { | ||
DocumentLinkResult.descriptor = new VertexDescriptor(Object.assign({}, V.descriptor.description, { | ||
label: VertexLabels.property(VertexLabels.documentLinkResult), | ||
result: new ArrayProperty(lsp.DocumentLink.is) | ||
})); | ||
function is(value) { | ||
return DocumentLinkResult.descriptor.validate(value); | ||
} | ||
DocumentLinkResult.is = is; | ||
})(DocumentLinkResult = exports.DocumentLinkResult || (exports.DocumentLinkResult = {})); | ||
var DeclarationResult; | ||
(function (DeclarationResult) { | ||
DeclarationResult.descriptor = new VertexDescriptor(Object.assign({}, V.descriptor.description, { | ||
label: VertexLabels.property(VertexLabels.declarationResult) | ||
})); | ||
function is(value) { | ||
return DeclarationResult.descriptor.validate(value); | ||
} | ||
DeclarationResult.is = is; | ||
})(DeclarationResult = exports.DeclarationResult || (exports.DeclarationResult = {})); | ||
var DefinitionResult; | ||
(function (DefinitionResult) { | ||
DefinitionResult.descriptor = new VertexDescriptor(Object.assign({}, V.descriptor.description, { | ||
label: VertexLabels.property(VertexLabels.definitionResult) | ||
})); | ||
function is(value) { | ||
return DefinitionResult.descriptor.validate(value); | ||
} | ||
DefinitionResult.is = is; | ||
})(DefinitionResult = exports.DefinitionResult || (exports.DefinitionResult = {})); | ||
var TypeDefinitionResult; | ||
(function (TypeDefinitionResult) { | ||
TypeDefinitionResult.descriptor = new VertexDescriptor(Object.assign({}, V.descriptor.description, { | ||
label: VertexLabels.property(VertexLabels.typeDefinitionResult) | ||
})); | ||
function is(value) { | ||
return TypeDefinitionResult.descriptor.validate(value); | ||
} | ||
TypeDefinitionResult.is = is; | ||
})(TypeDefinitionResult = exports.TypeDefinitionResult || (exports.TypeDefinitionResult = {})); | ||
var ReferenceResult; | ||
(function (ReferenceResult) { | ||
ReferenceResult.descriptor = new VertexDescriptor(Object.assign({}, V.descriptor.description, { | ||
label: VertexLabels.property(VertexLabels.referenceResult) | ||
})); | ||
function is(value) { | ||
return ReferenceResult.descriptor.validate(value); | ||
} | ||
ReferenceResult.is = is; | ||
})(ReferenceResult = exports.ReferenceResult || (exports.ReferenceResult = {})); | ||
var ImplementationResult; | ||
(function (ImplementationResult) { | ||
ImplementationResult.descriptor = new VertexDescriptor(Object.assign({}, V.descriptor.description, { | ||
label: VertexLabels.property(VertexLabels.implementationResult) | ||
})); | ||
function is(value) { | ||
return ImplementationResult.descriptor.validate(value); | ||
} | ||
ImplementationResult.is = is; | ||
})(ImplementationResult = exports.ImplementationResult || (exports.ImplementationResult = {})); | ||
var HoverResult; | ||
(function (HoverResult) { | ||
HoverResult.descriptor = new VertexDescriptor(Object.assign({}, V.descriptor.description, { | ||
label: VertexLabels.property(VertexLabels.hoverResult), | ||
result: new Property(lsp.Hover.is) | ||
})); | ||
function is(value) { | ||
return HoverResult.descriptor.validate(value); | ||
} | ||
HoverResult.is = is; | ||
})(HoverResult = exports.HoverResult || (exports.HoverResult = {})); | ||
var Vertex; | ||
(function (Vertex) { | ||
const descriptors = new Map(); | ||
descriptors.set(VertexLabels.metaData, MetaData.descriptor); | ||
descriptors.set(VertexLabels.event, Event.descriptor); | ||
descriptors.set(VertexLabels.project, Project.descriptor); | ||
descriptors.set(VertexLabels.group, Group.descriptor); | ||
descriptors.set(VertexLabels.document, Document.descriptor); | ||
descriptors.set(VertexLabels.moniker, Moniker.descriptor); | ||
descriptors.set(VertexLabels.packageInformation, PackageInformation.descriptor); | ||
descriptors.set(VertexLabels.resultSet, ResultSet.descriptor); | ||
descriptors.set(VertexLabels.range, Range.descriptor); | ||
descriptors.set(VertexLabels.documentSymbolResult, DocumentSymbolResult.descriptor); | ||
descriptors.set(VertexLabels.foldingRangeResult, FoldingRangeResult.descriptor); | ||
descriptors.set(VertexLabels.documentLinkResult, DocumentLinkResult.descriptor); | ||
descriptors.set(VertexLabels.diagnosticResult, DiagnosticResult.descriptor); | ||
descriptors.set(VertexLabels.definitionResult, DefinitionResult.descriptor); | ||
descriptors.set(VertexLabels.declarationResult, DeclarationResult.descriptor); | ||
descriptors.set(VertexLabels.typeDefinitionResult, TypeDefinitionResult.descriptor); | ||
descriptors.set(VertexLabels.hoverResult, HoverResult.descriptor); | ||
descriptors.set(VertexLabels.referenceResult, ReferenceResult.descriptor); | ||
descriptors.set(VertexLabels.implementationResult, ImplementationResult.descriptor); | ||
function getDescriptor(vertexOrVertexLabel) { | ||
const label = typeof vertexOrVertexLabel === 'string' ? vertexOrVertexLabel : vertexOrVertexLabel.label; | ||
const result = descriptors.get(label); | ||
if (result === undefined) { | ||
throw new Error(`No descriptor registered for vertex ${label}`); | ||
} | ||
return result; | ||
} | ||
Vertex.getDescriptor = getDescriptor; | ||
})(Vertex = exports.Vertex || (exports.Vertex = {})); | ||
var EdgeLabels; | ||
@@ -137,2 +946,50 @@ (function (EdgeLabels) { | ||
})(EdgeLabels = exports.EdgeLabels || (exports.EdgeLabels = {})); | ||
(function (EdgeLabels) { | ||
const values = StringEnum.values(EdgeLabels); | ||
function property(valueOrFlags, flags) { | ||
if (typeof valueOrFlags === 'string') { | ||
return new Property(value => value === valueOrFlags, flags); | ||
} | ||
return new StringEnumProperty(values, flags); | ||
} | ||
EdgeLabels.property = property; | ||
function is(value) { | ||
return values.has(value); | ||
} | ||
EdgeLabels.is = is; | ||
})(EdgeLabels = exports.EdgeLabels || (exports.EdgeLabels = {})); | ||
var Cardinality; | ||
(function (Cardinality) { | ||
Cardinality["one2one"] = "1:1"; | ||
Cardinality["one2many"] = "1:N"; | ||
Cardinality["many2many"] = "N:N"; | ||
})(Cardinality = exports.Cardinality || (exports.Cardinality = {})); | ||
class EdgeDescriptor extends ObjectDescriptor { | ||
constructor(description, cardinality, edgeDescriptions) { | ||
super(description); | ||
this.cardinality = cardinality; | ||
this.edgeDescriptions = edgeDescriptions; | ||
} | ||
} | ||
exports.EdgeDescriptor = EdgeDescriptor; | ||
var E11; | ||
(function (E11) { | ||
E11.descriptor = new EdgeDescriptor({ | ||
id: Id.property(), | ||
type: new Property(value => value === ElementTypes.edge), | ||
label: EdgeLabels.property(), | ||
outV: Id.property(), | ||
inV: Id.property() | ||
}, Cardinality.one2one, [[V.descriptor, V.descriptor]]); | ||
})(E11 = exports.E11 || (exports.E11 = {})); | ||
var E1N; | ||
(function (E1N) { | ||
E1N.descriptor = new EdgeDescriptor({ | ||
id: Id.property(), | ||
type: new Property(value => value === ElementTypes.edge), | ||
label: EdgeLabels.property(), | ||
outV: Id.property(), | ||
inVs: new ArrayProperty(Id.is) | ||
}, Cardinality.one2many, [[V.descriptor, V.descriptor]]); | ||
})(E1N = exports.E1N || (exports.E1N = {})); | ||
var ItemEdgeProperties; | ||
@@ -148,2 +1005,220 @@ (function (ItemEdgeProperties) { | ||
})(ItemEdgeProperties = exports.ItemEdgeProperties || (exports.ItemEdgeProperties = {})); | ||
(function (ItemEdgeProperties) { | ||
const values = StringEnum.values(ItemEdgeProperties); | ||
function property(flags) { | ||
return new Property(ItemEdgeProperties.is, flags); | ||
} | ||
ItemEdgeProperties.property = property; | ||
function is(value) { | ||
return values.has(value); | ||
} | ||
ItemEdgeProperties.is = is; | ||
})(ItemEdgeProperties = exports.ItemEdgeProperties || (exports.ItemEdgeProperties = {})); | ||
var contains; | ||
(function (contains) { | ||
const edgeInformation = [[Project.descriptor, Document.descriptor], [Document.descriptor, Range.descriptor]]; | ||
contains.descriptor = new EdgeDescriptor(Object.assign({}, E1N.descriptor.description, { | ||
label: EdgeLabels.property(EdgeLabels.contains) | ||
}), Cardinality.one2many, edgeInformation); | ||
function is(value) { | ||
return contains.descriptor.validate(value); | ||
} | ||
contains.is = is; | ||
})(contains = exports.contains || (exports.contains = {})); | ||
var next; | ||
(function (next) { | ||
const edgeInformation = [[Range.descriptor, ResultSet.descriptor], [ResultSet.descriptor, ResultSet.descriptor]]; | ||
next.descriptor = new EdgeDescriptor(Object.assign({}, E11.descriptor.description, { | ||
label: EdgeLabels.property(EdgeLabels.next) | ||
}), Cardinality.one2one, edgeInformation); | ||
function is(value) { | ||
return next.descriptor.validate(value); | ||
} | ||
next.is = is; | ||
})(next = exports.next || (exports.next = {})); | ||
var item; | ||
(function (item) { | ||
const edgeInformation = [ | ||
[DeclarationResult.descriptor, Range.descriptor], | ||
[DefinitionResult.descriptor, Range.descriptor], | ||
[TypeDefinitionResult.descriptor, Range.descriptor], | ||
[ReferenceResult.descriptor, Range.descriptor], | ||
[ReferenceResult.descriptor, ReferenceResult.descriptor], | ||
[ReferenceResult.descriptor, Moniker.descriptor], | ||
[ImplementationResult.descriptor, Range.descriptor], | ||
[ImplementationResult.descriptor, ImplementationResult.descriptor], | ||
[ImplementationResult.descriptor, Moniker.descriptor] | ||
]; | ||
item.descriptor = new EdgeDescriptor(Object.assign({}, E1N.descriptor.description, { | ||
label: EdgeLabels.property(EdgeLabels.item), | ||
shard: Id.property(), | ||
property: ItemEdgeProperties.property(PropertyFlags.optional) | ||
}), Cardinality.one2many, edgeInformation); | ||
function is(value) { | ||
return item.descriptor.validate(value); | ||
} | ||
item.is = is; | ||
})(item = exports.item || (exports.item = {})); | ||
var moniker; | ||
(function (moniker) { | ||
const edgeInformation = [ | ||
[Range.descriptor, Moniker.descriptor], | ||
[ResultSet.descriptor, Moniker.descriptor], | ||
[DeclarationResult.descriptor, Moniker.descriptor], | ||
[DefinitionResult.descriptor, Moniker.descriptor], | ||
[TypeDefinitionResult.descriptor, Moniker.descriptor], | ||
[ReferenceResult.descriptor, Moniker.descriptor], | ||
[ImplementationResult.descriptor, Moniker.descriptor] | ||
]; | ||
moniker.descriptor = new EdgeDescriptor(Object.assign({}, E11.descriptor.description, { | ||
label: EdgeLabels.property(EdgeLabels.moniker) | ||
}), Cardinality.one2one, edgeInformation); | ||
function is(value) { | ||
return moniker.descriptor.validate(value); | ||
} | ||
moniker.is = is; | ||
})(moniker = exports.moniker || (exports.moniker = {})); | ||
var attach; | ||
(function (attach) { | ||
const edgeInformation = [[Moniker.descriptor, Moniker.descriptor]]; | ||
attach.descriptor = new EdgeDescriptor(Object.assign({}, E11.descriptor.description, { | ||
label: EdgeLabels.property(EdgeLabels.attach) | ||
}), Cardinality.one2one, edgeInformation); | ||
function is(value) { | ||
return attach.descriptor.validate(value); | ||
} | ||
attach.is = is; | ||
})(attach = exports.attach || (exports.attach = {})); | ||
var packageInformation; | ||
(function (packageInformation) { | ||
const edgeInformation = [[Moniker.descriptor, PackageInformation.descriptor]]; | ||
packageInformation.descriptor = new EdgeDescriptor(Object.assign({}, E11.descriptor.description, { | ||
label: EdgeLabels.property(EdgeLabels.packageInformation) | ||
}), Cardinality.one2one, edgeInformation); | ||
function is(value) { | ||
return packageInformation.descriptor.validate(value); | ||
} | ||
packageInformation.is = is; | ||
})(packageInformation = exports.packageInformation || (exports.packageInformation = {})); | ||
var belongsTo; | ||
(function (belongsTo) { | ||
const edgeInformation = [[Project.descriptor, Group.descriptor]]; | ||
belongsTo.descriptor = new EdgeDescriptor(Object.assign({}, E11.descriptor.description, { | ||
label: EdgeLabels.property(EdgeLabels.belongsTo) | ||
}), Cardinality.one2one, edgeInformation); | ||
function is(value) { | ||
return belongsTo.descriptor.validate(value); | ||
} | ||
belongsTo.is = is; | ||
})(belongsTo = exports.belongsTo || (exports.belongsTo = {})); | ||
var textDocument_documentSymbol; | ||
(function (textDocument_documentSymbol) { | ||
const edgeInformation = [[Document.descriptor, DocumentSymbolResult.descriptor]]; | ||
textDocument_documentSymbol.descriptor = new EdgeDescriptor(Object.assign({}, E11.descriptor.description, { | ||
label: EdgeLabels.property(EdgeLabels.textDocument_documentSymbol) | ||
}), Cardinality.one2one, edgeInformation); | ||
function is(value) { | ||
return textDocument_documentSymbol.descriptor.validate(value); | ||
} | ||
textDocument_documentSymbol.is = is; | ||
})(textDocument_documentSymbol = exports.textDocument_documentSymbol || (exports.textDocument_documentSymbol = {})); | ||
var textDocument_foldingRange; | ||
(function (textDocument_foldingRange) { | ||
const edgeInformation = [[Document.descriptor, FoldingRangeResult.descriptor]]; | ||
textDocument_foldingRange.descriptor = new EdgeDescriptor(Object.assign({}, E11.descriptor.description, { | ||
label: EdgeLabels.property(EdgeLabels.textDocument_foldingRange) | ||
}), Cardinality.one2one, edgeInformation); | ||
function is(value) { | ||
return textDocument_foldingRange.descriptor.validate(value); | ||
} | ||
textDocument_foldingRange.is = is; | ||
})(textDocument_foldingRange = exports.textDocument_foldingRange || (exports.textDocument_foldingRange = {})); | ||
var textDocument_documentLink; | ||
(function (textDocument_documentLink) { | ||
const edgeInformation = [[Document.descriptor, DocumentLinkResult.descriptor]]; | ||
textDocument_documentLink.descriptor = new EdgeDescriptor(Object.assign({}, E11.descriptor.description, { | ||
label: EdgeLabels.property(EdgeLabels.textDocument_documentLink) | ||
}), Cardinality.one2one, edgeInformation); | ||
function is(value) { | ||
return textDocument_documentLink.descriptor.validate(value); | ||
} | ||
textDocument_documentLink.is = is; | ||
})(textDocument_documentLink = exports.textDocument_documentLink || (exports.textDocument_documentLink = {})); | ||
var textDocument_diagnostic; | ||
(function (textDocument_diagnostic) { | ||
const edgeInformation = [[Project.descriptor, DiagnosticResult.descriptor], [Document.descriptor, DiagnosticResult.descriptor]]; | ||
textDocument_diagnostic.descriptor = new EdgeDescriptor(Object.assign({}, E11.descriptor.description, { | ||
label: EdgeLabels.property(EdgeLabels.textDocument_diagnostic) | ||
}), Cardinality.one2one, edgeInformation); | ||
function is(value) { | ||
return textDocument_diagnostic.descriptor.validate(value); | ||
} | ||
textDocument_diagnostic.is = is; | ||
})(textDocument_diagnostic = exports.textDocument_diagnostic || (exports.textDocument_diagnostic = {})); | ||
var textDocument_declaration; | ||
(function (textDocument_declaration) { | ||
const edgeInformation = [[Range.descriptor, DeclarationResult.descriptor], [ResultSet.descriptor, DeclarationResult.descriptor]]; | ||
textDocument_declaration.descriptor = new EdgeDescriptor(Object.assign({}, E11.descriptor.description, { | ||
label: EdgeLabels.property(EdgeLabels.textDocument_declaration) | ||
}), Cardinality.one2one, edgeInformation); | ||
function is(value) { | ||
return textDocument_declaration.descriptor.validate(value); | ||
} | ||
textDocument_declaration.is = is; | ||
})(textDocument_declaration = exports.textDocument_declaration || (exports.textDocument_declaration = {})); | ||
var textDocument_definition; | ||
(function (textDocument_definition) { | ||
const edgeInformation = [[Range.descriptor, DefinitionResult.descriptor], [ResultSet.descriptor, DefinitionResult.descriptor]]; | ||
textDocument_definition.descriptor = new EdgeDescriptor(Object.assign({}, E11.descriptor.description, { | ||
label: EdgeLabels.property(EdgeLabels.textDocument_definition) | ||
}), Cardinality.one2one, edgeInformation); | ||
function is(value) { | ||
return textDocument_definition.descriptor.validate(value); | ||
} | ||
textDocument_definition.is = is; | ||
})(textDocument_definition = exports.textDocument_definition || (exports.textDocument_definition = {})); | ||
var textDocument_typeDefinition; | ||
(function (textDocument_typeDefinition) { | ||
const edgeInformation = [[Range.descriptor, TypeDefinitionResult.descriptor], [ResultSet.descriptor, TypeDefinitionResult.descriptor]]; | ||
textDocument_typeDefinition.descriptor = new EdgeDescriptor(Object.assign({}, E11.descriptor.description, { | ||
label: EdgeLabels.property(EdgeLabels.textDocument_typeDefinition) | ||
}), Cardinality.one2one, edgeInformation); | ||
function is(value) { | ||
return textDocument_typeDefinition.descriptor.validate(value); | ||
} | ||
textDocument_typeDefinition.is = is; | ||
})(textDocument_typeDefinition = exports.textDocument_typeDefinition || (exports.textDocument_typeDefinition = {})); | ||
var textDocument_hover; | ||
(function (textDocument_hover) { | ||
const edgeInformation = [[Range.descriptor, HoverResult.descriptor], [ResultSet.descriptor, HoverResult.descriptor]]; | ||
textDocument_hover.descriptor = new EdgeDescriptor(Object.assign({}, E11.descriptor.description, { | ||
label: EdgeLabels.property(EdgeLabels.textDocument_hover) | ||
}), Cardinality.one2one, edgeInformation); | ||
function is(value) { | ||
return textDocument_hover.descriptor.validate(value); | ||
} | ||
textDocument_hover.is = is; | ||
})(textDocument_hover = exports.textDocument_hover || (exports.textDocument_hover = {})); | ||
var textDocument_references; | ||
(function (textDocument_references) { | ||
const edgeInformation = [[Range.descriptor, ReferenceResult.descriptor], [ResultSet.descriptor, ReferenceResult.descriptor]]; | ||
textDocument_references.descriptor = new EdgeDescriptor(Object.assign({}, E11.descriptor.description, { | ||
label: EdgeLabels.property(EdgeLabels.textDocument_references) | ||
}), Cardinality.one2one, edgeInformation); | ||
function is(value) { | ||
return textDocument_references.descriptor.validate(value); | ||
} | ||
textDocument_references.is = is; | ||
})(textDocument_references = exports.textDocument_references || (exports.textDocument_references = {})); | ||
var textDocument_implementation; | ||
(function (textDocument_implementation) { | ||
const edgeInformation = [[Range.descriptor, ImplementationResult.descriptor], [ResultSet.descriptor, ImplementationResult.descriptor]]; | ||
textDocument_implementation.descriptor = new EdgeDescriptor(Object.assign({}, E11.descriptor.description, { | ||
label: EdgeLabels.property(EdgeLabels.textDocument_implementation) | ||
}), Cardinality.one2one, edgeInformation); | ||
function is(value) { | ||
return textDocument_implementation.descriptor.validate(value); | ||
} | ||
textDocument_implementation.is = is; | ||
})(textDocument_implementation = exports.textDocument_implementation || (exports.textDocument_implementation = {})); | ||
var Edge; | ||
@@ -161,3 +1236,30 @@ (function (Edge) { | ||
Edge.is1N = is1N; | ||
const descriptors = new Map(); | ||
descriptors.set(EdgeLabels.contains, contains.descriptor); | ||
descriptors.set(EdgeLabels.item, item.descriptor); | ||
descriptors.set(EdgeLabels.next, next.descriptor); | ||
descriptors.set(EdgeLabels.moniker, moniker.descriptor); | ||
descriptors.set(EdgeLabels.attach, attach.descriptor); | ||
descriptors.set(EdgeLabels.packageInformation, packageInformation.descriptor); | ||
descriptors.set(EdgeLabels.belongsTo, belongsTo.descriptor); | ||
descriptors.set(EdgeLabels.textDocument_documentSymbol, textDocument_documentSymbol.descriptor); | ||
descriptors.set(EdgeLabels.textDocument_foldingRange, textDocument_foldingRange.descriptor); | ||
descriptors.set(EdgeLabels.textDocument_documentLink, textDocument_documentLink.descriptor); | ||
descriptors.set(EdgeLabels.textDocument_diagnostic, textDocument_diagnostic.descriptor); | ||
descriptors.set(EdgeLabels.textDocument_declaration, textDocument_declaration.descriptor); | ||
descriptors.set(EdgeLabels.textDocument_definition, textDocument_definition.descriptor); | ||
descriptors.set(EdgeLabels.textDocument_typeDefinition, textDocument_typeDefinition.descriptor); | ||
descriptors.set(EdgeLabels.textDocument_hover, textDocument_hover.descriptor); | ||
descriptors.set(EdgeLabels.textDocument_references, textDocument_references.descriptor); | ||
descriptors.set(EdgeLabels.textDocument_implementation, textDocument_implementation.descriptor); | ||
function getDescriptor(edgeOrEdgeLabel) { | ||
const label = typeof edgeOrEdgeLabel === 'string' ? edgeOrEdgeLabel : edgeOrEdgeLabel.label; | ||
const result = descriptors.get(label); | ||
if (result === undefined) { | ||
throw new Error(`No descriptor registered for edge ${label}`); | ||
} | ||
return result; | ||
} | ||
Edge.getDescriptor = getDescriptor; | ||
})(Edge = exports.Edge || (exports.Edge = {})); | ||
//# sourceMappingURL=protocol.js.map |
{ | ||
"name": "lsif-protocol", | ||
"description": "Typescript implementation of the LSIF protocol", | ||
"version": "0.5.0-next.5", | ||
"version": "0.5.1", | ||
"author": "Microsoft Corporation", | ||
@@ -17,3 +17,3 @@ "license": "MIT", | ||
"dependencies": { | ||
"vscode-languageserver-protocol": "^3.15.3" | ||
"vscode-languageserver-protocol": "^3.16.0" | ||
}, | ||
@@ -23,7 +23,8 @@ "scripts": { | ||
"compile:publish": "node ../build/bin/tsc -p ./tsconfig.publish.json", | ||
"watch": "node ../build/bin/tsc -b ./tsconfig.json -w", | ||
"watch": "node ../build/bin/tsc -b ./tsconfig.watch.json -w", | ||
"clean": "node ../node_modules/rimraf/bin.js lib", | ||
"prepublishOnly": "npm run clean && npm run compile:publish", | ||
"lint": "node ../node_modules/eslint/bin/eslint.js ./src/*.ts", | ||
"prepublishOnly": "git clean -xfd . && npm run clean && npm install && npm run compile:publish && npm run lint", | ||
"postpublish": "node ../build/bin/post-publish.js" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
227573
11
2439