mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-27 10:37:38 +01:00
nes: debt: remove any use in NextEditProvider (#1948)
This commit is contained in:
committed by
GitHub
parent
b1f76d35eb
commit
7fbecee16e
@@ -409,7 +409,6 @@ export default tseslint.config(
|
||||
'./src/extension/inlineChat/node/rendererVisualization.ts',
|
||||
'./src/extension/inlineChat/vscode-node/inlineChatCommands.ts',
|
||||
'./src/extension/inlineEdits/common/observableWorkspaceRecordingReplayer.ts',
|
||||
'./src/extension/inlineEdits/node/nextEditProvider.ts',
|
||||
'./src/extension/inlineEdits/vscode-node/parts/vscodeWorkspace.ts',
|
||||
'./src/extension/intents/node/editCodeIntent.ts',
|
||||
'./src/extension/intents/node/editCodeStep.ts',
|
||||
|
||||
@@ -224,7 +224,7 @@ export class NextEditProvider extends Disposable implements INextEditProvider<Ne
|
||||
tracer.trace(latency);
|
||||
|
||||
if (result.isError()) {
|
||||
tracer.trace(`failed to fetch next edit ${result.err.kind}${(result.err as any).message ? ` (${(result.err as any).message})` : ''}`);
|
||||
tracer.trace(`failed to fetch next edit ${result.err.toString()}`);
|
||||
telemetryBuilder.setStatus(`noEdit:${result.err.kind}`);
|
||||
error = result.err;
|
||||
} else {
|
||||
|
||||
@@ -11,6 +11,7 @@ import { CancellationToken, CancellationTokenSource } from '../../../util/vs/bas
|
||||
import { URI } from '../../../util/vs/base/common/uri';
|
||||
import { LineEdit, LineReplacement, SerializedLineEdit } from '../../../util/vs/editor/common/core/edits/lineEdit';
|
||||
import { StringEdit } from '../../../util/vs/editor/common/core/edits/stringEdit';
|
||||
import { Position } from '../../../util/vs/editor/common/core/position';
|
||||
import { OffsetRange } from '../../../util/vs/editor/common/core/ranges/offsetRange';
|
||||
import { StringText } from '../../../util/vs/editor/common/core/text/abstractText';
|
||||
import { ChatFetchResponseType, FetchResponse } from '../../chat/common/commonTypes';
|
||||
@@ -23,7 +24,6 @@ import { DebugRecorderBookmark } from './debugRecorderBookmark';
|
||||
import { InlineEditRequestLogContext } from './inlineEditLogContext';
|
||||
import { stringifyChatMessages } from './utils/stringifyChatMessages';
|
||||
import { IXtabHistoryEntry } from './workspaceEditTracker/nesXtabHistoryTracker';
|
||||
import { Position } from '../../../util/vs/editor/common/core/position';
|
||||
|
||||
export const enum ShowNextEditPreference {
|
||||
Always = 'always',
|
||||
@@ -184,46 +184,84 @@ export enum FilteredOutReason {
|
||||
}
|
||||
|
||||
export namespace NoNextEditReason {
|
||||
export class ActiveDocumentHasNoEdits {
|
||||
public readonly kind = 'activeDocumentHasNoEdits';
|
||||
abstract class NoNextEditReason {
|
||||
abstract toString(): string;
|
||||
}
|
||||
export class NoSuggestions {
|
||||
export class ActiveDocumentHasNoEdits extends NoNextEditReason {
|
||||
public readonly kind = 'activeDocumentHasNoEdits';
|
||||
|
||||
toString(): string {
|
||||
return this.kind;
|
||||
}
|
||||
}
|
||||
export class NoSuggestions extends NoNextEditReason {
|
||||
public readonly kind = 'noSuggestions';
|
||||
|
||||
constructor(
|
||||
public readonly documentBeforeEdits: StringText,
|
||||
public readonly window: OffsetRange | undefined,
|
||||
public readonly nextCursorPosition?: Position | undefined,
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
||||
toString(): string {
|
||||
return this.kind;
|
||||
}
|
||||
}
|
||||
export class GotCancelled {
|
||||
export class GotCancelled extends NoNextEditReason {
|
||||
public readonly kind = 'gotCancelled';
|
||||
constructor(public readonly message: 'afterDebounce' | 'afterGettingEndpoint' | 'afterLanguageContextAwait' | 'afterPromptConstruction' | 'afterFetchCall' | 'duringStreaming' | 'afterResponse' | 'afterFailedRebase' | 'beforeExecutingNewRequest') {
|
||||
super();
|
||||
}
|
||||
|
||||
toString(): string {
|
||||
return `${this.kind}:${this.message}`;
|
||||
}
|
||||
}
|
||||
export class FetchFailure {
|
||||
export class FetchFailure extends NoNextEditReason {
|
||||
public readonly kind = 'fetchFailure';
|
||||
constructor(public readonly error: Error) {
|
||||
super();
|
||||
}
|
||||
toString(): string {
|
||||
return `${this.kind}:${this.error.message}`;
|
||||
}
|
||||
}
|
||||
export class FilteredOut {
|
||||
export class FilteredOut extends NoNextEditReason {
|
||||
public readonly kind = 'filteredOut';
|
||||
constructor(public readonly message: FilteredOutReason | string) {
|
||||
super();
|
||||
}
|
||||
toString(): string {
|
||||
return `${this.kind}:${this.message}`;
|
||||
}
|
||||
}
|
||||
export class PromptTooLarge {
|
||||
export class PromptTooLarge extends NoNextEditReason {
|
||||
public readonly kind = 'promptTooLarge';
|
||||
constructor(public readonly message: 'editWindow' | 'currentFile' | 'final') {
|
||||
super();
|
||||
}
|
||||
toString(): string {
|
||||
return `${this.kind}:${this.message}`;
|
||||
}
|
||||
}
|
||||
export class Uncategorized {
|
||||
export class Uncategorized extends NoNextEditReason {
|
||||
public readonly kind = 'uncategorized';
|
||||
constructor(public readonly error: Error) {
|
||||
super();
|
||||
}
|
||||
toString(): string {
|
||||
return `${this.kind}:${this.error.message}`;
|
||||
}
|
||||
}
|
||||
export class Unexpected {
|
||||
export class Unexpected extends NoNextEditReason {
|
||||
public readonly kind = 'unexpected';
|
||||
constructor(public readonly error: Error) {
|
||||
super();
|
||||
}
|
||||
toString(): string {
|
||||
return `${this.kind}:${this.error.message}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user