<commit_before>"use strict";

import { TextDocument, DocumentSymbolProvider, SymbolInformation, CancellationToken, SymbolKind, Location, Uri, Range, Position } from "vscode";
import { Analyzer, getSymbolKindForElementKind } from "./analyzer";
import { toRange } from "./utils";
import * as as from "./analysis_server_types";

export class DartDocumentSymbolProvider implements DocumentSymbolProvider {
	private analyzer: Analyzer;

	constructor(analyzer: Analyzer) {
		this.analyzer = analyzer;
	}

	provideDocumentSymbols(document: TextDocument, token: CancellationToken): Thenable<SymbolInformation[]> {
		let file = document.fileName;

		this.analyzer.analysisSetSubscriptions({
			subscriptions: { 'OUTLINE': [file] }
		});

		return new Promise<SymbolInformation[]>((resolve, reject) => {
			let disposable = this.analyzer.registerForAnalysisOutline(n => {
				if (n.file != file)
					return;

				this.analyzer.analysisSetSubscriptions({
					subscriptions: { 'OUTLINE': [] }
				});
				disposable.dispose();

				let symbols: SymbolInformation[] = [];
				for (let element of n.outline.children)
					this.transcribeOutline(symbols, null, element);
				resolve(symbols);
			});
		});
	}

	private transcribeOutline(symbols: SymbolInformation[], parent: as.Element, outline: as.Outline) {
		let element = outline.element;

		let name = element.name;
		if (element.parameters)
			name = `${name}()`;

		symbols.push({
			name: name,
			kind: getSymbolKindForElementKind(element.kind),
			location: {
				uri: Uri.file(element.location.file),
				range: toRange(element.location)
			},
			containerName: parent == null ? null : parent.name
		});

		if (outline.children) {
			for (let child of outline.children)
				this.transcribeOutline(symbols, element, child);
		}
	}
}<commit_msg>Show params in "Go to symbol" view.<commit_after>"use strict";

import { TextDocument, DocumentSymbolProvider, SymbolInformation, CancellationToken, SymbolKind, Location, Uri, Range, Position } from "vscode";
import { Analyzer, getSymbolKindForElementKind } from "./analyzer";
import { toRange } from "./utils";
import * as as from "./analysis_server_types";

export class DartDocumentSymbolProvider implements DocumentSymbolProvider {
	private analyzer: Analyzer;

	constructor(analyzer: Analyzer) {
		this.analyzer = analyzer;
	}

	provideDocumentSymbols(document: TextDocument, token: CancellationToken): Thenable<SymbolInformation[]> {
		let file = document.fileName;

		this.analyzer.analysisSetSubscriptions({
			subscriptions: { 'OUTLINE': [file] }
		});

		return new Promise<SymbolInformation[]>((resolve, reject) => {
			let disposable = this.analyzer.registerForAnalysisOutline(n => {
				if (n.file != file)
					return;

				this.analyzer.analysisSetSubscriptions({
					subscriptions: { 'OUTLINE': [] }
				});
				disposable.dispose();

				let symbols: SymbolInformation[] = [];
				for (let element of n.outline.children)
					this.transcribeOutline(symbols, null, element);
				resolve(symbols);
			});
		});
	}

	private transcribeOutline(symbols: SymbolInformation[], parent: as.Element, outline: as.Outline) {
		let element = outline.element;

		let name = element.name;

		if (element.parameters)		
			name = `${name}${element.parameters}`;

		symbols.push({
			name: name,
			kind: getSymbolKindForElementKind(element.kind),
			location: {
				uri: Uri.file(element.location.file),
				range: toRange(element.location)
			},
			containerName: parent == null ? null : parent.name
		});

		if (outline.children) {
			for (let child of outline.children)
				this.transcribeOutline(symbols, element, child);
		}
	}
}
{'fraction_non_alphanumeric': 0.12824048538334254, 'fraction_numerical': 0.0, 'mean_word_length': 4.413432835820895, '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': '2871411', 'n_tokens_mistral': 1253, 'n_tokens_neox': 1067, 'n_words': 248}