This commit is contained in:
Johannes Rieken
2025-11-10 15:13:22 +01:00
committed by GitHub
parent 39d140db4b
commit 2b196e8fb2
12 changed files with 38 additions and 46 deletions

View File

@@ -374,7 +374,6 @@ export default tseslint.config(
'src/vs/base/node/processes.ts', 'src/vs/base/node/processes.ts',
'src/vs/base/common/arrays.ts', 'src/vs/base/common/arrays.ts',
'src/vs/base/common/async.ts', 'src/vs/base/common/async.ts',
'src/vs/base/common/cancellation.ts',
'src/vs/base/common/collections.ts', 'src/vs/base/common/collections.ts',
'src/vs/base/common/console.ts', 'src/vs/base/common/console.ts',
'src/vs/base/common/controlFlow.ts', 'src/vs/base/common/controlFlow.ts',
@@ -389,7 +388,6 @@ export default tseslint.config(
'src/vs/base/common/json.ts', 'src/vs/base/common/json.ts',
'src/vs/base/common/jsonSchema.ts', 'src/vs/base/common/jsonSchema.ts',
'src/vs/base/common/lifecycle.ts', 'src/vs/base/common/lifecycle.ts',
'src/vs/base/common/linkedList.ts',
'src/vs/base/common/map.ts', 'src/vs/base/common/map.ts',
'src/vs/base/common/marshalling.ts', 'src/vs/base/common/marshalling.ts',
'src/vs/base/common/network.ts', 'src/vs/base/common/network.ts',
@@ -399,9 +397,7 @@ export default tseslint.config(
'src/vs/base/common/platform.ts', 'src/vs/base/common/platform.ts',
'src/vs/base/common/processes.ts', 'src/vs/base/common/processes.ts',
'src/vs/base/common/resourceTree.ts', 'src/vs/base/common/resourceTree.ts',
'src/vs/base/common/skipList.ts',
'src/vs/base/common/strings.ts', 'src/vs/base/common/strings.ts',
'src/vs/base/common/ternarySearchTree.ts',
'src/vs/base/common/types.ts', 'src/vs/base/common/types.ts',
'src/vs/base/common/uriIpc.ts', 'src/vs/base/common/uriIpc.ts',
'src/vs/base/common/verifier.ts', 'src/vs/base/common/verifier.ts',
@@ -471,7 +467,6 @@ export default tseslint.config(
'src/vs/platform/contextkey/browser/contextKeyService.ts', 'src/vs/platform/contextkey/browser/contextKeyService.ts',
'src/vs/platform/contextkey/common/contextkey.ts', 'src/vs/platform/contextkey/common/contextkey.ts',
'src/vs/platform/contextview/browser/contextView.ts', 'src/vs/platform/contextview/browser/contextView.ts',
'src/vs/platform/contextview/browser/contextViewService.ts',
'src/vs/platform/debug/common/extensionHostDebugIpc.ts', 'src/vs/platform/debug/common/extensionHostDebugIpc.ts',
'src/vs/platform/debug/electron-main/extensionHostDebugIpc.ts', 'src/vs/platform/debug/electron-main/extensionHostDebugIpc.ts',
'src/vs/platform/diagnostics/common/diagnostics.ts', 'src/vs/platform/diagnostics/common/diagnostics.ts',
@@ -573,8 +568,6 @@ export default tseslint.config(
'src/vs/editor/contrib/codeAction/browser/codeAction.ts', 'src/vs/editor/contrib/codeAction/browser/codeAction.ts',
'src/vs/editor/contrib/codeAction/browser/codeActionCommands.ts', 'src/vs/editor/contrib/codeAction/browser/codeActionCommands.ts',
'src/vs/editor/contrib/codeAction/common/types.ts', 'src/vs/editor/contrib/codeAction/common/types.ts',
'src/vs/editor/contrib/codelens/browser/codelens.ts',
'src/vs/editor/contrib/codelens/browser/codelensController.ts',
'src/vs/editor/contrib/colorPicker/browser/colorDetector.ts', 'src/vs/editor/contrib/colorPicker/browser/colorDetector.ts',
'src/vs/editor/contrib/diffEditorBreadcrumbs/browser/contribution.ts', 'src/vs/editor/contrib/diffEditorBreadcrumbs/browser/contribution.ts',
'src/vs/editor/contrib/dropOrPasteInto/browser/dropIntoEditorContribution.ts', 'src/vs/editor/contrib/dropOrPasteInto/browser/dropIntoEditorContribution.ts',
@@ -617,8 +610,6 @@ export default tseslint.config(
'src/vs/workbench/api/common/extHostConsoleForwarder.ts', 'src/vs/workbench/api/common/extHostConsoleForwarder.ts',
'src/vs/workbench/api/common/extHostDataChannels.ts', 'src/vs/workbench/api/common/extHostDataChannels.ts',
'src/vs/workbench/api/common/extHostDebugService.ts', 'src/vs/workbench/api/common/extHostDebugService.ts',
'src/vs/workbench/api/common/extHostDiagnostics.ts',
'src/vs/workbench/api/common/extHostDocumentSaveParticipant.ts',
'src/vs/workbench/api/common/extHostExtensionActivator.ts', 'src/vs/workbench/api/common/extHostExtensionActivator.ts',
'src/vs/workbench/api/common/extHostExtensionService.ts', 'src/vs/workbench/api/common/extHostExtensionService.ts',
'src/vs/workbench/api/common/extHostFileSystemConsumer.ts', 'src/vs/workbench/api/common/extHostFileSystemConsumer.ts',
@@ -941,7 +932,7 @@ export default tseslint.config(
'@typescript-eslint/no-explicit-any': [ '@typescript-eslint/no-explicit-any': [
'warn', 'warn',
{ {
'fixToUnknown': true 'fixToUnknown': false
} }
] ]
} }

View File

@@ -21,10 +21,10 @@ export interface CancellationToken {
* *
* @event * @event
*/ */
readonly onCancellationRequested: (listener: (e: any) => any, thisArgs?: any, disposables?: IDisposable[]) => IDisposable; readonly onCancellationRequested: (listener: (e: void) => unknown, thisArgs?: unknown, disposables?: IDisposable[]) => IDisposable;
} }
const shortcutEvent: Event<any> = Object.freeze(function (callback, context?): IDisposable { const shortcutEvent: Event<void> = Object.freeze(function (callback, context?): IDisposable {
const handle = setTimeout(callback.bind(context), 0); const handle = setTimeout(callback.bind(context), 0);
return { dispose() { clearTimeout(handle); } }; return { dispose() { clearTimeout(handle); } };
}); });
@@ -60,7 +60,7 @@ export namespace CancellationToken {
class MutableToken implements CancellationToken { class MutableToken implements CancellationToken {
private _isCancelled: boolean = false; private _isCancelled: boolean = false;
private _emitter: Emitter<any> | null = null; private _emitter: Emitter<void> | null = null;
public cancel() { public cancel() {
if (!this._isCancelled) { if (!this._isCancelled) {
@@ -76,12 +76,12 @@ class MutableToken implements CancellationToken {
return this._isCancelled; return this._isCancelled;
} }
get onCancellationRequested(): Event<any> { get onCancellationRequested(): Event<void> {
if (this._isCancelled) { if (this._isCancelled) {
return shortcutEvent; return shortcutEvent;
} }
if (!this._emitter) { if (!this._emitter) {
this._emitter = new Emitter<any>(); this._emitter = new Emitter<void>();
} }
return this._emitter.event; return this._emitter.event;
} }

View File

@@ -5,11 +5,11 @@
class Node<E> { class Node<E> {
static readonly Undefined = new Node<any>(undefined); static readonly Undefined = new Node<unknown>(undefined);
element: E; element: E;
next: Node<E>; next: Node<E> | typeof Node.Undefined;
prev: Node<E>; prev: Node<E> | typeof Node.Undefined;
constructor(element: E) { constructor(element: E) {
this.element = element; this.element = element;
@@ -20,8 +20,8 @@ class Node<E> {
export class LinkedList<E> { export class LinkedList<E> {
private _first: Node<E> = Node.Undefined; private _first: Node<E> | typeof Node.Undefined = Node.Undefined;
private _last: Node<E> = Node.Undefined; private _last: Node<E> | typeof Node.Undefined = Node.Undefined;
private _size: number = 0; private _size: number = 0;
get size(): number { get size(): number {
@@ -91,7 +91,7 @@ export class LinkedList<E> {
} else { } else {
const res = this._first.element; const res = this._first.element;
this._remove(this._first); this._remove(this._first);
return res; return res as E;
} }
} }
@@ -101,7 +101,7 @@ export class LinkedList<E> {
} else { } else {
const res = this._last.element; const res = this._last.element;
this._remove(this._last); this._remove(this._last);
return res; return res as E;
} }
} }
@@ -110,11 +110,11 @@ export class LinkedList<E> {
return undefined; return undefined;
} else { } else {
const res = this._last.element; const res = this._last.element;
return res; return res as E;
} }
} }
private _remove(node: Node<E>): void { private _remove(node: Node<E> | typeof Node.Undefined): void {
if (node.prev !== Node.Undefined && node.next !== Node.Undefined) { if (node.prev !== Node.Undefined && node.next !== Node.Undefined) {
// middle // middle
const anchor = node.prev; const anchor = node.prev;
@@ -144,7 +144,7 @@ export class LinkedList<E> {
*[Symbol.iterator](): Iterator<E> { *[Symbol.iterator](): Iterator<E> {
let node = this._first; let node = this._first;
while (node !== Node.Undefined) { while (node !== Node.Undefined) {
yield node.element; yield node.element as E;
node = node.next; node = node.next;
} }
} }

View File

@@ -116,7 +116,7 @@ export class ResourceMap<T> implements Map<URI, T> {
return this.map.delete(this.toKey(resource)); return this.map.delete(this.toKey(resource));
} }
forEach(clb: (value: T, key: URI, map: Map<URI, T>) => void, thisArg?: any): void { forEach(clb: (value: T, key: URI, map: Map<URI, T>) => void, thisArg?: object): void {
if (typeof thisArg !== 'undefined') { if (typeof thisArg !== 'undefined') {
clb = clb.bind(thisArg); clb = clb.bind(thisArg);
} }
@@ -185,7 +185,7 @@ export class ResourceSet implements Set<URI> {
return this._map.delete(value); return this._map.delete(value);
} }
forEach(callbackfn: (value: URI, value2: URI, set: Set<URI>) => void, thisArg?: any): void { forEach(callbackfn: (value: URI, value2: URI, set: Set<URI>) => void, thisArg?: unknown): void {
this._map.forEach((_value, key) => callbackfn.call(thisArg, key, key, this)); this._map.forEach((_value, key) => callbackfn.call(thisArg, key, key, this));
} }
@@ -340,7 +340,7 @@ export class LinkedMap<K, V> implements Map<K, V> {
return item.value; return item.value;
} }
forEach(callbackfn: (value: V, key: K, map: LinkedMap<K, V>) => void, thisArg?: any): void { forEach(callbackfn: (value: V, key: K, map: LinkedMap<K, V>) => void, thisArg?: unknown): void {
const state = this._state; const state = this._state;
let current = this._head; let current = this._head;
while (current) { while (current) {
@@ -789,7 +789,7 @@ export class BidirectionalMap<K, V> {
return true; return true;
} }
forEach(callbackfn: (value: V, key: K, map: BidirectionalMap<K, V>) => void, thisArg?: any): void { forEach(callbackfn: (value: V, key: K, map: BidirectionalMap<K, V>) => void, thisArg?: unknown): void {
this._m1.forEach((value, key) => { this._m1.forEach((value, key) => {
callbackfn.call(thisArg, value, key, this); callbackfn.call(thisArg, value, key, this);
}); });

View File

@@ -35,8 +35,8 @@ export class SkipList<K, V> implements Map<K, V> {
capacity: number = 2 ** 16 capacity: number = 2 ** 16
) { ) {
this._maxLevel = Math.max(1, Math.log2(capacity) | 0); this._maxLevel = Math.max(1, Math.log2(capacity) | 0);
// eslint-disable-next-line local/code-no-any-casts
this._header = <any>new Node(this._maxLevel, NIL, NIL); this._header = new Node(this._maxLevel, <K>NIL, <V>NIL);
} }
get size(): number { get size(): number {
@@ -44,8 +44,8 @@ export class SkipList<K, V> implements Map<K, V> {
} }
clear(): void { clear(): void {
// eslint-disable-next-line local/code-no-any-casts
this._header = <any>new Node(this._maxLevel, NIL, NIL); this._header = new Node(this._maxLevel, <K>NIL, <V>NIL);
this._size = 0; this._size = 0;
} }
@@ -74,7 +74,7 @@ export class SkipList<K, V> implements Map<K, V> {
// --- iteration // --- iteration
forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void { forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: unknown): void {
let node = this._header.forward[0]; let node = this._header.forward[0];
while (node) { while (node) {
callbackfn.call(thisArg, node.value, node.key, this); callbackfn.call(thisArg, node.value, node.key, this);
@@ -169,7 +169,7 @@ export class SkipList<K, V> implements Map<K, V> {
} }
} }
private static _randomLevel(list: SkipList<any, any>, p: number = 0.5): number { private static _randomLevel<K, V>(list: SkipList<K, V>, p: number = 0.5): number {
let lvl = 1; let lvl = 1;
while (Math.random() < p && lvl < list._maxLevel) { while (Math.random() < p && lvl < list._maxLevel) {
lvl += 1; lvl += 1;

View File

@@ -781,7 +781,7 @@ export class TernarySearchTree<K, V> {
// for debug/testing // for debug/testing
_isBalanced(): boolean { _isBalanced(): boolean {
const nodeIsBalanced = (node: TernarySearchTreeNode<any, any> | undefined): boolean => { const nodeIsBalanced = (node: TernarySearchTreeNode<unknown, unknown> | undefined): boolean => {
if (!node) { if (!node) {
return true; return true;
} }

View File

@@ -112,7 +112,7 @@ CommandsRegistry.registerCommand('_executeCodeLensProvider', function (accessor,
return getCodeLensModel(codeLensProvider, model, CancellationToken.None).then(value => { return getCodeLensModel(codeLensProvider, model, CancellationToken.None).then(value => {
disposables.add(value); disposables.add(value);
const resolve: Promise<any>[] = []; const resolve: Promise<unknown>[] = [];
for (const item of value.lenses) { for (const item of value.lenses) {
if (itemResolveCount === undefined || itemResolveCount === null || Boolean(item.symbol.command)) { if (itemResolveCount === undefined || itemResolveCount === null || Boolean(item.symbol.command)) {

View File

@@ -42,7 +42,7 @@ export class CodeLensContribution implements IEditorContribution {
private _getCodeLensModelPromise: CancelablePromise<CodeLensModel> | undefined; private _getCodeLensModelPromise: CancelablePromise<CodeLensModel> | undefined;
private readonly _oldCodeLensModels = new DisposableStore(); private readonly _oldCodeLensModels = new DisposableStore();
private _currentCodeLensModel: CodeLensModel | undefined; private _currentCodeLensModel: CodeLensModel | undefined;
private _resolveCodeLensesPromise: CancelablePromise<any> | undefined; private _resolveCodeLensesPromise: CancelablePromise<void[]> | undefined;
constructor( constructor(
private readonly _editor: ICodeEditor, private readonly _editor: ICodeEditor,

2
src/vs/monaco.d.ts vendored
View File

@@ -103,7 +103,7 @@ declare namespace monaco {
* *
* @event * @event
*/ */
readonly onCancellationRequested: (listener: (e: any) => any, thisArgs?: any, disposables?: IDisposable[]) => IDisposable; readonly onCancellationRequested: (listener: (e: void) => unknown, thisArgs?: unknown, disposables?: IDisposable[]) => IDisposable;
} }
/** /**
* Uniform Resource Identifier (Uri) http://tools.ietf.org/html/rfc3986. * Uniform Resource Identifier (Uri) http://tools.ietf.org/html/rfc3986.

View File

@@ -61,7 +61,7 @@ export class ContextViewHandler extends Disposable implements IContextViewProvid
this.contextView.layout(); this.contextView.layout();
} }
hideContextView(data?: any): void { hideContextView(data?: unknown): void {
this.contextView.hide(data); this.contextView.hide(data);
this.openContextView = undefined; this.openContextView = undefined;
} }

View File

@@ -186,7 +186,7 @@ export class DiagnosticCollection implements vscode.DiagnosticCollection {
this.#proxy?.$clear(this._owner); this.#proxy?.$clear(this._owner);
} }
forEach(callback: (uri: URI, diagnostics: ReadonlyArray<vscode.Diagnostic>, collection: DiagnosticCollection) => any, thisArg?: any): void { forEach(callback: (uri: URI, diagnostics: ReadonlyArray<vscode.Diagnostic>, collection: DiagnosticCollection) => unknown, thisArg?: unknown): void {
this._checkDisposed(); this._checkDisposed();
for (const [uri, values] of this) { for (const [uri, values] of this) {
callback.call(thisArg, uri, values, this); callback.call(thisArg, uri, values, this);

View File

@@ -17,7 +17,7 @@ import { ILogService } from '../../../platform/log/common/log.js';
import { IExtensionDescription } from '../../../platform/extensions/common/extensions.js'; import { IExtensionDescription } from '../../../platform/extensions/common/extensions.js';
import { SerializableObjectWithBuffers } from '../../services/extensions/common/proxyIdentifier.js'; import { SerializableObjectWithBuffers } from '../../services/extensions/common/proxyIdentifier.js';
type Listener = [Function, any, IExtensionDescription]; type Listener = [Function, unknown, IExtensionDescription];
export class ExtHostDocumentSaveParticipant implements ExtHostDocumentSaveParticipantShape { export class ExtHostDocumentSaveParticipant implements ExtHostDocumentSaveParticipantShape {
@@ -62,8 +62,8 @@ export class ExtHostDocumentSaveParticipant implements ExtHostDocumentSavePartic
break; break;
} }
const document = this._documents.getDocument(resource); const document = this._documents.getDocument(resource);
// eslint-disable-next-line local/code-no-any-casts
const success = await this._deliverEventAsyncAndBlameBadListeners(listener, <any>{ document, reason: TextDocumentSaveReason.to(reason) }); const success = await this._deliverEventAsyncAndBlameBadListeners(listener, { document, reason: TextDocumentSaveReason.to(reason) });
results.push(success); results.push(success);
} }
} finally { } finally {
@@ -72,7 +72,7 @@ export class ExtHostDocumentSaveParticipant implements ExtHostDocumentSavePartic
return results; return results;
} }
private _deliverEventAsyncAndBlameBadListeners([listener, thisArg, extension]: Listener, stubEvent: vscode.TextDocumentWillSaveEvent): Promise<any> { private _deliverEventAsyncAndBlameBadListeners([listener, thisArg, extension]: Listener, stubEvent: Pick<vscode.TextDocumentWillSaveEvent, 'document' | 'reason'>): Promise<boolean> {
const errors = this._badListeners.get(listener); const errors = this._badListeners.get(listener);
if (typeof errors === 'number' && errors > this._thresholds.errors) { if (typeof errors === 'number' && errors > this._thresholds.errors) {
// bad listener - ignore // bad listener - ignore
@@ -100,7 +100,7 @@ export class ExtHostDocumentSaveParticipant implements ExtHostDocumentSavePartic
}); });
} }
private _deliverEventAsync(extension: IExtensionDescription, listener: Function, thisArg: any, stubEvent: vscode.TextDocumentWillSaveEvent): Promise<any> { private _deliverEventAsync(extension: IExtensionDescription, listener: Function, thisArg: unknown, stubEvent: Pick<vscode.TextDocumentWillSaveEvent, 'document' | 'reason'>): Promise<boolean | undefined> {
const promises: Promise<vscode.TextEdit[]>[] = []; const promises: Promise<vscode.TextEdit[]>[] = [];
@@ -111,6 +111,7 @@ export class ExtHostDocumentSaveParticipant implements ExtHostDocumentSavePartic
const event = Object.freeze<vscode.TextDocumentWillSaveEvent>({ const event = Object.freeze<vscode.TextDocumentWillSaveEvent>({
document, document,
reason, reason,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
waitUntil(p: Promise<any | vscode.TextEdit[]>) { waitUntil(p: Promise<any | vscode.TextEdit[]>) {
if (Object.isFrozen(promises)) { if (Object.isFrozen(promises)) {
throw illegalState('waitUntil can not be called async'); throw illegalState('waitUntil can not be called async');