<commit_before>/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

import uri from 'vs/base/common/uri';
import { DEBUG_SCHEME } from 'vs/workbench/parts/debug/common/debug';

export class Source {

	public uri: uri;

	private static INTERNAL_URI_PREFIX = `${DEBUG_SCHEME}:///`;

	constructor(public raw: DebugProtocol.Source, public deemphasize: boolean) {
		const path = raw.path || raw.name;
		this.uri = raw.sourceReference > 0 ? uri.parse(`${Source.INTERNAL_URI_PREFIX}${path}?ref=${raw.sourceReference}`) : uri.file(path);
	}

	public get name() {
		return this.raw.name;
	}

	public get origin() {
		return this.raw.origin;
	}

	public get reference() {
		return this.raw.sourceReference;
	}

	public get inMemory() {
		return Source.isInMemory(this.uri);
	}

	public static isInMemory(uri: uri): boolean {
		return uri.toString().indexOf(Source.INTERNAL_URI_PREFIX) === 0;
	}

	public static getSourceReference(uri: uri): number {
		if (!Source.isInMemory(uri)) {
			return 0;
		}

		return parseInt(uri.query.substr('ref='.length));
	}
}
<commit_msg>debug: simplify internal uri schema<commit_after>/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

import uri from 'vs/base/common/uri';
import { DEBUG_SCHEME } from 'vs/workbench/parts/debug/common/debug';

export class Source {

	public uri: uri;

	constructor(public raw: DebugProtocol.Source, public deemphasize: boolean) {
		const path = raw.path || raw.name;
		this.uri = raw.sourceReference > 0 ? uri.parse(`${DEBUG_SCHEME}:${path}?ref=${raw.sourceReference}`) : uri.file(path);
	}

	public get name() {
		return this.raw.name;
	}

	public get origin() {
		return this.raw.origin;
	}

	public get reference() {
		return this.raw.sourceReference;
	}

	public get inMemory() {
		return Source.isInMemory(this.uri);
	}

	public static isInMemory(uri: uri): boolean {
		return uri.toString().indexOf(`${DEBUG_SCHEME}:`) === 0;
	}

	public static getSourceReference(uri: uri): number {
		if (!Source.isInMemory(uri)) {
			return 0;
		}

		return parseInt(uri.query.substr('ref='.length));
	}
}

{'fraction_non_alphanumeric': 0.2598721323805942, 'fraction_numerical': 0.0022564874012786762, 'mean_word_length': 2.288009888751545, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5006257', 'n_tokens_mistral': 795, 'n_tokens_neox': 746, 'n_words': 188}