Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bring back finishing inline chat when typing outside of whole range #182670

Merged
merged 1 commit into from May 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -260,8 +260,21 @@ export class InteractiveEditorController implements IEditorContribution {
}));

this._sessionStore.add(this._editor.onDidChangeModelContent(e => {
if (!this._ignoreModelContentChanged) {
this._activeSession!.recordExternalEditOccurred();
if (this._ignoreModelContentChanged) {
return;
}

const wholeRange = this._activeSession!.wholeRange;
let editIsOutsideOfWholeRange = false;
for (const { range } of e.changes) {
editIsOutsideOfWholeRange = !Range.areIntersectingOrTouching(range, wholeRange);
}

this._activeSession!.recordExternalEditOccurred(editIsOutsideOfWholeRange);

if (editIsOutsideOfWholeRange) {
this._logService.trace('[IE] text changed outside of whole range, FINISH session');
this._finishExistingSession();
}
}));

Expand Down
Expand Up @@ -37,6 +37,7 @@ type TelemetryData = {
rounds: string;
undos: string;
edits: boolean;
finishedByEdit: boolean;
startTime: string;
endTime: string;
editMode: string;
Expand All @@ -49,6 +50,7 @@ type TelemetryDataClassification = {
rounds: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Number of request that were made' };
undos: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'Requests that have been undone' };
edits: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'Did edits happen while the session was active' };
finishedByEdit: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'Did edits cause the session to terminate' };
startTime: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'When the session started' };
endTime: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'When the session ended' };
editMode: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'What edit mode was choosen: live, livePreview, preview' };
Expand Down Expand Up @@ -139,8 +141,9 @@ export class Session {
return this.textModelN.getValueInRange(new Range(startLine, 1, endLine, Number.MAX_VALUE));
}

recordExternalEditOccurred() {
recordExternalEditOccurred(didFinish: boolean) {
this._teldata.edits = true;
this._teldata.finishedByEdit = didFinish;
}

asTelemetryData(): TelemetryData {
Expand Down