How to use the lsif-protocol.MonikerKind.import 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
public handleMoniker(moniker: Moniker): void {
		if (moniker.kind !== MonikerKind.import || moniker.scheme !== TscMoniker.scheme) {
			return;
		}
		this.ensureIdGenerator(moniker.id);
		emit(moniker);
		const tscMoniker = TscMoniker.parse(moniker.identifier);
		if (!TscMoniker.hasPath(tscMoniker)) {
			return;
		}
		let parts = tscMoniker.path.split('/');
		let packagePath: string | undefined;
		let monikerPath: string | undefined;
		for (let i = parts.length - 1; i >= 0; i--) {
			let part = parts[i];
			if (part === 'node_modules') {
				// End is exclusive and one for the name
				const packageIndex = i + (parts[i + 1].startsWith('@') ? 3 : 2);
github microsoft / lsif-node / sqlite / src / blobStore.ts View on Github external
export function compare(m1: MonikerData, m2: MonikerData): number {
		let result = Strings.compare(m1.identifier, m2.identifier);
		if (result !== 0) {
			return result;
		}
		result = Strings.compare(m1.scheme, m2.scheme);
		if (result !== 0) {
			return result;
		}
		if (m1.kind === m2.kind) {
			return 0;
		}
		const k1 = m1.kind !== undefined ? m1.kind : MonikerKind.import;
		const k2 = m2.kind !== undefined ? m2.kind : MonikerKind.import;
		if (k1 === MonikerKind.import && k2 === MonikerKind.export) {
			return -1;
		}
		if (k1 === MonikerKind.export && k2 === MonikerKind.import) {
			return 1;
		}
		return 0;
	}
github microsoft / lsif-node / sqlite / src / blobStore.ts View on Github external
export function compare(m1: MonikerData, m2: MonikerData): number {
		let result = Strings.compare(m1.identifier, m2.identifier);
		if (result !== 0) {
			return result;
		}
		result = Strings.compare(m1.scheme, m2.scheme);
		if (result !== 0) {
			return result;
		}
		if (m1.kind === m2.kind) {
			return 0;
		}
		const k1 = m1.kind !== undefined ? m1.kind : MonikerKind.import;
		const k2 = m2.kind !== undefined ? m2.kind : MonikerKind.import;
		if (k1 === MonikerKind.import && k2 === MonikerKind.export) {
			return -1;
		}
		if (k1 === MonikerKind.export && k2 === MonikerKind.import) {
			return 1;
		}
		return 0;
	}
github microsoft / lsif-node / sqlite / src / blobStore.ts View on Github external
export function compare(m1: MonikerData, m2: MonikerData): number {
		let result = Strings.compare(m1.identifier, m2.identifier);
		if (result !== 0) {
			return result;
		}
		result = Strings.compare(m1.scheme, m2.scheme);
		if (result !== 0) {
			return result;
		}
		if (m1.kind === m2.kind) {
			return 0;
		}
		const k1 = m1.kind !== undefined ? m1.kind : MonikerKind.import;
		const k2 = m2.kind !== undefined ? m2.kind : MonikerKind.import;
		if (k1 === MonikerKind.import && k2 === MonikerKind.export) {
			return -1;
		}
		if (k1 === MonikerKind.export && k2 === MonikerKind.import) {
			return 1;
		}
		return 0;
	}
github microsoft / lsif-node / sqlite / src / blobStore.ts View on Github external
if (result !== 0) {
			return result;
		}
		result = Strings.compare(m1.scheme, m2.scheme);
		if (result !== 0) {
			return result;
		}
		if (m1.kind === m2.kind) {
			return 0;
		}
		const k1 = m1.kind !== undefined ? m1.kind : MonikerKind.import;
		const k2 = m2.kind !== undefined ? m2.kind : MonikerKind.import;
		if (k1 === MonikerKind.import && k2 === MonikerKind.export) {
			return -1;
		}
		if (k1 === MonikerKind.export && k2 === MonikerKind.import) {
			return 1;
		}
		return 0;
	}