Query editor input titles (#9512)

* address untitled editor file name differences; remove feature for updating title for untitled to content

* add tests for new methods

* fix tests

* fix up tests

* remove unncessary await

* revert changes to title for content
This commit is contained in:
Anthony Dresser
2020-03-11 12:42:13 -07:00
committed by GitHub
parent edd396f0fe
commit dbc20c1f67
9 changed files with 156 additions and 24 deletions

View File

@@ -20,8 +20,8 @@ export function doHandleUpgrade(editor?: EditorInput): EditorInput | undefined {
editor.getPreferredMode();
}
const association = languageRegistry.getAssociationForLanguage(language);
if (association) {
return association.convertInput(editor);
if (association && association.syncConvertinput) {
return association.syncConvertinput(editor);
}
}
return editor;

View File

@@ -12,7 +12,12 @@ export type InputCreator = (servicesAccessor: ServicesAccessor, activeEditor: IE
export type BaseInputCreator = (activeEditor: IEditorInput) => IEditorInput;
export interface ILanguageAssociation {
convertInput(activeEditor: IEditorInput): EditorInput | undefined;
convertInput(activeEditor: IEditorInput): Promise<EditorInput | undefined> | EditorInput | undefined;
/**
* Used for scenarios when we need to synchrounly create inputs, currently only for handling upgrades
* and planned to be removed eventually
*/
syncConvertinput?(activeEditor: IEditorInput): EditorInput | undefined;
createBase(activeEditor: IEditorInput): IEditorInput;
}