"use strict";
/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.InlineEditRequestLogContext = void 0;
const yaml = __importStar(require("yaml"));
const errors_1 = require("../../../util/common/errors");
const errors_2 = require("../../../util/vs/base/common/errors");
const event_1 = require("../../../util/vs/base/common/event");
const fetchCancellationError_1 = require("./dataTypes/fetchCancellationError");
const languageContext_1 = require("./dataTypes/languageContext");
const stringifyChatMessages_1 = require("./utils/stringifyChatMessages");
const utils_1 = require("./utils/utils");
class InlineEditRequestLogContext {
    static { this._id = 0; }
    get includeInLogTree() {
        return this._isVisible;
    }
    /** Mark this request as completed (no longer in progress). */
    markCompleted() {
        if (this._isCompleted) {
            console.warn(`[InlineEditRequestLogContext] markCompleted called twice (request #${this.requestId})`);
        }
        this._isCompleted = true;
        this.fireDidChange();
    }
    fireDidChange() {
        this._onDidChange.fire();
    }
    constructor(filePath, version, _context) {
        this.filePath = filePath;
        this.version = version;
        this._context = _context;
        this.requestId = InlineEditRequestLogContext._id++;
        this.time = (0, utils_1.now)();
        /** Tweaks visibility of this log element in the log tree */
        this._isVisible = false;
        this._isCompleted = false;
        this._onDidChange = new event_1.Emitter();
        /** Fires when state changes, allowing live log entries to refresh their content. */
        this.onDidChange = this._onDidChange.event;
        this.recordingBookmark = undefined;
        this._statelessNextEditProviderId = undefined;
        this._nextEditRequest = undefined;
        this._resultEdit = undefined;
        this._diagnosticsResultEdit = undefined;
        this._logContextOfCachedEdit = undefined;
        this._headerRequestId = undefined;
        this._prompt = undefined;
        this._rawMessages = undefined;
        this._outcome = 'pending';
        this._error = undefined;
        /**
         * Model Response
         */
        this.response = undefined;
        this.fullResponsePromise = undefined;
        this.fullResponse = undefined;
        this.providerStartTime = undefined;
        this.providerEndTime = undefined;
        this.fetchStartTime = undefined;
        this.fetchEndTime = undefined;
        /**
         * Each of edit suggestions from model
         */
        this._responseResults = undefined;
        this._recentEdit = undefined;
        this._trace = [];
        this._logs = [];
        this._isAccepted = undefined;
    }
    toLogDocument() {
        const lines = [];
        lines.push('# ' + this.getMarkdownTitle() + ` (Request #${this.requestId})`);
        if (!this._isCompleted) {
            lines.push('\n⏳ **In progress…**\n');
        }
        lines.push('💡 Tip: double-click anywhere to open this file as text to copy-paste content into an issue.\n');
        lines.push('<details><summary>Explanation for icons</summary>\n');
        lines.push(`- ${utils_1.Icon.lightbulbFull.svg} - model had suggestions\n`);
        lines.push(`- ${utils_1.Icon.circleSlash.svg} - model had NO suggestions\n`);
        lines.push(`- ${utils_1.Icon.database.svg} - response is from cache\n`);
        lines.push(`- ${utils_1.Icon.gitMerge.svg} - joined an in-flight request (async or speculative reuse)\n`);
        lines.push(`- ${utils_1.Icon.error.svg} - error happened\n`);
        lines.push(`- ${utils_1.Icon.skipped.svg} - fetching started but got cancelled\n`);
        lines.push('</details>\n');
        lines.push(`Inline Edit Provider: ${this._statelessNextEditProviderId ?? '<NOT-SET>'}\n`);
        lines.push(`Chat Endpoint`);
        lines.push('```');
        lines.push(`Model name: ${this._endpointInfo?.modelName ?? '<NOT-SET>'}`);
        lines.push(`URL: ${this._endpointInfo?.url ?? '<NOT-SET>'}`);
        lines.push('```');
        const fromCacheStatus = this._logContextOfCachedEdit ? `(cached #${this._logContextOfCachedEdit.requestId})` : '(not cached)';
        lines.push(`Opportunity ID: ${this._context ? this._context.requestUuid : '<NOT-SET>'}`);
        if (this.headerRequestId) {
            lines.push('');
            lines.push(`Header Request ID: ${this.headerRequestId} ${fromCacheStatus}`);
        }
        if (this._nextEditRequest) {
            lines.push(`## Latest user edits ${fromCacheStatus}`);
            lines.push('<details open><summary>Edit</summary>\n');
            lines.push(this._nextEditRequest.toMarkdown());
            lines.push('\n</details>\n');
        }
        if (this._diagnosticsResultEdit) {
            lines.push(`## Proposed diagnostics suggestion ${this._nesTypePicked === 'diagnostics' ? '(Picked)' : '(Not Picked)'}`);
            lines.push('<details open><summary>Edit</summary>\n');
            lines.push('``` patch');
            lines.push(this._diagnosticsResultEdit.toString());
            lines.push('```');
            lines.push('\n</details>\n');
        }
        if (this._resultEdit) {
            lines.push(`## Proposed inline suggestion ${fromCacheStatus}`);
            lines.push('<details open><summary>Edit</summary>\n');
            lines.push('``` patch');
            lines.push(this._resultEdit.toString());
            lines.push('```');
            lines.push('\n</details>\n');
        }
        if (this.prompt) {
            lines.push(`## Prompt ${fromCacheStatus}`);
            lines.push('<details><summary>Click to view</summary>\n');
            const e = this.prompt;
            lines.push('````');
            lines.push(...e.split('\n'));
            lines.push('````');
            lines.push('\n</details>\n');
        }
        if (this.error) {
            lines.push(`## Error ${fromCacheStatus}`);
            lines.push('```');
            lines.push(errors_1.ErrorUtils.toString(errors_1.ErrorUtils.fromUnknown(this.error)));
            lines.push('```');
        }
        if (this.response) {
            lines.push(`## Response ${fromCacheStatus}`);
            lines.push('<details><summary>Click to view</summary>\n');
            lines.push('````');
            lines.push(this.response);
            lines.push('````');
            lines.push('\n</details>\n');
        }
        if (this._responseResults) {
            lines.push(`## Response Results ${fromCacheStatus}`);
            lines.push('<details><summary>Click to view</summary>\n');
            lines.push('```');
            lines.push(yaml.stringify(this._responseResults, null, '\t'));
            lines.push('```');
            lines.push('\n</details>\n');
        }
        if (this._isAccepted !== undefined) {
            lines.push(`## Accepted : ${this._isAccepted ? 'Yes' : 'No'}`);
        }
        if (this._rebaseFailure) {
            lines.push('## Rebase Failure');
            lines.push('<details><summary>Click to view</summary>\n');
            lines.push(this._rebaseFailure.toMarkdown());
            lines.push('\n</details>\n');
        }
        if (this._logs.length > 0) {
            lines.push('## Logs');
            lines.push('<details open><summary>Logs</summary>\n');
            lines.push(...this._logs);
            lines.push('\n</details>\n');
        }
        lines.push(...this._renderTraceDiagram());
        if (this._trace.length > 0) {
            lines.push('## Trace');
            lines.push('<details><summary>Trace</summary>\n');
            lines.push('```');
            lines.push(...this._trace);
            lines.push('```');
            lines.push('\n</details>\n');
        }
        return lines.join('\n');
    }
    toMinimalLog() {
        // Does not include the users files, but just the relevant edits
        const lines = [];
        if (this._nesTypePicked === 'diagnostics' && this._diagnosticsResultEdit) {
            lines.push(`## Result (Diagnostics):`);
            lines.push('``` patch');
            lines.push(this._diagnosticsResultEdit.toString());
            lines.push('```');
        }
        else if (this._nesTypePicked === 'llm' && this._resultEdit) {
            lines.push(`## Result:`);
            lines.push('``` patch');
            if (typeof this._resultEdit === 'string') {
                lines.push(this._resultEdit);
            }
            else {
                lines.push(this._resultEdit.toString());
            }
            lines.push('```');
        }
        else {
            lines.push(`## Result: <NOT-SET>`);
        }
        if (this.error) {
            lines.push(`## Error:`);
            lines.push('```');
            lines.push(errors_1.ErrorUtils.toString(errors_1.ErrorUtils.fromUnknown(this.error)));
            lines.push('```');
        }
        lines.push(`### Info:`);
        lines.push(`**From cache:** ${this._logContextOfCachedEdit ? `YES (Request: ${this._logContextOfCachedEdit.requestId})` : 'NO'}`);
        if (this._context) {
            lines.push(`**Trigger Kind:** ${this._context.triggerKind === 0 ? 'Manual' : 'Automatic'}`);
            lines.push(`**Request UUID:** ${this._context.requestUuid}`);
        }
        return lines.join('\n');
    }
    setStatelessNextEditProviderId(id) {
        this._statelessNextEditProviderId = id;
    }
    setRequestInput(nextEditRequest) {
        this._isVisible = true;
        this._nextEditRequest = nextEditRequest;
        this.fireDidChange();
    }
    setResult(resultEditOrPatchString) {
        this._isVisible = true;
        this._resultEdit = resultEditOrPatchString;
        this.fireDidChange();
    }
    setDiagnosticsResult(resultEdit) {
        this._isVisible = true;
        this._diagnosticsResultEdit = resultEdit;
        this.fireDidChange();
    }
    setPickedNESType(nesTypePicked) {
        this._nesTypePicked = nesTypePicked;
        return this;
    }
    setIsCachedResult(logContextOfCachedEdit) {
        this._logContextOfCachedEdit = logContextOfCachedEdit;
        // Direct field copy — avoids triggering outcome transitions from the
        // public setters (e.g. setResponseResults -> succeeded, setError -> errored).
        // The final outcome is always 'cached'.
        this.recordingBookmark = logContextOfCachedEdit.recordingBookmark;
        this._nextEditRequest = logContextOfCachedEdit._nextEditRequest ?? this._nextEditRequest;
        this._resultEdit = logContextOfCachedEdit._resultEdit ?? this._resultEdit;
        this._diagnosticsResultEdit = logContextOfCachedEdit._diagnosticsResultEdit ?? this._diagnosticsResultEdit;
        this._endpointInfo = logContextOfCachedEdit._endpointInfo ?? this._endpointInfo;
        this._headerRequestId = logContextOfCachedEdit._headerRequestId ?? this._headerRequestId;
        if (logContextOfCachedEdit._prompt) {
            this._prompt = logContextOfCachedEdit._prompt;
        }
        this.response = logContextOfCachedEdit.response ?? this.response;
        this._responseResults = logContextOfCachedEdit._responseResults ?? this._responseResults;
        if (logContextOfCachedEdit.fullResponsePromise) {
            this.setFullResponse(logContextOfCachedEdit.fullResponsePromise);
        }
        this._error = logContextOfCachedEdit._error ?? this._error;
        this._isVisible = true;
        this._outcome = 'cached';
        this.fireDidChange();
    }
    /**
     * Marks this log context as having joined an already in-flight request
     * (async pending or speculative). The icon shows git-merge to distinguish
     * from a true cache hit.
     */
    setIsReusedInFlightResult(logContextOfReusedRequest) {
        this._logContextOfCachedEdit = logContextOfReusedRequest;
        this.recordingBookmark = logContextOfReusedRequest.recordingBookmark;
        this._nextEditRequest = logContextOfReusedRequest._nextEditRequest ?? this._nextEditRequest;
        this._resultEdit = logContextOfReusedRequest._resultEdit ?? this._resultEdit;
        this._diagnosticsResultEdit = logContextOfReusedRequest._diagnosticsResultEdit ?? this._diagnosticsResultEdit;
        this._endpointInfo = logContextOfReusedRequest._endpointInfo ?? this._endpointInfo;
        this._headerRequestId = logContextOfReusedRequest._headerRequestId ?? this._headerRequestId;
        if (logContextOfReusedRequest._prompt) {
            this._prompt = logContextOfReusedRequest._prompt;
        }
        this.response = logContextOfReusedRequest.response ?? this.response;
        this._responseResults = logContextOfReusedRequest._responseResults ?? this._responseResults;
        if (logContextOfReusedRequest.fullResponsePromise) {
            this.setFullResponse(logContextOfReusedRequest.fullResponsePromise);
        }
        this._error = logContextOfReusedRequest._error ?? this._error;
        this._isVisible = true;
        this._outcome = 'reusedInFlight';
        this.fireDidChange();
    }
    setEndpointInfo(url, modelName) {
        this._endpointInfo = { url, modelName };
        this.fireDidChange();
    }
    get endpointInfo() {
        return this._endpointInfo;
    }
    setHeaderRequestId(headerRequestId) {
        this._headerRequestId = headerRequestId;
        this.fireDidChange();
    }
    get headerRequestId() {
        return this._headerRequestId;
    }
    get prompt() {
        return this._prompt;
    }
    get rawMessages() {
        return this._rawMessages;
    }
    setPrompt(prompt) {
        this._isVisible = true;
        if (typeof prompt === 'string') {
            this._prompt = prompt;
        }
        else {
            this._rawMessages = prompt;
            this._prompt = (0, stringifyChatMessages_1.stringifyChatMessages)(prompt);
        }
        this.fireDidChange();
    }
    /**
     * Sets the outcome, warning if already set (i.e., not `pending`).
     * Use direct `this._outcome = ...` assignment to bypass the guard
     * (e.g., in `setIsCachedResult` which intentionally overrides any inherited outcome).
     */
    _setOutcome(outcome) {
        // 'reusedInFlight' is an intermediate state set when joining an in-flight
        // request (before the result arrives), so it can legitimately transition
        // to the final outcome (skipped, errored, etc.) just like 'pending'.
        if (this._outcome !== 'pending' && this._outcome !== 'reusedInFlight') {
            console.warn(`[InlineEditRequestLogContext] outcome transition from '${this._outcome}' to '${outcome}' (request #${this.requestId})`);
        }
        this._outcome = outcome;
    }
    _resolveIcon() {
        switch (this._outcome) {
            case 'pending': return this._isCompleted ? utils_1.Icon.check : utils_1.Icon.loading;
            case 'succeeded': return utils_1.Icon.lightbulbFull;
            case 'noSuggestions': return utils_1.Icon.circleSlash;
            case 'cached':
            case 'cachedFromGhostText': return utils_1.Icon.database;
            case 'reusedInFlight': return utils_1.Icon.gitMerge;
            case 'skipped':
            case 'cancelled': return utils_1.Icon.skipped;
            case 'errored': return utils_1.Icon.error;
            case 'previouslyRejected': return utils_1.Icon.thumbsdown;
        }
    }
    getIcon() {
        return this._resolveIcon().themeIcon;
    }
    setIsSkipped() {
        this._setOutcome('skipped');
        this._isVisible = false;
        this.fireDidChange();
    }
    markAsFromCache() {
        this._setOutcome('cachedFromGhostText');
        this._isVisible = true;
        this.fireDidChange();
    }
    markAsNoSuggestions() {
        this._setOutcome('noSuggestions');
        this._isVisible = true;
        this.fireDidChange();
    }
    markAsPreviouslyRejected() {
        // Direct assignment — bypasses _setOutcome guard because this transition
        // legitimately overrides 'succeeded' when a fetched edit turns out to be rejected.
        this._outcome = 'previouslyRejected';
        this._isVisible = true;
        this.fireDidChange();
    }
    get error() {
        return this._error;
    }
    setError(e) {
        this._isVisible = true;
        this._error = e;
        if (this._error instanceof fetchCancellationError_1.FetchCancellationError) {
            this._setOutcome('skipped');
        }
        else if ((0, errors_2.isCancellationError)(this._error)) {
            this._setOutcome('cancelled');
            this._isVisible = false;
        }
        else {
            this._setOutcome('errored');
        }
        this.fireDidChange();
    }
    setResponse(v) {
        this._isVisible = true;
        this.response = v;
        this.fireDidChange();
    }
    setFullResponse(promise) {
        this.fullResponsePromise = promise;
        promise.then(response => this.fullResponse = response);
    }
    async allPromisesResolved() {
        await this.fullResponsePromise;
    }
    setProviderStartTime() {
        this.providerStartTime = Date.now();
        this.fireDidChange();
    }
    setProviderEndTime() {
        this.providerEndTime = Date.now();
        this.fireDidChange();
    }
    setFetchStartTime() {
        this.fetchStartTime = Date.now();
        this.fireDidChange();
    }
    setFetchEndTime() {
        this.fetchEndTime = Date.now();
        this.fireDidChange();
    }
    get responseResults() {
        return this._responseResults;
    }
    setResponseResults(v) {
        this._isVisible = true;
        this._responseResults = v;
        if (this._outcome === 'pending') {
            this._outcome = 'succeeded';
        }
        this.fireDidChange();
    }
    getDebugName() {
        return `NES | ${basename(this.filePath)} (v${this.version})`;
    }
    getMarkdownTitle() {
        const icon = this._resolveIcon();
        return `${icon.svg} ` + this.getDebugName();
    }
    setRecentEdit(edit) {
        this._recentEdit = edit;
    }
    trace(msg) {
        this._trace.push(msg);
        this.fireDidChange();
    }
    _renderTraceDiagram() {
        if (this._trace.length === 0) {
            return [];
        }
        const lines = [];
        lines.push('## Trace Diagram');
        lines.push('<details open><summary>Trace Diagram</summary>\n');
        lines.push('```');
        // Parse trace lines into structured data
        const parsedTraces = this._trace.map(line => {
            const timeMatch = line.match(/^\[\s*(\d+)ms\]/);
            const timestamp = timeMatch ? parseInt(timeMatch[1], 10) : 0;
            // Extract the bracketed path segments and the message
            const afterTime = line.replace(/^\[\s*\d+ms\]\s*/, '');
            const segments = [];
            let remaining = afterTime;
            let bracketMatch;
            while ((bracketMatch = remaining.match(/^\[([^\]]+)\]/))) {
                segments.push(bracketMatch[1]);
                remaining = remaining.slice(bracketMatch[0].length);
            }
            const message = remaining.trim();
            return { timestamp, segments, message };
        });
        if (parsedTraces.length === 0) {
            lines.push('(no trace data)');
            lines.push('```');
            lines.push('\n</details>\n');
            return lines;
        }
        // Find the maximum timestamp for time width calculation
        const maxTime = Math.max(...parsedTraces.map(t => t.timestamp));
        const timeWidth = Math.max(6, String(maxTime).length + 3);
        // Build a map of segment paths to track when they start/end
        const activeSegments = new Map();
        const segmentLifetimes = [];
        parsedTraces.forEach((trace, idx) => {
            const currentPath = trace.segments.join('|');
            // Check for segments that are no longer active
            for (const [path, info] of activeSegments) {
                if (!currentPath.startsWith(path) && currentPath !== path) {
                    segmentLifetimes.push({
                        path,
                        startTime: info.startTime,
                        endTime: trace.timestamp,
                        depth: info.depth,
                        name: path.split('|').pop() || ''
                    });
                    activeSegments.delete(path);
                }
            }
            // Add new segments
            let pathSoFar = '';
            trace.segments.forEach((segment, depth) => {
                pathSoFar = pathSoFar ? `${pathSoFar}|${segment}` : segment;
                if (!activeSegments.has(pathSoFar)) {
                    activeSegments.set(pathSoFar, { startTime: trace.timestamp, depth });
                }
            });
        });
        // Close any remaining active segments
        const lastTimestamp = parsedTraces[parsedTraces.length - 1]?.timestamp || 0;
        for (const [path, info] of activeSegments) {
            segmentLifetimes.push({
                path,
                startTime: info.startTime,
                endTime: lastTimestamp,
                depth: info.depth,
                name: path.split('|').pop() || ''
            });
        }
        // Render timeline header
        lines.push('');
        lines.push('Timeline (nested call hierarchy):');
        lines.push('─'.repeat(60));
        // Track what's currently shown at each depth to avoid redundant output
        const currentAtDepth = [];
        for (const trace of parsedTraces) {
            const timeStr = `[${String(trace.timestamp).padStart(timeWidth - 3)}ms]`;
            const indentUnit = '│   ';
            const newBranchUnit = '├── ';
            // Determine which segments are new vs continuing
            let indent = '';
            let displaySegment = '';
            let hasNewSegment = false;
            for (let d = 0; d < trace.segments.length; d++) {
                const seg = trace.segments[d];
                if (currentAtDepth[d] !== seg) {
                    // This is a new segment at this depth
                    hasNewSegment = true;
                    currentAtDepth[d] = seg;
                    // Clear deeper levels
                    currentAtDepth.length = d + 1;
                    displaySegment = seg;
                    indent = indentUnit.repeat(d);
                    break;
                }
                indent = indentUnit.repeat(d + 1);
            }
            if (hasNewSegment) {
                // Show the new segment
                const prefix = indent + newBranchUnit;
                lines.push(`${timeStr} ${prefix}[${displaySegment}]`);
                if (trace.message) {
                    const msgIndent = indentUnit.repeat(trace.segments.length);
                    lines.push(`${' '.repeat(timeWidth + 1)} ${msgIndent}↳ ${trace.message}`);
                }
            }
            else if (trace.message) {
                // Just a message at the current depth
                const msgIndent = indentUnit.repeat(trace.segments.length);
                lines.push(`${timeStr} ${msgIndent}↳ ${trace.message}`);
            }
        }
        lines.push('─'.repeat(60));
        lines.push('```');
        lines.push('\n</details>\n');
        return lines;
    }
    addLog(content) {
        this._logs.push(content.replace('\n', '\\n').replace('\t', '\\t').replace('`', '\`') + '\n');
        this.fireDidChange();
    }
    setRebaseFailure(failure) {
        this._rebaseFailure = failure;
    }
    setAccepted(isAccepted) {
        this._isAccepted = isAccepted;
    }
    addListToLog(list) {
        list.forEach(l => this.addLog(`- ${l}`));
    }
    addCodeblockToLog(code, language = '') {
        this._logs.push(`\`\`\`${language}\n${code}\n\`\`\`\n`);
    }
    setDiagnosticsData(fileDiagnostics) {
        this._fileDiagnostics = fileDiagnostics;
    }
    setTerminalData(terminalOutput) {
        this._terminalOutput = terminalOutput;
    }
    setLanguageContext(langCtx) {
        this._languageContext = langCtx;
    }
    /**
     * Convert the current instance into a JSON format to enable serialization
     * @returns JSON representation of the current state
     */
    toJSON() {
        return {
            requestId: this.requestId,
            time: this.time,
            filePath: this.filePath,
            version: this.version,
            statelessNextEditProviderId: this._statelessNextEditProviderId,
            nextEditRequest: this._nextEditRequest?.serialize(),
            diagnosticsResultEdit: this._diagnosticsResultEdit?.toString(),
            resultEdit: this._resultEdit?.toString(),
            isCachedResult: !!this._logContextOfCachedEdit,
            prompt: this.prompt,
            error: String(this.error),
            response: this.fullResponse,
            responseResults: yaml.stringify(this._responseResults, null, '\t'),
            providerStartTime: this.providerStartTime,
            providerEndTime: this.providerEndTime,
            fetchStartTime: this.fetchStartTime,
            fetchEndTime: this.fetchEndTime,
            logs: this._logs,
            isAccepted: this._isAccepted,
            languageContext: this._languageContext ? (0, languageContext_1.serializeLanguageContext)(this._languageContext) : undefined,
            diagnostics: this._fileDiagnostics,
            terminalOutput: this._terminalOutput,
        };
    }
}
exports.InlineEditRequestLogContext = InlineEditRequestLogContext;
function basename(path) {
    const slash = Math.max(path.lastIndexOf('/'), path.lastIndexOf('\\'));
    if (slash === -1) {
        return path;
    }
    return path.slice(slash + 1);
}
//# sourceMappingURL=inlineEditLogContext.js.map