public definitions()

in server/src/graphStore.ts [723:752]


	public definitions(uri: string, position: lsp.Position): lsp.Location | lsp.Location[] | undefined {
		const ranges = this.findRange(this.toDatabase(uri), position);
		if (ranges === undefined) {
			return undefined;
		}

		const findDefinitions = (range: RangeResult): lsp.Location | lsp.Location[] | undefined => {
			const [definitionResult] = this.getResultForId(range.id, EdgeLabels.textDocument_definition);
			if (definitionResult === undefined) {
				return undefined;
			}

			const result: lsp.Location[] = [];
			const queryResult: LocationResult[] = this.findRangeFromResult.all({ id: definitionResult.id });
			if (queryResult && queryResult.length > 0) {
				for(let item of queryResult) {
					result.push(this.createLocation(item));
				}
			}
			return result;
		};

		for (const range of ranges) {
			const result = findDefinitions(range);
			if (result !== undefined) {
				return result;
			}
		}
		return undefined;
	}