Simplify logic for getMimeTypeInfo
Convert set to array instead of having both
This commit is contained in:
parent
57d5c9dd0f
commit
0260183788
1 changed files with 3 additions and 8 deletions
|
@ -570,14 +570,9 @@ export class NotebookService extends Disposable implements INotebookService {
|
|||
|
||||
getMimeTypeInfo(textModel: NotebookTextModel, kernelProvides: readonly string[] | undefined, output: IOutputDto): readonly IOrderedMimeType[] {
|
||||
|
||||
const mimeTypeSet = new Set<string>();
|
||||
let mimeTypes: string[] = [];
|
||||
output.outputs.forEach(op => {
|
||||
if (!mimeTypeSet.has(op.mime)) {
|
||||
mimeTypeSet.add(op.mime);
|
||||
mimeTypes.push(op.mime);
|
||||
}
|
||||
});
|
||||
const mimeTypeSet = new Set<string>(output.outputs.map(op => op.mime));
|
||||
const mimeTypes: string[] = [...mimeTypeSet];
|
||||
|
||||
const coreDisplayOrder = this._displayOrder;
|
||||
const sorted = sortMimeTypes(mimeTypes, coreDisplayOrder?.userOrder ?? [], coreDisplayOrder?.defaultOrder ?? []);
|
||||
|
||||
|
|
Loading…
Reference in a new issue