How to use the lsif-protocol.VertexLabels.metaData 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 / sqlite / src / main.ts View on Github external
rd.on('line', (line) => {
			if (!line) {
				return;
			}
			let element: Edge | Vertex;
			try {
				element = JSON.parse(line);
			} catch (err) {
				console.log(`Parsing failed for line:\n${line}`);
				throw err;
			}
			if (element.type === ElementTypes.vertex && element.label === VertexLabels.metaData) {
				let convertMetaData = (data: CompressorProperty): CompressorPropertyDescription => {
					let result: CompressorPropertyDescription = {
						name: data.name as string,
						index: data.index,
						compressionKind: data.compressionKind
					};
					if (data.shortForm !== undefined) {
						let long: Set = new Set();
						let short: Set = new Set();
						result.shortForm = [];
						for (let elem of data.shortForm) {
							let [key, value] = elem;
							if (long.has(key)) {
								throw new Error(`Duplicate key ${key} in short form.`);
							}
							long.add(key);
github microsoft / lsif-node / sqlite / src / main.ts View on Github external
function stringify(element: Vertex | Edge): string {
		if (element.type === ElementTypes.vertex && element.label === VertexLabels.metaData) {
			return JSON.stringify(element, undefined, 0);
		}
		let compressor = Compressor.getCompressor(element);
		if (compressor === undefined) {
			throw new Error(`No compressor found for ${element.label}`);
		}
		return JSON.stringify(compressor.compress(element, { mode: 'store' }));
	}
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;
				default:
					this.insertVertex(element);
github microsoft / vscode-lsif-extension / server / src / json.ts View on Github external
private processVertex(vertex: Vertex): void {
		this.vertices.all.set(vertex.id, vertex);
		switch(vertex.label) {
			case VertexLabels.metaData:
				this.version = vertex.version;
				if (vertex.projectRoot !== undefined) {
					this.projectRoot = URI.parse(vertex.projectRoot);
				}
				break;
			case VertexLabels.project:
				this.vertices.projects.set(vertex.id, vertex);
				break;
			case VertexLabels.document:
				this.vertices.documents.set(vertex.id, vertex);
				this.indices.documents.set(vertex.uri, vertex);
				break;
			case VertexLabels.range:
				this.vertices.ranges.set(vertex.id, vertex);
				break;
		}
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;
				case VertexLabels.hoverResult:
					this.handleHover(element);