mirror of
https://github.com/Microsoft/vscode
synced 2024-10-13 14:57:14 +00:00
untitled - mark as dirty when having initial contents
This commit is contained in:
parent
4064a323e1
commit
7b0eede51b
|
@ -146,7 +146,7 @@ export class UntitledEditorModel extends BaseTextEditorModel implements IEncodin
|
|||
const hasBackup = !!backup;
|
||||
|
||||
// untitled associated to file path are dirty right away as well as untitled with content
|
||||
this.setDirty(this._hasAssociatedFilePath || hasBackup);
|
||||
this.setDirty(this._hasAssociatedFilePath || hasBackup || !!this.initialValue);
|
||||
|
||||
let untitledContents: ITextBufferFactory;
|
||||
if (backup) {
|
||||
|
|
|
@ -173,6 +173,16 @@ suite('Workbench untitled editors', () => {
|
|||
input.dispose();
|
||||
});
|
||||
|
||||
test('Untitled with initial content is dirty', async () => {
|
||||
const service = accessor.untitledEditorService;
|
||||
const input = service.createOrGet(undefined, undefined, 'Hello World');
|
||||
|
||||
// dirty
|
||||
const model = await input.resolve();
|
||||
assert.ok(model.isDirty());
|
||||
input.dispose();
|
||||
});
|
||||
|
||||
test('Untitled created with files.defaultLanguage setting', () => {
|
||||
const defaultLanguage = 'javascript';
|
||||
const config = accessor.testConfigurationService;
|
||||
|
|
Loading…
Reference in a new issue