public async Task <bool> SetUseGlobalEditorAsync(string documentMoniker, bool useGlobalEditor) { Requires.NotNullOrEmpty(documentMoniker, nameof(documentMoniker)); SubTypeDescriptor?editorInfo = await GetSubTypeDescriptorAsync(documentMoniker); if (editorInfo == null) { return(false); } // 'useGlobalEditor' means use the default editor that is registered for source files await _options.Value.SetUseDesignerByDefaultAsync(editorInfo.SubType, !useGlobalEditor); return(true); }
public async Task <IProjectSpecificEditorInfo?> GetSpecificEditorAsync(string documentMoniker) { Requires.NotNullOrEmpty(documentMoniker, nameof(documentMoniker)); IProjectSpecificEditorInfo?editor = await GetDefaultEditorAsync(documentMoniker); if (editor == null) { return(null); } SubTypeDescriptor?descriptor = await GetSubTypeDescriptorAsync(documentMoniker); if (descriptor == null) { return(null); } bool isDefaultEditor = await _options.Value.GetUseDesignerByDefaultAsync(descriptor.SubType, descriptor.UseDesignerByDefault); return(new EditorInfo(editor.EditorFactory, descriptor.DisplayName, isDefaultEditor)); }