Merge from vscode 8e0f348413f4f616c23a88ae30030efa85811973 (#6381)

* Merge from vscode 8e0f348413f4f616c23a88ae30030efa85811973

* disable strict null check
This commit is contained in:
Anthony Dresser
2019-07-15 22:35:46 -07:00
committed by GitHub
parent f720ec642f
commit 0b7e7ddbf9
2406 changed files with 59140 additions and 35464 deletions

View File

@@ -5,84 +5,196 @@
declare module 'vscode-chokidar' {
// TypeScript Version: 3.0
import * as fs from "fs";
import { EventEmitter } from "events";
/**
* takes paths to be watched recursively and options
* The object's keys are all the directories (using absolute paths unless the `cwd` option was
* used), and the values are arrays of the names of the items contained in each directory.
*/
export function watch(paths: string | string[], options: IOptions): FSWatcher;
export interface IOptions {
/**
* (regexp or function) files to be ignored. This function or regexp is tested against the whole path, not just filename.
* If it is a function with two arguments, it gets called twice per path - once with a single argument (the path), second time with two arguments (the path and the fs.Stats object of that path).
*/
ignored?: any;
/**
* (default: false). Indicates whether the process should continue to run as long as files are being watched.
*/
persistent?: boolean;
/**
* (default: false). Indicates whether to watch files that don't have read permissions.
*/
ignorePermissionErrors?: boolean;
/**
* (default: false). Indicates whether chokidar should ignore the initial add events or not.
*/
ignoreInitial?: boolean;
/**
* (default: 100). Interval of file system polling.
*/
interval?: number;
/**
* (default: 300). Interval of file system polling for binary files (see extensions in src/is-binary).
*/
binaryInterval?: number;
/**
* (default: false on Windows, true on Linux and OS X). Whether to use fs.watchFile (backed by polling), or fs.watch. If polling leads to high CPU utilization, consider setting this to false.
*/
usePolling?: boolean;
/**
* (default: true on OS X). Whether to use the fsevents watching interface if available. When set to true explicitly and fsevents is available this supercedes the usePolling setting. When set to false on OS X, usePolling: true becomes the default.
*/
useFsEvents?: boolean;
/**
* (default: true). When false, only the symlinks themselves will be watched for changes instead of following the link references and bubbling events through the link's path.
*/
followSymlinks?: boolean;
/**
* (default: false). If set to true then the strings passed to .watch() and .add() are treated as literal path names, even if they look like globs.
*/
disableGlobbing?: boolean;
export interface WatchedPaths {
[directory: string]: string[];
}
export interface FSWatcher {
export class FSWatcher extends EventEmitter implements fs.FSWatcher {
add(fileDirOrGlob: string): void;
add(filesDirsOrGlobs: Array<string>): void;
unwatch(fileDirOrGlob: string): void;
unwatch(filesDirsOrGlobs: Array<string>): void;
readonly options?: WatchOptions;
/**
* Listen for an FS event. Available events: add, addDir, change, unlink, unlinkDir, error. Additionally all is available which gets emitted for every non-error event.
* Constructs a new FSWatcher instance with optional WatchOptions parameter.
*/
on(event: string, clb: (type: string, path: string) => void): void;
on(event: string, clb: (error: Error) => void): void;
constructor(options?: WatchOptions);
/**
* Add files, directories, or glob patterns for tracking. Takes an array of strings or just one
* string.
*/
add(paths: string | string[]): void;
/**
* Stop watching files, directories, or glob patterns. Takes an array of strings or just one
* string.
*/
unwatch(paths: string | string[]): void;
/**
* Returns an object representing all the paths on the file system being watched by this
* `FSWatcher` instance. The object's keys are all the directories (using absolute paths unless
* the `cwd` option was used), and the values are arrays of the names of the items contained in
* each directory.
*/
getWatched(): WatchedPaths;
/**
* Removes all listeners from watched files.
*/
close(): void;
options: IOptions;
on(event: 'add' | 'addDir' | 'change', listener: (path: string, stats?: fs.Stats) => void): this;
on(event: 'all', listener: (eventName: 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir', path: string, stats?: fs.Stats) => void): this;
/**
* Error occured
*/
on(event: 'error', listener: (error: Error) => void): this;
/**
* Exposes the native Node `fs.FSWatcher events`
*/
on(event: 'raw', listener: (eventName: string, path: string, details: any) => void): this;
/**
* Fires when the initial scan is complete
*/
on(event: 'ready', listener: () => void): this;
on(event: 'unlink' | 'unlinkDir', listener: (path: string) => void): this;
on(event: string, listener: (...args: any[]) => void): this;
}
export interface WatchOptions {
/**
* Indicates whether the process should continue to run as long as files are being watched. If
* set to `false` when using `fsevents` to watch, no more events will be emitted after `ready`,
* even if the process continues to run.
*/
persistent?: boolean;
/**
* ([anymatch](https://github.com/es128/anymatch)-compatible definition) Defines files/paths to
* be ignored. The whole relative or absolute path is tested, not just filename. If a function
* with two arguments is provided, it gets called twice per path - once with a single argument
* (the path), second time with two arguments (the path and the
* [`fs.Stats`](http://nodejs.org/api/fs.html#fs_class_fs_stats) object of that path).
*/
ignored?: any;
/**
* If set to `false` then `add`/`addDir` events are also emitted for matching paths while
* instantiating the watching as chokidar discovers these file paths (before the `ready` event).
*/
ignoreInitial?: boolean;
/**
* When `false`, only the symlinks themselves will be watched for changes instead of following
* the link references and bubbling events through the link's path.
*/
followSymlinks?: boolean;
/**
* The base directory from which watch `paths` are to be derived. Paths emitted with events will
* be relative to this.
*/
cwd?: string;
/**
* If set to true then the strings passed to .watch() and .add() are treated as literal path
* names, even if they look like globs. Default: false.
*/
disableGlobbing?: boolean;
/**
* Whether to use fs.watchFile (backed by polling), or fs.watch. If polling leads to high CPU
* utilization, consider setting this to `false`. It is typically necessary to **set this to
* `true` to successfully watch files over a network**, and it may be necessary to successfully
* watch files in other non-standard situations. Setting to `true` explicitly on OS X overrides
* the `useFsEvents` default.
*/
usePolling?: boolean;
/**
* Whether to use the `fsevents` watching interface if available. When set to `true` explicitly
* and `fsevents` is available this supercedes the `usePolling` setting. When set to `false` on
* OS X, `usePolling: true` becomes the default.
*/
useFsEvents?: boolean;
/**
* If relying upon the [`fs.Stats`](http://nodejs.org/api/fs.html#fs_class_fs_stats) object that
* may get passed with `add`, `addDir`, and `change` events, set this to `true` to ensure it is
* provided even in cases where it wasn't already available from the underlying watch events.
*/
alwaysStat?: boolean;
/**
* If set, limits how many levels of subdirectories will be traversed.
*/
depth?: number;
/**
* Interval of file system polling.
*/
interval?: number;
/**
* Interval of file system polling for binary files. ([see list of binary extensions](https://gi
* thub.com/sindresorhus/binary-extensions/blob/master/binary-extensions.json))
*/
binaryInterval?: number;
/**
* Indicates whether to watch files that don't have read permissions if possible. If watching
* fails due to `EPERM` or `EACCES` with this set to `true`, the errors will be suppressed
* silently.
*/
ignorePermissionErrors?: boolean;
/**
* `true` if `useFsEvents` and `usePolling` are `false`). Automatically filters out artifacts
* that occur when using editors that use "atomic writes" instead of writing directly to the
* source file. If a file is re-added within 100 ms of being deleted, Chokidar emits a `change`
* event rather than `unlink` then `add`. If the default of 100 ms does not work well for you,
* you can override it by setting `atomic` to a custom value, in milliseconds.
*/
atomic?: boolean | number;
/**
* can be set to an object in order to adjust timing params:
*/
awaitWriteFinish?: AwaitWriteFinishOptions | boolean;
}
export interface AwaitWriteFinishOptions {
/**
* Amount of time in milliseconds for a file size to remain constant before emitting its event.
*/
stabilityThreshold?: number;
/**
* File size polling interval.
*/
pollInterval?: number;
}
/**
* produces an instance of `FSWatcher`.
*/
export function watch(
paths: string | string[],
options?: WatchOptions
): FSWatcher;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,19 +0,0 @@
declare module 'gc-signals' {
export interface GCSignal {
}
/**
* Create a new GC signal. When being garbage collected the passed
* value is stored for later consumption.
*/
export const GCSignal: {
new(id: number): GCSignal;
};
/**
* Consume ids of garbage collected signals.
*/
export function consumeSignals(): number[];
export function onDidGarbageCollectSignals(callback: (ids: number[]) => any): {
dispose(): void;
};
export function trackGarbageCollection(obj: any, id: number): number;
}

View File

@@ -4,6 +4,8 @@
*--------------------------------------------------------------------------------------------*/
interface ArrayConstructor {
isArray<T>(arg: ReadonlyArray<T> | null | undefined): arg is ReadonlyArray<T>;
isArray<T>(arg: Array<T> | null | undefined): arg is Array<T>;
isArray(arg: any): arg is Array<any>;
isArray<T>(arg: any): arg is Array<T>;
}

View File

@@ -3,7 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
declare module 'vscode-nsfw' {
declare module 'nsfw' {
interface NsfwWatcher {
start(): any;
stop(): any;
@@ -22,6 +22,7 @@ declare module 'vscode-nsfw' {
directory: string;
file?: string;
newFile?: string;
newDirectory?: string;
oldFile?: string;
}

33
src/typings/onigasm-umd.d.ts vendored Normal file
View File

@@ -0,0 +1,33 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
declare module "onigasm-umd" {
function loadWASM(data: string | ArrayBuffer): Promise<void>;
class OnigString {
constructor(content: string);
readonly content: string;
readonly dispose?: () => void;
}
class OnigScanner {
constructor(patterns: string[]);
findNextMatchSync(string: string | OnigString, startPosition: number): IOnigMatch;
}
export interface IOnigCaptureIndex {
index: number
start: number
end: number
length: number
}
export interface IOnigMatch {
index: number
captureIndices: IOnigCaptureIndex[]
scanner: OnigScanner
}
}

View File

@@ -17,7 +17,12 @@ declare const enum LoaderEventType {
NodeEndEvaluatingScript = 32,
NodeBeginNativeRequire = 33,
NodeEndNativeRequire = 34
NodeEndNativeRequire = 34,
CachedDataFound = 60,
CachedDataMissed = 61,
CachedDataRejected = 62,
CachedDataCreated = 63,
}
declare class LoaderEvent {

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
// Type definitions for sqlite3 3.1
// Project: https://github.com/mapbox/node-sqlite3
// Project: http://github.com/mapbox/node-sqlite3
// Definitions by: Nick Malaguti <https://github.com/nmalaguti>
// Sumant Manne <https://github.com/dpyro>
// Behind The Math <https://github.com/BehindTheMath>
@@ -18,6 +18,9 @@ declare module 'vscode-sqlite3' {
export const OPEN_READONLY: number;
export const OPEN_READWRITE: number;
export const OPEN_CREATE: number;
export const OPEN_SHAREDCACHE: number;
export const OPEN_PRIVATECACHE: number;
export const OPEN_URI: number;
export const cached: {
Database(filename: string, callback?: (this: Database, err: Error | null) => void): Database;
@@ -100,6 +103,9 @@ declare module 'vscode-sqlite3' {
OPEN_READONLY: number;
OPEN_READWRITE: number;
OPEN_CREATE: number;
OPEN_SHAREDCACHE: number;
OPEN_PRIVATECACHE: number;
OPEN_URI: number;
cached: typeof cached;
RunResult: RunResult;
Statement: typeof Statement;

View File

@@ -30,7 +30,7 @@ declare module "vscode-textmate" {
*/
export interface RegistryOptions {
theme?: IRawTheme;
loadGrammar(scopeName: string): Thenable<IRawGrammar | null> | null;
loadGrammar(scopeName: string): Thenable<IRawGrammar | undefined | null>;
getInjections?(scopeName: string): string[];
getOnigLib?(): Thenable<IOnigLib>;
}
@@ -85,7 +85,7 @@ declare module "vscode-textmate" {
* Load the grammar for `scopeName` and all referenced included grammars asynchronously.
*/
loadGrammar(initialScopeName: string): Thenable<IGrammar>;
private _loadGrammar(initialScopeName, initialLanguage, embeddedLanguages, tokenTypes);
private _loadGrammar;
/**
* Adds a rawGrammar.
*/
@@ -182,7 +182,7 @@ declare module "vscode-textmate" {
equals(other: StackElement): boolean;
}
export const INITIAL: StackElement;
export const parseRawGrammar: (content: string, filePath: string) => IRawGrammar;
export const parseRawGrammar: (content: string, filePath?: string) => IRawGrammar;
export interface ILocation {
readonly filename: string;
readonly line: number;

View File

@@ -0,0 +1,6 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
declare module 'vscode-windows-ca-certs';

View File

@@ -3,10 +3,8 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
declare module getmac {
export function getMac(callback: (error: Error, macAddress: string) => void): void;
declare module 'vsda' {
export class signer {
sign(arg: any): any;
}
}
declare module 'getmac' {
export = getmac;
}

69
src/typings/xterm-addon-search.d.ts vendored Normal file
View File

@@ -0,0 +1,69 @@
/**
* Copyright (c) 2017 The xterm.js authors. All rights reserved.
* @license MIT
*/
// HACK: gulp-tsb doesn't play nice with importing from typings
// import { Terminal, ITerminalAddon } from 'xterm';
declare module 'xterm-addon-search' {
/**
* Options for a search.
*/
export interface ISearchOptions {
/**
* Whether the search term is a regex.
*/
regex?: boolean;
/**
* Whether to search for a whole word, the result is only valid if it's
* suppounded in "non-word" characters such as `_`, `(`, `)` or space.
*/
wholeWord?: boolean;
/**
* Whether the search is case sensitive.
*/
caseSensitive?: boolean;
/**
* Whether to do an indcremental search, this will expand the selection if it
* still matches the term the user typed. Note that this only affects
* `findNext`, not `findPrevious`.
*/
incremental?: boolean;
}
/**
* An xterm.js addon that provides search functionality.
*/
export class SearchAddon {
/**
* Activates the addon
* @param terminal The terminal the addon is being loaded in.
*/
public activate(terminal: any): void;
/**
* Disposes the addon.
*/
public dispose(): void;
/**
* Search forwards for the next result that matches the search term and
* options.
* @param term The search term.
* @param searchOptions The options for the search.
*/
public findNext(term: string, searchOptions?: ISearchOptions): boolean;
/**
* Search backwards for the previous result that matches the search term and
* options.
* @param term The search term.
* @param searchOptions The options for the search.
*/
public findPrevious(term: string, searchOptions?: ISearchOptions): boolean;
}
}

71
src/typings/xterm-addon-web-links.d.ts vendored Normal file
View File

@@ -0,0 +1,71 @@
/**
* Copyright (c) 2017 The xterm.js authors. All rights reserved.
* @license MIT
*/
// HACK: gulp-tsb doesn't play nice with importing from typings
// import { Terminal, ITerminalAddon } from 'xterm';
interface ILinkMatcherOptions {
/**
* The index of the link from the regex.match(text) call. This defaults to 0
* (for regular expressions without capture groups).
*/
matchIndex?: number;
/**
* A callback that validates whether to create an individual link, pass
* whether the link is valid to the callback.
*/
validationCallback?: (uri: string, callback: (isValid: boolean) => void) => void;
/**
* A callback that fires when the mouse hovers over a link for a moment.
*/
tooltipCallback?: (event: MouseEvent, uri: string) => boolean | void;
/**
* A callback that fires when the mouse leaves a link. Note that this can
* happen even when tooltipCallback hasn't fired for the link yet.
*/
leaveCallback?: () => void;
/**
* The priority of the link matcher, this defines the order in which the link
* matcher is evaluated relative to others, from highest to lowest. The
* default value is 0.
*/
priority?: number;
/**
* A callback that fires when the mousedown and click events occur that
* determines whether a link will be activated upon click. This enables
* only activating a link when a certain modifier is held down, if not the
* mouse event will continue propagation (eg. double click to select word).
*/
willLinkActivate?: (event: MouseEvent, uri: string) => boolean;
}
declare module 'xterm-addon-web-links' {
/**
* An xterm.js addon that enables web links.
*/
export class WebLinksAddon {
/**
* Creates a new web links addon.
* @param handler The callback when the link is called.
* @param options Options for the link matcher.
*/
constructor(handler?: (event: MouseEvent, uri: string) => void, options?: ILinkMatcherOptions);
/**
* Activates the addon
* @param terminal The terminal the addon is being loaded in.
*/
public activate(terminal: any): void;
/**
* Disposes the addon.
*/
public dispose(): void;
}
}

View File

@@ -9,7 +9,7 @@
/// <reference lib="dom"/>
declare module 'vscode-xterm' {
declare module 'xterm' {
/**
* A string representing text font weight.
*/
@@ -26,13 +26,14 @@ declare module 'vscode-xterm' {
export interface ITerminalOptions {
/**
* Whether background should support non-opaque color. It must be set before
* executing open() method and can't be changed later without excuting it again.
* Warning: Enabling this option can reduce performances somewhat.
* executing the `Terminal.open()` method and can't be changed later without
* executing it again. Note that enabling this can negatively impact
* performance.
*/
allowTransparency?: boolean;
/**
* A data uri of the sound to use for the bell (needs bellStyle = 'sound').
* A data uri of the sound to use for the bell when `bellStyle = 'sound'`.
*/
bellSound?: string;
@@ -76,31 +77,6 @@ declare module 'vscode-xterm' {
*/
drawBoldTextInBrightColors?: boolean;
/**
* Whether to enable the rendering of bold text.
*
* @deprecated Use fontWeight and fontWeightBold instead.
*/
enableBold?: boolean;
/**
* What character atlas implementation to use. The character atlas caches drawn characters,
* speeding up rendering significantly. However, it can introduce some minor rendering
* artifacts.
*
* - 'none': Don't use an atlas.
* - 'static': Generate an atlas when the terminal starts or is reconfigured. This atlas will
* only contain ASCII characters in 16 colors.
* - 'dynamic': Generate an atlas using a LRU cache as characters are requested. Limited to
* ASCII characters (for now), but supports 256 colors. For characters covered by the static
* cache, it's slightly slower in comparison, since there's more overhead involved in
* managing the cache.
*
* Currently defaults to 'static'. This option may be removed in the future. If it is, passed
* parameters will be ignored.
*/
experimentalCharAtlas?: 'none' | 'static' | 'dynamic';
/**
* The font size used to render text.
*/
@@ -139,9 +115,9 @@ declare module 'vscode-xterm' {
/**
* Whether holding a modifier key will force normal selection behavior,
* regardless of whether the terminal is in mouse events mode. This will
* also prevent mouse events from being emitted by the terminal. For example,
* this allows you to use xterm.js' regular selection inside tmux with
* mouse mode enabled.
* also prevent mouse events from being emitted by the terminal. For
* example, this allows you to use xterm.js' regular selection inside tmux
* with mouse mode enabled.
*/
macOptionClickForcesSelection?: boolean;
@@ -174,8 +150,9 @@ declare module 'vscode-xterm' {
screenReaderMode?: boolean;
/**
* The amount of scrollback in the terminal. Scrollback is the amount of rows
* that are retained when lines are scrolled beyond the initial viewport.
* The amount of scrollback in the terminal. Scrollback is the amount of
* rows that are retained when lines are scrolled beyond the initial
* viewport.
*/
scrollback?: number;
@@ -212,7 +189,7 @@ declare module 'vscode-xterm' {
background?: string,
/** The cursor color */
cursor?: string,
/** The accent color of the cursor (used as the foreground color for a block cursor) */
/** The accent color of the cursor (fg color for a block cursor) */
cursorAccent?: string,
/** The selection color (can be transparent) */
selection?: string,
@@ -278,8 +255,8 @@ declare module 'vscode-xterm' {
leaveCallback?: () => void;
/**
* The priority of the link matcher, this defines the order in which the link
* matcher is evaluated relative to others, from highest to lowest. The
* The priority of the link matcher, this defines the order in which the
* link matcher is evaluated relative to others, from highest to lowest. The
* default value is 0.
*/
priority?: number;
@@ -293,13 +270,6 @@ declare module 'vscode-xterm' {
willLinkActivate?: (event: MouseEvent, uri: string) => boolean;
}
export interface IEventEmitter {
on(type: string, listener: (...args: any[]) => void): void;
off(type: string, listener: (...args: any[]) => void): void;
emit(type: string, data?: any): void;
addDisposableListener(type: string, handler: (...args: any[]) => void): IDisposable;
}
/**
* An object that can be disposed via a dispose function.
*/
@@ -315,22 +285,47 @@ declare module 'vscode-xterm' {
(listener: (e: T) => any): IDisposable;
}
/**
* Represents a specific line in the terminal that is tracked when scrollback
* is trimmed and lines are added or removed.
*/
export interface IMarker extends IDisposable {
/**
* A unique identifier for this marker.
*/
readonly id: number;
/**
* Whether this marker is disposed.
*/
readonly isDisposed: boolean;
/**
* The actual line index in the buffer at this point in time.
*/
readonly line: number;
}
/**
* The set of localizable strings.
*/
export interface ILocalizableStrings {
blankLine: string;
/**
* The aria label for the underlying input textarea for the terminal.
*/
promptLabel: string;
/**
* Announcement for when line reading is suppressed due to too many lines
* being printed to the terminal when `screenReaderMode` is enabled.
*/
tooMuchOutput: string;
}
/**
* The class that represents an xterm.js terminal.
*/
export class Terminal implements IEventEmitter, IDisposable {
export class Terminal implements IDisposable {
/**
* The element containing the terminal.
*/
@@ -454,96 +449,6 @@ declare module 'vscode-xterm' {
*/
focus(): void;
/**
* Registers an event listener.
* @param type The type of the event.
* @param listener The listener.
* @deprecated use `Terminal.onEvent(listener)` instead.
*/
on(type: 'blur' | 'focus' | 'linefeed' | 'selection', listener: () => void): void;
/**
* Registers an event listener.
* @param type The type of the event.
* @param listener The listener.
* @deprecated use `Terminal.onEvent(listener)` instead.
*/
on(type: 'data', listener: (...args: any[]) => void): void;
/**
* Registers an event listener.
* @param type The type of the event.
* @param listener The listener.
* @deprecated use `Terminal.onEvent(listener)` instead.
*/
on(type: 'key', listener: (key: string, event: KeyboardEvent) => void): void;
/**
* Registers an event listener.
* @param type The type of the event.
* @param listener The listener.
* @deprecated use `Terminal.onEvent(listener)` instead.
*/
on(type: 'keypress' | 'keydown', listener: (event: KeyboardEvent) => void): void;
/**
* Registers an event listener.
* @param type The type of the event.
* @param listener The listener.
* @deprecated use `Terminal.onEvent(listener)` instead.
*/
on(type: 'refresh', listener: (data: { start: number, end: number }) => void): void;
/**
* Registers an event listener.
* @param type The type of the event.
* @param listener The listener.
* @deprecated use `Terminal.onEvent(listener)` instead.
*/
on(type: 'resize', listener: (data: { cols: number, rows: number }) => void): void;
/**
* Registers an event listener.
* @param type The type of the event.
* @param listener The listener.
* @deprecated use `Terminal.onEvent(listener)` instead.
*/
on(type: 'scroll', listener: (ydisp: number) => void): void;
/**
* Registers an event listener.
* @param type The type of the event.
* @param listener The listener.
* @deprecated use `Terminal.onEvent(listener)` instead.
*/
on(type: 'title', listener: (title: string) => void): void;
/**
* Registers an event listener.
* @param type The type of the event.
* @param listener The listener.
* @deprecated use `Terminal.onEvent(listener)` instead.
*/
on(type: string, listener: (...args: any[]) => void): void;
/**
* Deregisters an event listener.
* @param type The type of the event.
* @param listener The listener.
* @deprecated use `Terminal.onEvent(listener).dispose()` instead.
*/
off(type: 'blur' | 'focus' | 'linefeed' | 'selection' | 'data' | 'key' | 'keypress' | 'keydown' | 'refresh' | 'resize' | 'scroll' | 'title' | string, listener: (...args: any[]) => void): void;
/**
* Emits an event on the terminal.
* @param type The type of event
* @param data data associated with the event.
* @deprecated This is being removed from the API with no replacement, see
* issue #1505.
*/
emit(type: string, data?: any): void;
/**
* Adds an event listener to the Terminal, returning an IDisposable that can
* be used to conveniently remove the event listener.
* @param type The type of event.
* @param handler The event handler.
* @deprecated use `Terminal.onEvent(listener)` instead.
*/
addDisposableListener(type: string, handler: (...args: any[]) => void): IDisposable;
/**
* Resizes the terminal. It's best practice to debounce calls to resize,
* this will help ensure that the pty can respond to the resize event
@@ -706,13 +611,6 @@ declare module 'vscode-xterm' {
*/
dispose(): void;
/**
* Destroys the terminal and detaches it from the DOM.
*
* @deprecated Use dispose() instead.
*/
destroy(): void;
/**
* Scroll the display of the terminal
* @param amount The number of lines to scroll down (negative scroll up).
@@ -759,9 +657,9 @@ declare module 'vscode-xterm' {
writeln(data: string): void;
/**
* Writes UTF8 data to the terminal.
* This has a slight performance advantage over the string based write method
* due to lesser data conversions needed on the way from the pty to xterm.js.
* Writes UTF8 data to the terminal. This has a slight performance advantage
* over the string based write method due to lesser data conversions needed
* on the way from the pty to xterm.js.
* @param data The data to write to the terminal.
*/
writeUtf8(data: Uint8Array): void;
@@ -775,7 +673,7 @@ declare module 'vscode-xterm' {
* Retrieves an option's value from the terminal.
* @param key The option key.
*/
getOption(key: 'allowTransparency' | 'cancelEvents' | 'convertEol' | 'cursorBlink' | 'debug' | 'disableStdin' | 'enableBold' | 'macOptionIsMeta' | 'rightClickSelectsWord' | 'popOnBell' | 'screenKeys' | 'useFlowControl' | 'visualBell' | 'windowsMode'): boolean;
getOption(key: 'allowTransparency' | 'cancelEvents' | 'convertEol' | 'cursorBlink' | 'debug' | 'disableStdin' | 'macOptionIsMeta' | 'rightClickSelectsWord' | 'popOnBell' | 'screenKeys' | 'useFlowControl' | 'visualBell' | 'windowsMode'): boolean;
/**
* Retrieves an option's value from the terminal.
* @param key The option key.
@@ -826,7 +724,7 @@ declare module 'vscode-xterm' {
* @param key The option key.
* @param value The option value.
*/
setOption(key: 'allowTransparency' | 'cancelEvents' | 'convertEol' | 'cursorBlink' | 'debug' | 'disableStdin' | 'enableBold' | 'macOptionIsMeta' | 'popOnBell' | 'rightClickSelectsWord' | 'screenKeys' | 'useFlowControl' | 'visualBell' | 'windowsMode', value: boolean): void;
setOption(key: 'allowTransparency' | 'cancelEvents' | 'convertEol' | 'cursorBlink' | 'debug' | 'disableStdin' | 'macOptionIsMeta' | 'popOnBell' | 'rightClickSelectsWord' | 'screenKeys' | 'useFlowControl' | 'visualBell' | 'windowsMode', value: boolean): void;
/**
* Sets an option on the terminal.
* @param key The option key.
@@ -897,13 +795,13 @@ declare module 'vscode-xterm' {
*/
export interface ITerminalAddon extends IDisposable {
/**
* (EXPERIMENTAL) This is called when the addon is activated within xterm.js.
* (EXPERIMENTAL) This is called when the addon is activated.
*/
activate(terminal: Terminal): void;
}
/**
* An object representing a selecrtion within the terminal.
* An object representing a selection within the terminal.
*/
interface ISelectionPosition {
/**
@@ -927,6 +825,9 @@ declare module 'vscode-xterm' {
endRow: number;
}
/**
* Represents a terminal buffer.
*/
interface IBuffer {
/**
* The y position of the cursor. This ranges between `0` (when the
@@ -958,16 +859,21 @@ declare module 'vscode-xterm' {
readonly length: number;
/**
* Gets a line from the buffer, or undefined if the line index does not exist.
* Gets a line from the buffer, or undefined if the line index does not
* exist.
*
* Note that the result of this function should be used immediately after calling as when the
* terminal updates it could lead to unexpected behavior.
* Note that the result of this function should be used immediately after
* calling as when the terminal updates it could lead to unexpected
* behavior.
*
* @param y The line index to get.
*/
getLine(y: number): IBufferLine | undefined;
}
/**
* Represents a line in the terminal's buffer.
*/
interface IBufferLine {
/**
* Whether the line is wrapped from the previous line.
@@ -977,16 +883,17 @@ declare module 'vscode-xterm' {
/**
* Gets a cell from the line, or undefined if the line index does not exist.
*
* Note that the result of this function should be used immediately after calling as when the
* terminal updates it could lead to unexpected behavior.
* Note that the result of this function should be used immediately after
* calling as when the terminal updates it could lead to unexpected
* behavior.
*
* @param x The character index to get.
*/
getCell(x: number): IBufferCell;
getCell(x: number): IBufferCell | undefined;
/**
* Gets the line as a string. Note that this is gets only the string for the line, not taking
* isWrapped into account.
* Gets the line as a string. Note that this is gets only the string for the
* line, not taking isWrapped into account.
*
* @param trimRight Whether to trim any whitespace at the right of the line.
* @param startColumn The column to start from (inclusive).
@@ -995,6 +902,9 @@ declare module 'vscode-xterm' {
translateToString(trimRight?: boolean, startColumn?: number, endColumn?: number): string;
}
/**
* Represents a single cell in the terminal's buffer.
*/
interface IBufferCell {
/**
* The character within the cell.
@@ -1013,19 +923,24 @@ declare module 'vscode-xterm' {
}
// Modifications to official .d.ts below
declare module 'vscode-xterm' {
declare module 'xterm' {
interface TerminalCore {
debug: boolean;
handler(text: string): void;
_onScroll: IEventEmitter2<number>;
_onKey: IEventEmitter2<{ key: string }>;
_onScroll: IEventEmitter<number>;
_onKey: IEventEmitter<{ key: string }>;
charMeasure?: { height: number, width: number };
_charSizeService: {
width: number;
height: number;
}
_renderCoordinator: {
_renderService: {
_renderer: {
_renderLayers: any[];
};
@@ -1033,46 +948,11 @@ declare module 'vscode-xterm' {
};
}
interface IEventEmitter2<T> {
interface IEventEmitter<T> {
fire(e: T): void;
}
interface ISearchOptions {
/**
* Whether the find should be done as a regex.
*/
regex?: boolean;
/**
* Whether only whole words should match.
*/
wholeWord?: boolean;
/**
* Whether find should pay attention to case.
*/
caseSensitive?: boolean;
}
interface Terminal {
_core: TerminalCore;
webLinksInit(handler?: (event: MouseEvent, uri: string) => void, options?: ILinkMatcherOptions): void;
/**
* Find the next instance of the term, then scroll to and select it. If it
* doesn't exist, do nothing.
* @param term The search term.
* @param findOptions Regex, whole word, and case sensitive options.
* @return Whether a result was found.
*/
findNext(term: string, findOptions: ISearchOptions): boolean;
/**
* Find the previous instance of the term, then scroll to and select it. If it
* doesn't exist, do nothing.
* @param term The search term.
* @param findOptions Regex, whole word, and case sensitive options.
* @return Whether a result was found.
*/
findPrevious(term: string, findOptions: ISearchOptions): boolean;
}
}
}