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

'use strict';

import URI from 'vs/base/common/uri';
import {Range} from 'vs/editor/common/core/range';
import {IModel, IRange} from 'vs/editor/common/editorCommon';
import {TPromise} from 'vs/base/common/winjs.base';
import {onUnexpectedError, illegalArgument} from 'vs/base/common/errors';
import {IQuickFixSupport, IQuickFix} from 'vs/editor/common/modes';
import {IModelService} from 'vs/editor/common/services/modelService';
import {CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import LanguageFeatureRegistry from 'vs/editor/common/modes/languageFeatureRegistry';

export const QuickFixRegistry = new LanguageFeatureRegistry<IQuickFixSupport>('quickFixSupport');

export interface IQuickFix2 extends IQuickFix {
	support: IQuickFixSupport;
	id: string;
}

export function getQuickFixes(model: IModel, range: IRange): TPromise<IQuickFix2[]> {

	const quickFixes: IQuickFix2[] = [];
	const promises = QuickFixRegistry.all(model).map(support => {
		return support.getQuickFixes(model.getAssociatedResource(), range).then(result => {
			if (!Array.isArray(result)) {
				return
			}
			let c = 0;
			for (let fix of result) {
				quickFixes.push({
					command: fix.command,
					score: fix.score,
					id: `quickfix_#${c++}`,
					support<commit_msg>make sure IQuickFix items get a unique id assigned, fixes #2059<commit_after>/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

'use strict';

import URI from 'vs/base/common/uri';
import {Range} from 'vs/editor/common/core/range';
import {IModel, IRange} from 'vs/editor/common/editorCommon';
import {TPromise} from 'vs/base/common/winjs.base';
import {onUnexpectedError, illegalArgument} from 'vs/base/common/errors';
import {IQuickFixSupport, IQuickFix} from 'vs/editor/common/modes';
import {IModelService} from 'vs/editor/common/services/modelService';
import {CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import LanguageFeatureRegistry from 'vs/editor/common/modes/languageFeatureRegistry';

export const QuickFixRegistry = new LanguageFeatureRegistry<IQuickFixSupport>('quickFixSupport');

export interface IQuickFix2 extends IQuickFix {
	support: IQuickFixSupport;
	id: string;
}

export function getQuickFixes(model: IModel, range: IRange): TPromise<IQuickFix2[]> {

	const quickFixes: IQuickFix2[] = [];
	let idPool = 0;
	const promises = QuickFixRegistry.all(model).map(support => {
		return support.getQuickFixes(model.getAssociatedResource(), range).then(result => {
			if (!Array.isArray(result)) {
				return
			}
			for (let fix of result) {
				quickFixes.push({
					command: fix.command,
					score: fix.score,
					id: `quickfix_#${idPool++}`,
					support
{'fraction_non_alphanumeric': 0.21863799283154123, 'fraction_numerical': 0.0035842293906810036, 'mean_word_length': 2.9633136094674555, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, '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': '5707134', 'n_tokens_mistral': 965, 'n_tokens_neox': 899, 'n_words': 233}