mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 12:19:20 +00:00
cleanup any-usages (#274732)
* cleanup any-usages https://github.com/microsoft/vscode/issues/274723 * ignore location for now
This commit is contained in:
@@ -671,27 +671,19 @@ export default tseslint.config(
|
||||
'src/vs/editor/contrib/find/browser/findWidgetSearchHistory.ts',
|
||||
'src/vs/editor/contrib/find/browser/replaceWidgetHistory.ts',
|
||||
'src/vs/editor/contrib/folding/browser/folding.ts',
|
||||
'src/vs/editor/contrib/format/browser/format.ts',
|
||||
'src/vs/editor/contrib/gotoSymbol/browser/goToCommands.ts',
|
||||
'src/vs/editor/contrib/gotoSymbol/browser/symbolNavigation.ts',
|
||||
'src/vs/editor/contrib/hover/browser/hoverActions.ts',
|
||||
'src/vs/editor/contrib/inlineCompletions/browser/structuredLogger.ts',
|
||||
'src/vs/editor/contrib/inlineCompletions/browser/utils.ts',
|
||||
'src/vs/editor/contrib/smartSelect/browser/smartSelect.ts',
|
||||
'src/vs/editor/contrib/snippet/browser/snippetParser.ts',
|
||||
'src/vs/editor/contrib/stickyScroll/browser/stickyScrollModelProvider.ts',
|
||||
'src/vs/editor/contrib/suggest/browser/suggest.ts',
|
||||
'src/vs/editor/contrib/suggest/browser/suggestAlternatives.ts',
|
||||
'src/vs/editor/contrib/suggest/browser/suggestCommitCharacters.ts',
|
||||
'src/vs/editor/contrib/suggest/browser/suggestController.ts',
|
||||
'src/vs/editor/contrib/unicodeHighlighter/browser/unicodeHighlighter.ts',
|
||||
'src/vs/editor/contrib/wordHighlighter/browser/wordHighlighter.ts',
|
||||
'src/vs/editor/standalone/common/monarch/monarchCommon.ts',
|
||||
'src/vs/editor/standalone/common/monarch/monarchCompile.ts',
|
||||
'src/vs/editor/standalone/common/monarch/monarchLexer.ts',
|
||||
'src/vs/editor/standalone/common/monarch/monarchTypes.ts',
|
||||
'src/vs/editor/contrib/gotoSymbol/browser/peek/referencesController.ts',
|
||||
'src/vs/editor/contrib/gotoSymbol/browser/peek/referencesWidget.ts',
|
||||
'src/vs/editor/contrib/inlineCompletions/browser/controller/commands.ts',
|
||||
'src/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.ts',
|
||||
'src/vs/editor/contrib/inlineCompletions/browser/model/typingSpeed.ts',
|
||||
@@ -741,19 +733,8 @@ export default tseslint.config(
|
||||
'src/vs/workbench/api/common/extHostTreeViews.ts',
|
||||
'src/vs/workbench/api/common/extHostTypeConverters.ts',
|
||||
'src/vs/workbench/api/common/extHostTypes.ts',
|
||||
'src/vs/workbench/api/common/extHostTypes/diagnostic.ts',
|
||||
'src/vs/workbench/api/common/extHostTypes/es5ClassCompat.ts',
|
||||
'src/vs/workbench/api/common/extHostTypes/location.ts',
|
||||
'src/vs/workbench/api/common/extHostTypes/markdownString.ts',
|
||||
'src/vs/workbench/api/common/extHostTypes/notebooks.ts',
|
||||
'src/vs/workbench/api/common/extHostTypes/position.ts',
|
||||
'src/vs/workbench/api/common/extHostTypes/range.ts',
|
||||
'src/vs/workbench/api/common/extHostTypes/selection.ts',
|
||||
'src/vs/workbench/api/common/extHostTypes/snippetString.ts',
|
||||
'src/vs/workbench/api/common/extHostTypes/snippetTextEdit.ts',
|
||||
'src/vs/workbench/api/common/extHostTypes/symbolInformation.ts',
|
||||
'src/vs/workbench/api/common/extHostTypes/textEdit.ts',
|
||||
'src/vs/workbench/api/common/extHostTypes/workspaceEdit.ts',
|
||||
'src/vs/workbench/api/common/extHostWebview.ts',
|
||||
'src/vs/workbench/api/common/extHostWebviewMessaging.ts',
|
||||
'src/vs/workbench/api/common/extHostWebviewPanels.ts',
|
||||
|
||||
@@ -460,7 +460,7 @@ export function getOnTypeFormattingEdits(
|
||||
});
|
||||
}
|
||||
|
||||
function isFormattingOptions(obj: any): obj is FormattingOptions {
|
||||
function isFormattingOptions(obj: unknown): obj is FormattingOptions {
|
||||
const candidate = obj as FormattingOptions | undefined;
|
||||
|
||||
return !!candidate && typeof candidate === 'object' && typeof candidate.tabSize === 'number' && typeof candidate.insertSpaces === 'boolean';
|
||||
|
||||
@@ -245,7 +245,7 @@ export abstract class ReferencesController implements IEditorContribution {
|
||||
this._requestIdPool += 1; // Cancel pending requests
|
||||
}
|
||||
|
||||
private _gotoReference(ref: Location, pinned: boolean): Promise<any> {
|
||||
private _gotoReference(ref: Location, pinned: boolean): Promise<unknown> {
|
||||
this._widget?.hide();
|
||||
|
||||
this._ignoreModelChangeEvent = true;
|
||||
@@ -397,9 +397,9 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
when: ContextKeyExpr.and(ctxReferenceSearchVisible, WorkbenchListFocusContextKey, WorkbenchTreeElementCanCollapse.negate(), WorkbenchTreeElementCanExpand.negate()),
|
||||
handler(accessor: ServicesAccessor) {
|
||||
const listService = accessor.get(IListService);
|
||||
const focus = <any[]>listService.lastFocusedList?.getFocus();
|
||||
const focus = <unknown[]>listService.lastFocusedList?.getFocus();
|
||||
if (Array.isArray(focus) && focus[0] instanceof OneReference) {
|
||||
withController(accessor, controller => controller.revealReference(focus[0]));
|
||||
withController(accessor, controller => controller.revealReference(focus[0] as OneReference));
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -414,17 +414,17 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
when: ContextKeyExpr.and(ctxReferenceSearchVisible, WorkbenchListFocusContextKey, WorkbenchTreeElementCanCollapse.negate(), WorkbenchTreeElementCanExpand.negate()),
|
||||
handler(accessor: ServicesAccessor) {
|
||||
const listService = accessor.get(IListService);
|
||||
const focus = <any[]>listService.lastFocusedList?.getFocus();
|
||||
const focus = <unknown[]>listService.lastFocusedList?.getFocus();
|
||||
if (Array.isArray(focus) && focus[0] instanceof OneReference) {
|
||||
withController(accessor, controller => controller.openReference(focus[0], true, true));
|
||||
withController(accessor, controller => controller.openReference(focus[0] as OneReference, true, true));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
CommandsRegistry.registerCommand('openReference', (accessor) => {
|
||||
const listService = accessor.get(IListService);
|
||||
const focus = <any[]>listService.lastFocusedList?.getFocus();
|
||||
const focus = <unknown[]>listService.lastFocusedList?.getFocus();
|
||||
if (Array.isArray(focus) && focus[0] instanceof OneReference) {
|
||||
withController(accessor, controller => controller.openReference(focus[0], false, true));
|
||||
withController(accessor, controller => controller.openReference(focus[0] as OneReference, false, true));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -432,7 +432,7 @@ export class ReferenceWidget extends peekView.PeekViewWidget {
|
||||
}, undefined));
|
||||
|
||||
// listen on selection and focus
|
||||
const onEvent = (element: any, kind: 'show' | 'goto' | 'side') => {
|
||||
const onEvent = (element: TreeElement | undefined, kind: 'show' | 'goto' | 'side') => {
|
||||
if (element instanceof OneReference) {
|
||||
if (kind === 'show') {
|
||||
this._revealReference(element, false);
|
||||
@@ -467,7 +467,7 @@ export class ReferenceWidget extends peekView.PeekViewWidget {
|
||||
this._splitView.resizeView(0, widthInPixel * this.layoutData.ratio);
|
||||
}
|
||||
|
||||
setSelection(selection: OneReference): Promise<any> {
|
||||
setSelection(selection: OneReference): Promise<unknown> {
|
||||
return this._revealReference(selection, true).then(() => {
|
||||
if (!this._model) {
|
||||
// disposed
|
||||
@@ -479,7 +479,7 @@ export class ReferenceWidget extends peekView.PeekViewWidget {
|
||||
});
|
||||
}
|
||||
|
||||
setModel(newModel: ReferencesModel | undefined): Promise<any> {
|
||||
setModel(newModel: ReferencesModel | undefined): Promise<unknown> {
|
||||
// clean up
|
||||
this._disposeOnNewModel.clear();
|
||||
this._model = newModel;
|
||||
@@ -489,7 +489,7 @@ export class ReferenceWidget extends peekView.PeekViewWidget {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
private _onNewModel(): Promise<any> {
|
||||
private _onNewModel(): Promise<unknown> {
|
||||
if (!this._model) {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ export class Scanner {
|
||||
|
||||
export abstract class Marker {
|
||||
|
||||
readonly _markerBrand: any;
|
||||
readonly _markerBrand: undefined;
|
||||
|
||||
public parent!: Marker;
|
||||
protected _children: Marker[] = [];
|
||||
|
||||
@@ -323,7 +323,7 @@ export async function provideSuggestionItems(
|
||||
|
||||
if (token.isCancellationRequested) {
|
||||
disposables.dispose();
|
||||
return Promise.reject<any>(new CancellationError());
|
||||
return Promise.reject(new CancellationError());
|
||||
}
|
||||
|
||||
return new CompletionItemModel(
|
||||
@@ -402,7 +402,7 @@ CommandsRegistry.registerCommand('_executeCompletionItemProvider', async (access
|
||||
suggestions: []
|
||||
};
|
||||
|
||||
const resolving: Promise<any>[] = [];
|
||||
const resolving: Promise<unknown>[] = [];
|
||||
const actualPosition = ref.object.textEditorModel.validatePosition(position);
|
||||
const completions = await provideSuggestionItems(completionProvider, ref.object.textEditorModel, actualPosition, undefined, { triggerCharacter: triggerCharacter ?? undefined, triggerKind: triggerCharacter ? languages.CompletionTriggerKind.TriggerCharacter : languages.CompletionTriggerKind.Invoke });
|
||||
for (const item of completions.items) {
|
||||
|
||||
@@ -17,7 +17,7 @@ export class SuggestAlternatives {
|
||||
|
||||
private _index: number = 0;
|
||||
private _model: CompletionModel | undefined;
|
||||
private _acceptNext: ((selected: ISelectedSuggestion) => any) | undefined;
|
||||
private _acceptNext: ((selected: ISelectedSuggestion) => unknown) | undefined;
|
||||
private _listener: IDisposable | undefined;
|
||||
private _ignore: boolean | undefined;
|
||||
|
||||
@@ -40,7 +40,7 @@ export class SuggestAlternatives {
|
||||
this._ignore = false;
|
||||
}
|
||||
|
||||
set({ model, index }: ISelectedSuggestion, acceptNext: (selected: ISelectedSuggestion) => any): void {
|
||||
set({ model, index }: ISelectedSuggestion, acceptNext: (selected: ISelectedSuggestion) => unknown): void {
|
||||
|
||||
// no suggestions -> nothing to do
|
||||
if (model.items.length === 0) {
|
||||
|
||||
@@ -20,7 +20,7 @@ export class CommitCharacterController {
|
||||
readonly item: ISelectedSuggestion;
|
||||
};
|
||||
|
||||
constructor(editor: ICodeEditor, widget: SuggestWidget, model: SuggestModel, accept: (selected: ISelectedSuggestion) => any) {
|
||||
constructor(editor: ICodeEditor, widget: SuggestWidget, model: SuggestModel, accept: (selected: ISelectedSuggestion) => unknown) {
|
||||
|
||||
this._disposables.add(model.onDidSuggest(e => {
|
||||
if (e.completionModel.items.length === 0) {
|
||||
|
||||
@@ -347,7 +347,7 @@ export class SuggestController implements IEditorContribution {
|
||||
const { item } = event;
|
||||
|
||||
//
|
||||
const tasks: Promise<any>[] = [];
|
||||
const tasks: Promise<unknown>[] = [];
|
||||
const cts = new CancellationTokenSource();
|
||||
|
||||
// pushing undo stops *before* additional text edits and
|
||||
@@ -662,7 +662,7 @@ export class SuggestController implements IEditorContribution {
|
||||
// wait for trigger because only then the cancel-event is trustworthy
|
||||
const listener: IDisposable[] = [];
|
||||
|
||||
Event.any<any>(this.model.onDidTrigger, this.model.onDidCancel)(() => {
|
||||
Event.any<unknown>(this.model.onDidTrigger, this.model.onDidCancel)(() => {
|
||||
// retrigger or cancel -> try to type default text
|
||||
dispose(listener);
|
||||
fallback();
|
||||
@@ -829,7 +829,7 @@ export class TriggerSuggestAction extends EditorAction {
|
||||
});
|
||||
}
|
||||
|
||||
run(_accessor: ServicesAccessor, editor: ICodeEditor, args: any): void {
|
||||
run(_accessor: ServicesAccessor, editor: ICodeEditor, args: unknown): void {
|
||||
const controller = SuggestController.get(editor);
|
||||
|
||||
if (!controller) {
|
||||
|
||||
@@ -24,7 +24,7 @@ export enum DiagnosticSeverity {
|
||||
@es5ClassCompat
|
||||
export class DiagnosticRelatedInformation {
|
||||
|
||||
static is(thing: any): thing is DiagnosticRelatedInformation {
|
||||
static is(thing: unknown): thing is DiagnosticRelatedInformation {
|
||||
if (!thing) {
|
||||
return false;
|
||||
}
|
||||
@@ -78,7 +78,7 @@ export class Diagnostic {
|
||||
this.severity = severity;
|
||||
}
|
||||
|
||||
toJSON(): any {
|
||||
toJSON(): { severity: string; message: string; range: Range; source?: string; code?: string | number } {
|
||||
return {
|
||||
severity: DiagnosticSeverity[this.severity],
|
||||
message: this.message,
|
||||
|
||||
@@ -12,7 +12,7 @@ import { Range } from './range.js';
|
||||
@es5ClassCompat
|
||||
export class Location {
|
||||
|
||||
static isLocation(thing: any): thing is vscode.Location {
|
||||
static isLocation(thing: unknown): thing is vscode.Location {
|
||||
if (thing instanceof Location) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -14,11 +14,14 @@ export class MarkdownString implements vscode.MarkdownString {
|
||||
|
||||
readonly #delegate: BaseMarkdownString;
|
||||
|
||||
static isMarkdownString(thing: any): thing is vscode.MarkdownString {
|
||||
static isMarkdownString(thing: unknown): thing is vscode.MarkdownString {
|
||||
if (thing instanceof MarkdownString) {
|
||||
return true;
|
||||
}
|
||||
return thing && thing.appendCodeblock && thing.appendMarkdown && thing.appendText && (thing.value !== undefined);
|
||||
if (!thing || typeof thing !== 'object') {
|
||||
return false;
|
||||
}
|
||||
return (thing as vscode.MarkdownString).appendCodeblock && (thing as vscode.MarkdownString).appendMarkdown && (thing as vscode.MarkdownString).appendText && ((thing as vscode.MarkdownString).value !== undefined);
|
||||
}
|
||||
|
||||
constructor(value?: string, supportThemeIcons: boolean = false) {
|
||||
|
||||
@@ -17,7 +17,7 @@ export enum NotebookCellKind {
|
||||
}
|
||||
|
||||
export class NotebookRange {
|
||||
static isNotebookRange(thing: any): thing is vscode.NotebookRange {
|
||||
static isNotebookRange(thing: unknown): thing is vscode.NotebookRange {
|
||||
if (thing instanceof NotebookRange) {
|
||||
return true;
|
||||
}
|
||||
@@ -104,10 +104,10 @@ export class NotebookCellData {
|
||||
languageId: string;
|
||||
mime?: string;
|
||||
outputs?: vscode.NotebookCellOutput[];
|
||||
metadata?: Record<string, any>;
|
||||
metadata?: Record<string, unknown>;
|
||||
executionSummary?: vscode.NotebookCellExecutionSummary;
|
||||
|
||||
constructor(kind: NotebookCellKind, value: string, languageId: string, mime?: string, outputs?: vscode.NotebookCellOutput[], metadata?: Record<string, any>, executionSummary?: vscode.NotebookCellExecutionSummary) {
|
||||
constructor(kind: NotebookCellKind, value: string, languageId: string, mime?: string, outputs?: vscode.NotebookCellOutput[], metadata?: Record<string, unknown>, executionSummary?: vscode.NotebookCellExecutionSummary) {
|
||||
this.kind = kind;
|
||||
this.value = value;
|
||||
this.languageId = languageId;
|
||||
@@ -123,7 +123,7 @@ export class NotebookCellData {
|
||||
export class NotebookData {
|
||||
|
||||
cells: NotebookCellData[];
|
||||
metadata?: { [key: string]: any };
|
||||
metadata?: { [key: string]: unknown };
|
||||
|
||||
constructor(cells: NotebookCellData[]) {
|
||||
this.cells = cells;
|
||||
@@ -133,7 +133,7 @@ export class NotebookData {
|
||||
@es5ClassCompat
|
||||
export class NotebookEdit implements vscode.NotebookEdit {
|
||||
|
||||
static isNotebookCellEdit(thing: any): thing is NotebookEdit {
|
||||
static isNotebookCellEdit(thing: unknown): thing is NotebookEdit {
|
||||
if (thing instanceof NotebookEdit) {
|
||||
return true;
|
||||
}
|
||||
@@ -156,13 +156,13 @@ export class NotebookEdit implements vscode.NotebookEdit {
|
||||
return new NotebookEdit(range, []);
|
||||
}
|
||||
|
||||
static updateCellMetadata(index: number, newMetadata: { [key: string]: any }): NotebookEdit {
|
||||
static updateCellMetadata(index: number, newMetadata: { [key: string]: unknown }): NotebookEdit {
|
||||
const edit = new NotebookEdit(new NotebookRange(index, index), []);
|
||||
edit.newCellMetadata = newMetadata;
|
||||
return edit;
|
||||
}
|
||||
|
||||
static updateNotebookMetadata(newMetadata: { [key: string]: any }): NotebookEdit {
|
||||
static updateNotebookMetadata(newMetadata: { [key: string]: unknown }): NotebookEdit {
|
||||
const edit = new NotebookEdit(new NotebookRange(0, 0), []);
|
||||
edit.newNotebookMetadata = newMetadata;
|
||||
return edit;
|
||||
@@ -170,8 +170,8 @@ export class NotebookEdit implements vscode.NotebookEdit {
|
||||
|
||||
range: NotebookRange;
|
||||
newCells: NotebookCellData[];
|
||||
newCellMetadata?: { [key: string]: any };
|
||||
newNotebookMetadata?: { [key: string]: any };
|
||||
newCellMetadata?: { [key: string]: unknown };
|
||||
newNotebookMetadata?: { [key: string]: unknown };
|
||||
|
||||
constructor(range: NotebookRange, newCells: NotebookCellData[]) {
|
||||
this.range = range;
|
||||
@@ -220,7 +220,7 @@ export class NotebookCellOutputItem {
|
||||
return new NotebookCellOutputItem(bytes, mime);
|
||||
}
|
||||
|
||||
static json(value: any, mime: string = 'text/x-json'): NotebookCellOutputItem {
|
||||
static json(value: unknown, mime: string = 'text/x-json'): NotebookCellOutputItem {
|
||||
const rawStr = JSON.stringify(value, undefined, '\t');
|
||||
return NotebookCellOutputItem.text(rawStr, mime);
|
||||
}
|
||||
@@ -239,7 +239,7 @@ export class NotebookCellOutputItem {
|
||||
|
||||
export class NotebookCellOutput {
|
||||
|
||||
static isNotebookCellOutput(candidate: any): candidate is vscode.NotebookCellOutput {
|
||||
static isNotebookCellOutput(candidate: unknown): candidate is vscode.NotebookCellOutput {
|
||||
if (candidate instanceof NotebookCellOutput) {
|
||||
return true;
|
||||
}
|
||||
@@ -274,12 +274,12 @@ export class NotebookCellOutput {
|
||||
|
||||
id: string;
|
||||
items: NotebookCellOutputItem[];
|
||||
metadata?: Record<string, any>;
|
||||
metadata?: Record<string, unknown>;
|
||||
|
||||
constructor(
|
||||
items: NotebookCellOutputItem[],
|
||||
idOrMetadata?: string | Record<string, any>,
|
||||
metadata?: Record<string, any>
|
||||
idOrMetadata?: string | Record<string, unknown>,
|
||||
metadata?: Record<string, unknown>
|
||||
) {
|
||||
this.items = NotebookCellOutput.ensureUniqueMimeTypes(items, true);
|
||||
if (typeof idOrMetadata === 'string') {
|
||||
@@ -291,4 +291,3 @@ export class NotebookCellOutput {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ export class Position {
|
||||
return result;
|
||||
}
|
||||
|
||||
static isPosition(other: any): other is Position {
|
||||
static isPosition(other: unknown): other is Position {
|
||||
if (!other) {
|
||||
return false;
|
||||
}
|
||||
@@ -183,7 +183,7 @@ export class Position {
|
||||
return new Position(line, character);
|
||||
}
|
||||
|
||||
toJSON(): any {
|
||||
toJSON(): { line: number; character: number } {
|
||||
return { line: this.line, character: this.character };
|
||||
}
|
||||
|
||||
|
||||
@@ -11,15 +11,15 @@ import { Position } from './position.js';
|
||||
@es5ClassCompat
|
||||
export class Range {
|
||||
|
||||
static isRange(thing: any): thing is vscode.Range {
|
||||
static isRange(thing: unknown): thing is vscode.Range {
|
||||
if (thing instanceof Range) {
|
||||
return true;
|
||||
}
|
||||
if (!thing) {
|
||||
if (!thing || typeof thing !== 'object') {
|
||||
return false;
|
||||
}
|
||||
return Position.isPosition((<Range>thing).start)
|
||||
&& Position.isPosition((<Range>thing.end));
|
||||
&& Position.isPosition((<Range>thing).end);
|
||||
}
|
||||
|
||||
static of(obj: vscode.Range): Range {
|
||||
@@ -149,7 +149,7 @@ export class Range {
|
||||
return new Range(start, end);
|
||||
}
|
||||
|
||||
toJSON(): any {
|
||||
toJSON(): unknown {
|
||||
return [this.start, this.end];
|
||||
}
|
||||
|
||||
|
||||
@@ -11,11 +11,11 @@ import { getDebugDescriptionOfRange, Range } from './range.js';
|
||||
@es5ClassCompat
|
||||
export class Selection extends Range {
|
||||
|
||||
static isSelection(thing: any): thing is Selection {
|
||||
static isSelection(thing: unknown): thing is Selection {
|
||||
if (thing instanceof Selection) {
|
||||
return true;
|
||||
}
|
||||
if (!thing) {
|
||||
if (!thing || typeof thing !== 'object') {
|
||||
return false;
|
||||
}
|
||||
return Range.isRange(thing)
|
||||
|
||||
@@ -8,11 +8,11 @@ import { es5ClassCompat } from './es5ClassCompat.js';
|
||||
@es5ClassCompat
|
||||
export class SnippetString {
|
||||
|
||||
static isSnippetString(thing: any): thing is SnippetString {
|
||||
static isSnippetString(thing: unknown): thing is SnippetString {
|
||||
if (thing instanceof SnippetString) {
|
||||
return true;
|
||||
}
|
||||
if (!thing) {
|
||||
if (!thing || typeof thing !== 'object') {
|
||||
return false;
|
||||
}
|
||||
return typeof (<SnippetString>thing).value === 'string';
|
||||
@@ -41,7 +41,7 @@ export class SnippetString {
|
||||
return this;
|
||||
}
|
||||
|
||||
appendPlaceholder(value: string | ((snippet: SnippetString) => any), number: number = this._tabstop++): SnippetString {
|
||||
appendPlaceholder(value: string | ((snippet: SnippetString) => unknown), number: number = this._tabstop++): SnippetString {
|
||||
|
||||
if (typeof value === 'function') {
|
||||
const nested = new SnippetString();
|
||||
@@ -74,7 +74,7 @@ export class SnippetString {
|
||||
return this;
|
||||
}
|
||||
|
||||
appendVariable(name: string, defaultValue?: string | ((snippet: SnippetString) => any)): SnippetString {
|
||||
appendVariable(name: string, defaultValue?: string | ((snippet: SnippetString) => unknown)): SnippetString {
|
||||
|
||||
if (typeof defaultValue === 'function') {
|
||||
const nested = new SnippetString();
|
||||
|
||||
@@ -10,7 +10,7 @@ import { Range } from './range.js';
|
||||
|
||||
export class SnippetTextEdit implements vscode.SnippetTextEdit {
|
||||
|
||||
static isSnippetTextEdit(thing: any): thing is SnippetTextEdit {
|
||||
static isSnippetTextEdit(thing: unknown): thing is SnippetTextEdit {
|
||||
if (thing instanceof SnippetTextEdit) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ export class SymbolInformation {
|
||||
SymbolInformation.validate(this);
|
||||
}
|
||||
|
||||
toJSON(): any {
|
||||
toJSON(): { name: string; kind: string; location: Location; containerName: string | undefined } {
|
||||
return {
|
||||
name: this.name,
|
||||
kind: SymbolKind[this.kind],
|
||||
|
||||
@@ -16,11 +16,11 @@ export enum EndOfLine {
|
||||
@es5ClassCompat
|
||||
export class TextEdit {
|
||||
|
||||
static isTextEdit(thing: any): thing is TextEdit {
|
||||
static isTextEdit(thing: unknown): thing is TextEdit {
|
||||
if (thing instanceof TextEdit) {
|
||||
return true;
|
||||
}
|
||||
if (!thing) {
|
||||
if (!thing || typeof thing !== 'object') {
|
||||
return false;
|
||||
}
|
||||
return Range.isRange((<TextEdit>thing))
|
||||
@@ -87,7 +87,7 @@ export class TextEdit {
|
||||
this._newText = newText;
|
||||
}
|
||||
|
||||
toJSON(): any {
|
||||
toJSON(): { range: Range; newText: string; newEol: EndOfLine | undefined } {
|
||||
return {
|
||||
range: this.range,
|
||||
newText: this.newText,
|
||||
|
||||
@@ -97,7 +97,7 @@ export class WorkspaceEdit implements vscode.WorkspaceEdit {
|
||||
}
|
||||
|
||||
// --- notebook
|
||||
private replaceNotebookMetadata(uri: URI, value: Record<string, any>, metadata?: vscode.WorkspaceEditEntryMetadata): void {
|
||||
private replaceNotebookMetadata(uri: URI, value: Record<string, unknown>, metadata?: vscode.WorkspaceEditEntryMetadata): void {
|
||||
this._edits.push({ _type: FileEditType.Cell, metadata, uri, edit: { editType: CellEditType.DocumentMetadata, metadata: value } });
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ export class WorkspaceEdit implements vscode.WorkspaceEdit {
|
||||
}
|
||||
}
|
||||
|
||||
private replaceNotebookCellMetadata(uri: URI, index: number, cellMetadata: Record<string, any>, metadata?: vscode.WorkspaceEditEntryMetadata): void {
|
||||
private replaceNotebookCellMetadata(uri: URI, index: number, cellMetadata: Record<string, unknown>, metadata?: vscode.WorkspaceEditEntryMetadata): void {
|
||||
this._edits.push({ _type: FileEditType.Cell, metadata, uri, edit: { editType: CellEditType.Metadata, index, metadata: cellMetadata } });
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ export class WorkspaceEdit implements vscode.WorkspaceEdit {
|
||||
return this.entries().length;
|
||||
}
|
||||
|
||||
toJSON(): any {
|
||||
toJSON(): [URI, TextEdit[]][] {
|
||||
return this.entries();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user