Remove extra not null assertions (#202201)

* Remove extra not null assertions

With https://github.com/microsoft/TypeScript/pull/56908, TS should better preserve type refinements. To help test this out, I made a quick pass through our code to remove type assertions that are no longer needed

Most of these are not impacted by https://github.com/microsoft/TypeScript/pull/56908 but removing them helps TS test changes like this

Not adding an eslint rule for now as it requires whole program intellisense, which is too slow for commit hooks

* Fix merge
This commit is contained in:
Matt Bierner
2024-01-30 15:43:09 -08:00
committed by GitHub
parent adaf974eb2
commit 31fbc3dc94
177 changed files with 529 additions and 531 deletions
+1 -1
View File
@@ -118,7 +118,7 @@ function _renderFormattedText(element: Node, treeNode: IFormatParseTree, actionH
if (child && Array.isArray(treeNode.children)) {
treeNode.children.forEach((nodeChild) => {
_renderFormattedText(child!, nodeChild, actionHandler, renderCodeSegments);
_renderFormattedText(child, nodeChild, actionHandler, renderCodeSegments);
});
}
}
@@ -253,9 +253,7 @@ export class ContextView extends Disposable {
return;
}
if (this.delegate!.layout) {
this.delegate!.layout!();
}
this.delegate?.layout?.();
this.doLayout();
}
+2 -2
View File
@@ -183,7 +183,7 @@ export class NativeDragAndDropData implements IDragAndDropData {
function equalsDragFeedback(f1: number[] | undefined, f2: number[] | undefined): boolean {
if (Array.isArray(f1) && Array.isArray(f2)) {
return equals(f1, f2!);
return equals(f1, f2);
}
return f1 === f2;
@@ -910,7 +910,7 @@ export class ListView<T> implements IListView<T> {
const checked = this.accessibilityProvider.isChecked(item.element);
if (typeof checked === 'boolean') {
item.row!.domNode.setAttribute('aria-checked', String(!!checked));
item.row.domNode.setAttribute('aria-checked', String(!!checked));
} else if (checked) {
const update = (checked: boolean) => item.row!.domNode.setAttribute('aria-checked', String(!!checked));
update(checked.value);
+3 -3
View File
@@ -1602,7 +1602,7 @@ class StickyScrollWidget<T, TFilterData, TRef> implements IDisposable {
const isVisible = !!state && state.count > 0;
// If state has not changed, do nothing
if ((!wasVisible && !isVisible) || (wasVisible && isVisible && this._previousState!.equal(state!))) {
if ((!wasVisible && !isVisible) || (wasVisible && isVisible && this._previousState!.equal(state))) {
return;
}
@@ -2551,7 +2551,7 @@ export abstract class AbstractTree<T, TFilterData, TRef> implements IDisposable
this.findController = new FindController(this, this.model, this.view, filter!, _options.contextViewProvider, opts);
this.focusNavigationFilter = node => this.findController!.shouldAllowFocus(node);
this.onDidChangeFindOpenState = this.findController.onDidChangeOpenState;
this.disposables.add(this.findController!);
this.disposables.add(this.findController);
this.onDidChangeFindMode = this.findController.onDidChangeMode;
this.onDidChangeFindMatchType = this.findController.onDidChangeMatchType;
} else {
@@ -2960,7 +2960,7 @@ export abstract class AbstractTree<T, TFilterData, TRef> implements IDisposable
const node = queue.shift()!;
if (node !== root && node.collapsible) {
state.expanded[getId(node.element!)] = node.collapsed ? 0 : 1;
state.expanded[getId(node.element)] = node.collapsed ? 0 : 1;
}
queue.push(...node.children);
+10 -10
View File
@@ -239,10 +239,10 @@ function asObjectTreeOptions<TInput, T, TFilterData>(options?: IAsyncDataTreeOpt
...options.accessibilityProvider,
getPosInSet: undefined,
getSetSize: undefined,
getRole: options.accessibilityProvider!.getRole ? (el) => {
getRole: options.accessibilityProvider.getRole ? (el) => {
return options.accessibilityProvider!.getRole!(el.element as T);
} : () => 'treeitem',
isChecked: options.accessibilityProvider!.isChecked ? (e) => {
isChecked: options.accessibilityProvider.isChecked ? (e) => {
return !!(options.accessibilityProvider?.isChecked!(e.element as T));
} : undefined,
getAriaLabel(e) {
@@ -251,8 +251,8 @@ function asObjectTreeOptions<TInput, T, TFilterData>(options?: IAsyncDataTreeOpt
getWidgetAriaLabel() {
return options.accessibilityProvider!.getWidgetAriaLabel();
},
getWidgetRole: options.accessibilityProvider!.getWidgetRole ? () => options.accessibilityProvider!.getWidgetRole!() : () => 'tree',
getAriaLevel: options.accessibilityProvider!.getAriaLevel && (node => {
getWidgetRole: options.accessibilityProvider.getWidgetRole ? () => options.accessibilityProvider!.getWidgetRole!() : () => 'tree',
getAriaLevel: options.accessibilityProvider.getAriaLevel && (node => {
return options.accessibilityProvider!.getAriaLevel!(node.element as T);
}),
getActiveDescendantId: options.accessibilityProvider.getActiveDescendantId && (node => {
@@ -825,7 +825,7 @@ export class AsyncDataTree<TInput, T, TFilterData = void> implements IDisposable
const treeNode = this.tree.getNode(node);
if (treeNode.collapsed) {
node.hasChildren = !!this.dataSource.hasChildren(node.element!);
node.hasChildren = !!this.dataSource.hasChildren(node.element);
node.stale = true;
return;
}
@@ -855,7 +855,7 @@ export class AsyncDataTree<TInput, T, TFilterData = void> implements IDisposable
}
private async doRefreshNode(node: IAsyncDataTreeNode<TInput, T>, recursive: boolean, viewStateContext?: IAsyncDataTreeViewStateContext<TInput, T>): Promise<IAsyncDataTreeNode<TInput, T>[]> {
node.hasChildren = !!this.dataSource.hasChildren(node.element!);
node.hasChildren = !!this.dataSource.hasChildren(node.element);
let childrenPromise: Promise<Iterable<T>>;
@@ -904,7 +904,7 @@ export class AsyncDataTree<TInput, T, TFilterData = void> implements IDisposable
if (result) {
return result;
}
const children = this.dataSource.getChildren(node.element!);
const children = this.dataSource.getChildren(node.element);
if (isIterable(children)) {
return this.processChildren(children);
} else {
@@ -1033,9 +1033,9 @@ export class AsyncDataTree<TInput, T, TFilterData = void> implements IDisposable
const children = node.children.map(node => this.asTreeElement(node, viewStateContext));
const objectTreeOptions: IObjectTreeSetChildrenOptions<IAsyncDataTreeNode<TInput, T>> | undefined = options && {
...options,
diffIdentityProvider: options!.diffIdentityProvider && {
diffIdentityProvider: options.diffIdentityProvider && {
getId(node: IAsyncDataTreeNode<TInput, T>): { toString(): string } {
return options!.diffIdentityProvider!.getId(node.element as T);
return options.diffIdentityProvider!.getId(node.element as T);
}
}
};
@@ -1210,7 +1210,7 @@ function asCompressibleObjectTreeOptions<TInput, T, TFilterData>(options?: IComp
keyboardNavigationLabelProvider: objectTreeOptions.keyboardNavigationLabelProvider && {
...objectTreeOptions.keyboardNavigationLabelProvider,
getCompressedNodeKeyboardNavigationLabel(els) {
return options!.keyboardNavigationLabelProvider!.getCompressedNodeKeyboardNavigationLabel(els.map(e => e.element as T));
return options.keyboardNavigationLabelProvider!.getCompressedNodeKeyboardNavigationLabel(els.map(e => e.element as T));
}
}
};
+1 -1
View File
@@ -51,7 +51,7 @@ export function memoize(_target: any, key: string, descriptor: any) {
configurable: false,
enumerable: false,
writable: false,
value: fn!.apply(this, args)
value: fn.apply(this, args)
});
}
+2 -2
View File
@@ -653,8 +653,8 @@ export abstract class ReferenceCollection<T> {
const { object } = reference;
const dispose = createSingleCallFunction(() => {
if (--reference!.counter === 0) {
this.destroyReferencedObject(key, reference!.object);
if (--reference.counter === 0) {
this.destroyReferencedObject(key, reference.object);
this.references.delete(key);
}
});
+3 -3
View File
@@ -62,7 +62,7 @@ export class LinkedList<E> {
} else if (atTheEnd) {
// push
const oldLast = this._last!;
const oldLast = this._last;
this._last = newNode;
newNode.prev = oldLast;
oldLast.next = newNode;
@@ -119,12 +119,12 @@ export class LinkedList<E> {
} else if (node.next === Node.Undefined) {
// last
this._last = this._last!.prev!;
this._last = this._last.prev!;
this._last.next = Node.Undefined;
} else if (node.prev === Node.Undefined) {
// first
this._first = this._first!.next!;
this._first = this._first.next!;
this._first.prev = Node.Undefined;
}
+1 -1
View File
@@ -552,7 +552,7 @@ export class TernarySearchTree<K, V> {
const min = this._min(node.right);
if (min.key) {
const { key, value, segment } = min;
this._delete(min.key!, false);
this._delete(min.key, false);
node.key = key;
node.value = value;
node.segment = segment;
@@ -54,10 +54,10 @@ function validateMenuBarItem(menubar: MenuBar, menubarContainer: HTMLElement, la
const buttonElement = getButtonElementByAriaLabel(menubarContainer, readableLabel);
assert(buttonElement !== null, `Button element not found for ${readableLabel} button.`);
const titleDiv = getTitleDivFromButtonDiv(buttonElement!);
const titleDiv = getTitleDivFromButtonDiv(buttonElement);
assert(titleDiv !== null, `Title div not found for ${readableLabel} button.`);
const mnem = getMnemonicFromTitleDiv(titleDiv!);
const mnem = getMnemonicFromTitleDiv(titleDiv);
assert.strictEqual(mnem, mnemonic, 'Mnemonic not correct');
}
+37 -37
View File
@@ -199,12 +199,12 @@ suite('Fuzzy Scorer', () => {
assert.ok(pathRes.score);
assert.ok(pathRes.descriptionMatch);
assert.ok(pathRes.labelMatch);
assert.strictEqual(pathRes.labelMatch!.length, 1);
assert.strictEqual(pathRes.labelMatch![0].start, 8);
assert.strictEqual(pathRes.labelMatch![0].end, 11);
assert.strictEqual(pathRes.descriptionMatch!.length, 1);
assert.strictEqual(pathRes.descriptionMatch![0].start, 1);
assert.strictEqual(pathRes.descriptionMatch![0].end, 4);
assert.strictEqual(pathRes.labelMatch.length, 1);
assert.strictEqual(pathRes.labelMatch[0].start, 8);
assert.strictEqual(pathRes.labelMatch[0].end, 11);
assert.strictEqual(pathRes.descriptionMatch.length, 1);
assert.strictEqual(pathRes.descriptionMatch[0].start, 1);
assert.strictEqual(pathRes.descriptionMatch[0].end, 4);
// No Match
const noRes = scoreItem(resource, '987', true, ResourceAccessor);
@@ -232,41 +232,41 @@ suite('Fuzzy Scorer', () => {
const res1 = scoreItem(resource, 'xyz some', true, ResourceAccessor);
assert.ok(res1.score);
assert.strictEqual(res1.labelMatch?.length, 1);
assert.strictEqual(res1.labelMatch![0].start, 0);
assert.strictEqual(res1.labelMatch![0].end, 4);
assert.strictEqual(res1.labelMatch[0].start, 0);
assert.strictEqual(res1.labelMatch[0].end, 4);
assert.strictEqual(res1.descriptionMatch?.length, 1);
assert.strictEqual(res1.descriptionMatch![0].start, 1);
assert.strictEqual(res1.descriptionMatch![0].end, 4);
assert.strictEqual(res1.descriptionMatch[0].start, 1);
assert.strictEqual(res1.descriptionMatch[0].end, 4);
const res2 = scoreItem(resource, 'some xyz', true, ResourceAccessor);
assert.ok(res2.score);
assert.strictEqual(res1.score, res2.score);
assert.strictEqual(res2.labelMatch?.length, 1);
assert.strictEqual(res2.labelMatch![0].start, 0);
assert.strictEqual(res2.labelMatch![0].end, 4);
assert.strictEqual(res2.labelMatch[0].start, 0);
assert.strictEqual(res2.labelMatch[0].end, 4);
assert.strictEqual(res2.descriptionMatch?.length, 1);
assert.strictEqual(res2.descriptionMatch![0].start, 1);
assert.strictEqual(res2.descriptionMatch![0].end, 4);
assert.strictEqual(res2.descriptionMatch[0].start, 1);
assert.strictEqual(res2.descriptionMatch[0].end, 4);
const res3 = scoreItem(resource, 'some xyz file file123', true, ResourceAccessor);
assert.ok(res3.score);
assert.ok(res3.score > res2.score);
assert.strictEqual(res3.labelMatch?.length, 1);
assert.strictEqual(res3.labelMatch![0].start, 0);
assert.strictEqual(res3.labelMatch![0].end, 11);
assert.strictEqual(res3.labelMatch[0].start, 0);
assert.strictEqual(res3.labelMatch[0].end, 11);
assert.strictEqual(res3.descriptionMatch?.length, 1);
assert.strictEqual(res3.descriptionMatch![0].start, 1);
assert.strictEqual(res3.descriptionMatch![0].end, 4);
assert.strictEqual(res3.descriptionMatch[0].start, 1);
assert.strictEqual(res3.descriptionMatch[0].end, 4);
const res4 = scoreItem(resource, 'path z y', true, ResourceAccessor);
assert.ok(res4.score);
assert.ok(res4.score < res2.score);
assert.strictEqual(res4.labelMatch?.length, 0);
assert.strictEqual(res4.descriptionMatch?.length, 2);
assert.strictEqual(res4.descriptionMatch![0].start, 2);
assert.strictEqual(res4.descriptionMatch![0].end, 4);
assert.strictEqual(res4.descriptionMatch![1].start, 10);
assert.strictEqual(res4.descriptionMatch![1].end, 14);
assert.strictEqual(res4.descriptionMatch[0].start, 2);
assert.strictEqual(res4.descriptionMatch[0].end, 4);
assert.strictEqual(res4.descriptionMatch[1].start, 10);
assert.strictEqual(res4.descriptionMatch[1].end, 14);
});
test('scoreItem - multiple with cache yields different results', function () {
@@ -299,12 +299,12 @@ suite('Fuzzy Scorer', () => {
assert.ok(pathRes.score);
assert.ok(pathRes.descriptionMatch);
assert.ok(pathRes.labelMatch);
assert.strictEqual(pathRes.labelMatch!.length, 1);
assert.strictEqual(pathRes.labelMatch![0].start, 0);
assert.strictEqual(pathRes.labelMatch![0].end, 7);
assert.strictEqual(pathRes.descriptionMatch!.length, 1);
assert.strictEqual(pathRes.descriptionMatch![0].start, 23);
assert.strictEqual(pathRes.descriptionMatch![0].end, 26);
assert.strictEqual(pathRes.labelMatch.length, 1);
assert.strictEqual(pathRes.labelMatch[0].start, 0);
assert.strictEqual(pathRes.labelMatch[0].end, 7);
assert.strictEqual(pathRes.descriptionMatch.length, 1);
assert.strictEqual(pathRes.descriptionMatch[0].start, 23);
assert.strictEqual(pathRes.descriptionMatch[0].end, 26);
});
test('scoreItem - avoid match scattering (bug #36119)', function () {
@@ -314,9 +314,9 @@ suite('Fuzzy Scorer', () => {
assert.ok(pathRes.score);
assert.ok(pathRes.descriptionMatch);
assert.ok(pathRes.labelMatch);
assert.strictEqual(pathRes.labelMatch!.length, 1);
assert.strictEqual(pathRes.labelMatch![0].start, 0);
assert.strictEqual(pathRes.labelMatch![0].end, 9);
assert.strictEqual(pathRes.labelMatch.length, 1);
assert.strictEqual(pathRes.labelMatch[0].start, 0);
assert.strictEqual(pathRes.labelMatch[0].end, 9);
});
test('scoreItem - prefers more compact matches', function () {
@@ -328,11 +328,11 @@ suite('Fuzzy Scorer', () => {
assert.ok(res.score);
assert.ok(res.descriptionMatch);
assert.ok(!res.labelMatch!.length);
assert.strictEqual(res.descriptionMatch!.length, 2);
assert.strictEqual(res.descriptionMatch![0].start, 11);
assert.strictEqual(res.descriptionMatch![0].end, 12);
assert.strictEqual(res.descriptionMatch![1].start, 13);
assert.strictEqual(res.descriptionMatch![1].end, 14);
assert.strictEqual(res.descriptionMatch.length, 2);
assert.strictEqual(res.descriptionMatch[0].start, 11);
assert.strictEqual(res.descriptionMatch[0].end, 12);
assert.strictEqual(res.descriptionMatch[1].start, 13);
assert.strictEqual(res.descriptionMatch[1].end, 14);
});
test('scoreItem - proper target offset', function () {
@@ -1121,7 +1121,7 @@ suite('Fuzzy Scorer', () => {
assert.strictEqual(query.values?.[1].normalized, 'World');
assert.strictEqual(query.values?.[1].normalizedLowercase, 'World'.toLowerCase());
const restoredQuery = pieceToQuery(query.values!);
const restoredQuery = pieceToQuery(query.values);
assert.strictEqual(restoredQuery.original, query.original);
assert.strictEqual(restoredQuery.values?.length, query.values?.length);
assert.strictEqual(restoredQuery.containsPathSeparator, query.containsPathSeparator);
+1 -1
View File
@@ -41,7 +41,7 @@ export function beginTrackingDisposables(): void {
export function endTrackingDisposables(): void {
if (currentTracker) {
setDisposableTracker(null);
console.log(currentTracker!.allDisposables.map(e => `${e[0]}\n${e[1]}`).join('\n\n'));
console.log(currentTracker.allDisposables.map(e => `${e[0]}\n${e[1]}`).join('\n\n'));
currentTracker = null;
}
}
+2 -2
View File
@@ -221,9 +221,9 @@ export class LocalStorageSecretStorageProvider implements ISecretStorageProvider
const authAccount = JSON.stringify({ extensionId: 'vscode.github-authentication', key: 'github.auth' });
record[authAccount] = JSON.stringify(authSessionInfo.scopes.map(scopes => ({
id: authSessionInfo!.id,
id: authSessionInfo.id,
scopes,
accessToken: authSessionInfo!.accessToken
accessToken: authSessionInfo.accessToken
})));
return record;
+1 -1
View File
@@ -466,7 +466,7 @@ export abstract class EditorAction2 extends Action2 {
logService.debug(`[EditorAction2] NOT running command because its precondition is FALSE`, this.desc.id, this.desc.precondition?.serialize());
return;
}
return this.runEditorCommand(editorAccessor, editor!, ...args);
return this.runEditorCommand(editorAccessor, editor, ...args);
});
}
@@ -66,7 +66,7 @@ export class HoverService implements IHoverService {
hover.isLocked = true;
}
hover.onDispose(() => {
const hoverWasFocused = this._currentHover?.domNode && isAncestorOfActiveElement(this._currentHover.domNode!);
const hoverWasFocused = this._currentHover?.domNode && isAncestorOfActiveElement(this._currentHover.domNode);
if (hoverWasFocused) {
// Required to handle cases such as closing the hover with the escape key
this._lastFocusedElementBeforeOpen?.focus();
@@ -173,7 +173,7 @@ export class ViewOverlayWidgets extends ViewPart {
const fixedOverflowWidgets = this._context.configuration.options.get(EditorOption.fixedOverflowWidgets);
if (fixedOverflowWidgets && widgetData.widget.allowEditorOverflow) {
// top, left are computed relative to the editor and we need them relative to the page
const editorBoundingBox = this._viewDomNodeRect!;
const editorBoundingBox = this._viewDomNodeRect;
domNode.setTop(top + editorBoundingBox.top);
domNode.setLeft(left + editorBoundingBox.left);
domNode.setPosition('fixed');
+1 -1
View File
@@ -2003,7 +2003,7 @@ class EditorGoToLocation extends BaseEditorOption<EditorOption.gotoLocation, IGo
}
const input = _input as IGotoLocationOptions;
return {
multiple: stringSet<GoToLocationValues>(input.multiple, this.defaultValue.multiple!, ['peek', 'gotoAndPeek', 'goto']),
multiple: stringSet<GoToLocationValues>(input.multiple, this.defaultValue.multiple, ['peek', 'gotoAndPeek', 'goto']),
multipleDefinitions: input.multipleDefinitions ?? stringSet<GoToLocationValues>(input.multipleDefinitions, 'peek', ['peek', 'gotoAndPeek', 'goto']),
multipleTypeDefinitions: input.multipleTypeDefinitions ?? stringSet<GoToLocationValues>(input.multipleTypeDefinitions, 'peek', ['peek', 'gotoAndPeek', 'goto']),
multipleDeclarations: input.multipleDeclarations ?? stringSet<GoToLocationValues>(input.multipleDeclarations, 'peek', ['peek', 'gotoAndPeek', 'goto']),
+2 -2
View File
@@ -151,8 +151,8 @@ export function getWordAtText(column: number, wordDefinition: RegExp, text: stri
if (match) {
const result = {
word: match[0],
startColumn: textOffset + 1 + match.index!,
endColumn: textOffset + 1 + match.index! + match[0].length
startColumn: textOffset + 1 + match.index,
endColumn: textOffset + 1 + match.index + match[0].length
};
wordDefinition.lastIndex = 0;
return result;
@@ -173,7 +173,7 @@ class NonPeekableTextBufferTokenizer {
if (this.line === null) {
this.lineTokens = this.textModel.tokenization.getLineTokens(this.lineIdx + 1);
this.line = this.lineTokens.getLineContent();
this.lineTokenOffset = this.lineCharOffset === 0 ? 0 : this.lineTokens!.findTokenIndexAtOffset(this.lineCharOffset);
this.lineTokenOffset = this.lineCharOffset === 0 ? 0 : this.lineTokens.findTokenIndexAtOffset(this.lineCharOffset);
}
const startLineIdx = this.lineIdx;
@@ -229,7 +229,7 @@ export class ContextMenuController implements IEditorContribution {
this._contextMenuService.showContextMenu({
domForShadowRoot: useShadowDOM ? this._editor.getDomNode() : undefined,
getAnchor: () => anchor!,
getAnchor: () => anchor,
getActions: () => actions,
@@ -469,8 +469,8 @@ export class OutlineModelService implements IOutlineModelService {
const listener = token.onCancellationRequested(() => {
// last -> cancel provider request, remove cached promise
if (--data!.promiseCnt === 0) {
data!.source.cancel();
if (--data.promiseCnt === 0) {
data.source.cancel();
this._cache.delete(textModel.id);
}
});
@@ -51,7 +51,7 @@ registerSingleton(IEditorCancellationTokens, class implements IEditorCancellatio
// remove w/o cancellation
if (removeFn) {
removeFn();
data!.key.set(!data!.tokens.isEmpty());
data.key.set(!data.tokens.isEmpty());
removeFn = undefined;
}
};
@@ -1220,7 +1220,7 @@ export class FindWidget extends Widget implements IOverlayWidget, IVerticalSashL
return;
}
const maxWidth = parseFloat(dom.getComputedStyle(this._domNode).maxWidth!) || 0;
const maxWidth = parseFloat(dom.getComputedStyle(this._domNode).maxWidth) || 0;
if (width > maxWidth) {
return;
}
@@ -1643,7 +1643,7 @@ suite('FindModel', () => {
]
);
editor!.getModel()!.setValue('hello\nhi');
editor.getModel()!.setValue('hello\nhi');
assertFindState(
editor,
[1, 1, 1, 1],
@@ -1674,7 +1674,7 @@ suite('FindModel', () => {
findModel.selectAllMatches();
assert.deepStrictEqual(editor!.getSelections()!.map(s => s.toString()), [
assert.deepStrictEqual(editor.getSelections()!.map(s => s.toString()), [
new Selection(6, 14, 6, 19),
new Selection(6, 27, 6, 32),
new Selection(7, 14, 7, 19),
@@ -1718,14 +1718,14 @@ suite('FindModel', () => {
findModel.selectAllMatches();
assert.deepStrictEqual(editor!.getSelections()!.map(s => s.toString()), [
assert.deepStrictEqual(editor.getSelections()!.map(s => s.toString()), [
new Selection(7, 14, 7, 19),
new Selection(6, 14, 6, 19),
new Selection(6, 27, 6, 32),
new Selection(8, 14, 8, 19)
].map(s => s.toString()));
assert.deepStrictEqual(editor!.getSelection()!.toString(), new Selection(7, 14, 7, 19).toString());
assert.deepStrictEqual(editor.getSelection()!.toString(), new Selection(7, 14, 7, 19).toString());
assertFindState(
editor,
@@ -2156,7 +2156,7 @@ suite('FindModel', () => {
for (let i = 0; i < 1100; i++) {
initialText += 'line' + i + '\n';
}
editor!.getModel()!.setValue(initialText);
editor.getModel()!.setValue(initialText);
const findState = disposables.add(new FindReplaceState());
findState.change({ searchString: '^', replaceString: 'a ', isRegex: true }, false);
const findModel = disposables.add(new FindModelBoundToEditorModel(editor, findState));
@@ -2168,7 +2168,7 @@ suite('FindModel', () => {
expectedText += 'a line' + i + '\n';
}
expectedText += 'a ';
assert.strictEqual(editor!.getModel()!.getValue(), expectedText);
assert.strictEqual(editor.getModel()!.getValue(), expectedText);
findModel.dispose();
findState.dispose();
@@ -216,7 +216,7 @@ export class FoldingController extends Disposable implements IEditorContribution
if (state.collapsedRegions && state.collapsedRegions.length > 0 && this.foldingModel) {
this._restoringViewState = true;
try {
this.foldingModel.applyMemento(state.collapsedRegions!);
this.foldingModel.applyMemento(state.collapsedRegions);
} finally {
this._restoringViewState = false;
}
@@ -476,7 +476,7 @@ export class FoldingController extends Disposable implements IEditorContribution
const surrounding = e.event.altKey;
let toToggle = [];
if (surrounding) {
const filter = (otherRegion: FoldingRegion) => !otherRegion.containedBy(region!) && !region!.containedBy(otherRegion);
const filter = (otherRegion: FoldingRegion) => !otherRegion.containedBy(region) && !region.containedBy(otherRegion);
const toMaybeToggle = foldingModel.getRegionsInside(null, filter);
for (const r of toMaybeToggle) {
if (r.isCollapsed) {
@@ -99,7 +99,7 @@ export class MarkerController implements IEditorContribution {
if (!this._widget || !this._widget.position || !this._model) {
return;
}
const info = this._model.find(this._editor.getModel()!.uri, this._widget!.position!);
const info = this._model.find(this._editor.getModel()!.uri, this._widget.position);
if (info) {
this._widget.updateMarker(info.marker);
} else {
@@ -146,7 +146,7 @@ export abstract class SymbolNavigationAction extends EditorAction2 {
} else if (referenceCount === 1 && altAction) {
// already at the only result, run alternative
SymbolNavigationAction._activeAlternativeCommands.add(this.desc.id);
instaService.invokeFunction((accessor) => altAction!.runEditorCommand(accessor, editor, arg, range).finally(() => {
instaService.invokeFunction((accessor) => altAction.runEditorCommand(accessor, editor, arg, range).finally(() => {
SymbolNavigationAction._activeAlternativeCommands.delete(this.desc.id);
}));
@@ -74,7 +74,7 @@ class InPlaceReplaceController implements IEditorContribution {
return Promise.resolve(undefined);
}
this.currentRequest = createCancelablePromise(token => this.editorWorkerService.navigateValueSet(modelURI, selection!, up));
this.currentRequest = createCancelablePromise(token => this.editorWorkerService.navigateValueSet(modelURI, selection, up));
return this.currentRequest.then(result => {
@@ -91,7 +91,7 @@ class InPlaceReplaceController implements IEditorContribution {
// Selection
const editRange = Range.lift(result.range);
let highlightRange = result.range;
const diff = result.value.length - (selection!.endColumn - selection!.startColumn);
const diff = result.value.length - (selection.endColumn - selection.startColumn);
// highlight
highlightRange = {
@@ -101,11 +101,11 @@ class InPlaceReplaceController implements IEditorContribution {
endColumn: highlightRange.startColumn + result.value.length
};
if (diff > 1) {
selection = new Selection(selection!.startLineNumber, selection!.startColumn, selection!.endLineNumber, selection!.endColumn + diff - 1);
selection = new Selection(selection.startLineNumber, selection.startColumn, selection.endLineNumber, selection.endColumn + diff - 1);
}
// Insert new text
const command = new InPlaceReplaceCommand(editRange, selection!, result.value);
const command = new InPlaceReplaceCommand(editRange, selection, result.value);
this.editor.pushUndoStop();
this.editor.executeCommand(source, command);
@@ -19,7 +19,7 @@ function testMoveLinesDownCommand(lines: string[], selection: Selection, expecte
if (!languageConfigurationService) {
languageConfigurationService = disposables.add(new TestLanguageConfigurationService());
}
testCommand(lines, null, selection, (accessor, sel) => new MoveLinesCommand(sel, true, EditorAutoIndentStrategy.Advanced, languageConfigurationService!), expectedLines, expectedSelection);
testCommand(lines, null, selection, (accessor, sel) => new MoveLinesCommand(sel, true, EditorAutoIndentStrategy.Advanced, languageConfigurationService), expectedLines, expectedSelection);
disposables.dispose();
}
@@ -28,7 +28,7 @@ function testMoveLinesUpCommand(lines: string[], selection: Selection, expectedL
if (!languageConfigurationService) {
languageConfigurationService = disposables.add(new TestLanguageConfigurationService());
}
testCommand(lines, null, selection, (accessor, sel) => new MoveLinesCommand(sel, false, EditorAutoIndentStrategy.Advanced, languageConfigurationService!), expectedLines, expectedSelection);
testCommand(lines, null, selection, (accessor, sel) => new MoveLinesCommand(sel, false, EditorAutoIndentStrategy.Advanced, languageConfigurationService), expectedLines, expectedSelection);
disposables.dispose();
}
@@ -37,7 +37,7 @@ function testMoveLinesDownWithIndentCommand(languageId: string, lines: string[],
if (!languageConfigurationService) {
languageConfigurationService = disposables.add(new TestLanguageConfigurationService());
}
testCommand(lines, languageId, selection, (accessor, sel) => new MoveLinesCommand(sel, true, EditorAutoIndentStrategy.Full, languageConfigurationService!), expectedLines, expectedSelection);
testCommand(lines, languageId, selection, (accessor, sel) => new MoveLinesCommand(sel, true, EditorAutoIndentStrategy.Full, languageConfigurationService), expectedLines, expectedSelection);
disposables.dispose();
}
@@ -46,7 +46,7 @@ function testMoveLinesUpWithIndentCommand(languageId: string, lines: string[], s
if (!languageConfigurationService) {
languageConfigurationService = disposables.add(new TestLanguageConfigurationService());
}
testCommand(lines, languageId, selection, (accessor, sel) => new MoveLinesCommand(sel, false, EditorAutoIndentStrategy.Full, languageConfigurationService!), expectedLines, expectedSelection);
testCommand(lines, languageId, selection, (accessor, sel) => new MoveLinesCommand(sel, false, EditorAutoIndentStrategy.Full, languageConfigurationService), expectedLines, expectedSelection);
disposables.dispose();
}
@@ -254,7 +254,7 @@ class RenameController implements IEditorContribution {
respectAutoSaveConfig: true
}).then(result => {
if (result.ariaSummary) {
alert(nls.localize('aria', "Successfully renamed '{0}' to '{1}'. Summary: {2}", loc!.text, inputFieldResult.newName, result.ariaSummary));
alert(nls.localize('aria', "Successfully renamed '{0}' to '{1}'. Summary: {2}", loc.text, inputFieldResult.newName, result.ariaSummary));
}
}).catch(err => {
this._notificationService.error(nls.localize('rename.failedApply', "Rename failed to apply edits"));
@@ -71,7 +71,7 @@ suite('SmartSelect', () => {
const uri = URI.file('test.js');
const model = modelService.createModel(text.join('\n'), new StaticLanguageSelector(languageId), uri);
const [actual] = await provideSelectionRanges(providers, model, [new Position(lineNumber, column)], { selectLeadingAndTrailingWhitespace, selectSubwords: true }, CancellationToken.None);
const actualStr = actual!.map(r => new Range(r.startLineNumber, r.startColumn, r.endLineNumber, r.endColumn).toString());
const actualStr = actual.map(r => new Range(r.startLineNumber, r.startColumn, r.endLineNumber, r.endColumn).toString());
const desiredStr = ranges.reverse().map(r => String(r));
assert.deepStrictEqual(actualStr, desiredStr, `\nA: ${actualStr} VS \nE: ${desiredStr}`);
@@ -223,8 +223,8 @@ suite('SmartSelect', () => {
modelService.destroyModel(model.uri);
assert.strictEqual(expected.length, ranges!.length);
for (const range of ranges!) {
assert.strictEqual(expected.length, ranges.length);
for (const range of ranges) {
const exp = expected.shift() || null;
assert.ok(Range.equalsRange(range.range, exp), `A=${range.range} <> E=${exp}`);
}
@@ -776,10 +776,10 @@ suite('SnippetParser', () => {
assert.strictEqual(snippet.children.length, 1);
assert.ok(variable instanceof Variable);
assert.ok(variable.transform);
assert.strictEqual(variable.transform!.children.length, 1);
assert.ok(variable.transform!.children[0] instanceof FormatString);
assert.strictEqual((<FormatString>variable.transform!.children[0]).ifValue, 'import { hello } from world');
assert.strictEqual((<FormatString>variable.transform!.children[0]).elseValue, undefined);
assert.strictEqual(variable.transform.children.length, 1);
assert.ok(variable.transform.children[0] instanceof FormatString);
assert.strictEqual((<FormatString>variable.transform.children[0]).ifValue, 'import { hello } from world');
assert.strictEqual((<FormatString>variable.transform.children[0]).elseValue, undefined);
});
test('Snippet escape backslashes inside conditional insertion variable replacement #80394', function () {
@@ -789,10 +789,10 @@ suite('SnippetParser', () => {
assert.strictEqual(snippet.children.length, 1);
assert.ok(variable instanceof Variable);
assert.ok(variable.transform);
assert.strictEqual(variable.transform!.children.length, 1);
assert.ok(variable.transform!.children[0] instanceof FormatString);
assert.strictEqual((<FormatString>variable.transform!.children[0]).ifValue, '\\');
assert.strictEqual((<FormatString>variable.transform!.children[0]).elseValue, undefined);
assert.strictEqual(variable.transform.children.length, 1);
assert.ok(variable.transform.children[0] instanceof FormatString);
assert.strictEqual((<FormatString>variable.transform.children[0]).ifValue, '\\');
assert.strictEqual((<FormatString>variable.transform.children[0]).elseValue, undefined);
});
test('Snippet placeholder empty right after expansion #152553', function () {
@@ -360,8 +360,8 @@ suite('TextModelWithTokens 2', () => {
disposables.add(languageService.registerLanguage({ id: mode1 }));
disposables.add(languageService.registerLanguage({ id: mode2 }));
const encodedMode1 = languageIdCodec!.encodeLanguageId(mode1);
const encodedMode2 = languageIdCodec!.encodeLanguageId(mode2);
const encodedMode1 = languageIdCodec.encodeLanguageId(mode1);
const encodedMode2 = languageIdCodec.encodeLanguageId(mode2);
const otherMetadata1 = (
(encodedMode1 << MetadataConsts.LANGUAGEID_OFFSET)
@@ -466,7 +466,7 @@ suite('TextModelWithTokens 2', () => {
const languageIdCodec = instantiationService.get(ILanguageService).languageIdCodec;
const encodedMode = languageIdCodec!.encodeLanguageId(mode);
const encodedMode = languageIdCodec.encodeLanguageId(mode);
const otherMetadata = (
(encodedMode << MetadataConsts.LANGUAGEID_OFFSET)
@@ -19,7 +19,7 @@ suite('LanguageSelector', function () {
test('score, invalid selector', function () {
assert.strictEqual(score({}, model.uri, model.language, true, undefined, undefined), 0);
assert.strictEqual(score(undefined!, model.uri, model.language, true, undefined, undefined), 0);
assert.strictEqual(score(undefined, model.uri, model.language, true, undefined, undefined), 0);
assert.strictEqual(score(null!, model.uri, model.language, true, undefined, undefined), 0);
assert.strictEqual(score('', model.uri, model.language, true, undefined, undefined), 0);
});
@@ -199,7 +199,7 @@ class MenuInfo {
group = [groupName, []];
this._menuGroups.push(group);
}
group![1].push(item);
group[1].push(item);
// keep keys for eventing
this._collectContextKeys(item);
@@ -293,7 +293,7 @@ flakySuite('BackupMainService', () => {
const emptyBackups = service.getEmptyWindowBackups();
assert.strictEqual(1, emptyBackups.length);
assert.strictEqual(1, fs.readdirSync(path.join(backupHome, emptyBackups[0].backupFolder!)).length);
assert.strictEqual(1, fs.readdirSync(path.join(backupHome, emptyBackups[0].backupFolder)).length);
});
suite('loadSync', () => {
@@ -234,6 +234,6 @@ class ConfigurationEditing {
tabSize: this.configurationService.getValue('editor.tabSize', { overrideIdentifier: 'jsonc' })
};
}
return this._formattingOptions!;
return this._formattingOptions;
}
}
@@ -493,12 +493,12 @@ suite('CustomConfigurationModel', () => {
assert.deepStrictEqual(testObject.configurationModel.contents, Object.create(null));
assert.deepStrictEqual(testObject.configurationModel.keys, []);
testObject.parse(null!);
testObject.parse(null);
assert.deepStrictEqual(testObject.configurationModel.contents, Object.create(null));
assert.deepStrictEqual(testObject.configurationModel.keys, []);
testObject.parse(undefined!);
testObject.parse(undefined);
assert.deepStrictEqual(testObject.configurationModel.contents, Object.create(null));
assert.deepStrictEqual(testObject.configurationModel.keys, []);
@@ -264,7 +264,7 @@ export class ExtensionManagementChannelClient extends Disposable implements IExt
}
uninstall(extension: ILocalExtension, options?: UninstallOptions): Promise<void> {
return Promise.resolve(this.channel.call<void>('uninstall', [extension!, options]));
return Promise.resolve(this.channel.call<void>('uninstall', [extension, options]));
}
reinstallFromGallery(extension: ILocalExtension): Promise<ILocalExtension> {
@@ -81,7 +81,7 @@ suite('File Service', () => {
assert.strictEqual(service.hasCapability(resource, FileSystemProviderCapabilities.Readonly), true);
assert.strictEqual(service.hasCapability(resource, FileSystemProviderCapabilities.FileOpenReadWriteClose), false);
registrationDisposable!.dispose();
registrationDisposable.dispose();
assert.strictEqual(await service.canHandleResource(resource), false);
assert.strictEqual(service.hasProvider(resource), false);
@@ -100,10 +100,10 @@ flakySuite('IndexedDBFileSystemProvider', function () {
assert.strictEqual((await userdataFileProvider.stat(newFolderResource)).type, FileType.Directory);
assert.ok(event);
assert.strictEqual(event!.resource.path, newFolderResource.path);
assert.strictEqual(event!.operation, FileOperation.CREATE);
assert.strictEqual(event!.target!.resource.path, newFolderResource.path);
assert.strictEqual(event!.target!.isDirectory, true);
assert.strictEqual(event.resource.path, newFolderResource.path);
assert.strictEqual(event.operation, FileOperation.CREATE);
assert.strictEqual(event.target!.resource.path, newFolderResource.path);
assert.strictEqual(event.target!.isDirectory, true);
});
test('createFolder: creating multiple folders at once', async () => {
@@ -162,17 +162,17 @@ flakySuite('IndexedDBFileSystemProvider', function () {
assert.strictEqual(result.resource.toString(), resource.toString());
assert.strictEqual(result.name, 'resolver');
assert.ok(result.children);
assert.ok(result.children!.length > 0);
assert.ok(result!.isDirectory);
assert.strictEqual(result.children!.length, testsElements.length);
assert.ok(result.children.length > 0);
assert.ok(result.isDirectory);
assert.strictEqual(result.children.length, testsElements.length);
assert.ok(result.children!.every(entry => {
assert.ok(result.children.every(entry => {
return testsElements.some(name => {
return basename(entry.resource) === name;
});
}));
result.children!.forEach(value => {
result.children.forEach(value => {
assert.ok(basename(value.resource));
if (['examples', 'other'].indexOf(basename(value.resource)) >= 0) {
assert.ok(value.isDirectory);
@@ -181,10 +181,10 @@ flakySuite('Disk File Service', function () {
assert.strictEqual(existsSync(newFolder.resource.fsPath), true);
assert.ok(event);
assert.strictEqual(event!.resource.fsPath, newFolderResource.fsPath);
assert.strictEqual(event!.operation, FileOperation.CREATE);
assert.strictEqual(event!.target!.resource.fsPath, newFolderResource.fsPath);
assert.strictEqual(event!.target!.isDirectory, true);
assert.strictEqual(event.resource.fsPath, newFolderResource.fsPath);
assert.strictEqual(event.operation, FileOperation.CREATE);
assert.strictEqual(event.target!.resource.fsPath, newFolderResource.fsPath);
assert.strictEqual(event.target!.isDirectory, true);
});
test('createFolder: creating multiple folders at once', async () => {
@@ -243,20 +243,20 @@ flakySuite('Disk File Service', function () {
assert.strictEqual(result.resource.toString(), resource.toString());
assert.strictEqual(result.name, 'resolver');
assert.ok(result.children);
assert.ok(result.children!.length > 0);
assert.ok(result.children.length > 0);
assert.ok(result.isDirectory);
assert.strictEqual(result.readonly, false);
assert.ok(result.mtime! > 0);
assert.ok(result.ctime! > 0);
assert.strictEqual(result.children!.length, testsElements.length);
assert.strictEqual(result.children.length, testsElements.length);
assert.ok(result.children!.every(entry => {
assert.ok(result.children.every(entry => {
return testsElements.some(name => {
return basename(entry.resource.fsPath) === name;
});
}));
result.children!.forEach(value => {
result.children.forEach(value => {
assert.ok(basename(value.resource.fsPath));
if (['examples', 'other'].indexOf(basename(value.resource.fsPath)) >= 0) {
assert.ok(value.isDirectory);
@@ -286,36 +286,36 @@ flakySuite('Disk File Service', function () {
assert.ok(result);
assert.strictEqual(result.name, 'resolver');
assert.ok(result.children);
assert.ok(result.children!.length > 0);
assert.ok(result.children.length > 0);
assert.ok(result.isDirectory);
assert.ok(result.mtime! > 0);
assert.ok(result.ctime! > 0);
assert.strictEqual(result.children!.length, testsElements.length);
assert.ok(result.mtime > 0);
assert.ok(result.ctime > 0);
assert.strictEqual(result.children.length, testsElements.length);
assert.ok(result.children!.every(entry => {
assert.ok(result.children.every(entry => {
return testsElements.some(name => {
return basename(entry.resource.fsPath) === name;
});
}));
assert.ok(result.children!.every(entry => entry.etag.length > 0));
assert.ok(result.children.every(entry => entry.etag.length > 0));
result.children!.forEach(value => {
result.children.forEach(value => {
assert.ok(basename(value.resource.fsPath));
if (['examples', 'other'].indexOf(basename(value.resource.fsPath)) >= 0) {
assert.ok(value.isDirectory);
assert.ok(value.mtime! > 0);
assert.ok(value.ctime! > 0);
assert.ok(value.mtime > 0);
assert.ok(value.ctime > 0);
} else if (basename(value.resource.fsPath) === 'index.html') {
assert.ok(!value.isDirectory);
assert.ok(!value.children);
assert.ok(value.mtime! > 0);
assert.ok(value.ctime! > 0);
assert.ok(value.mtime > 0);
assert.ok(value.ctime > 0);
} else if (basename(value.resource.fsPath) === 'site.css') {
assert.ok(!value.isDirectory);
assert.ok(!value.children);
assert.ok(value.mtime! > 0);
assert.ok(value.ctime! > 0);
assert.ok(value.mtime > 0);
assert.ok(value.ctime > 0);
} else {
assert.ok(!'Unexpected value ' + basename(value.resource.fsPath));
}
@@ -336,20 +336,20 @@ flakySuite('Disk File Service', function () {
assert.ok(result);
assert.ok(result.children);
assert.ok(result.children!.length > 0);
assert.ok(result.children.length > 0);
assert.ok(result.isDirectory);
const children = result.children!;
const children = result.children;
assert.strictEqual(children.length, 4);
const other = getByName(result, 'other');
assert.ok(other);
assert.ok(other!.children!.length > 0);
assert.ok(other.children!.length > 0);
const deep = getByName(other!, 'deep');
const deep = getByName(other, 'deep');
assert.ok(deep);
assert.ok(deep!.children!.length > 0);
assert.strictEqual(deep!.children!.length, 4);
assert.ok(deep.children!.length > 0);
assert.strictEqual(deep.children!.length, 4);
});
test('resolve directory - resolveTo multiple directories', () => {
@@ -371,25 +371,25 @@ flakySuite('Disk File Service', function () {
assert.ok(result);
assert.ok(result.children);
assert.ok(result.children!.length > 0);
assert.ok(result.children.length > 0);
assert.ok(result.isDirectory);
const children = result.children!;
const children = result.children;
assert.strictEqual(children.length, 4);
const other = getByName(result, 'other');
assert.ok(other);
assert.ok(other!.children!.length > 0);
assert.ok(other.children!.length > 0);
const deep = getByName(other!, 'deep');
const deep = getByName(other, 'deep');
assert.ok(deep);
assert.ok(deep!.children!.length > 0);
assert.strictEqual(deep!.children!.length, 4);
assert.ok(deep.children!.length > 0);
assert.strictEqual(deep.children!.length, 4);
const examples = getByName(result, 'examples');
assert.ok(examples);
assert.ok(examples!.children!.length > 0);
assert.strictEqual(examples!.children!.length, 4);
assert.ok(examples.children!.length > 0);
assert.strictEqual(examples.children!.length, 4);
}
test('resolve directory - resolveSingleChildFolders', async () => {
@@ -398,16 +398,16 @@ flakySuite('Disk File Service', function () {
assert.ok(result);
assert.ok(result.children);
assert.ok(result.children!.length > 0);
assert.ok(result.children.length > 0);
assert.ok(result.isDirectory);
const children = result.children!;
const children = result.children;
assert.strictEqual(children.length, 1);
const deep = getByName(result, 'deep');
assert.ok(deep);
assert.ok(deep!.children!.length > 0);
assert.strictEqual(deep!.children!.length, 4);
assert.ok(deep.children!.length > 0);
assert.strictEqual(deep.children!.length, 4);
});
test('resolves', async () => {
@@ -470,9 +470,9 @@ flakySuite('Disk File Service', function () {
assert.strictEqual(resolved.readonly, false);
assert.strictEqual(resolved.isSymbolicLink, false);
assert.strictEqual(resolved.resource.toString(), resource.toString());
assert.ok(resolved.mtime! > 0);
assert.ok(resolved.ctime! > 0);
assert.ok(resolved.size! > 0);
assert.ok(resolved.mtime > 0);
assert.ok(resolved.ctime > 0);
assert.ok(resolved.size > 0);
});
test('stat - directory', async () => {
@@ -484,8 +484,8 @@ flakySuite('Disk File Service', function () {
assert.strictEqual(result.name, 'resolver');
assert.ok(result.isDirectory);
assert.strictEqual(result.readonly, false);
assert.ok(result.mtime! > 0);
assert.ok(result.ctime! > 0);
assert.ok(result.mtime > 0);
assert.ok(result.ctime > 0);
});
test('deleteFile (non recursive)', async () => {
@@ -1554,7 +1554,7 @@ flakySuite('Disk File Service', function () {
}
assert.ok(error);
assert.strictEqual(error!.fileOperationResult, FileOperationResult.FILE_IS_DIRECTORY);
assert.strictEqual(error.fileOperationResult, FileOperationResult.FILE_IS_DIRECTORY);
});
(isWindows /* error code does not seem to be supported on windows */ ? test.skip : test)('readFile - FILE_NOT_DIRECTORY', async () => {
@@ -1568,7 +1568,7 @@ flakySuite('Disk File Service', function () {
}
assert.ok(error);
assert.strictEqual(error!.fileOperationResult, FileOperationResult.FILE_NOT_DIRECTORY);
assert.strictEqual(error.fileOperationResult, FileOperationResult.FILE_NOT_DIRECTORY);
});
test('readFile - FILE_NOT_FOUND', async () => {
@@ -1582,7 +1582,7 @@ flakySuite('Disk File Service', function () {
}
assert.ok(error);
assert.strictEqual(error!.fileOperationResult, FileOperationResult.FILE_NOT_FOUND);
assert.strictEqual(error.fileOperationResult, FileOperationResult.FILE_NOT_FOUND);
});
test('readFile - FILE_NOT_MODIFIED_SINCE - default', async () => {
@@ -1621,7 +1621,7 @@ flakySuite('Disk File Service', function () {
}
assert.ok(error);
assert.strictEqual(error!.fileOperationResult, FileOperationResult.FILE_NOT_MODIFIED_SINCE);
assert.strictEqual(error.fileOperationResult, FileOperationResult.FILE_NOT_MODIFIED_SINCE);
assert.ok(error instanceof NotModifiedSinceFileOperationError && error.stat);
assert.strictEqual(fileProvider.totalBytesRead, 0);
}
@@ -2377,7 +2377,7 @@ flakySuite('Disk File Service', function () {
assert.ok(error);
assert.ok(error instanceof FileOperationError);
assert.strictEqual(error!.fileOperationResult, FileOperationResult.FILE_MODIFIED_SINCE);
assert.strictEqual(error.fileOperationResult, FileOperationResult.FILE_MODIFIED_SINCE);
});
test('writeFile - no error when writing to file where size is the same', async () => {
@@ -293,7 +293,7 @@ export class InstantiationService implements IInstantiationService {
return idle.value[key](callback, thisArg, disposables);
} else {
const entry: EaryListenerData = { listener: [callback, thisArg, disposables], disposable: undefined };
const rm = list!.push(entry);
const rm = list.push(entry);
const result = toDisposable(() => {
rm();
entry.disposable?.dispose();
@@ -567,11 +567,11 @@ export class IssueMainService implements IIssueMainService {
state.y = displayBounds.y; // prevent window from falling out of the screen to the bottom
}
if (state.width! > displayBounds.width) {
if (state.width > displayBounds.width) {
state.width = displayBounds.width; // prevent window from exceeding display bounds width
}
if (state.height! > displayBounds.height) {
if (state.height > displayBounds.height) {
state.height = displayBounds.height; // prevent window from exceeding display bounds height
}
}
+3 -3
View File
@@ -706,7 +706,7 @@ abstract class ResourceNavigator<T> extends Disposable {
this._register(this.widget.onMouseDblClick((e: { browserEvent: MouseEvent; element: T | undefined }) => this.onMouseDblClick(e.element, e.browserEvent)));
if (typeof options?.openOnSingleClick !== 'boolean' && options?.configurationService) {
this.openOnSingleClick = options?.configurationService!.getValue(openModeSettingKey) !== 'doubleClick';
this.openOnSingleClick = options?.configurationService.getValue(openModeSettingKey) !== 'doubleClick';
this._register(options?.configurationService.onDidChangeConfiguration(e => {
if (e.affectsConfiguration(openModeSettingKey)) {
this.openOnSingleClick = options?.configurationService!.getValue(openModeSettingKey) !== 'doubleClick';
@@ -723,8 +723,8 @@ abstract class ResourceNavigator<T> extends Disposable {
}
const selectionKeyboardEvent = event.browserEvent as SelectionKeyboardEvent;
const preserveFocus = typeof selectionKeyboardEvent.preserveFocus === 'boolean' ? selectionKeyboardEvent.preserveFocus! : true;
const pinned = typeof selectionKeyboardEvent.pinned === 'boolean' ? selectionKeyboardEvent.pinned! : !preserveFocus;
const preserveFocus = typeof selectionKeyboardEvent.preserveFocus === 'boolean' ? selectionKeyboardEvent.preserveFocus : true;
const pinned = typeof selectionKeyboardEvent.pinned === 'boolean' ? selectionKeyboardEvent.pinned : !preserveFocus;
const sideBySide = false;
this._open(this.getSelectedElement(), preserveFocus, pinned, sideBySide, event.browserEvent);
@@ -837,8 +837,8 @@ export class QuickInputList {
return;
}
this._lastHover = this.options.hoverDelegate.showHover({
content: element.saneTooltip!,
target: element.element!,
content: element.saneTooltip,
target: element.element,
linkHandler: (url) => {
this.options.linkOpenerDelegate(url);
},
+1 -1
View File
@@ -71,7 +71,7 @@ export class SignService extends AbstractSignService implements ISignService {
resolve();
}
}, 50, $window);
}).finally(() => checkInterval!.dispose()),
}).finally(() => checkInterval.dispose()),
]);
@@ -261,7 +261,7 @@ export class TerminalProcess extends Disposable implements ITerminalChildProcess
const cwd = slc.cwd instanceof URI ? slc.cwd.path : slc.cwd;
const envPaths: string[] | undefined = (slc.env && slc.env.PATH) ? slc.env.PATH.split(path.delimiter) : undefined;
const executable = await findExecutable(slc.executable!, cwd, envPaths, this._executableEnv);
const executable = await findExecutable(slc.executable, cwd, envPaths, this._executableEnv);
if (!executable) {
return { message: localize('launchFail.executableDoesNotExist', "Path to shell executable \"{0}\" does not exist", slc.executable) };
}
@@ -27,7 +27,7 @@ suite('RequestStore', () => {
const request = requestStore.createRequest({ arg: 'foo' });
strictEqual(typeof eventArgs?.requestId, 'number');
strictEqual(eventArgs?.arg, 'foo');
requestStore.acceptReply(eventArgs!.requestId, { data: 'bar' });
requestStore.acceptReply(eventArgs.requestId, { data: 'bar' });
const result = await request;
strictEqual(result.data, 'bar');
});
+2 -2
View File
@@ -354,11 +354,11 @@ export abstract class AbstractTunnelService implements ITunnelService {
return resolvedTunnel.then(tunnel => {
if (!tunnel) {
this.logService.trace('ForwardedPorts: (TunnelService) New tunnel is undefined.');
this.removeEmptyOrErrorTunnelFromMap(remoteHost!, remotePort);
this.removeEmptyOrErrorTunnelFromMap(remoteHost, remotePort);
return undefined;
} else if (typeof tunnel === 'string') {
this.logService.trace('ForwardedPorts: (TunnelService) The tunnel provider returned an error when creating the tunnel.');
this.removeEmptyOrErrorTunnelFromMap(remoteHost!, remotePort);
this.removeEmptyOrErrorTunnelFromMap(remoteHost, remotePort);
return tunnel;
}
this.logService.trace('ForwardedPorts: (TunnelService) New tunnel established.');
@@ -247,8 +247,8 @@ suite('FileUserDataProvider', () => {
const result = await testObject.resolve(userDataProfilesService.defaultProfile.snippetsHome);
assert.ok(result.isDirectory);
assert.ok(result.children !== undefined);
assert.strictEqual(result.children!.length, 1);
assert.strictEqual(result.children![0].resource.toString(), joinPath(userDataProfilesService.defaultProfile.snippetsHome, 'settings.json').toString());
assert.strictEqual(result.children.length, 1);
assert.strictEqual(result.children[0].resource.toString(), joinPath(userDataProfilesService.defaultProfile.snippetsHome, 'settings.json').toString());
});
test('read backup file', async () => {
@@ -275,8 +275,8 @@ suite('FileUserDataProvider', () => {
const result = await testObject.resolve(backupWorkspaceHomeOnDisk.with({ scheme: environmentService.userRoamingDataHome.scheme }));
assert.ok(result.isDirectory);
assert.ok(result.children !== undefined);
assert.strictEqual(result.children!.length, 1);
assert.strictEqual(result.children![0].resource.toString(), joinPath(backupWorkspaceHomeOnDisk.with({ scheme: environmentService.userRoamingDataHome.scheme }), `backup.json`).toString());
assert.strictEqual(result.children.length, 1);
assert.strictEqual(result.children[0].resource.toString(), joinPath(backupWorkspaceHomeOnDisk.with({ scheme: environmentService.userRoamingDataHome.scheme }), `backup.json`).toString());
});
});
@@ -477,7 +477,7 @@ function getEditToInsertAtLocation(content: string, key: string, value: any, loc
const isPreviouisSettingIncludesComment = previousSettingCommaOffset !== undefined && previousSettingCommaOffset > node.endOffset;
edits.push({
offset: isPreviouisSettingIncludesComment ? previousSettingCommaOffset! + 1 : node.endOffset,
offset: isPreviouisSettingIncludesComment ? previousSettingCommaOffset + 1 : node.endOffset,
length: 0,
content: nextSettingNode ? eol + newProperty + ',' : eol + newProperty
});
@@ -404,7 +404,7 @@ export class SnippetsSynchroniser extends AbstractSynchroniser implements IUserD
const local: IStringDictionary<IFileContent> = {};
for (const resourcePreview of resourcePreviews) {
if (resourcePreview.fileContent) {
local[this.extUri.basename(resourcePreview.localResource!)] = resourcePreview.fileContent;
local[this.extUri.basename(resourcePreview.localResource)] = resourcePreview.fileContent;
}
}
await this.backupLocal(JSON.stringify(this.toSnippetsContents(local)));
@@ -413,7 +413,7 @@ export class SnippetsSynchroniser extends AbstractSynchroniser implements IUserD
private async updateLocalSnippets(resourcePreviews: ISnippetsAcceptedResourcePreview[], force: boolean): Promise<void> {
for (const { fileContent, acceptResult, localResource, remoteResource, localChange } of resourcePreviews) {
if (localChange !== Change.None) {
const key = remoteResource ? this.extUri.basename(remoteResource) : this.extUri.basename(localResource!);
const key = remoteResource ? this.extUri.basename(remoteResource) : this.extUri.basename(localResource);
const resource = this.extUri.joinPath(this.snippetsFolder, key);
// Removed
@@ -446,7 +446,7 @@ export class SnippetsSynchroniser extends AbstractSynchroniser implements IUserD
for (const { acceptResult, localResource, remoteResource, remoteChange } of resourcePreviews) {
if (remoteChange !== Change.None) {
const key = localResource ? this.extUri.basename(localResource) : this.extUri.basename(remoteResource!);
const key = localResource ? this.extUri.basename(localResource) : this.extUri.basename(remoteResource);
if (remoteChange === Change.Deleted) {
delete newSnippets[key];
} else {
@@ -76,7 +76,7 @@ export abstract class AbstractUserDataSyncStoreManagementService extends Disposa
configurationSyncStore = isWeb && configurationSyncStore.web ? { ...configurationSyncStore, ...configurationSyncStore.web } : configurationSyncStore;
if (isString(configurationSyncStore.url)
&& isObject(configurationSyncStore.authenticationProviders)
&& Object.keys(configurationSyncStore.authenticationProviders).every(authenticationProviderId => Array.isArray(configurationSyncStore!.authenticationProviders![authenticationProviderId].scopes))
&& Object.keys(configurationSyncStore.authenticationProviders).every(authenticationProviderId => Array.isArray(configurationSyncStore.authenticationProviders[authenticationProviderId].scopes))
) {
const syncStore = configurationSyncStore as ConfigurationSyncStore;
const canSwitch = !!syncStore.canSwitch;
@@ -94,7 +94,7 @@ export abstract class AbstractUserDataSyncStoreManagementService extends Disposa
insidersUrl: URI.parse(syncStore.insidersUrl),
canSwitch,
authenticationProviders: Object.keys(syncStore.authenticationProviders).reduce<IAuthenticationProvider[]>((result, id) => {
result.push({ id, scopes: syncStore!.authenticationProviders[id].scopes });
result.push({ id, scopes: syncStore.authenticationProviders[id].scopes });
return result;
}, [])
};
@@ -98,7 +98,7 @@ suite('GlobalStateSync', () => {
const { content } = await testClient.read(testObject.resource);
assert.ok(content !== null);
const actual = parseGlobalState(content!);
const actual = parseGlobalState(content);
assert.deepStrictEqual(actual.storage, { 'globalState.argv.locale': { version: 1, value: 'en' }, 'a': { version: 1, value: 'value1' } });
}));
@@ -129,7 +129,7 @@ suite('GlobalStateSync', () => {
const { content } = await testClient.read(testObject.resource);
assert.ok(content !== null);
const actual = parseGlobalState(content!);
const actual = parseGlobalState(content);
assert.deepStrictEqual(actual.storage, { 'a': { version: 1, value: 'value1' }, 'b': { version: 1, value: 'value2' } });
}));
@@ -147,7 +147,7 @@ suite('GlobalStateSync', () => {
const { content } = await testClient.read(testObject.resource);
assert.ok(content !== null);
const actual = parseGlobalState(content!);
const actual = parseGlobalState(content);
assert.deepStrictEqual(actual.storage, { 'a': { version: 1, value: 'value1' } });
}));
@@ -165,7 +165,7 @@ suite('GlobalStateSync', () => {
const { content } = await testClient.read(testObject.resource);
assert.ok(content !== null);
const actual = parseGlobalState(content!);
const actual = parseGlobalState(content);
assert.deepStrictEqual(actual.storage, { 'a': { version: 1, value: 'value1' }, 'b': { version: 1, value: 'value2' } });
}));
@@ -182,7 +182,7 @@ suite('GlobalStateSync', () => {
const { content } = await testClient.read(testObject.resource);
assert.ok(content !== null);
const actual = parseGlobalState(content!);
const actual = parseGlobalState(content);
assert.deepStrictEqual(actual.storage, { 'a': { version: 1, value: 'value2' } });
}));
@@ -201,7 +201,7 @@ suite('GlobalStateSync', () => {
const { content } = await testClient.read(testObject.resource);
assert.ok(content !== null);
const actual = parseGlobalState(content!);
const actual = parseGlobalState(content);
assert.deepStrictEqual(actual.storage, { 'a': { version: 1, value: 'value1' } });
}));
@@ -222,7 +222,7 @@ suite('GlobalStateSync', () => {
const { content } = await testClient.read(testObject.resource, '1');
assert.ok(content !== null);
const actual = parseGlobalState(content!);
const actual = parseGlobalState(content);
assert.deepStrictEqual(actual.storage, { 'a': { version: 1, value: 'value1' } });
}));
@@ -73,8 +73,8 @@ suite('KeybindingsSync', () => {
const lastSyncUserData = await testObject.getLastSyncUserData();
const remoteUserData = await testObject.getRemoteUserData(null);
assert.strictEqual(getKeybindingsContentFromSyncContent(lastSyncUserData!.syncData!.content!, true, client.instantiationService.get(ILogService)), '[]');
assert.strictEqual(getKeybindingsContentFromSyncContent(remoteUserData!.syncData!.content!, true, client.instantiationService.get(ILogService)), '[]');
assert.strictEqual(getKeybindingsContentFromSyncContent(lastSyncUserData!.syncData!.content, true, client.instantiationService.get(ILogService)), '[]');
assert.strictEqual(getKeybindingsContentFromSyncContent(remoteUserData.syncData!.content, true, client.instantiationService.get(ILogService)), '[]');
assert.strictEqual((await fileService.readFile(keybindingsResource)).value.toString(), '');
});
@@ -98,8 +98,8 @@ suite('KeybindingsSync', () => {
const lastSyncUserData = await testObject.getLastSyncUserData();
const remoteUserData = await testObject.getRemoteUserData(null);
assert.strictEqual(getKeybindingsContentFromSyncContent(lastSyncUserData!.syncData!.content!, true, client.instantiationService.get(ILogService)), content);
assert.strictEqual(getKeybindingsContentFromSyncContent(remoteUserData!.syncData!.content!, true, client.instantiationService.get(ILogService)), content);
assert.strictEqual(getKeybindingsContentFromSyncContent(lastSyncUserData!.syncData!.content, true, client.instantiationService.get(ILogService)), content);
assert.strictEqual(getKeybindingsContentFromSyncContent(remoteUserData.syncData!.content, true, client.instantiationService.get(ILogService)), content);
assert.strictEqual((await fileService.readFile(keybindingsResource)).value.toString(), content);
});
@@ -113,8 +113,8 @@ suite('KeybindingsSync', () => {
const lastSyncUserData = await testObject.getLastSyncUserData();
const remoteUserData = await testObject.getRemoteUserData(null);
assert.strictEqual(getKeybindingsContentFromSyncContent(lastSyncUserData!.syncData!.content!, true, client.instantiationService.get(ILogService)), expectedContent);
assert.strictEqual(getKeybindingsContentFromSyncContent(remoteUserData!.syncData!.content!, true, client.instantiationService.get(ILogService)), expectedContent);
assert.strictEqual(getKeybindingsContentFromSyncContent(lastSyncUserData!.syncData!.content, true, client.instantiationService.get(ILogService)), expectedContent);
assert.strictEqual(getKeybindingsContentFromSyncContent(remoteUserData.syncData!.content, true, client.instantiationService.get(ILogService)), expectedContent);
assert.strictEqual((await fileService.readFile(keybindingsResource)).value.toString(), expectedContent);
});
@@ -138,8 +138,8 @@ suite('KeybindingsSync', () => {
const lastSyncUserData = await testObject.getLastSyncUserData();
const remoteUserData = await testObject.getRemoteUserData(null);
assert.strictEqual(getKeybindingsContentFromSyncContent(lastSyncUserData!.syncData!.content!, true, client.instantiationService.get(ILogService)), content);
assert.strictEqual(getKeybindingsContentFromSyncContent(remoteUserData!.syncData!.content!, true, client.instantiationService.get(ILogService)), content);
assert.strictEqual(getKeybindingsContentFromSyncContent(lastSyncUserData!.syncData!.content, true, client.instantiationService.get(ILogService)), content);
assert.strictEqual(getKeybindingsContentFromSyncContent(remoteUserData.syncData!.content, true, client.instantiationService.get(ILogService)), content);
assert.strictEqual((await fileService.readFile(keybindingsResource)).value.toString(), content);
});
@@ -162,8 +162,8 @@ suite('KeybindingsSync', () => {
const lastSyncUserData = await testObject.getLastSyncUserData();
const remoteUserData = await testObject.getRemoteUserData(null);
assert.strictEqual(getKeybindingsContentFromSyncContent(lastSyncUserData!.syncData!.content!, true, client.instantiationService.get(ILogService)), content);
assert.strictEqual(getKeybindingsContentFromSyncContent(remoteUserData!.syncData!.content!, true, client.instantiationService.get(ILogService)), content);
assert.strictEqual(getKeybindingsContentFromSyncContent(lastSyncUserData!.syncData!.content, true, client.instantiationService.get(ILogService)), content);
assert.strictEqual(getKeybindingsContentFromSyncContent(remoteUserData.syncData!.content, true, client.instantiationService.get(ILogService)), content);
assert.strictEqual((await fileService.readFile(keybindingsResource)).value.toString(), expectedLocalContent);
});
@@ -186,7 +186,7 @@ suite('KeybindingsSync', () => {
const remoteUserData = await testObject.getRemoteUserData(null);
assert.deepStrictEqual(lastSyncUserData!.ref, remoteUserData.ref);
assert.deepStrictEqual(lastSyncUserData!.syncData, remoteUserData.syncData);
assert.strictEqual(getKeybindingsContentFromSyncContent(lastSyncUserData!.syncData!.content!, true, client.instantiationService.get(ILogService)), '[]');
assert.strictEqual(getKeybindingsContentFromSyncContent(lastSyncUserData!.syncData!.content, true, client.instantiationService.get(ILogService)), '[]');
});
test('test apply remote when keybindings file does not exist', async () => {
@@ -89,8 +89,8 @@ suite('SettingsSync - Auto', () => {
const lastSyncUserData = await testObject.getLastSyncUserData();
const remoteUserData = await testObject.getRemoteUserData(null);
assert.strictEqual(parseSettingsSyncContent(lastSyncUserData!.syncData!.content!)?.settings, '{}');
assert.strictEqual(parseSettingsSyncContent(remoteUserData!.syncData!.content!)?.settings, '{}');
assert.strictEqual(parseSettingsSyncContent(lastSyncUserData!.syncData!.content)?.settings, '{}');
assert.strictEqual(parseSettingsSyncContent(remoteUserData.syncData!.content)?.settings, '{}');
assert.strictEqual((await fileService.readFile(settingsResource)).value.toString(), '');
}));
@@ -130,8 +130,8 @@ suite('SettingsSync - Auto', () => {
const lastSyncUserData = await testObject.getLastSyncUserData();
const remoteUserData = await testObject.getRemoteUserData(null);
assert.strictEqual(parseSettingsSyncContent(lastSyncUserData!.syncData!.content!)?.settings, content);
assert.strictEqual(parseSettingsSyncContent(remoteUserData!.syncData!.content!)?.settings, content);
assert.strictEqual(parseSettingsSyncContent(lastSyncUserData!.syncData!.content)?.settings, content);
assert.strictEqual(parseSettingsSyncContent(remoteUserData.syncData!.content)?.settings, content);
assert.strictEqual((await fileService.readFile(settingsResource)).value.toString(), content);
}));
@@ -155,7 +155,7 @@ suite('SettingsSync - Auto', () => {
const remoteUserData = await testObject.getRemoteUserData(null);
assert.deepStrictEqual(lastSyncUserData!.ref, remoteUserData.ref);
assert.deepStrictEqual(lastSyncUserData!.syncData, remoteUserData.syncData);
assert.strictEqual(parseSettingsSyncContent(lastSyncUserData!.syncData!.content!)?.settings, '{}');
assert.strictEqual(parseSettingsSyncContent(lastSyncUserData!.syncData!.content)?.settings, '{}');
}));
test('sync for first time to the server', () => runWithFakedTimers<void>({ useFakeTimers: true }, async () => {
@@ -187,7 +187,7 @@ suite('SettingsSync - Auto', () => {
const { content } = await client.read(testObject.resource);
assert.ok(content !== null);
const actual = parseSettings(content!);
const actual = parseSettings(content);
assert.deepStrictEqual(actual, expected);
}));
@@ -211,7 +211,7 @@ suite('SettingsSync - Auto', () => {
const { content } = await client.read(testObject.resource);
assert.ok(content !== null);
const actual = parseSettings(content!);
const actual = parseSettings(content);
assert.deepStrictEqual(actual, `{
// Always
"files.autoSave": "afterDelay",
@@ -242,7 +242,7 @@ suite('SettingsSync - Auto', () => {
const { content } = await client.read(testObject.resource);
assert.ok(content !== null);
const actual = parseSettings(content!);
const actual = parseSettings(content);
assert.deepStrictEqual(actual, `{
// Always
"files.autoSave": "afterDelay",
@@ -273,7 +273,7 @@ suite('SettingsSync - Auto', () => {
const { content } = await client.read(testObject.resource);
assert.ok(content !== null);
const actual = parseSettings(content!);
const actual = parseSettings(content);
assert.deepStrictEqual(actual, `{
// Always
"files.autoSave": "afterDelay",
@@ -297,7 +297,7 @@ suite('SettingsSync - Auto', () => {
const { content } = await client.read(testObject.resource);
assert.ok(content !== null);
const actual = parseSettings(content!);
const actual = parseSettings(content);
assert.deepStrictEqual(actual, `{
}`);
}));
@@ -315,7 +315,7 @@ suite('SettingsSync - Auto', () => {
const { content } = await client.read(testObject.resource);
assert.ok(content !== null);
const actual = parseSettings(content!);
const actual = parseSettings(content);
assert.deepStrictEqual(actual, `{
,
}`);
@@ -367,7 +367,7 @@ suite('SettingsSync - Auto', () => {
const { content } = await client.read(testObject.resource);
assert.ok(content !== null);
const actual = parseSettings(content!);
const actual = parseSettings(content);
assert.deepStrictEqual(actual, `{
// Always
"files.autoSave": "afterDelay",
@@ -415,7 +415,7 @@ suite('SettingsSync - Auto', () => {
const { content } = await client.read(testObject.resource);
assert.ok(content !== null);
const actual = parseSettings(content!);
const actual = parseSettings(content);
assert.deepStrictEqual(actual, `{
// Always
"files.autoSave": "afterDelay",
@@ -576,7 +576,7 @@ suite('SettingsSync - Manual', () => {
const { content } = await client.read(testObject.resource);
assert.ok(content !== null);
const actual = parseSettings(content!);
const actual = parseSettings(content);
assert.deepStrictEqual(actual, `{
// Always
"files.autoSave": "afterDelay",
@@ -230,7 +230,7 @@ suite('SnippetsSync', () => {
const { content } = await testClient.read(testObject.resource);
assert.ok(content !== null);
const actual = parseSnippets(content!);
const actual = parseSnippets(content);
assert.deepStrictEqual(actual, { 'html.json': htmlSnippet1, 'typescript.json': tsSnippet1 });
});
@@ -265,7 +265,7 @@ suite('SnippetsSync', () => {
const { content } = await testClient.read(testObject.resource);
assert.ok(content !== null);
const actual = parseSnippets(content!);
const actual = parseSnippets(content);
assert.deepStrictEqual(actual, { 'html.json': htmlSnippet1, 'typescript.json': tsSnippet1 });
});
@@ -300,7 +300,7 @@ suite('SnippetsSync', () => {
const { content } = await testClient.read(testObject.resource);
assert.ok(content !== null);
const actual = parseSnippets(content!);
const actual = parseSnippets(content);
assert.deepStrictEqual(actual, { 'html.json': htmlSnippet1 });
});
@@ -363,7 +363,7 @@ suite('SnippetsSync', () => {
const { content } = await testClient.read(testObject.resource);
assert.ok(content !== null);
const actual = parseSnippets(content!);
const actual = parseSnippets(content);
assert.deepStrictEqual(actual, { 'html.json': htmlSnippet2, 'typescript.json': tsSnippet1 });
});
@@ -383,7 +383,7 @@ suite('SnippetsSync', () => {
const { content } = await testClient.read(testObject.resource);
assert.ok(content !== null);
const actual = parseSnippets(content!);
const actual = parseSnippets(content);
assert.deepStrictEqual(actual, { 'html.json': htmlSnippet1, 'typescript.json': tsSnippet1 });
});
@@ -419,7 +419,7 @@ suite('SnippetsSync', () => {
const { content } = await testClient.read(testObject.resource);
assert.ok(content !== null);
const actual = parseSnippets(content!);
const actual = parseSnippets(content);
assert.deepStrictEqual(actual, { 'html.json': htmlSnippet2 });
});
@@ -476,7 +476,7 @@ suite('SnippetsSync', () => {
const { content } = await testClient.read(testObject.resource);
assert.ok(content !== null);
const actual = parseSnippets(content!);
const actual = parseSnippets(content);
assert.deepStrictEqual(actual, { 'html.json': htmlSnippet2 });
});
@@ -497,7 +497,7 @@ suite('SnippetsSync', () => {
const { content } = await testClient.read(testObject.resource);
assert.ok(content !== null);
const actual = parseSnippets(content!);
const actual = parseSnippets(content);
assert.deepStrictEqual(actual, { 'typescript.json': tsSnippet1 });
});
@@ -583,7 +583,7 @@ suite('SnippetsSync', () => {
const { content } = await testClient.read(testObject.resource);
assert.ok(content !== null);
const actual = parseSnippets(content!);
const actual = parseSnippets(content);
assert.deepStrictEqual(actual, { 'typescript.json': tsSnippet1, 'html.json': htmlSnippet3 });
});
@@ -611,7 +611,7 @@ suite('SnippetsSync', () => {
const { content } = await testClient.read(testObject.resource);
assert.ok(content !== null);
const actual = parseSnippets(content!);
const actual = parseSnippets(content);
assert.deepStrictEqual(actual, { 'typescript.json': tsSnippet1 });
});
@@ -631,7 +631,7 @@ suite('SnippetsSync', () => {
const { content } = await testClient.read(testObject.resource);
assert.ok(content !== null);
const actual = parseSnippets(content!);
const actual = parseSnippets(content);
assert.deepStrictEqual(actual, { 'html.json': htmlSnippet1, 'global.code-snippets': globalSnippet });
});
@@ -654,7 +654,7 @@ suite('SnippetsSync', () => {
const { content } = await testClient.read(testObject.resource);
assert.ok(content !== null);
const actual = parseSnippets(content!);
const actual = parseSnippets(content);
assert.deepStrictEqual(actual, { 'typescript.json': tsSnippet1, 'global.code-snippets': globalSnippet });
});
@@ -86,8 +86,8 @@ suite('TasksSync', () => {
assert.deepStrictEqual(testObject.status, SyncStatus.Idle);
const lastSyncUserData = await testObject.getLastSyncUserData();
const remoteUserData = await testObject.getRemoteUserData(null);
assert.strictEqual(getTasksContentFromSyncContent(lastSyncUserData!.syncData!.content!, client.instantiationService.get(ILogService)), content);
assert.strictEqual(getTasksContentFromSyncContent(remoteUserData!.syncData!.content!, client.instantiationService.get(ILogService)), content);
assert.strictEqual(getTasksContentFromSyncContent(lastSyncUserData!.syncData!.content, client.instantiationService.get(ILogService)), content);
assert.strictEqual(getTasksContentFromSyncContent(remoteUserData.syncData!.content, client.instantiationService.get(ILogService)), content);
assert.strictEqual((await fileService.readFile(tasksResource)).value.toString(), content);
});
@@ -109,8 +109,8 @@ suite('TasksSync', () => {
assert.deepStrictEqual(testObject.status, SyncStatus.Idle);
const lastSyncUserData = await testObject.getLastSyncUserData();
const remoteUserData = await testObject.getRemoteUserData(null);
assert.strictEqual(getTasksContentFromSyncContent(lastSyncUserData!.syncData!.content!, client.instantiationService.get(ILogService)), content);
assert.strictEqual(getTasksContentFromSyncContent(remoteUserData!.syncData!.content!, client.instantiationService.get(ILogService)), content);
assert.strictEqual(getTasksContentFromSyncContent(lastSyncUserData!.syncData!.content, client.instantiationService.get(ILogService)), content);
assert.strictEqual(getTasksContentFromSyncContent(remoteUserData.syncData!.content, client.instantiationService.get(ILogService)), content);
});
test('first time sync: when tasks file exists locally with same content as remote', async () => {
@@ -137,8 +137,8 @@ suite('TasksSync', () => {
assert.deepStrictEqual(testObject.status, SyncStatus.Idle);
const lastSyncUserData = await testObject.getLastSyncUserData();
const remoteUserData = await testObject.getRemoteUserData(null);
assert.strictEqual(getTasksContentFromSyncContent(lastSyncUserData!.syncData!.content!, client.instantiationService.get(ILogService)), content);
assert.strictEqual(getTasksContentFromSyncContent(remoteUserData!.syncData!.content!, client.instantiationService.get(ILogService)), content);
assert.strictEqual(getTasksContentFromSyncContent(lastSyncUserData!.syncData!.content, client.instantiationService.get(ILogService)), content);
assert.strictEqual(getTasksContentFromSyncContent(remoteUserData.syncData!.content, client.instantiationService.get(ILogService)), content);
assert.strictEqual((await fileService.readFile(tasksResource)).value.toString(), content);
});
@@ -167,8 +167,8 @@ suite('TasksSync', () => {
assert.deepStrictEqual(testObject.status, SyncStatus.Idle);
const lastSyncUserData = await testObject.getLastSyncUserData();
const remoteUserData = await testObject.getRemoteUserData(null);
assert.strictEqual(getTasksContentFromSyncContent(lastSyncUserData!.syncData!.content!, client.instantiationService.get(ILogService)), content);
assert.strictEqual(getTasksContentFromSyncContent(remoteUserData!.syncData!.content!, client.instantiationService.get(ILogService)), content);
assert.strictEqual(getTasksContentFromSyncContent(lastSyncUserData!.syncData!.content, client.instantiationService.get(ILogService)), content);
assert.strictEqual(getTasksContentFromSyncContent(remoteUserData.syncData!.content, client.instantiationService.get(ILogService)), content);
});
test('when tasks file remotely has moved forward', async () => {
@@ -203,8 +203,8 @@ suite('TasksSync', () => {
assert.deepStrictEqual(testObject.status, SyncStatus.Idle);
const lastSyncUserData = await testObject.getLastSyncUserData();
const remoteUserData = await testObject.getRemoteUserData(null);
assert.strictEqual(getTasksContentFromSyncContent(lastSyncUserData!.syncData!.content!, client.instantiationService.get(ILogService)), content);
assert.strictEqual(getTasksContentFromSyncContent(remoteUserData!.syncData!.content!, client.instantiationService.get(ILogService)), content);
assert.strictEqual(getTasksContentFromSyncContent(lastSyncUserData!.syncData!.content, client.instantiationService.get(ILogService)), content);
assert.strictEqual(getTasksContentFromSyncContent(remoteUserData.syncData!.content, client.instantiationService.get(ILogService)), content);
assert.strictEqual((await fileService.readFile(tasksResource)).value.toString(), content);
});
@@ -241,8 +241,8 @@ suite('TasksSync', () => {
assert.deepStrictEqual(testObject.status, SyncStatus.Idle);
const lastSyncUserData = await testObject.getLastSyncUserData();
const remoteUserData = await testObject.getRemoteUserData(null);
assert.strictEqual(getTasksContentFromSyncContent(lastSyncUserData!.syncData!.content!, client.instantiationService.get(ILogService)), content);
assert.strictEqual(getTasksContentFromSyncContent(remoteUserData!.syncData!.content!, client.instantiationService.get(ILogService)), content);
assert.strictEqual(getTasksContentFromSyncContent(lastSyncUserData!.syncData!.content, client.instantiationService.get(ILogService)), content);
assert.strictEqual(getTasksContentFromSyncContent(remoteUserData.syncData!.content, client.instantiationService.get(ILogService)), content);
assert.strictEqual((await fileService.readFile(tasksResource)).value.toString(), content);
});
@@ -294,8 +294,8 @@ suite('TasksSync', () => {
assert.deepStrictEqual(testObject.status, SyncStatus.Idle);
const lastSyncUserData = await testObject.getLastSyncUserData();
const remoteUserData = await testObject.getRemoteUserData(null);
assert.strictEqual(getTasksContentFromSyncContent(lastSyncUserData!.syncData!.content!, client.instantiationService.get(ILogService)), previewContent);
assert.strictEqual(getTasksContentFromSyncContent(remoteUserData!.syncData!.content!, client.instantiationService.get(ILogService)), previewContent);
assert.strictEqual(getTasksContentFromSyncContent(lastSyncUserData!.syncData!.content, client.instantiationService.get(ILogService)), previewContent);
assert.strictEqual(getTasksContentFromSyncContent(remoteUserData.syncData!.content, client.instantiationService.get(ILogService)), previewContent);
assert.strictEqual((await fileService.readFile(tasksResource)).value.toString(), previewContent);
});
@@ -347,8 +347,8 @@ suite('TasksSync', () => {
assert.deepStrictEqual(testObject.status, SyncStatus.Idle);
const lastSyncUserData = await testObject.getLastSyncUserData();
const remoteUserData = await testObject.getRemoteUserData(null);
assert.strictEqual(getTasksContentFromSyncContent(lastSyncUserData!.syncData!.content!, client.instantiationService.get(ILogService)), content);
assert.strictEqual(getTasksContentFromSyncContent(remoteUserData!.syncData!.content!, client.instantiationService.get(ILogService)), content);
assert.strictEqual(getTasksContentFromSyncContent(lastSyncUserData!.syncData!.content, client.instantiationService.get(ILogService)), content);
assert.strictEqual(getTasksContentFromSyncContent(remoteUserData.syncData!.content, client.instantiationService.get(ILogService)), content);
assert.strictEqual((await fileService.readFile(tasksResource)).value.toString(), content);
});
@@ -394,8 +394,8 @@ suite('TasksSync', () => {
assert.deepStrictEqual(testObject.status, SyncStatus.Idle);
const lastSyncUserData = await testObject.getLastSyncUserData();
const remoteUserData = await testObject.getRemoteUserData(null);
assert.strictEqual(getTasksContentFromSyncContent(lastSyncUserData!.syncData!.content!, client.instantiationService.get(ILogService)), content);
assert.strictEqual(getTasksContentFromSyncContent(remoteUserData!.syncData!.content!, client.instantiationService.get(ILogService)), content);
assert.strictEqual(getTasksContentFromSyncContent(lastSyncUserData!.syncData!.content, client.instantiationService.get(ILogService)), content);
assert.strictEqual(getTasksContentFromSyncContent(remoteUserData.syncData!.content, client.instantiationService.get(ILogService)), content);
assert.strictEqual((await fileService.readFile(tasksResource)).value.toString(), content);
});
@@ -441,8 +441,8 @@ suite('TasksSync', () => {
assert.deepStrictEqual(testObject.status, SyncStatus.Idle);
const lastSyncUserData = await testObject.getLastSyncUserData();
const remoteUserData = await testObject.getRemoteUserData(null);
assert.strictEqual(getTasksContentFromSyncContent(lastSyncUserData!.syncData!.content!, client.instantiationService.get(ILogService)), content);
assert.strictEqual(getTasksContentFromSyncContent(remoteUserData!.syncData!.content!, client.instantiationService.get(ILogService)), content);
assert.strictEqual(getTasksContentFromSyncContent(lastSyncUserData!.syncData!.content, client.instantiationService.get(ILogService)), content);
assert.strictEqual(getTasksContentFromSyncContent(remoteUserData.syncData!.content, client.instantiationService.get(ILogService)), content);
assert.strictEqual((await fileService.readFile(tasksResource)).value.toString(), content);
});
@@ -469,8 +469,8 @@ suite('TasksSync', () => {
assert.deepStrictEqual(testObject.status, SyncStatus.Idle);
const lastSyncUserData = await testObject.getLastSyncUserData();
const remoteUserData = await testObject.getRemoteUserData(null);
assert.strictEqual(getTasksContentFromSyncContent(lastSyncUserData!.syncData!.content!, client.instantiationService.get(ILogService)), null);
assert.strictEqual(getTasksContentFromSyncContent(remoteUserData!.syncData!.content!, client.instantiationService.get(ILogService)), null);
assert.strictEqual(getTasksContentFromSyncContent(lastSyncUserData!.syncData!.content, client.instantiationService.get(ILogService)), null);
assert.strictEqual(getTasksContentFromSyncContent(remoteUserData.syncData!.content, client.instantiationService.get(ILogService)), null);
assert.strictEqual(await fileService.exists(tasksResource), false);
});
@@ -502,7 +502,7 @@ suite('TasksSync', () => {
const remoteUserData = await testObject.getRemoteUserData(null);
assert.deepStrictEqual(lastSyncUserData!.ref, remoteUserData.ref);
assert.deepStrictEqual(lastSyncUserData!.syncData, remoteUserData.syncData);
assert.strictEqual(getTasksContentFromSyncContent(lastSyncUserData!.syncData!.content!, client.instantiationService.get(ILogService)), content);
assert.strictEqual(getTasksContentFromSyncContent(lastSyncUserData!.syncData!.content, client.instantiationService.get(ILogService)), content);
});
test('apply remote when tasks file does not exist', async () => {
@@ -119,7 +119,7 @@ suite('UserDataProfilesManifestSync', () => {
const { content } = await testClient.read(testObject.resource);
assert.ok(content !== null);
const actual = parseRemoteProfiles(content!);
const actual = parseRemoteProfiles(content);
assert.deepStrictEqual(actual, [{ id: '1', name: 'name 1', collection: '1' }, { id: '2', name: 'name 2', collection: '2' }]);
});
@@ -138,7 +138,7 @@ suite('UserDataProfilesManifestSync', () => {
const { content } = await testClient.read(testObject.resource);
assert.ok(content !== null);
const actual = parseRemoteProfiles(content!);
const actual = parseRemoteProfiles(content);
assert.deepStrictEqual(actual, [{ id: '1', name: 'name 1', collection: '1' }]);
});
@@ -158,7 +158,7 @@ suite('UserDataProfilesManifestSync', () => {
const { content } = await testClient.read(testObject.resource);
assert.ok(content !== null);
const actual = parseRemoteProfiles(content!);
const actual = parseRemoteProfiles(content);
assert.deepStrictEqual(actual, [{ id: '1', name: 'name 1', collection: '1', shortName: 'short 1' }, { id: '2', name: 'name 2', collection: '2' }]);
});
@@ -178,7 +178,7 @@ suite('UserDataProfilesManifestSync', () => {
const { content } = await testClient.read(testObject.resource);
assert.ok(content !== null);
const actual = parseRemoteProfiles(content!);
const actual = parseRemoteProfiles(content);
assert.deepStrictEqual(actual, [{ id: '1', name: 'name 2', collection: '1', shortName: '2' }]);
});
@@ -199,7 +199,7 @@ suite('UserDataProfilesManifestSync', () => {
const { content } = await testClient.read(testObject.resource);
assert.ok(content !== null);
const actual = parseRemoteProfiles(content!);
const actual = parseRemoteProfiles(content);
assert.deepStrictEqual(actual, [{ id: '2', name: 'name 2', collection: '2' }]);
});
@@ -213,7 +213,7 @@ suite('UserDataProfilesManifestSync', () => {
const { content } = await testClient.read(testObject.resource);
assert.ok(content !== null);
const actual = parseRemoteProfiles(content!);
const actual = parseRemoteProfiles(content);
assert.deepStrictEqual(actual, [{ id: '1', name: 'name 1', collection: '1', useDefaultFlags: { keybindings: true } }]);
assert.deepStrictEqual(getLocalProfiles(testClient), [{ id: '1', name: 'name 1', shortName: undefined, useDefaultFlags: { keybindings: true } }]);
@@ -234,7 +234,7 @@ suite('UserDataProfilesManifestSync', () => {
const { content } = await testClient.read(testObject.resource);
assert.ok(content !== null);
const actual = parseRemoteProfiles(content!);
const actual = parseRemoteProfiles(content);
assert.deepStrictEqual(actual, [{ id: '1', name: 'name 1', collection: '1', useDefaultFlags: { keybindings: true } }]);
assert.deepStrictEqual(getLocalProfiles(testClient), [{ id: '1', name: 'name 1', shortName: undefined, useDefaultFlags: { keybindings: true } }]);
});
@@ -254,7 +254,7 @@ suite('UserDataProfilesManifestSync', () => {
const { content } = await testClient.read(testObject.resource);
assert.ok(content !== null);
const actual = parseRemoteProfiles(content!);
const actual = parseRemoteProfiles(content);
assert.deepStrictEqual(actual, [{ id: '1', name: 'name 1', collection: '1', useDefaultFlags: { keybindings: true } }]);
assert.deepStrictEqual(getLocalProfiles(testClient), [{ id: '1', name: 'name 1', shortName: undefined, useDefaultFlags: { keybindings: true } }]);
@@ -1546,7 +1546,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
if (window.isReady) {
this.lifecycleMainService.unload(window, UnloadReason.LOAD).then(async veto => {
if (!veto) {
await this.doOpenInBrowserWindow(window!, configuration, options, defaultProfile);
await this.doOpenInBrowserWindow(window, configuration, options, defaultProfile);
}
});
} else {
@@ -289,7 +289,7 @@ export class ExtensionHostConnection {
if (extHostNamedPipeServer) {
extHostNamedPipeServer.on('connection', (socket) => {
extHostNamedPipeServer!.close();
extHostNamedPipeServer.close();
this._pipeSockets(socket, this._connectionData!);
});
} else {
@@ -155,7 +155,7 @@ export class MainThreadAuthentication extends Disposable implements MainThreadAu
// modal flows
if (options.createIfNone || options.forceNewSession) {
const providerName = this.authenticationService.getLabel(providerId);
const detail = (typeof options.forceNewSession === 'object') ? options.forceNewSession!.detail : undefined;
const detail = (typeof options.forceNewSession === 'object') ? options.forceNewSession.detail : undefined;
// We only want to show the "recreating session" prompt if we are using forceNewSession & there are sessions
// that we will be "forcing through".
@@ -92,7 +92,7 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb
const dto: IThreadFocusDto = {
kind: 'thread',
threadId: thread?.threadId,
sessionId: session!.getId(),
sessionId: session.getId(),
};
this._proxy.$acceptStackFrameFocus(dto);
}
@@ -52,7 +52,7 @@ export class MainThreadDialogs implements MainThreadDiaglogsShape {
if (options?.filters) {
result.filters = [];
for (const [key, value] of Object.entries(options.filters)) {
result.filters!.push({ name: key, extensions: value });
result.filters.push({ name: key, extensions: value });
}
}
return result;
@@ -171,7 +171,7 @@ export class MainThreadExtensionService implements MainThreadExtensionServiceSha
message: localize('uninstalledDep', "Cannot activate the '{0}' extension because it depends on the '{1}' extension from '{2}', which is not installed. Would you like to install the extension and reload the window?", extName, dependencyExtension.displayName, dependencyExtension.publisherDisplayName),
actions: {
primary: [new Action('install', localize('install missing dep', "Install and Reload"), '', true,
() => this._extensionsWorkbenchService.install(dependencyExtension!)
() => this._extensionsWorkbenchService.install(dependencyExtension)
.then(() => this._hostService.reload(), e => this._notificationService.error(e)))]
}
});
@@ -253,7 +253,7 @@ class MainThreadSCMProvider implements ISCMProvider, QuickDiffProvider {
this._onDidChange.fire();
if (typeof features.commitTemplate !== 'undefined') {
this._onDidChangeCommitTemplate.fire(this.commitTemplate!);
this._onDidChangeCommitTemplate.fire(this.commitTemplate);
}
if (typeof features.statusBarCommands !== 'undefined') {
@@ -445,9 +445,9 @@ export class MainThreadTask implements MainThreadTaskShape {
resolvedDefinition = await this._configurationResolverService.resolveAnyAsync(task.getWorkspaceFolder(),
execution.task.definition, dictionary);
}
this._proxy.$onDidStartTask(execution, event.terminalId!, resolvedDefinition);
this._proxy.$onDidStartTask(execution, event.terminalId, resolvedDefinition);
} else if (event.kind === TaskEventKind.ProcessStarted) {
this._proxy.$onDidStartTaskProcess(TaskProcessStartedDTO.from(task.getTaskExecution(), event.processId!));
this._proxy.$onDidStartTaskProcess(TaskProcessStartedDTO.from(task.getTaskExecution(), event.processId));
} else if (event.kind === TaskEventKind.ProcessEnded) {
this._proxy.$onDidEndTaskProcess(TaskProcessEndedDTO.from(task.getTaskExecution(), event.exitCode));
} else if (event.kind === TaskEventKind.End) {
@@ -59,7 +59,7 @@ export class MainThreadTimeline implements MainThreadTimelineShape {
$emitTimelineChangeEvent(e: TimelineChangeEvent): void {
this.logService.trace(`MainThreadTimeline#emitChangeEvent: id=${e.id}, uri=${e.uri?.toString(true)}`);
const emitter = this._providerEmitters.get(e.id!);
const emitter = this._providerEmitters.get(e.id);
emitter?.fire(e);
}
@@ -1071,7 +1071,7 @@ class CompletionsAdapter {
const dto1 = this._convertCompletionItem(item, id);
const resolvedItem = await this._provider.resolveCompletionItem!(item, token);
const resolvedItem = await this._provider.resolveCompletionItem(item, token);
if (!resolvedItem) {
return undefined;
@@ -1426,7 +1426,7 @@ class InlayHintsAdapter {
if (!item) {
return undefined;
}
const hint = await this._provider.resolveInlayHint!(item, token);
const hint = await this._provider.resolveInlayHint(item, token);
if (!hint) {
return undefined;
}
@@ -1560,7 +1560,7 @@ class LinkProviderAdapter {
if (!item) {
return undefined;
}
const link = await this._provider.resolveDocumentLink!(item, token);
const link = await this._provider.resolveDocumentLink(item, token);
if (!link || !LinkProviderAdapter._validateLink(link)) {
return undefined;
}
@@ -934,7 +934,7 @@ export abstract class BaseExtHostTerminalService extends Disposable implements I
// following calls to createTerminal will be created with the new environment. It will
// result in more noise by sending multiple updates when called but collections are
// expected to be small.
this._syncEnvironmentVariableCollection(extensionIdentifier, collection!);
this._syncEnvironmentVariableCollection(extensionIdentifier, collection);
});
}
}
+2 -2
View File
@@ -102,7 +102,7 @@ export class Position {
let result = positions[0];
for (let i = 1; i < positions.length; i++) {
const p = positions[i];
if (p.isBefore(result!)) {
if (p.isBefore(result)) {
result = p;
}
}
@@ -116,7 +116,7 @@ export class Position {
let result = positions[0];
for (let i = 1; i < positions.length; i++) {
const p = positions[i];
if (p.isAfter(result!)) {
if (p.isAfter(result)) {
result = p;
}
}
@@ -142,7 +142,7 @@ export class ExtHostDebugService extends ExtHostDebugServiceBase {
// Mark terminal as unused when its session ends, see #112055
const sessionListener = this.onDidTerminateDebugSession(s => {
if (s.id === sessionId) {
this._integratedTerminalInstances.free(terminal!);
this._integratedTerminalInstances.free(terminal);
sessionListener.dispose();
}
});
@@ -1070,8 +1070,8 @@ suite('ExtHostLanguageFeatureCommands', function () {
assert.strictEqual(value.length, 1);
const [first] = value;
assert.ok(first.command);
assert.strictEqual(first.command!.command, 'command');
assert.strictEqual(first.command!.title, 'command_title');
assert.strictEqual(first.command.command, 'command');
assert.strictEqual(first.command.title, 'command_title');
assert.strictEqual(first.kind!.value, 'foo');
assert.strictEqual(first.title, 'title');
@@ -1101,8 +1101,8 @@ suite('ExtHostLanguageFeatureCommands', function () {
assert.strictEqual(value.length, 1);
const [first] = value;
assert.ok(first.command);
assert.ok(first.command!.arguments![1] instanceof types.Selection);
assert.ok(first.command!.arguments![1].isEqual(selection));
assert.ok(first.command.arguments![1] instanceof types.Selection);
assert.ok(first.command.arguments![1].isEqual(selection));
});
});
});
@@ -1394,7 +1394,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
assert.strictEqual(first.position.line, 0);
assert.strictEqual(first.position.character, 1);
assert.strictEqual(first.textEdits?.length, 1);
assert.strictEqual(first.textEdits![0].newText, 'Hello');
assert.strictEqual(first.textEdits[0].newText, 'Hello');
assert.strictEqual(second.position.line, 10);
assert.strictEqual(second.position.character, 11);
@@ -803,7 +803,7 @@ suite('ExtHost Testing', () => {
contextValue: undefined,
expected: undefined,
actual: undefined,
location: convert.location.from({ uri: test2.uri!, range: test2.range! }),
location: convert.location.from({ uri: test2.uri!, range: test2.range }),
}]
]);
@@ -357,7 +357,7 @@ suite('ExtHostTypes', function () {
assert.strictEqual(edit.newText, '');
assertToJSON(edit, { range: [{ line: 1, character: 1 }, { line: 2, character: 11 }], newText: '' });
edit = new types.TextEdit(range, null!);
edit = new types.TextEdit(range, null);
assert.strictEqual(edit.newText, '');
edit = new types.TextEdit(range, '');
@@ -644,7 +644,7 @@ suite('ExtHostWorkspace', function () {
});
const ws = createExtHostWorkspace(rpcProtocol, { id: 'foo', folders: [aWorkspaceFolderData(URI.file(root), 0)], name: 'Test' }, new NullLogService());
return ws.findFiles(new RelativePattern('/other/folder', 'glob/**'), null!, 10, new ExtensionIdentifier('test')).then(() => {
return ws.findFiles(new RelativePattern('/other/folder', 'glob/**'), null, 10, new ExtensionIdentifier('test')).then(() => {
assert(mainThreadCalled, 'mainThreadCalled');
});
});
@@ -664,7 +664,7 @@ suite('ExtHostWorkspace', function () {
const ws = createExtHostWorkspace(rpcProtocol, { id: 'foo', folders: [aWorkspaceFolderData(URI.file(root), 0)], name: 'Test' }, new NullLogService());
const token = CancellationToken.Cancelled;
return ws.findFiles(new RelativePattern('/other/folder', 'glob/**'), null!, 10, new ExtensionIdentifier('test'), token).then(() => {
return ws.findFiles(new RelativePattern('/other/folder', 'glob/**'), null, 10, new ExtensionIdentifier('test'), token).then(() => {
assert(!mainThreadCalled, '!mainThreadCalled');
});
});
@@ -1110,13 +1110,13 @@ class MoveFocusedViewAction extends Action2 {
const destination = quickPick.selectedItems[0];
if (destination.id === '_.panel.newcontainer') {
viewDescriptorService.moveViewToLocation(viewDescriptor!, ViewContainerLocation.Panel, this.desc.id);
viewDescriptorService.moveViewToLocation(viewDescriptor, ViewContainerLocation.Panel, this.desc.id);
viewsService.openView(focusedViewId, true);
} else if (destination.id === '_.sidebar.newcontainer') {
viewDescriptorService.moveViewToLocation(viewDescriptor!, ViewContainerLocation.Sidebar, this.desc.id);
viewDescriptorService.moveViewToLocation(viewDescriptor, ViewContainerLocation.Sidebar, this.desc.id);
viewsService.openView(focusedViewId, true);
} else if (destination.id === '_.auxiliarybar.newcontainer') {
viewDescriptorService.moveViewToLocation(viewDescriptor!, ViewContainerLocation.AuxiliaryBar, this.desc.id);
viewDescriptorService.moveViewToLocation(viewDescriptor, ViewContainerLocation.AuxiliaryBar, this.desc.id);
viewsService.openView(focusedViewId, true);
} else if (destination.id) {
viewDescriptorService.moveViewsToContainer([viewDescriptor], viewDescriptorService.getViewContainerById(destination.id)!, undefined, this.desc.id);
+11 -11
View File
@@ -479,14 +479,14 @@ export class CompositeDragAndDropObserver extends Disposable {
if (callbacks.onDragEnter) {
const data = this.readDragData('composite') || this.readDragData('view');
if (data) {
callbacks.onDragEnter({ eventData: e, dragAndDropData: data! });
callbacks.onDragEnter({ eventData: e, dragAndDropData: data });
}
}
},
onDragLeave: e => {
const data = this.readDragData('composite') || this.readDragData('view');
if (callbacks.onDragLeave && data) {
callbacks.onDragLeave({ eventData: e, dragAndDropData: data! });
callbacks.onDragLeave({ eventData: e, dragAndDropData: data });
}
},
onDrop: e => {
@@ -496,10 +496,10 @@ export class CompositeDragAndDropObserver extends Disposable {
return;
}
callbacks.onDrop({ eventData: e, dragAndDropData: data! });
callbacks.onDrop({ eventData: e, dragAndDropData: data });
// Fire drag event in case drop handler destroys the dragged element
this.onDragEnd.fire({ eventData: e, dragAndDropData: data! });
this.onDragEnd.fire({ eventData: e, dragAndDropData: data });
}
},
onDragOver: e => {
@@ -511,7 +511,7 @@ export class CompositeDragAndDropObserver extends Disposable {
return;
}
callbacks.onDragOver({ eventData: e, dragAndDropData: data! });
callbacks.onDragOver({ eventData: e, dragAndDropData: data });
}
}
}));
@@ -552,7 +552,7 @@ export class CompositeDragAndDropObserver extends Disposable {
return;
}
this.onDragEnd.fire({ eventData: e, dragAndDropData: data! });
this.onDragEnd.fire({ eventData: e, dragAndDropData: data });
},
onDragEnter: e => {
if (callbacks.onDragEnter) {
@@ -562,7 +562,7 @@ export class CompositeDragAndDropObserver extends Disposable {
}
if (data) {
callbacks.onDragEnter({ eventData: e, dragAndDropData: data! });
callbacks.onDragEnter({ eventData: e, dragAndDropData: data });
}
}
},
@@ -572,7 +572,7 @@ export class CompositeDragAndDropObserver extends Disposable {
return;
}
callbacks.onDragLeave?.({ eventData: e, dragAndDropData: data! });
callbacks.onDragLeave?.({ eventData: e, dragAndDropData: data });
},
onDrop: e => {
if (callbacks.onDrop) {
@@ -581,10 +581,10 @@ export class CompositeDragAndDropObserver extends Disposable {
return;
}
callbacks.onDrop({ eventData: e, dragAndDropData: data! });
callbacks.onDrop({ eventData: e, dragAndDropData: data });
// Fire drag event in case drop handler destroys the dragged element
this.onDragEnd.fire({ eventData: e, dragAndDropData: data! });
this.onDragEnd.fire({ eventData: e, dragAndDropData: data });
}
},
onDragOver: e => {
@@ -594,7 +594,7 @@ export class CompositeDragAndDropObserver extends Disposable {
return;
}
callbacks.onDragOver({ eventData: e, dragAndDropData: data! });
callbacks.onDragOver({ eventData: e, dragAndDropData: data });
}
}
}));
@@ -421,7 +421,7 @@ export class CompoisteBarActionViewItem extends BaseActionViewItem {
return;
}
const hoverPosition = this.options.hoverOptions!.position();
const hoverPosition = this.options.hoverOptions.position();
this.lastHover = this.hoverService.showHover({
target: this.container,
content: this.computeTitle(),
@@ -1110,12 +1110,12 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupsView {
if (!horizontalOpenerTimeout && openHorizontalPosition !== undefined) {
lastOpenHorizontalPosition = openHorizontalPosition;
horizontalOpenerTimeout = setTimeout(() => openPartAtPosition(openHorizontalPosition!), 200);
horizontalOpenerTimeout = setTimeout(() => openPartAtPosition(openHorizontalPosition), 200);
}
if (!verticalOpenerTimeout && openVerticalPosition !== undefined) {
lastOpenVerticalPosition = openVerticalPosition;
verticalOpenerTimeout = setTimeout(() => openPartAtPosition(openVerticalPosition!), 200);
verticalOpenerTimeout = setTimeout(() => openPartAtPosition(openVerticalPosition), 200);
}
},
onDragLeave: () => clearAllTimeouts(),
@@ -115,7 +115,7 @@ export class SidebarPart extends AbstractPaneCompositePart {
this.updateTitleArea();
const id = this.getActiveComposite()?.getId();
if (id) {
this.onTitleAreaUpdate(id!);
this.onTitleAreaUpdate(id);
}
this.updateActivityBarVisiblity();
this.rememberActivityBarVisiblePosition();
@@ -166,8 +166,8 @@ export class FilterWidget extends Widget {
if (this.options.text) {
inputBox.value = this.options.text;
}
this._register(inputBox.onDidChange(filter => this.delayedFilterUpdate.trigger(() => this.onDidInputChange(inputBox!))));
this._register(DOM.addStandardDisposableListener(inputBox.inputElement, DOM.EventType.KEY_DOWN, (e: any) => this.onInputKeyDown(e, inputBox!)));
this._register(inputBox.onDidChange(filter => this.delayedFilterUpdate.trigger(() => this.onDidInputChange(inputBox))));
this._register(DOM.addStandardDisposableListener(inputBox.inputElement, DOM.EventType.KEY_DOWN, (e: any) => this.onInputKeyDown(e, inputBox)));
this._register(DOM.addStandardDisposableListener(container, DOM.EventType.KEY_DOWN, this.handleKeyboardEvent));
this._register(DOM.addStandardDisposableListener(container, DOM.EventType.KEY_UP, this.handleKeyboardEvent));
this._register(DOM.addStandardDisposableListener(inputBox.inputElement, DOM.EventType.CLICK, (e) => {
@@ -268,7 +268,7 @@ export class AccessibleView extends Disposable {
getAnchor: () => { return { x: (getActiveWindow().innerWidth / 2) - ((Math.min(this._layoutService.activeContainerDimension.width * 0.62 /* golden cut */, DIMENSIONS.MAX_WIDTH)) / 2), y: this._layoutService.activeContainerOffset.quickPickTop }; },
render: (container) => {
container.classList.add('accessible-view-container');
return this._render(provider!, container, showAccessibleViewHelp);
return this._render(provider, container, showAccessibleViewHelp);
},
onHide: () => {
if (!showAccessibleViewHelp) {
@@ -512,7 +512,7 @@ export class AccessibleView extends Disposable {
if (e.keyCode === KeyCode.Escape || shouldHide(e.browserEvent, this._keybindingService, this._configurationService)) {
hide(e);
} else if (e.keyCode === KeyCode.KeyH && provider.options.readMoreUrl) {
const url: string = provider.options.readMoreUrl!;
const url: string = provider.options.readMoreUrl;
alert(AccessibilityHelpNLS.openingDocs);
this._openerService.open(URI.parse(url));
e.preventDefault();
@@ -191,7 +191,7 @@ class ChatAccessibleViewContribution extends Disposable {
accessibleViewService.show({
id: AccessibleViewProviderId.Chat,
verbositySettingKey: AccessibilityVerbositySettingId.Chat,
provideContent(): string { return responseContent!; },
provideContent(): string { return responseContent; },
onClose() {
verifiedWidget.reveal(focusedItem);
if (chatInputFocused) {
@@ -107,8 +107,8 @@ export class ChatEditor extends EditorPane {
if (this._memento && this._viewState) {
const widgetViewState = this.widget.getViewState();
this._viewState!.inputValue = widgetViewState.inputValue;
this._memento!.saveMemento();
this._viewState.inputValue = widgetViewState.inputValue;
this._memento.saveMemento();
}
}
@@ -157,7 +157,7 @@ export class ChatWidget extends Disposable implements IChatWidget {
}
get inputEditor(): ICodeEditor {
return this.inputPart.inputEditor!;
return this.inputPart.inputEditor;
}
get inputUri(): URI {
@@ -683,22 +683,22 @@ export class ChatWidget extends Disposable implements IChatWidget {
}
const width = this.bodyDimension?.width ?? this.container.offsetWidth;
const inputHeight = this.inputPart.layout(this._dynamicMessageLayoutData!.maxHeight, width);
const inputHeight = this.inputPart.layout(this._dynamicMessageLayoutData.maxHeight, width);
const totalMessages = this.viewModel.getItems();
// grab the last N messages
const messages = totalMessages.slice(-this._dynamicMessageLayoutData!.numOfMessages);
const messages = totalMessages.slice(-this._dynamicMessageLayoutData.numOfMessages);
const needsRerender = messages.some(m => m.currentRenderedHeight === undefined);
const listHeight = needsRerender
? this._dynamicMessageLayoutData!.maxHeight
? this._dynamicMessageLayoutData.maxHeight
: messages.reduce((acc, message) => acc + message.currentRenderedHeight!, 0);
this.layout(
Math.min(
// we add an additional 18px in order to show that there is scrollable content
inputHeight + listHeight + (totalMessages.length > 2 ? 18 : 0),
this._dynamicMessageLayoutData!.maxHeight
this._dynamicMessageLayoutData.maxHeight
),
width
);
@@ -401,11 +401,11 @@ export class ChatResponseViewModel extends Disposable implements IChatResponseVi
// This should be true, if the model is changing
const now = Date.now();
const wordCount = countWords(_model.response.asString());
const timeDiff = now - this._contentUpdateTimings!.loadingStartTime;
const timeDiff = now - this._contentUpdateTimings.loadingStartTime;
const impliedWordLoadRate = this._contentUpdateTimings.lastWordCount / (timeDiff / 1000);
this.trace('onDidChange', `Update- got ${this._contentUpdateTimings.lastWordCount} words over ${timeDiff}ms = ${impliedWordLoadRate} words/s. ${wordCount} words are now available.`);
this._contentUpdateTimings = {
loadingStartTime: this._contentUpdateTimings!.loadingStartTime,
loadingStartTime: this._contentUpdateTimings.loadingStartTime,
lastUpdateTime: now,
impliedWordLoadRate,
lastWordCount: wordCount
@@ -123,20 +123,20 @@ suite('Chat', () => {
const session1 = testDisposables.add(testService.startSession('provider1', CancellationToken.None));
await session1.waitForInitialization();
session1!.addRequest({ parts: [], text: 'request 1' }, { message: 'request 1', variables: {} });
session1.addRequest({ parts: [], text: 'request 1' }, { message: 'request 1', variables: {} });
const session2 = testDisposables.add(testService.startSession('provider2', CancellationToken.None));
await session2.waitForInitialization();
session2!.addRequest({ parts: [], text: 'request 2' }, { message: 'request 2', variables: {} });
session2.addRequest({ parts: [], text: 'request 2' }, { message: 'request 2', variables: {} });
storageService.flush();
const testService2 = testDisposables.add(instantiationService.createInstance(ChatService));
testDisposables.add(testService2.registerProvider(provider1));
testDisposables.add(testService2.registerProvider(provider2));
const retrieved1 = testDisposables.add(testService2.getOrRestoreSession(session1.sessionId)!);
await retrieved1!.waitForInitialization();
await retrieved1.waitForInitialization();
const retrieved2 = testDisposables.add(testService2.getOrRestoreSession(session2.sessionId)!);
await retrieved2!.waitForInitialization();
await retrieved2.waitForInitialization();
assert.deepStrictEqual(retrieved1.getRequests()[0]?.message.text, 'request 1');
assert.deepStrictEqual(retrieved2.getRequests()[0]?.message.text, 'request 2');
});
@@ -433,7 +433,7 @@ class DocumentSymbolsOutlineCreator implements IOutlineCreator<IEditorPane, Docu
return undefined;
}
const firstLoadBarrier = new Barrier();
const result = editor.invokeWithinContext(accessor => accessor.get(IInstantiationService).createInstance(DocumentSymbolsOutline, editor!, target, firstLoadBarrier));
const result = editor.invokeWithinContext(accessor => accessor.get(IInstantiationService).createInstance(DocumentSymbolsOutline, editor, target, firstLoadBarrier));
await firstLoadBarrier.wait();
return result;
}
@@ -261,7 +261,7 @@ export class CommentThreadBody<T extends IRange | ICellRange = IRange> extends D
this._parentEditor,
this._commentThread,
comment,
this._pendingEdits ? this._pendingEdits[comment.uniqueIdInThread!] : undefined,
this._pendingEdits ? this._pendingEdits[comment.uniqueIdInThread] : undefined,
this.owner,
this.parentResourceUri,
this._parentCommentThreadWidget,
@@ -875,9 +875,9 @@ export class CommentController implements IEditorContribution {
continueOnCommentText = this._inProcessContinueOnComments.get(e.owner)?.splice(continueOnCommentIndex, 1)[0].body;
}
const pendingCommentText = (this._pendingNewCommentCache[e.owner] && this._pendingNewCommentCache[e.owner][thread.threadId!])
const pendingCommentText = (this._pendingNewCommentCache[e.owner] && this._pendingNewCommentCache[e.owner][thread.threadId])
?? continueOnCommentText;
const pendingEdits = this._pendingEditsCache[e.owner] && this._pendingEditsCache[e.owner][thread.threadId!];
const pendingEdits = this._pendingEditsCache[e.owner] && this._pendingEditsCache[e.owner][thread.threadId];
this.displayCommentThread(e.owner, thread, pendingCommentText, pendingEdits);
this._commentInfos.filter(info => info.owner === e.owner)[0].threads.push(thread);
this.tryUpdateReservedSpace();
@@ -1234,12 +1234,12 @@ export class CommentController implements IEditorContribution {
info.threads.forEach(thread => {
let pendingComment: string | undefined = undefined;
if (providerCacheStore) {
pendingComment = providerCacheStore[thread.threadId!];
pendingComment = providerCacheStore[thread.threadId];
}
let pendingEdits: { [key: number]: string } | undefined = undefined;
if (providerEditsCacheStore) {
pendingEdits = providerEditsCacheStore[thread.threadId!];
pendingEdits = providerEditsCacheStore[thread.threadId];
}
this.displayCommentThread(info.owner, thread, pendingComment, pendingEdits);
@@ -1288,10 +1288,10 @@ export class CommentController implements IEditorContribution {
this._pendingNewCommentCache[zone.owner] = {};
}
this._pendingNewCommentCache[zone.owner][zone.commentThread.threadId!] = pendingNewComment;
this._pendingNewCommentCache[zone.owner][zone.commentThread.threadId] = pendingNewComment;
} else {
if (providerNewCommentCacheStore) {
delete providerNewCommentCacheStore[zone.commentThread.threadId!];
delete providerNewCommentCacheStore[zone.commentThread.threadId];
}
}
@@ -1301,9 +1301,9 @@ export class CommentController implements IEditorContribution {
if (!providerEditsCacheStore) {
this._pendingEditsCache[zone.owner] = {};
}
this._pendingEditsCache[zone.owner][zone.commentThread.threadId!] = pendingEdits;
this._pendingEditsCache[zone.owner][zone.commentThread.threadId] = pendingEdits;
} else if (providerEditsCacheStore) {
delete providerEditsCacheStore[zone.commentThread.threadId!];
delete providerEditsCacheStore[zone.commentThread.threadId];
}
zone.dispose();
@@ -53,7 +53,7 @@ export class ResourceWithCommentThreads {
public static createCommentNode(owner: string, resource: URI, commentThread: CommentThread): CommentNode {
const { threadId, comments, range } = commentThread;
const commentNodes: CommentNode[] = comments!.map(comment => new CommentNode(owner, threadId!, resource, comment, range, commentThread.state));
const commentNodes: CommentNode[] = comments!.map(comment => new CommentNode(owner, threadId, resource, comment, range, commentThread.state));
if (commentNodes.length > 1) {
commentNodes[0].replies = commentNodes.slice(1, commentNodes.length);
}
@@ -245,7 +245,7 @@ export class CustomEditorService extends Disposable implements ICustomEditorServ
let replacement: EditorInput | IResourceEditorInput;
if (possibleEditors.defaultEditor) {
const viewType = possibleEditors.defaultEditor.id;
replacement = CustomEditorInput.create(this.instantiationService, newResource, viewType!, group);
replacement = CustomEditorInput.create(this.instantiationService, newResource, viewType, group);
} else {
replacement = { resource: newResource, options: { override: DEFAULT_EDITOR_ASSOCIATION.id } };
}
@@ -46,7 +46,7 @@ export class CustomEditorModelManager implements ICustomEditorModelManager {
return {
object: model,
dispose: createSingleCallFunction(() => {
if (--entry!.counter <= 0) {
if (--entry.counter <= 0) {
entry.model.then(x => x.dispose());
this._references.delete(key);
}
@@ -368,7 +368,7 @@ export class SelectionToReplAction extends EditorAction {
text = editor.getModel().getValueInRange(selection);
}
await session.addReplExpression(viewModel.focusedStackFrame!, text);
await session.addReplExpression(viewModel.focusedStackFrame, text);
await viewsService.openView(REPL_VIEW_ID, false);
}
}
@@ -387,7 +387,7 @@ export class DebugService implements IDebugService {
const values = await Promise.all(compound.configurations.map(configData => {
const name = typeof configData === 'string' ? configData : configData.name;
if (name === compound!.name) {
if (name === compound.name) {
return Promise.resolve(false);
}
@@ -408,7 +408,7 @@ export class DebugService implements IDebugService {
if (launchesMatchingConfigData.length === 1) {
launchForName = launchesMatchingConfigData[0];
} else {
throw new Error(nls.localize('noFolderWithName', "Can not find folder with name '{0}' for configuration '{1}' in compound '{2}'.", configData.folder, configData.name, compound!.name));
throw new Error(nls.localize('noFolderWithName', "Can not find folder with name '{0}' for configuration '{1}' in compound '{2}'.", configData.folder, configData.name, compound.name));
}
}
@@ -322,7 +322,7 @@ export class DebugSession implements IDebugSession, IDisposable {
await this.raw.start();
this.registerListeners();
await this.raw!.initialize({
await this.raw.initialize({
clientID: 'vscode',
clientName: this.productService.nameLong,
adapterID: this.configuration.type,
@@ -472,7 +472,7 @@ export class DisassemblyView extends EditorPane {
const currentLine: IRange = {
startLineNumber: instruction.line,
startColumn: instruction.column ?? 0,
endLineNumber: instruction.endLine ?? instruction.line!,
endLineNumber: instruction.endLine ?? instruction.line,
endColumn: instruction.endColumn ?? 0,
};
@@ -788,7 +788,7 @@ class InstructionRenderer extends Disposable implements ITableRenderer<IDisassem
const disposables = [
this._disassemblyView.onDidChangeStackFrame(() => this.rerenderBackground(instruction, sourcecode, currentElement.element)),
addStandardDisposableListener(sourcecode, 'dblclick', () => this.openSourceCode(currentElement.element?.instruction!)),
addStandardDisposableListener(sourcecode, 'dblclick', () => this.openSourceCode(currentElement.element?.instruction)),
];
return { currentElement, instruction, sourcecode, cellDisposable, disposables };
@@ -893,7 +893,7 @@ class InstructionRenderer extends Disposable implements ITableRenderer<IDisassem
const sourceURI = this.getUriFromSource(instruction);
const selection = instruction.endLine ? {
startLineNumber: instruction.line!,
endLineNumber: instruction.endLine!,
endLineNumber: instruction.endLine,
startColumn: instruction.column || 1,
endColumn: instruction.endColumn || Constants.MAX_SAFE_SMALL_INTEGER,
} : {
@@ -421,7 +421,7 @@ export class Repl extends FilterViewPane implements IHistoryNavigationWidget {
if (session) {
this.replElementsChangeListener?.dispose();
this.replElementsChangeListener = session.onDidChangeReplElements(() => {
this.refreshReplElements(session!.getReplElements().length === 0);
this.refreshReplElements(session.getReplElements().length === 0);
});
if (this.tree && treeInput !== session) {

Some files were not shown because too many files have changed in this diff Show More