How to use the lsif-protocol.EdgeLabels function in lsif-protocol

To help you get started, we’ve selected a few lsif-protocol examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / lsif-node / util / src / validate.ts View on Github external
count++;

		if ((!LSIF.Edge.is11(edge) && !(LSIF.Edge.is1N(edge))) || edge.outV === undefined) {
			// This error was caught before
			return;
		}

		if (edge.label === undefined || !Object.values(LSIF.EdgeLabels).includes(edge.label)) {
			errors.push(new Error(edges[key].element, edge.label ? `requires property "label"` : `unknown label`));
			edges[key].invalidate();
			return;
		}

		let validation: ValidatorResult;
		switch (edge.label) {
			case LSIF.EdgeLabels.item:
				validation = validateSchema(edge, itemSchema);
				break;
			case LSIF.EdgeLabels.contains:
				validation = validateSchema(edge, e1NSchema);
				break;
			default:
				validation = validateSchema(edge, e11Schema);
		}

		const validationErrors: ValidationError[] = validation.errors.filter((error) => error.property === 'instance');
		if (validationErrors.length > 0) {
			edges[key].invalidate();
			errors.push(new Error(edges[key].element, validationErrors.join('; ')));
		}
	});
github microsoft / lsif-node / util / src / validate.ts View on Github external
ids.forEach((key: string) => {
		const edge: LSIF.Edge = edges[key].element as LSIF.Edge;
		outputMessage = `Verifying edge ${count} of ${length}...`;
		process.stdout.write(`${outputMessage}\r`);
		count++;

		if ((!LSIF.Edge.is11(edge) && !(LSIF.Edge.is1N(edge))) || edge.outV === undefined) {
			// This error was caught before
			return;
		}

		if (edge.label === undefined || !Object.values(LSIF.EdgeLabels).includes(edge.label)) {
			errors.push(new Error(edges[key].element, edge.label ? `requires property "label"` : `unknown label`));
			edges[key].invalidate();
			return;
		}

		let validation: ValidatorResult;
		switch (edge.label) {
			case LSIF.EdgeLabels.item:
				validation = validateSchema(edge, itemSchema);
				break;
			case LSIF.EdgeLabels.contains:
				validation = validateSchema(edge, e1NSchema);
				break;
			default:
				validation = validateSchema(edge, e11Schema);
		}
github sourcegraph / sourcegraph / lsif / src / worker / conversion / correlator.ts View on Github external
if (element.type === lsif.ElementTypes.edge) {
            switch (element.label) {
                case lsif.EdgeLabels.contains:
                    this.handleContains(element)
                    break

                case lsif.EdgeLabels.next:
                    this.handleNextEdge(element)
                    break

                case lsif.EdgeLabels.item:
                    this.handleItemEdge(element)
                    break

                case lsif.EdgeLabels.textDocument_definition:
                    this.handleDefinitionEdge(element)
                    break

                case lsif.EdgeLabels.textDocument_references:
                    this.handleReferenceEdge(element)
                    break

                case lsif.EdgeLabels.textDocument_hover:
                    this.handleHoverEdge(element)
                    break

                case lsif.EdgeLabels.moniker:
                    this.handleMonikerEdge(element)
                    break

                case lsif.EdgeLabels.nextMoniker: