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 <chgagnon@microsoft.com>
This commit is contained in:
Alex Ma
2020-02-06 14:09:45 -08:00
committed by GitHub
parent 5ef69f5133
commit 6da98ed439
3 changed files with 14 additions and 14 deletions

View File

@@ -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);

View File

@@ -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())

View File

@@ -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();