mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 02:28:34 +01:00
Replace !isFalsyOrEmpty with isNonEmptyArray
This new call works as a type guard and can help avoid writing double negations Avoid either call in cases where we were iterating over the possibly undefined value. Use `|| []` for these
This commit is contained in:
@@ -19,7 +19,7 @@ import { MainContext, MainThreadLanguageFeaturesShape, ExtHostLanguageFeaturesSh
|
||||
import { regExpLeadsToEndlessLoop } from 'vs/base/common/strings';
|
||||
import { IPosition } from 'vs/editor/common/core/position';
|
||||
import { IRange, Range as EditorRange } from 'vs/editor/common/core/range';
|
||||
import { isFalsyOrEmpty } from 'vs/base/common/arrays';
|
||||
import { isFalsyOrEmpty, isNonEmptyArray } from 'vs/base/common/arrays';
|
||||
import { isObject } from 'vs/base/common/types';
|
||||
import { ISelection, Selection } from 'vs/editor/common/core/selection';
|
||||
import { IExtensionDescription } from 'vs/workbench/services/extensions/common/extensions';
|
||||
@@ -433,7 +433,7 @@ class NavigateTypeAdapter {
|
||||
provideWorkspaceSymbols(search: string, token: CancellationToken): Thenable<WorkspaceSymbolsDto> {
|
||||
const result: WorkspaceSymbolsDto = IdObject.mixin({ symbols: [] });
|
||||
return asThenable(() => this._provider.provideWorkspaceSymbols(search, token)).then(value => {
|
||||
if (!isFalsyOrEmpty(value)) {
|
||||
if (isNonEmptyArray(value)) {
|
||||
for (const item of value) {
|
||||
if (!item) {
|
||||
// drop
|
||||
|
||||
Reference in New Issue
Block a user