How to use the lsif-protocol.ElementTypes.vertex 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 / npm / src / main.ts View on Github external
rd.on('line', (line) => {
		let element: Edge | Vertex = JSON.parse(line);
		if (element.type === ElementTypes.vertex) {
			switch(element.label) {
				case VertexLabels.moniker:
					if (element.kind === MonikerKind.local) {
						emit(line);
					} else {
						if (exportLinker !== undefined) {
							exportLinker.handleMoniker(element);
						}
						importLinker.handleMoniker(element);
					}
					break;
				default:
					emit(line);
			}
		} else {
			emit(line);
github microsoft / lsif-node / npm / src / main.ts View on Github external
protected createPackageInformation(packageJson: PackageJson): PackageInformation {
		let result: PackageInformation = {
			id: this.idGenerator(),
			type: ElementTypes.vertex,
			label: VertexLabels.packageInformation,
			name: packageJson.name,
			manager: 'npm',
			version: packageJson.version
		};
		if (packageJson.hasRepository()) {
			result.repository = packageJson.repository;
		}
		return result;
	}
github microsoft / lsif-node / tsc / src / emitters / graphSON.ts View on Github external
emit: (element: Vertex | Edge) => {
			if (element.type === ElementTypes.vertex) {
				let gs: GraphSonVertex;
				let values: GraphSonProperty[];
				switch (element.label) {
					case 'project':
						gs = {
							id: element.id,
							label: element.label
						};
						vertices.set(gs.id, gs);
						break;
					case 'document':
						gs = {
							id: element.id,
							label: element.label,
							properties: {
								uri: [ { id: idGenerator(), value: element.uri } ]
github microsoft / lsif-node / sqlite / src / main.ts View on Github external
function shortForm(element: Vertex | Edge): number {
		let result: number | undefined;
		if (element.type === ElementTypes.vertex) {
			result = vertexShortForms.get(element.label);
		} else {
			result = edgeShortForms.get(element.label);
		}
		if (result === undefined) {
			throw new Error(`Can't compute short form for ${element.label}`);
		}
		return result;
	}
github microsoft / lsif-node / sqlite / src / graphStore.ts View on Github external
public insert(element: Edge | Vertex): void {
		if (element.type === ElementTypes.vertex) {
			switch (element.label) {
				case VertexLabels.metaData:
					this.insertMetaData(element);
					break;
				case VertexLabels.project:
					this.insertProject(element);
					break;
				case VertexLabels.document:
					this.insertDocument(element);
					break;
				case VertexLabels.packageInformation:
					this.insertPackageInformation(element);
					break;
				case VertexLabels.range:
					this.insertRange(element);
					break;
github microsoft / lsif-node / tsc / src / emitters / graphSON.ts View on Github external
emit: (element: Vertex | Edge) => {
			if (element.type === ElementTypes.vertex) {
				let gs: GraphSonVertex;
				let values: GraphSonProperty[];
				switch (element.label) {
					case 'project':
						gs = {
							id: element.id,
							label: element.label
						};
						vertices.set(gs.id, gs);
						break;
					case 'document':
						gs = {
							id: element.id,
							label: element.label,
							properties: {
								uri: [ { id: idGenerator(), value: element.uri } ]
github microsoft / lsif-node / sqlite / src / blobStore.ts View on Github external
public insert(element: Edge | Vertex): void {
		if (element.type === ElementTypes.vertex) {
			switch(element.label) {
				case VertexLabels.metaData:
					this.handleMetaData(element);
					break;
				case VertexLabels.document:
					this.documents.set(element.id, element);
					break;
				case VertexLabels.range:
					this.handleRange(element);
					break;
				case VertexLabels.resultSet:
					this.handleResultSet(element);
					break;
				case VertexLabels.moniker:
					this.handleMoniker(element);
					break;
github microsoft / vscode-lsif-extension / server / src / json.ts View on Github external
rd.on('line', (line: string) => {
				if (!line || line.length === 0) {
					return;
				}
				let element: Edge | Vertex = JSON.parse(line);
				switch (element.type) {
					case ElementTypes.vertex:
						this.processVertex(element);
						break;
					case ElementTypes.edge:
						this.processEdge(element);
						break;
				}
			});
			rd.on('close', () => {