From 6da98ed4397356435132d45dc8254e1031f23f73 Mon Sep 17 00:00:00 2001 From: Alex Ma Date: Thu, 6 Feb 2020 14:09:45 -0800 Subject: [PATCH] disable updateNameFromFirstLine from untitledTextEditorModel (#9064) * disable updateNameFromFirstLine * change to either * WIP commit * final fix * formatting * fix for tab space * replace tab with space * Fix formatting Co-authored-by: Charles Gagnon --- src/vs/workbench/browser/labels.ts | 18 +++++++++--------- .../common/editor/untitledTextEditorModel.ts | 6 +++--- .../common/editor/untitledTextEditor.test.ts | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/vs/workbench/browser/labels.ts b/src/vs/workbench/browser/labels.ts index ca8c1187cc..ba2878e510 100644 --- a/src/vs/workbench/browser/labels.ts +++ b/src/vs/workbench/browser/labels.ts @@ -510,15 +510,15 @@ class ResourceLabelWidget extends IconLabel { } let label = this.label.name || ''; - if (resource?.scheme === Schemas.untitled) { - // Untitled labels are very dynamic because they may change - // whenever the content changes. As such we always ask the - // text file service for the name of the untitled editor - const untitledName = this.textFileService.untitled.get(resource)?.getName(); - if (untitledName) { - label = untitledName; - } - } + // if (resource?.scheme === Schemas.untitled) { // {{SQL CARBON EDIT}} - For Query Editor, untitled editor query must use same label. + // // Untitled labels are very dynamic because they may change + // // whenever the content changes. As such we always ask the + // // text file service for the name of the untitled editor + // const untitledName = this.textFileService.untitled.get(resource)?.getName(); + // if (untitledName) { + // label = untitledName; + // } + // } this.setLabel(label, this.label.description, iconLabelOptions); diff --git a/src/vs/workbench/common/editor/untitledTextEditorModel.ts b/src/vs/workbench/common/editor/untitledTextEditorModel.ts index 86d34c476b..c3ad6b9a25 100644 --- a/src/vs/workbench/common/editor/untitledTextEditorModel.ts +++ b/src/vs/workbench/common/editor/untitledTextEditorModel.ts @@ -242,9 +242,9 @@ export class UntitledTextEditorModel extends BaseTextEditorModel implements IUnt } private updateNameFromFirstLine(): void { - if (this.hasAssociatedFilePath) { - return; // not in case of an associated file path - } + // if (this.hasAssociatedFilePath) { {{SQL CARBON EDIT}} - For Query Editor, must not change name even without file path. + return; + // } // Determine the first words of the model following these rules: // - cannot be only whitespace (so we trim()) diff --git a/src/vs/workbench/test/common/editor/untitledTextEditor.test.ts b/src/vs/workbench/test/common/editor/untitledTextEditor.test.ts index 2ca352927d..9e3e720eff 100644 --- a/src/vs/workbench/test/common/editor/untitledTextEditor.test.ts +++ b/src/vs/workbench/test/common/editor/untitledTextEditor.test.ts @@ -303,7 +303,7 @@ suite('Workbench untitled text editors', () => { model.dispose(); }); - test('service#onDidChangeLabel', async () => { + test.skip('service#onDidChangeLabel', async () => { // {{SQL CARBON EDIT}} - Disable as untitledTextEditorModel test is disabled. const service = accessor.untitledTextEditorService; const input = service.create(); @@ -383,7 +383,7 @@ suite('Workbench untitled text editors', () => { assert.ok(counter > 1); }); - test('model#onDidChangeName and input name', async function () { + test.skip('model#onDidChangeName and input name', async function () { // {{SQL CARBON EDIT}} - Disable as untitledTextEditorModel test is disabled. const service = accessor.untitledTextEditorService; const input = service.create();