<commit_before>import _ from "lodash";
import {Solution} from "./solution";
import {Models, DriverState, OmnisharpClientStatus} from "omnisharp-client";
import {Observable, Subject, ReplaySubject} from "rxjs";
import {CompositeDisposable, Disposable, IDisposable} from "omnisharp-client";
import {normalize} from "path";
import {ProjectViewModel, projectViewModelFactory, workspaceViewModelFactory} from "./project-view-model";
import {OutputMessageElement} from "../views/output-message-element";
let fastdom: typeof Fastdom = require("fastdom");
import {bufferFor} from "../operators/bufferFor";

export interface VMViewState {
    isOff: boolean;
    isConnecting: boolean;
    isOn: boolean;
    isReady: boolean;
    isError: boolean;
}

export class ViewModel implements VMViewState, IDisposable {
    public isOff: boolean;
    public isConnecting: boolean;
    public isOn: boolean;
    public isReady: boolean;
    public isError: boolean;

    private _uniqueId: string;
    public disposable = new CompositeDisposable();
    public get uniqueId() { return this._solution.uniqueId; }

    public get index() { return this._solution.index; }
    public get path() { return this._solution.path; }
    public output: OutputMessage[] = [];
    public outputElement = document.createElement("div");
    public diagnosticsByFile = new Map<string, Models.DiagnosticLocation[]>();
    public get diagnostics() {
        return _.flatMap(_.toArray(this.diagnosticsByFile.values()), x => x);
    }
    public diagnosticCounts: { [index: string]: number; } = { errors: 0, warnings: 0, hidden: 0 };

    public errors: number = 0;
    public warnings: number = 0;<commit_msg>change sorting of diagnostics<commit_after>import _ from "lodash";
import {Solution} from "./solution";
import {Models, DriverState, OmnisharpClientStatus} from "omnisharp-client";
import {Observable, Subject, ReplaySubject} from "rxjs";
import {CompositeDisposable, Disposable, IDisposable} from "omnisharp-client";
import {normalize} from "path";
import {ProjectViewModel, projectViewModelFactory, workspaceViewModelFactory} from "./project-view-model";
import {OutputMessageElement} from "../views/output-message-element";
let fastdom: typeof Fastdom = require("fastdom");
import {bufferFor} from "../operators/bufferFor";

export interface VMViewState {
    isOff: boolean;
    isConnecting: boolean;
    isOn: boolean;
    isReady: boolean;
    isError: boolean;
}

export class ViewModel implements VMViewState, IDisposable {
    public isOff: boolean;
    public isConnecting: boolean;
    public isOn: boolean;
    public isReady: boolean;
    public isError: boolean;

    private _uniqueId: string;
    public disposable = new CompositeDisposable();
    public get uniqueId() { return this._solution.uniqueId; }

    public get index() { return this._solution.index; }
    public get path() { return this._solution.path; }
    public output: OutputMessage[] = [];
    public outputElement = document.createElement("div");
    public diagnosticsByFile = new Map<string, Models.DiagnosticLocation[]>();
    public get diagnostics() {
        return  _(_.toArray(this.diagnosticsByFile.values()))
            .flatMap(x => x)
            .sortBy(x => x.LogLevel, x => x.FileName, x => x.Line, x => x.Column, x => x.Text)
            .value();
    }
    public diagnosticCounts: { [index: string]: number; } = { errors: 0, warnings: 0, hidden: 0 };

    public errors: number = 0;
    public warnings: number = 0;
{'fraction_non_alphanumeric': 0.11912943871706758, 'fraction_numerical': 0.0028636884306987398, 'mean_word_length': 4.244744744744745, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 12, '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': '888642', 'n_tokens_mistral': 1020, 'n_tokens_neox': 964, 'n_words': 295}