Skip to content

Commit 2920016

Browse files
committed
do not use hasClass and first
#103454
1 parent 1fccb9e commit 2920016

File tree

6 files changed

+56
-59
lines changed

6 files changed

+56
-59
lines changed

src/vs/workbench/contrib/debug/browser/debugConfigurationManager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import { CancellationToken, CancellationTokenSource } from 'vs/base/common/cance
3737
import { withUndefinedAsNull } from 'vs/base/common/types';
3838
import { sequence } from 'vs/base/common/async';
3939
import { IHistoryService } from 'vs/workbench/services/history/common/history';
40-
import { first, flatten } from 'vs/base/common/arrays';
40+
import { flatten } from 'vs/base/common/arrays';
4141
import { getVisibleAndSorted } from 'vs/workbench/contrib/debug/common/debugUtils';
4242
import { DebugConfigurationProviderTriggerKind } from 'vs/workbench/api/common/extHostTypes';
4343

@@ -518,7 +518,7 @@ export class ConfigurationManager implements IConfigurationManager {
518518
const rootUri = this.historyService.getLastActiveWorkspaceRoot();
519519
launch = this.getLaunch(rootUri);
520520
if (!launch || launch.getConfigurationNames().length === 0) {
521-
launch = first(this.launches, l => !!(l && l.getConfigurationNames().length), launch) || this.launches[0];
521+
launch = this.launches.find(l => !!(l && l.getConfigurationNames().length)) || launch || this.launches[0];
522522
}
523523
}
524524

src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import { ExceptionWidget } from 'vs/workbench/contrib/debug/browser/exceptionWid
2626
import { FloatingClickWidget } from 'vs/workbench/browser/parts/editor/editorWidgets';
2727
import { Position } from 'vs/editor/common/core/position';
2828
import { CoreEditingCommands } from 'vs/editor/browser/controller/coreCommands';
29-
import { first } from 'vs/base/common/arrays';
3029
import { memoize, createMemoizer } from 'vs/base/common/decorators';
3130
import { IEditorHoverOptions, EditorOption } from 'vs/editor/common/config/editorOptions';
3231
import { DebugHoverWidget } from 'vs/workbench/contrib/debug/browser/debugHover';
@@ -373,7 +372,7 @@ export class DebugEditorContribution implements IDebugEditorContribution {
373372
}
374373

375374
// First call stack frame that is available is the frame where exception has been thrown
376-
const exceptionSf = first(callStack, sf => !!(sf && sf.source && sf.source.available && sf.source.presentationHint !== 'deemphasize'), undefined);
375+
const exceptionSf = callStack.find(sf => !!(sf && sf.source && sf.source.available && sf.source.presentationHint !== 'deemphasize'));
377376
if (!exceptionSf || exceptionSf !== focusedSf) {
378377
this.closeExceptionWidget();
379378
return;

src/vs/workbench/contrib/debug/browser/repl.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ import { transparent, editorForeground } from 'vs/platform/theme/common/colorReg
3737
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
3838
import { FocusSessionActionViewItem } from 'vs/workbench/contrib/debug/browser/debugActionViewItems';
3939
import { CompletionContext, CompletionList, CompletionProviderRegistry, CompletionItem, completionKindFromString, CompletionItemKind, CompletionItemInsertTextRule } from 'vs/editor/common/modes';
40-
import { first } from 'vs/base/common/arrays';
4140
import { ITreeNode, ITreeContextMenuEvent, IAsyncDataSource } from 'vs/base/browser/ui/tree/tree';
4241
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
4342
import { LinkDetector } from 'vs/workbench/contrib/debug/browser/linkDetector';
@@ -360,7 +359,7 @@ export class Repl extends ViewPane implements IHistoryNavigationWidget {
360359
if (focusedSession) {
361360
session = focusedSession;
362361
} else if (!treeInput || sessionsToIgnore.has(treeInput)) {
363-
session = first(this.debugService.getModel().getSessions(true), s => !sessionsToIgnore.has(s)) || undefined;
362+
session = this.debugService.getModel().getSessions(true).find(s => !sessionsToIgnore.has(s));
364363
}
365364
}
366365
if (session) {

src/vs/workbench/contrib/debug/common/debugModel.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { Event, Emitter } from 'vs/base/common/event';
1010
import { generateUuid } from 'vs/base/common/uuid';
1111
import { RunOnceScheduler } from 'vs/base/common/async';
1212
import { isString, isUndefinedOrNull } from 'vs/base/common/types';
13-
import { distinct, lastIndex, first } from 'vs/base/common/arrays';
13+
import { distinct, lastIndex } from 'vs/base/common/arrays';
1414
import { Range, IRange } from 'vs/editor/common/core/range';
1515
import {
1616
ITreeElement, IExpression, IExpressionContainer, IDebugSession, IStackFrame, IExceptionBreakpoint, IBreakpoint, IFunctionBreakpoint, IDebugModel,
@@ -421,7 +421,7 @@ export class Thread implements IThread {
421421
}
422422

423423
getTopStackFrame(): IStackFrame | undefined {
424-
return first(this.getCallStack(), sf => !!(sf && sf.source && sf.source.available && sf.source.presentationHint !== 'deemphasize'), undefined);
424+
return this.getCallStack().find(sf => !!(sf && sf.source && sf.source.available && sf.source.presentationHint !== 'deemphasize'));
425425
}
426426

427427
get stateLabel(): string {

0 commit comments

Comments
 (0)