Merge pull request #15966 from Microsoft/kind
Make ScriptElementKind and HighlightSpanKind string enums
This commit is contained in:
commit
73ee2feb51
|
@ -69,3 +69,5 @@ function createCancellationToken(args) {
|
|||
}
|
||||
}
|
||||
module.exports = createCancellationToken;
|
||||
|
||||
//# sourceMappingURL=cancellationToken.js.map
|
||||
|
|
8723
lib/lib.d.ts
vendored
8723
lib/lib.d.ts
vendored
File diff suppressed because it is too large
Load diff
8723
lib/lib.dom.d.ts
vendored
8723
lib/lib.dom.d.ts
vendored
File diff suppressed because it is too large
Load diff
10547
lib/lib.es2016.full.d.ts
vendored
10547
lib/lib.es2016.full.d.ts
vendored
File diff suppressed because it is too large
Load diff
10547
lib/lib.es2017.full.d.ts
vendored
10547
lib/lib.es2017.full.d.ts
vendored
File diff suppressed because it is too large
Load diff
8723
lib/lib.es6.d.ts
vendored
8723
lib/lib.es6.d.ts
vendored
File diff suppressed because it is too large
Load diff
10547
lib/lib.esnext.full.d.ts
vendored
10547
lib/lib.esnext.full.d.ts
vendored
File diff suppressed because it is too large
Load diff
277
lib/lib.webworker.d.ts
vendored
277
lib/lib.webworker.d.ts
vendored
|
@ -20,7 +20,7 @@ and limitations under the License.
|
|||
|
||||
|
||||
/////////////////////////////
|
||||
/// Worker APIs
|
||||
/// IE Worker APIs
|
||||
/////////////////////////////
|
||||
|
||||
interface Algorithm {
|
||||
|
@ -28,16 +28,16 @@ interface Algorithm {
|
|||
}
|
||||
|
||||
interface CacheQueryOptions {
|
||||
cacheName?: string;
|
||||
ignoreMethod?: boolean;
|
||||
ignoreSearch?: boolean;
|
||||
ignoreMethod?: boolean;
|
||||
ignoreVary?: boolean;
|
||||
cacheName?: string;
|
||||
}
|
||||
|
||||
interface CloseEventInit extends EventInit {
|
||||
wasClean?: boolean;
|
||||
code?: number;
|
||||
reason?: string;
|
||||
wasClean?: boolean;
|
||||
}
|
||||
|
||||
interface EventInit {
|
||||
|
@ -69,16 +69,16 @@ interface MessageEventInit extends EventInit {
|
|||
channel?: string;
|
||||
data?: any;
|
||||
origin?: string;
|
||||
ports?: MessagePort[];
|
||||
source?: any;
|
||||
ports?: MessagePort[];
|
||||
}
|
||||
|
||||
interface NotificationOptions {
|
||||
body?: string;
|
||||
dir?: NotificationDirection;
|
||||
icon?: string;
|
||||
lang?: string;
|
||||
body?: string;
|
||||
tag?: string;
|
||||
icon?: string;
|
||||
}
|
||||
|
||||
interface ObjectURLOptions {
|
||||
|
@ -86,29 +86,29 @@ interface ObjectURLOptions {
|
|||
}
|
||||
|
||||
interface PushSubscriptionOptionsInit {
|
||||
applicationServerKey?: any;
|
||||
userVisibleOnly?: boolean;
|
||||
applicationServerKey?: any;
|
||||
}
|
||||
|
||||
interface RequestInit {
|
||||
body?: any;
|
||||
cache?: RequestCache;
|
||||
credentials?: RequestCredentials;
|
||||
headers?: any;
|
||||
integrity?: string;
|
||||
keepalive?: boolean;
|
||||
method?: string;
|
||||
mode?: RequestMode;
|
||||
redirect?: RequestRedirect;
|
||||
headers?: any;
|
||||
body?: any;
|
||||
referrer?: string;
|
||||
referrerPolicy?: ReferrerPolicy;
|
||||
mode?: RequestMode;
|
||||
credentials?: RequestCredentials;
|
||||
cache?: RequestCache;
|
||||
redirect?: RequestRedirect;
|
||||
integrity?: string;
|
||||
keepalive?: boolean;
|
||||
window?: any;
|
||||
}
|
||||
|
||||
interface ResponseInit {
|
||||
headers?: any;
|
||||
status?: number;
|
||||
statusText?: string;
|
||||
headers?: any;
|
||||
}
|
||||
|
||||
interface ClientQueryOptions {
|
||||
|
@ -176,7 +176,7 @@ interface AudioBuffer {
|
|||
declare var AudioBuffer: {
|
||||
prototype: AudioBuffer;
|
||||
new(): AudioBuffer;
|
||||
};
|
||||
}
|
||||
|
||||
interface Blob {
|
||||
readonly size: number;
|
||||
|
@ -189,7 +189,7 @@ interface Blob {
|
|||
declare var Blob: {
|
||||
prototype: Blob;
|
||||
new (blobParts?: any[], options?: BlobPropertyBag): Blob;
|
||||
};
|
||||
}
|
||||
|
||||
interface Cache {
|
||||
add(request: RequestInfo): Promise<void>;
|
||||
|
@ -204,7 +204,7 @@ interface Cache {
|
|||
declare var Cache: {
|
||||
prototype: Cache;
|
||||
new(): Cache;
|
||||
};
|
||||
}
|
||||
|
||||
interface CacheStorage {
|
||||
delete(cacheName: string): Promise<boolean>;
|
||||
|
@ -217,7 +217,7 @@ interface CacheStorage {
|
|||
declare var CacheStorage: {
|
||||
prototype: CacheStorage;
|
||||
new(): CacheStorage;
|
||||
};
|
||||
}
|
||||
|
||||
interface CloseEvent extends Event {
|
||||
readonly code: number;
|
||||
|
@ -229,7 +229,7 @@ interface CloseEvent extends Event {
|
|||
declare var CloseEvent: {
|
||||
prototype: CloseEvent;
|
||||
new(typeArg: string, eventInitDict?: CloseEventInit): CloseEvent;
|
||||
};
|
||||
}
|
||||
|
||||
interface Console {
|
||||
assert(test?: boolean, message?: string, ...optionalParams: any[]): void;
|
||||
|
@ -240,8 +240,8 @@ interface Console {
|
|||
dirxml(value: any): void;
|
||||
error(message?: any, ...optionalParams: any[]): void;
|
||||
exception(message?: string, ...optionalParams: any[]): void;
|
||||
group(groupTitle?: string, ...optionalParams: any[]): void;
|
||||
groupCollapsed(groupTitle?: string, ...optionalParams: any[]): void;
|
||||
group(groupTitle?: string): void;
|
||||
groupCollapsed(groupTitle?: string): void;
|
||||
groupEnd(): void;
|
||||
info(message?: any, ...optionalParams: any[]): void;
|
||||
log(message?: any, ...optionalParams: any[]): void;
|
||||
|
@ -259,7 +259,7 @@ interface Console {
|
|||
declare var Console: {
|
||||
prototype: Console;
|
||||
new(): Console;
|
||||
};
|
||||
}
|
||||
|
||||
interface Coordinates {
|
||||
readonly accuracy: number;
|
||||
|
@ -274,7 +274,7 @@ interface Coordinates {
|
|||
declare var Coordinates: {
|
||||
prototype: Coordinates;
|
||||
new(): Coordinates;
|
||||
};
|
||||
}
|
||||
|
||||
interface CryptoKey {
|
||||
readonly algorithm: KeyAlgorithm;
|
||||
|
@ -286,7 +286,7 @@ interface CryptoKey {
|
|||
declare var CryptoKey: {
|
||||
prototype: CryptoKey;
|
||||
new(): CryptoKey;
|
||||
};
|
||||
}
|
||||
|
||||
interface DOMError {
|
||||
readonly name: string;
|
||||
|
@ -296,7 +296,7 @@ interface DOMError {
|
|||
declare var DOMError: {
|
||||
prototype: DOMError;
|
||||
new(): DOMError;
|
||||
};
|
||||
}
|
||||
|
||||
interface DOMException {
|
||||
readonly code: number;
|
||||
|
@ -316,10 +316,10 @@ interface DOMException {
|
|||
readonly INVALID_STATE_ERR: number;
|
||||
readonly NAMESPACE_ERR: number;
|
||||
readonly NETWORK_ERR: number;
|
||||
readonly NO_DATA_ALLOWED_ERR: number;
|
||||
readonly NO_MODIFICATION_ALLOWED_ERR: number;
|
||||
readonly NOT_FOUND_ERR: number;
|
||||
readonly NOT_SUPPORTED_ERR: number;
|
||||
readonly NO_DATA_ALLOWED_ERR: number;
|
||||
readonly NO_MODIFICATION_ALLOWED_ERR: number;
|
||||
readonly PARSE_ERR: number;
|
||||
readonly QUOTA_EXCEEDED_ERR: number;
|
||||
readonly SECURITY_ERR: number;
|
||||
|
@ -348,10 +348,10 @@ declare var DOMException: {
|
|||
readonly INVALID_STATE_ERR: number;
|
||||
readonly NAMESPACE_ERR: number;
|
||||
readonly NETWORK_ERR: number;
|
||||
readonly NO_DATA_ALLOWED_ERR: number;
|
||||
readonly NO_MODIFICATION_ALLOWED_ERR: number;
|
||||
readonly NOT_FOUND_ERR: number;
|
||||
readonly NOT_SUPPORTED_ERR: number;
|
||||
readonly NO_DATA_ALLOWED_ERR: number;
|
||||
readonly NO_MODIFICATION_ALLOWED_ERR: number;
|
||||
readonly PARSE_ERR: number;
|
||||
readonly QUOTA_EXCEEDED_ERR: number;
|
||||
readonly SECURITY_ERR: number;
|
||||
|
@ -362,7 +362,7 @@ declare var DOMException: {
|
|||
readonly URL_MISMATCH_ERR: number;
|
||||
readonly VALIDATION_ERR: number;
|
||||
readonly WRONG_DOCUMENT_ERR: number;
|
||||
};
|
||||
}
|
||||
|
||||
interface DOMStringList {
|
||||
readonly length: number;
|
||||
|
@ -374,7 +374,7 @@ interface DOMStringList {
|
|||
declare var DOMStringList: {
|
||||
prototype: DOMStringList;
|
||||
new(): DOMStringList;
|
||||
};
|
||||
}
|
||||
|
||||
interface ErrorEvent extends Event {
|
||||
readonly colno: number;
|
||||
|
@ -388,12 +388,12 @@ interface ErrorEvent extends Event {
|
|||
declare var ErrorEvent: {
|
||||
prototype: ErrorEvent;
|
||||
new(type: string, errorEventInitDict?: ErrorEventInit): ErrorEvent;
|
||||
};
|
||||
}
|
||||
|
||||
interface Event {
|
||||
readonly bubbles: boolean;
|
||||
readonly cancelable: boolean;
|
||||
cancelBubble: boolean;
|
||||
readonly cancelable: boolean;
|
||||
readonly currentTarget: EventTarget;
|
||||
readonly defaultPrevented: boolean;
|
||||
readonly eventPhase: number;
|
||||
|
@ -420,7 +420,7 @@ declare var Event: {
|
|||
readonly AT_TARGET: number;
|
||||
readonly BUBBLING_PHASE: number;
|
||||
readonly CAPTURING_PHASE: number;
|
||||
};
|
||||
}
|
||||
|
||||
interface EventTarget {
|
||||
addEventListener(type: string, listener?: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
||||
|
@ -431,7 +431,7 @@ interface EventTarget {
|
|||
declare var EventTarget: {
|
||||
prototype: EventTarget;
|
||||
new(): EventTarget;
|
||||
};
|
||||
}
|
||||
|
||||
interface File extends Blob {
|
||||
readonly lastModifiedDate: any;
|
||||
|
@ -442,7 +442,7 @@ interface File extends Blob {
|
|||
declare var File: {
|
||||
prototype: File;
|
||||
new (parts: (ArrayBuffer | ArrayBufferView | Blob | string)[], filename: string, properties?: FilePropertyBag): File;
|
||||
};
|
||||
}
|
||||
|
||||
interface FileList {
|
||||
readonly length: number;
|
||||
|
@ -453,7 +453,7 @@ interface FileList {
|
|||
declare var FileList: {
|
||||
prototype: FileList;
|
||||
new(): FileList;
|
||||
};
|
||||
}
|
||||
|
||||
interface FileReader extends EventTarget, MSBaseReader {
|
||||
readonly error: DOMError;
|
||||
|
@ -468,17 +468,8 @@ interface FileReader extends EventTarget, MSBaseReader {
|
|||
declare var FileReader: {
|
||||
prototype: FileReader;
|
||||
new(): FileReader;
|
||||
};
|
||||
|
||||
interface FormData {
|
||||
append(name: string, value: string | Blob, fileName?: string): void;
|
||||
}
|
||||
|
||||
declare var FormData: {
|
||||
prototype: FormData;
|
||||
new(): FormData;
|
||||
};
|
||||
|
||||
interface Headers {
|
||||
append(name: string, value: string): void;
|
||||
delete(name: string): void;
|
||||
|
@ -491,7 +482,7 @@ interface Headers {
|
|||
declare var Headers: {
|
||||
prototype: Headers;
|
||||
new(init?: any): Headers;
|
||||
};
|
||||
}
|
||||
|
||||
interface IDBCursor {
|
||||
readonly direction: IDBCursorDirection;
|
||||
|
@ -515,7 +506,7 @@ declare var IDBCursor: {
|
|||
readonly NEXT_NO_DUPLICATE: string;
|
||||
readonly PREV: string;
|
||||
readonly PREV_NO_DUPLICATE: string;
|
||||
};
|
||||
}
|
||||
|
||||
interface IDBCursorWithValue extends IDBCursor {
|
||||
readonly value: any;
|
||||
|
@ -524,7 +515,7 @@ interface IDBCursorWithValue extends IDBCursor {
|
|||
declare var IDBCursorWithValue: {
|
||||
prototype: IDBCursorWithValue;
|
||||
new(): IDBCursorWithValue;
|
||||
};
|
||||
}
|
||||
|
||||
interface IDBDatabaseEventMap {
|
||||
"abort": Event;
|
||||
|
@ -541,7 +532,7 @@ interface IDBDatabase extends EventTarget {
|
|||
close(): void;
|
||||
createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore;
|
||||
deleteObjectStore(name: string): void;
|
||||
transaction(storeNames: string | string[], mode?: IDBTransactionMode): IDBTransaction;
|
||||
transaction(storeNames: string | string[], mode?: string): IDBTransaction;
|
||||
addEventListener(type: "versionchange", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener<K extends keyof IDBDatabaseEventMap>(type: K, listener: (this: IDBDatabase, ev: IDBDatabaseEventMap[K]) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
|
@ -550,7 +541,7 @@ interface IDBDatabase extends EventTarget {
|
|||
declare var IDBDatabase: {
|
||||
prototype: IDBDatabase;
|
||||
new(): IDBDatabase;
|
||||
};
|
||||
}
|
||||
|
||||
interface IDBFactory {
|
||||
cmp(first: any, second: any): number;
|
||||
|
@ -561,7 +552,7 @@ interface IDBFactory {
|
|||
declare var IDBFactory: {
|
||||
prototype: IDBFactory;
|
||||
new(): IDBFactory;
|
||||
};
|
||||
}
|
||||
|
||||
interface IDBIndex {
|
||||
keyPath: string | string[];
|
||||
|
@ -572,14 +563,14 @@ interface IDBIndex {
|
|||
count(key?: IDBKeyRange | IDBValidKey): IDBRequest;
|
||||
get(key: IDBKeyRange | IDBValidKey): IDBRequest;
|
||||
getKey(key: IDBKeyRange | IDBValidKey): IDBRequest;
|
||||
openCursor(range?: IDBKeyRange | IDBValidKey, direction?: IDBCursorDirection): IDBRequest;
|
||||
openKeyCursor(range?: IDBKeyRange | IDBValidKey, direction?: IDBCursorDirection): IDBRequest;
|
||||
openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest;
|
||||
openKeyCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest;
|
||||
}
|
||||
|
||||
declare var IDBIndex: {
|
||||
prototype: IDBIndex;
|
||||
new(): IDBIndex;
|
||||
};
|
||||
}
|
||||
|
||||
interface IDBKeyRange {
|
||||
readonly lower: any;
|
||||
|
@ -595,7 +586,7 @@ declare var IDBKeyRange: {
|
|||
lowerBound(lower: any, open?: boolean): IDBKeyRange;
|
||||
only(value: any): IDBKeyRange;
|
||||
upperBound(upper: any, open?: boolean): IDBKeyRange;
|
||||
};
|
||||
}
|
||||
|
||||
interface IDBObjectStore {
|
||||
readonly indexNames: DOMStringList;
|
||||
|
@ -611,14 +602,14 @@ interface IDBObjectStore {
|
|||
deleteIndex(indexName: string): void;
|
||||
get(key: any): IDBRequest;
|
||||
index(name: string): IDBIndex;
|
||||
openCursor(range?: IDBKeyRange | IDBValidKey, direction?: IDBCursorDirection): IDBRequest;
|
||||
openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest;
|
||||
put(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest;
|
||||
}
|
||||
|
||||
declare var IDBObjectStore: {
|
||||
prototype: IDBObjectStore;
|
||||
new(): IDBObjectStore;
|
||||
};
|
||||
}
|
||||
|
||||
interface IDBOpenDBRequestEventMap extends IDBRequestEventMap {
|
||||
"blocked": Event;
|
||||
|
@ -635,7 +626,7 @@ interface IDBOpenDBRequest extends IDBRequest {
|
|||
declare var IDBOpenDBRequest: {
|
||||
prototype: IDBOpenDBRequest;
|
||||
new(): IDBOpenDBRequest;
|
||||
};
|
||||
}
|
||||
|
||||
interface IDBRequestEventMap {
|
||||
"error": Event;
|
||||
|
@ -643,7 +634,7 @@ interface IDBRequestEventMap {
|
|||
}
|
||||
|
||||
interface IDBRequest extends EventTarget {
|
||||
readonly error: DOMException;
|
||||
readonly error: DOMError;
|
||||
onerror: (this: IDBRequest, ev: Event) => any;
|
||||
onsuccess: (this: IDBRequest, ev: Event) => any;
|
||||
readonly readyState: IDBRequestReadyState;
|
||||
|
@ -657,7 +648,7 @@ interface IDBRequest extends EventTarget {
|
|||
declare var IDBRequest: {
|
||||
prototype: IDBRequest;
|
||||
new(): IDBRequest;
|
||||
};
|
||||
}
|
||||
|
||||
interface IDBTransactionEventMap {
|
||||
"abort": Event;
|
||||
|
@ -667,7 +658,7 @@ interface IDBTransactionEventMap {
|
|||
|
||||
interface IDBTransaction extends EventTarget {
|
||||
readonly db: IDBDatabase;
|
||||
readonly error: DOMException;
|
||||
readonly error: DOMError;
|
||||
readonly mode: IDBTransactionMode;
|
||||
onabort: (this: IDBTransaction, ev: Event) => any;
|
||||
oncomplete: (this: IDBTransaction, ev: Event) => any;
|
||||
|
@ -687,7 +678,7 @@ declare var IDBTransaction: {
|
|||
readonly READ_ONLY: string;
|
||||
readonly READ_WRITE: string;
|
||||
readonly VERSION_CHANGE: string;
|
||||
};
|
||||
}
|
||||
|
||||
interface IDBVersionChangeEvent extends Event {
|
||||
readonly newVersion: number | null;
|
||||
|
@ -697,7 +688,7 @@ interface IDBVersionChangeEvent extends Event {
|
|||
declare var IDBVersionChangeEvent: {
|
||||
prototype: IDBVersionChangeEvent;
|
||||
new(): IDBVersionChangeEvent;
|
||||
};
|
||||
}
|
||||
|
||||
interface ImageData {
|
||||
data: Uint8ClampedArray;
|
||||
|
@ -709,7 +700,7 @@ declare var ImageData: {
|
|||
prototype: ImageData;
|
||||
new(width: number, height: number): ImageData;
|
||||
new(array: Uint8ClampedArray, width: number, height: number): ImageData;
|
||||
};
|
||||
}
|
||||
|
||||
interface MessageChannel {
|
||||
readonly port1: MessagePort;
|
||||
|
@ -719,7 +710,7 @@ interface MessageChannel {
|
|||
declare var MessageChannel: {
|
||||
prototype: MessageChannel;
|
||||
new(): MessageChannel;
|
||||
};
|
||||
}
|
||||
|
||||
interface MessageEvent extends Event {
|
||||
readonly data: any;
|
||||
|
@ -732,7 +723,7 @@ interface MessageEvent extends Event {
|
|||
declare var MessageEvent: {
|
||||
prototype: MessageEvent;
|
||||
new(type: string, eventInitDict?: MessageEventInit): MessageEvent;
|
||||
};
|
||||
}
|
||||
|
||||
interface MessagePortEventMap {
|
||||
"message": MessageEvent;
|
||||
|
@ -750,7 +741,7 @@ interface MessagePort extends EventTarget {
|
|||
declare var MessagePort: {
|
||||
prototype: MessagePort;
|
||||
new(): MessagePort;
|
||||
};
|
||||
}
|
||||
|
||||
interface NotificationEventMap {
|
||||
"click": Event;
|
||||
|
@ -780,7 +771,7 @@ declare var Notification: {
|
|||
prototype: Notification;
|
||||
new(title: string, options?: NotificationOptions): Notification;
|
||||
requestPermission(callback?: NotificationPermissionCallback): Promise<NotificationPermission>;
|
||||
};
|
||||
}
|
||||
|
||||
interface Performance {
|
||||
readonly navigation: PerformanceNavigation;
|
||||
|
@ -803,7 +794,7 @@ interface Performance {
|
|||
declare var Performance: {
|
||||
prototype: Performance;
|
||||
new(): Performance;
|
||||
};
|
||||
}
|
||||
|
||||
interface PerformanceNavigation {
|
||||
readonly redirectCount: number;
|
||||
|
@ -822,18 +813,18 @@ declare var PerformanceNavigation: {
|
|||
readonly TYPE_NAVIGATE: number;
|
||||
readonly TYPE_RELOAD: number;
|
||||
readonly TYPE_RESERVED: number;
|
||||
};
|
||||
}
|
||||
|
||||
interface PerformanceTiming {
|
||||
readonly connectEnd: number;
|
||||
readonly connectStart: number;
|
||||
readonly domainLookupEnd: number;
|
||||
readonly domainLookupStart: number;
|
||||
readonly domComplete: number;
|
||||
readonly domContentLoadedEventEnd: number;
|
||||
readonly domContentLoadedEventStart: number;
|
||||
readonly domInteractive: number;
|
||||
readonly domLoading: number;
|
||||
readonly domainLookupEnd: number;
|
||||
readonly domainLookupStart: number;
|
||||
readonly fetchStart: number;
|
||||
readonly loadEventEnd: number;
|
||||
readonly loadEventStart: number;
|
||||
|
@ -853,7 +844,7 @@ interface PerformanceTiming {
|
|||
declare var PerformanceTiming: {
|
||||
prototype: PerformanceTiming;
|
||||
new(): PerformanceTiming;
|
||||
};
|
||||
}
|
||||
|
||||
interface Position {
|
||||
readonly coords: Coordinates;
|
||||
|
@ -863,7 +854,7 @@ interface Position {
|
|||
declare var Position: {
|
||||
prototype: Position;
|
||||
new(): Position;
|
||||
};
|
||||
}
|
||||
|
||||
interface PositionError {
|
||||
readonly code: number;
|
||||
|
@ -880,7 +871,7 @@ declare var PositionError: {
|
|||
readonly PERMISSION_DENIED: number;
|
||||
readonly POSITION_UNAVAILABLE: number;
|
||||
readonly TIMEOUT: number;
|
||||
};
|
||||
}
|
||||
|
||||
interface ProgressEvent extends Event {
|
||||
readonly lengthComputable: boolean;
|
||||
|
@ -892,7 +883,7 @@ interface ProgressEvent extends Event {
|
|||
declare var ProgressEvent: {
|
||||
prototype: ProgressEvent;
|
||||
new(type: string, eventInitDict?: ProgressEventInit): ProgressEvent;
|
||||
};
|
||||
}
|
||||
|
||||
interface PushManager {
|
||||
getSubscription(): Promise<PushSubscription>;
|
||||
|
@ -903,7 +894,7 @@ interface PushManager {
|
|||
declare var PushManager: {
|
||||
prototype: PushManager;
|
||||
new(): PushManager;
|
||||
};
|
||||
}
|
||||
|
||||
interface PushSubscription {
|
||||
readonly endpoint: USVString;
|
||||
|
@ -916,7 +907,7 @@ interface PushSubscription {
|
|||
declare var PushSubscription: {
|
||||
prototype: PushSubscription;
|
||||
new(): PushSubscription;
|
||||
};
|
||||
}
|
||||
|
||||
interface PushSubscriptionOptions {
|
||||
readonly applicationServerKey: ArrayBuffer | null;
|
||||
|
@ -926,7 +917,7 @@ interface PushSubscriptionOptions {
|
|||
declare var PushSubscriptionOptions: {
|
||||
prototype: PushSubscriptionOptions;
|
||||
new(): PushSubscriptionOptions;
|
||||
};
|
||||
}
|
||||
|
||||
interface ReadableStream {
|
||||
readonly locked: boolean;
|
||||
|
@ -937,7 +928,7 @@ interface ReadableStream {
|
|||
declare var ReadableStream: {
|
||||
prototype: ReadableStream;
|
||||
new(): ReadableStream;
|
||||
};
|
||||
}
|
||||
|
||||
interface ReadableStreamReader {
|
||||
cancel(): Promise<void>;
|
||||
|
@ -948,7 +939,7 @@ interface ReadableStreamReader {
|
|||
declare var ReadableStreamReader: {
|
||||
prototype: ReadableStreamReader;
|
||||
new(): ReadableStreamReader;
|
||||
};
|
||||
}
|
||||
|
||||
interface Request extends Object, Body {
|
||||
readonly cache: RequestCache;
|
||||
|
@ -970,7 +961,7 @@ interface Request extends Object, Body {
|
|||
declare var Request: {
|
||||
prototype: Request;
|
||||
new(input: Request | string, init?: RequestInit): Request;
|
||||
};
|
||||
}
|
||||
|
||||
interface Response extends Object, Body {
|
||||
readonly body: ReadableStream | null;
|
||||
|
@ -986,9 +977,7 @@ interface Response extends Object, Body {
|
|||
declare var Response: {
|
||||
prototype: Response;
|
||||
new(body?: any, init?: ResponseInit): Response;
|
||||
error: () => Response;
|
||||
redirect: (url: string, status?: number) => Response;
|
||||
};
|
||||
}
|
||||
|
||||
interface ServiceWorkerEventMap extends AbstractWorkerEventMap {
|
||||
"statechange": Event;
|
||||
|
@ -1006,7 +995,7 @@ interface ServiceWorker extends EventTarget, AbstractWorker {
|
|||
declare var ServiceWorker: {
|
||||
prototype: ServiceWorker;
|
||||
new(): ServiceWorker;
|
||||
};
|
||||
}
|
||||
|
||||
interface ServiceWorkerRegistrationEventMap {
|
||||
"updatefound": Event;
|
||||
|
@ -1031,7 +1020,7 @@ interface ServiceWorkerRegistration extends EventTarget {
|
|||
declare var ServiceWorkerRegistration: {
|
||||
prototype: ServiceWorkerRegistration;
|
||||
new(): ServiceWorkerRegistration;
|
||||
};
|
||||
}
|
||||
|
||||
interface SyncManager {
|
||||
getTags(): any;
|
||||
|
@ -1041,7 +1030,7 @@ interface SyncManager {
|
|||
declare var SyncManager: {
|
||||
prototype: SyncManager;
|
||||
new(): SyncManager;
|
||||
};
|
||||
}
|
||||
|
||||
interface URL {
|
||||
hash: string;
|
||||
|
@ -1064,7 +1053,7 @@ declare var URL: {
|
|||
new(url: string, base?: string): URL;
|
||||
createObjectURL(object: any, options?: ObjectURLOptions): string;
|
||||
revokeObjectURL(url: string): void;
|
||||
};
|
||||
}
|
||||
|
||||
interface WebSocketEventMap {
|
||||
"close": CloseEvent;
|
||||
|
@ -1101,7 +1090,7 @@ declare var WebSocket: {
|
|||
readonly CLOSING: number;
|
||||
readonly CONNECTING: number;
|
||||
readonly OPEN: number;
|
||||
};
|
||||
}
|
||||
|
||||
interface WorkerEventMap extends AbstractWorkerEventMap {
|
||||
"message": MessageEvent;
|
||||
|
@ -1118,7 +1107,7 @@ interface Worker extends EventTarget, AbstractWorker {
|
|||
declare var Worker: {
|
||||
prototype: Worker;
|
||||
new(stringUrl: string): Worker;
|
||||
};
|
||||
}
|
||||
|
||||
interface XMLHttpRequestEventMap extends XMLHttpRequestEventTargetEventMap {
|
||||
"readystatechange": Event;
|
||||
|
@ -1164,7 +1153,7 @@ declare var XMLHttpRequest: {
|
|||
readonly LOADING: number;
|
||||
readonly OPENED: number;
|
||||
readonly UNSENT: number;
|
||||
};
|
||||
}
|
||||
|
||||
interface XMLHttpRequestUpload extends EventTarget, XMLHttpRequestEventTarget {
|
||||
addEventListener<K extends keyof XMLHttpRequestEventTargetEventMap>(type: K, listener: (this: XMLHttpRequestUpload, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void;
|
||||
|
@ -1174,7 +1163,7 @@ interface XMLHttpRequestUpload extends EventTarget, XMLHttpRequestEventTarget {
|
|||
declare var XMLHttpRequestUpload: {
|
||||
prototype: XMLHttpRequestUpload;
|
||||
new(): XMLHttpRequestUpload;
|
||||
};
|
||||
}
|
||||
|
||||
interface AbstractWorkerEventMap {
|
||||
"error": ErrorEvent;
|
||||
|
@ -1289,7 +1278,7 @@ interface Client {
|
|||
declare var Client: {
|
||||
prototype: Client;
|
||||
new(): Client;
|
||||
};
|
||||
}
|
||||
|
||||
interface Clients {
|
||||
claim(): Promise<void>;
|
||||
|
@ -1301,7 +1290,7 @@ interface Clients {
|
|||
declare var Clients: {
|
||||
prototype: Clients;
|
||||
new(): Clients;
|
||||
};
|
||||
}
|
||||
|
||||
interface DedicatedWorkerGlobalScopeEventMap extends WorkerGlobalScopeEventMap {
|
||||
"message": MessageEvent;
|
||||
|
@ -1318,7 +1307,7 @@ interface DedicatedWorkerGlobalScope extends WorkerGlobalScope {
|
|||
declare var DedicatedWorkerGlobalScope: {
|
||||
prototype: DedicatedWorkerGlobalScope;
|
||||
new(): DedicatedWorkerGlobalScope;
|
||||
};
|
||||
}
|
||||
|
||||
interface ExtendableEvent extends Event {
|
||||
waitUntil(f: Promise<any>): void;
|
||||
|
@ -1327,7 +1316,7 @@ interface ExtendableEvent extends Event {
|
|||
declare var ExtendableEvent: {
|
||||
prototype: ExtendableEvent;
|
||||
new(type: string, eventInitDict?: ExtendableEventInit): ExtendableEvent;
|
||||
};
|
||||
}
|
||||
|
||||
interface ExtendableMessageEvent extends ExtendableEvent {
|
||||
readonly data: any;
|
||||
|
@ -1340,7 +1329,7 @@ interface ExtendableMessageEvent extends ExtendableEvent {
|
|||
declare var ExtendableMessageEvent: {
|
||||
prototype: ExtendableMessageEvent;
|
||||
new(type: string, eventInitDict?: ExtendableMessageEventInit): ExtendableMessageEvent;
|
||||
};
|
||||
}
|
||||
|
||||
interface FetchEvent extends ExtendableEvent {
|
||||
readonly clientId: string | null;
|
||||
|
@ -1352,7 +1341,7 @@ interface FetchEvent extends ExtendableEvent {
|
|||
declare var FetchEvent: {
|
||||
prototype: FetchEvent;
|
||||
new(type: string, eventInitDict: FetchEventInit): FetchEvent;
|
||||
};
|
||||
}
|
||||
|
||||
interface FileReaderSync {
|
||||
readAsArrayBuffer(blob: Blob): any;
|
||||
|
@ -1364,7 +1353,7 @@ interface FileReaderSync {
|
|||
declare var FileReaderSync: {
|
||||
prototype: FileReaderSync;
|
||||
new(): FileReaderSync;
|
||||
};
|
||||
}
|
||||
|
||||
interface NotificationEvent extends ExtendableEvent {
|
||||
readonly action: string;
|
||||
|
@ -1374,7 +1363,7 @@ interface NotificationEvent extends ExtendableEvent {
|
|||
declare var NotificationEvent: {
|
||||
prototype: NotificationEvent;
|
||||
new(type: string, eventInitDict: NotificationEventInit): NotificationEvent;
|
||||
};
|
||||
}
|
||||
|
||||
interface PushEvent extends ExtendableEvent {
|
||||
readonly data: PushMessageData | null;
|
||||
|
@ -1383,7 +1372,7 @@ interface PushEvent extends ExtendableEvent {
|
|||
declare var PushEvent: {
|
||||
prototype: PushEvent;
|
||||
new(type: string, eventInitDict?: PushEventInit): PushEvent;
|
||||
};
|
||||
}
|
||||
|
||||
interface PushMessageData {
|
||||
arrayBuffer(): ArrayBuffer;
|
||||
|
@ -1395,7 +1384,7 @@ interface PushMessageData {
|
|||
declare var PushMessageData: {
|
||||
prototype: PushMessageData;
|
||||
new(): PushMessageData;
|
||||
};
|
||||
}
|
||||
|
||||
interface ServiceWorkerGlobalScopeEventMap extends WorkerGlobalScopeEventMap {
|
||||
"activate": ExtendableEvent;
|
||||
|
@ -1429,7 +1418,7 @@ interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|||
declare var ServiceWorkerGlobalScope: {
|
||||
prototype: ServiceWorkerGlobalScope;
|
||||
new(): ServiceWorkerGlobalScope;
|
||||
};
|
||||
}
|
||||
|
||||
interface SyncEvent extends ExtendableEvent {
|
||||
readonly lastChance: boolean;
|
||||
|
@ -1439,7 +1428,7 @@ interface SyncEvent extends ExtendableEvent {
|
|||
declare var SyncEvent: {
|
||||
prototype: SyncEvent;
|
||||
new(type: string, init: SyncEventInit): SyncEvent;
|
||||
};
|
||||
}
|
||||
|
||||
interface WindowClient extends Client {
|
||||
readonly focused: boolean;
|
||||
|
@ -1451,7 +1440,7 @@ interface WindowClient extends Client {
|
|||
declare var WindowClient: {
|
||||
prototype: WindowClient;
|
||||
new(): WindowClient;
|
||||
};
|
||||
}
|
||||
|
||||
interface WorkerGlobalScopeEventMap {
|
||||
"error": ErrorEvent;
|
||||
|
@ -1474,7 +1463,7 @@ interface WorkerGlobalScope extends EventTarget, WorkerUtils, WindowConsole, Glo
|
|||
declare var WorkerGlobalScope: {
|
||||
prototype: WorkerGlobalScope;
|
||||
new(): WorkerGlobalScope;
|
||||
};
|
||||
}
|
||||
|
||||
interface WorkerLocation {
|
||||
readonly hash: string;
|
||||
|
@ -1492,7 +1481,7 @@ interface WorkerLocation {
|
|||
declare var WorkerLocation: {
|
||||
prototype: WorkerLocation;
|
||||
new(): WorkerLocation;
|
||||
};
|
||||
}
|
||||
|
||||
interface WorkerNavigator extends Object, NavigatorID, NavigatorOnLine, NavigatorBeacon, NavigatorConcurrentHardware {
|
||||
readonly hardwareConcurrency: number;
|
||||
|
@ -1501,7 +1490,7 @@ interface WorkerNavigator extends Object, NavigatorID, NavigatorOnLine, Navigato
|
|||
declare var WorkerNavigator: {
|
||||
prototype: WorkerNavigator;
|
||||
new(): WorkerNavigator;
|
||||
};
|
||||
}
|
||||
|
||||
interface WorkerUtils extends Object, WindowBase64 {
|
||||
readonly indexedDB: IDBFactory;
|
||||
|
@ -1544,38 +1533,38 @@ interface ImageBitmap {
|
|||
|
||||
interface URLSearchParams {
|
||||
/**
|
||||
* Appends a specified key/value pair as a new search parameter.
|
||||
*/
|
||||
* Appends a specified key/value pair as a new search parameter.
|
||||
*/
|
||||
append(name: string, value: string): void;
|
||||
/**
|
||||
* Deletes the given search parameter, and its associated value, from the list of all search parameters.
|
||||
*/
|
||||
* Deletes the given search parameter, and its associated value, from the list of all search parameters.
|
||||
*/
|
||||
delete(name: string): void;
|
||||
/**
|
||||
* Returns the first value associated to the given search parameter.
|
||||
*/
|
||||
* Returns the first value associated to the given search parameter.
|
||||
*/
|
||||
get(name: string): string | null;
|
||||
/**
|
||||
* Returns all the values association with a given search parameter.
|
||||
*/
|
||||
* Returns all the values association with a given search parameter.
|
||||
*/
|
||||
getAll(name: string): string[];
|
||||
/**
|
||||
* Returns a Boolean indicating if such a search parameter exists.
|
||||
*/
|
||||
* Returns a Boolean indicating if such a search parameter exists.
|
||||
*/
|
||||
has(name: string): boolean;
|
||||
/**
|
||||
* Sets the value associated to a given search parameter to the given value. If there were several values, delete the others.
|
||||
*/
|
||||
* Sets the value associated to a given search parameter to the given value. If there were several values, delete the others.
|
||||
*/
|
||||
set(name: string, value: string): void;
|
||||
}
|
||||
|
||||
declare var URLSearchParams: {
|
||||
prototype: URLSearchParams;
|
||||
/**
|
||||
* Constructor returning a URLSearchParams object.
|
||||
*/
|
||||
* Constructor returning a URLSearchParams object.
|
||||
*/
|
||||
new (init?: string | URLSearchParams): URLSearchParams;
|
||||
};
|
||||
}
|
||||
|
||||
interface BlobPropertyBag {
|
||||
type?: string;
|
||||
|
@ -1782,23 +1771,8 @@ interface AddEventListenerOptions extends EventListenerOptions {
|
|||
|
||||
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
|
||||
|
||||
interface DecodeErrorCallback {
|
||||
(error: DOMException): void;
|
||||
}
|
||||
interface DecodeSuccessCallback {
|
||||
(decodedData: AudioBuffer): void;
|
||||
}
|
||||
interface ErrorEventHandler {
|
||||
(message: string, filename?: string, lineno?: number, colno?: number, error?: Error): void;
|
||||
}
|
||||
interface ForEachCallback {
|
||||
(keyId: any, status: MediaKeyStatus): void;
|
||||
}
|
||||
interface FunctionStringCallback {
|
||||
(data: string): void;
|
||||
}
|
||||
interface NotificationPermissionCallback {
|
||||
(permission: NotificationPermission): void;
|
||||
(message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void;
|
||||
}
|
||||
interface PositionCallback {
|
||||
(position: Position): void;
|
||||
|
@ -1806,6 +1780,21 @@ interface PositionCallback {
|
|||
interface PositionErrorCallback {
|
||||
(error: PositionError): void;
|
||||
}
|
||||
interface DecodeSuccessCallback {
|
||||
(decodedData: AudioBuffer): void;
|
||||
}
|
||||
interface DecodeErrorCallback {
|
||||
(error: DOMException): void;
|
||||
}
|
||||
interface FunctionStringCallback {
|
||||
(data: string): void;
|
||||
}
|
||||
interface ForEachCallback {
|
||||
(keyId: any, status: MediaKeyStatus): void;
|
||||
}
|
||||
interface NotificationPermissionCallback {
|
||||
(permission: NotificationPermission): void;
|
||||
}
|
||||
declare var onmessage: (this: DedicatedWorkerGlobalScope, ev: MessageEvent) => any;
|
||||
declare function close(): void;
|
||||
declare function postMessage(message: any, transfer?: any[]): void;
|
||||
|
|
41
lib/protocol.d.ts
vendored
41
lib/protocol.d.ts
vendored
|
@ -47,9 +47,6 @@ declare namespace ts.server.protocol {
|
|||
type CompilerOptionsForInferredProjects = "compilerOptionsForInferredProjects";
|
||||
type GetCodeFixes = "getCodeFixes";
|
||||
type GetSupportedCodeFixes = "getSupportedCodeFixes";
|
||||
type GetApplicableRefactors = "getApplicableRefactors";
|
||||
type GetRefactorCodeActions = "getRefactorCodeActions";
|
||||
type GetRefactorCodeActionsFull = "getRefactorCodeActions-full";
|
||||
}
|
||||
/**
|
||||
* A TypeScript Server message
|
||||
|
@ -290,33 +287,6 @@ declare namespace ts.server.protocol {
|
|||
*/
|
||||
offset: number;
|
||||
}
|
||||
type FileLocationOrRangeRequestArgs = FileLocationRequestArgs | FileRangeRequestArgs;
|
||||
interface GetApplicableRefactorsRequest extends Request {
|
||||
command: CommandTypes.GetApplicableRefactors;
|
||||
arguments: GetApplicableRefactorsRequestArgs;
|
||||
}
|
||||
type GetApplicableRefactorsRequestArgs = FileLocationOrRangeRequestArgs;
|
||||
interface ApplicableRefactorInfo {
|
||||
name: string;
|
||||
description: string;
|
||||
}
|
||||
interface GetApplicableRefactorsResponse extends Response {
|
||||
body?: ApplicableRefactorInfo[];
|
||||
}
|
||||
interface GetRefactorCodeActionsRequest extends Request {
|
||||
command: CommandTypes.GetRefactorCodeActions;
|
||||
arguments: GetRefactorCodeActionsRequestArgs;
|
||||
}
|
||||
type GetRefactorCodeActionsRequestArgs = FileLocationOrRangeRequestArgs & {
|
||||
refactorName: string;
|
||||
};
|
||||
type RefactorCodeActions = {
|
||||
actions: protocol.CodeAction[];
|
||||
renameLocation?: number;
|
||||
};
|
||||
interface GetRefactorCodeActionsResponse extends Response {
|
||||
body: RefactorCodeActions;
|
||||
}
|
||||
/**
|
||||
* Request for the available codefixes at a specific position.
|
||||
*/
|
||||
|
@ -324,7 +294,10 @@ declare namespace ts.server.protocol {
|
|||
command: CommandTypes.GetCodeFixes;
|
||||
arguments: CodeFixRequestArgs;
|
||||
}
|
||||
interface FileRangeRequestArgs extends FileRequestArgs {
|
||||
/**
|
||||
* Instances of this interface specify errorcodes on a specific location in a sourcefile.
|
||||
*/
|
||||
interface CodeFixRequestArgs extends FileRequestArgs {
|
||||
/**
|
||||
* The line number for the request (1-based).
|
||||
*/
|
||||
|
@ -341,11 +314,6 @@ declare namespace ts.server.protocol {
|
|||
* The character offset (on the line) for the request (1-based).
|
||||
*/
|
||||
endOffset: number;
|
||||
}
|
||||
/**
|
||||
* Instances of this interface specify errorcodes on a specific location in a sourcefile.
|
||||
*/
|
||||
interface CodeFixRequestArgs extends FileRangeRequestArgs {
|
||||
/**
|
||||
* Errorcodes we want to get the fixes for.
|
||||
*/
|
||||
|
@ -1814,7 +1782,6 @@ declare namespace ts.server.protocol {
|
|||
insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces?: boolean;
|
||||
insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?: boolean;
|
||||
insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean;
|
||||
insertSpaceAfterTypeAssertion?: boolean;
|
||||
insertSpaceBeforeFunctionParenthesis?: boolean;
|
||||
placeOpenBraceOnNewLineForFunctions?: boolean;
|
||||
placeOpenBraceOnNewLineForControlBlocks?: boolean;
|
||||
|
|
1532
lib/tsc.js
1532
lib/tsc.js
File diff suppressed because it is too large
Load diff
286
lib/tsserver.js
286
lib/tsserver.js
|
@ -6523,6 +6523,9 @@ var ts;
|
|||
}
|
||||
ts.getJSDocs = getJSDocs;
|
||||
function getJSDocParameterTags(param) {
|
||||
if (!isParameter(param)) {
|
||||
return undefined;
|
||||
}
|
||||
var func = param.parent;
|
||||
var tags = getJSDocTags(func, 286);
|
||||
if (!param.name) {
|
||||
|
@ -6541,18 +6544,6 @@ var ts;
|
|||
}
|
||||
}
|
||||
ts.getJSDocParameterTags = getJSDocParameterTags;
|
||||
function getParameterFromJSDoc(node) {
|
||||
var name = node.parameterName.text;
|
||||
var grandParent = node.parent.parent;
|
||||
ts.Debug.assert(node.parent.kind === 283);
|
||||
if (!isFunctionLike(grandParent)) {
|
||||
return undefined;
|
||||
}
|
||||
return ts.find(grandParent.parameters, function (p) {
|
||||
return p.name.kind === 71 && p.name.text === name;
|
||||
});
|
||||
}
|
||||
ts.getParameterFromJSDoc = getParameterFromJSDoc;
|
||||
function getJSDocType(node) {
|
||||
var tag = getFirstJSDocTag(node, 288);
|
||||
if (!tag && node.kind === 146) {
|
||||
|
@ -6689,6 +6680,36 @@ var ts;
|
|||
}
|
||||
}
|
||||
ts.isDeclarationName = isDeclarationName;
|
||||
function getNameOfDeclaration(declaration) {
|
||||
if (!declaration) {
|
||||
return undefined;
|
||||
}
|
||||
if (declaration.kind === 194) {
|
||||
var kind = getSpecialPropertyAssignmentKind(declaration);
|
||||
var lhs = declaration.left;
|
||||
switch (kind) {
|
||||
case 0:
|
||||
case 2:
|
||||
return undefined;
|
||||
case 1:
|
||||
if (lhs.kind === 71) {
|
||||
return lhs.name;
|
||||
}
|
||||
else {
|
||||
return lhs.expression.name;
|
||||
}
|
||||
case 4:
|
||||
case 5:
|
||||
return lhs.name;
|
||||
case 3:
|
||||
return lhs.expression.name;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return declaration.name;
|
||||
}
|
||||
}
|
||||
ts.getNameOfDeclaration = getNameOfDeclaration;
|
||||
function isLiteralComputedPropertyDeclarationName(node) {
|
||||
return (node.kind === 9 || node.kind === 8) &&
|
||||
node.parent.kind === 144 &&
|
||||
|
@ -6879,7 +6900,7 @@ var ts;
|
|||
}
|
||||
ts.isStringOrNumericLiteral = isStringOrNumericLiteral;
|
||||
function hasDynamicName(declaration) {
|
||||
var name = ts.getNameOfDeclaration(declaration);
|
||||
var name = getNameOfDeclaration(declaration);
|
||||
return name && isDynamicName(name);
|
||||
}
|
||||
ts.hasDynamicName = hasDynamicName;
|
||||
|
@ -9034,27 +9055,6 @@ var ts;
|
|||
return identifier.length >= 3 && identifier.charCodeAt(0) === 95 && identifier.charCodeAt(1) === 95 && identifier.charCodeAt(2) === 95 ? identifier.substr(1) : identifier;
|
||||
}
|
||||
ts.unescapeIdentifier = unescapeIdentifier;
|
||||
function getNameOfDeclaration(declaration) {
|
||||
if (!declaration) {
|
||||
return undefined;
|
||||
}
|
||||
if (declaration.kind === 194) {
|
||||
var expr = declaration;
|
||||
switch (ts.getSpecialPropertyAssignmentKind(expr)) {
|
||||
case 1:
|
||||
case 4:
|
||||
case 5:
|
||||
case 3:
|
||||
return expr.left.name;
|
||||
default:
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return declaration.name;
|
||||
}
|
||||
}
|
||||
ts.getNameOfDeclaration = getNameOfDeclaration;
|
||||
})(ts || (ts = {}));
|
||||
var ts;
|
||||
(function (ts) {
|
||||
|
@ -19665,8 +19665,15 @@ var ts;
|
|||
case 243:
|
||||
return node.isExportEquals ? "export=" : "default";
|
||||
case 194:
|
||||
if (ts.getSpecialPropertyAssignmentKind(node) === 2) {
|
||||
return "export=";
|
||||
switch (ts.getSpecialPropertyAssignmentKind(node)) {
|
||||
case 2:
|
||||
return "export=";
|
||||
case 1:
|
||||
case 4:
|
||||
case 5:
|
||||
return node.left.name.text;
|
||||
case 3:
|
||||
return node.left.expression.name.text;
|
||||
}
|
||||
ts.Debug.fail("Unknown binary declaration kind");
|
||||
break;
|
||||
|
@ -19758,8 +19765,6 @@ var ts;
|
|||
}
|
||||
}
|
||||
else {
|
||||
if (node.kind === 290)
|
||||
ts.Debug.assert(ts.isInJavaScriptFile(node));
|
||||
var isJSDocTypedefInJSDocNamespace = node.kind === 290 &&
|
||||
node.name &&
|
||||
node.name.kind === 71 &&
|
||||
|
@ -19889,7 +19894,9 @@ var ts;
|
|||
ts.forEachChild(node, bind, bindEach);
|
||||
}
|
||||
function bindChildrenWorker(node) {
|
||||
ts.forEach(node.jsDoc, bind);
|
||||
if (ts.isInJavaScriptFile(node) && node.jsDoc) {
|
||||
ts.forEach(node.jsDoc, bind);
|
||||
}
|
||||
if (checkUnreachable(node)) {
|
||||
bindEachChild(node);
|
||||
return;
|
||||
|
@ -20939,7 +20946,9 @@ var ts;
|
|||
}
|
||||
node.parent = parent;
|
||||
var saveInStrictMode = inStrictMode;
|
||||
bindJSDocTypedefTagIfAny(node);
|
||||
if (ts.isInJavaScriptFile(node)) {
|
||||
bindJSDocTypedefTagIfAny(node);
|
||||
}
|
||||
bindWorker(node);
|
||||
if (node.kind > 142) {
|
||||
var saveParent = parent;
|
||||
|
@ -20999,7 +21008,7 @@ var ts;
|
|||
function bindWorker(node) {
|
||||
switch (node.kind) {
|
||||
case 71:
|
||||
if (ts.isInJavaScriptFile(node) && node.isInJSDocNamespace) {
|
||||
if (node.isInJSDocNamespace) {
|
||||
var parentNode = node.parent;
|
||||
while (parentNode && parentNode.kind !== 290) {
|
||||
parentNode = parentNode.parent;
|
||||
|
@ -21067,7 +21076,10 @@ var ts;
|
|||
return bindVariableDeclarationOrBindingElement(node);
|
||||
case 149:
|
||||
case 148:
|
||||
return bindPropertyWorker(node);
|
||||
case 276:
|
||||
return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 67108864 : 0), 0);
|
||||
case 291:
|
||||
return bindJSDocProperty(node);
|
||||
case 261:
|
||||
case 262:
|
||||
return bindPropertyOrMethodOrAccessor(node, 4, 0);
|
||||
|
@ -21105,10 +21117,13 @@ var ts;
|
|||
return bindPropertyOrMethodOrAccessor(node, 65536, 74687);
|
||||
case 160:
|
||||
case 161:
|
||||
case 279:
|
||||
return bindFunctionOrConstructorType(node);
|
||||
case 163:
|
||||
case 172:
|
||||
return bindAnonymousTypeWorker(node);
|
||||
case 292:
|
||||
case 275:
|
||||
return bindAnonymousDeclaration(node, 2048, "__type");
|
||||
case 178:
|
||||
return bindObjectLiteralExpression(node);
|
||||
case 186:
|
||||
|
@ -21125,6 +21140,11 @@ var ts;
|
|||
return bindClassLikeDeclaration(node);
|
||||
case 230:
|
||||
return bindBlockScopedDeclaration(node, 64, 792968);
|
||||
case 290:
|
||||
if (!node.fullName || node.fullName.kind === 71) {
|
||||
return bindBlockScopedDeclaration(node, 524288, 793064);
|
||||
}
|
||||
break;
|
||||
case 231:
|
||||
return bindBlockScopedDeclaration(node, 524288, 793064);
|
||||
case 232:
|
||||
|
@ -21157,37 +21177,8 @@ var ts;
|
|||
}
|
||||
case 234:
|
||||
return updateStrictModeStatementList(node.statements);
|
||||
default:
|
||||
if (ts.isInJavaScriptFile(node))
|
||||
return bindJSDocWorker(node);
|
||||
}
|
||||
}
|
||||
function bindJSDocWorker(node) {
|
||||
switch (node.kind) {
|
||||
case 276:
|
||||
return bindPropertyWorker(node);
|
||||
case 291:
|
||||
return declareSymbolAndAddToSymbolTable(node, 4, 0);
|
||||
case 279:
|
||||
return bindFunctionOrConstructorType(node);
|
||||
case 292:
|
||||
case 275:
|
||||
return bindAnonymousTypeWorker(node);
|
||||
case 290: {
|
||||
var fullName = node.fullName;
|
||||
if (!fullName || fullName.kind === 71) {
|
||||
return bindBlockScopedDeclaration(node, 524288, 793064);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
function bindPropertyWorker(node) {
|
||||
return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 67108864 : 0), 0);
|
||||
}
|
||||
function bindAnonymousTypeWorker(node) {
|
||||
return bindAnonymousDeclaration(node, 2048, "__type");
|
||||
}
|
||||
function checkTypePredicate(node) {
|
||||
var parameterName = node.parameterName, type = node.type;
|
||||
if (parameterName && parameterName.kind === 71) {
|
||||
|
@ -21447,8 +21438,10 @@ var ts;
|
|||
return bindAnonymousDeclaration(node, 16, bindingName);
|
||||
}
|
||||
function bindPropertyOrMethodOrAccessor(node, symbolFlags, symbolExcludes) {
|
||||
if (!file.isDeclarationFile && !ts.isInAmbientContext(node) && ts.isAsyncFunction(node)) {
|
||||
emitFlags |= 1024;
|
||||
if (!file.isDeclarationFile && !ts.isInAmbientContext(node)) {
|
||||
if (ts.isAsyncFunction(node)) {
|
||||
emitFlags |= 1024;
|
||||
}
|
||||
}
|
||||
if (currentFlow && ts.isObjectLiteralOrClassExpressionMethod(node)) {
|
||||
node.flowNode = currentFlow;
|
||||
|
@ -21457,6 +21450,9 @@ var ts;
|
|||
? bindAnonymousDeclaration(node, symbolFlags, "__computed")
|
||||
: declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes);
|
||||
}
|
||||
function bindJSDocProperty(node) {
|
||||
return declareSymbolAndAddToSymbolTable(node, 4, 0);
|
||||
}
|
||||
function shouldReportErrorOnModuleDeclaration(node) {
|
||||
var instanceState = getModuleInstanceState(node);
|
||||
return instanceState === 1 || (instanceState === 2 && options.preserveConstEnums);
|
||||
|
@ -39395,10 +39391,6 @@ var ts;
|
|||
return entityNameSymbol;
|
||||
}
|
||||
}
|
||||
if (entityName.parent.kind === 286) {
|
||||
var parameter = ts.getParameterFromJSDoc(entityName.parent);
|
||||
return parameter && parameter.symbol;
|
||||
}
|
||||
if (ts.isPartOfExpression(entityName)) {
|
||||
if (ts.nodeIsMissing(entityName)) {
|
||||
return undefined;
|
||||
|
@ -58836,22 +58828,27 @@ var ts;
|
|||
}
|
||||
ts.findContainingList = findContainingList;
|
||||
function getTouchingWord(sourceFile, position, includeJsDocComment) {
|
||||
return getTouchingToken(sourceFile, position, includeJsDocComment, function (n) { return isWord(n.kind); });
|
||||
if (includeJsDocComment === void 0) { includeJsDocComment = false; }
|
||||
return getTouchingToken(sourceFile, position, function (n) { return isWord(n.kind); }, includeJsDocComment);
|
||||
}
|
||||
ts.getTouchingWord = getTouchingWord;
|
||||
function getTouchingPropertyName(sourceFile, position, includeJsDocComment) {
|
||||
return getTouchingToken(sourceFile, position, includeJsDocComment, function (n) { return isPropertyName(n.kind); });
|
||||
if (includeJsDocComment === void 0) { includeJsDocComment = false; }
|
||||
return getTouchingToken(sourceFile, position, function (n) { return isPropertyName(n.kind); }, includeJsDocComment);
|
||||
}
|
||||
ts.getTouchingPropertyName = getTouchingPropertyName;
|
||||
function getTouchingToken(sourceFile, position, includeJsDocComment, includeItemAtEndPosition) {
|
||||
function getTouchingToken(sourceFile, position, includeItemAtEndPosition, includeJsDocComment) {
|
||||
if (includeJsDocComment === void 0) { includeJsDocComment = false; }
|
||||
return getTokenAtPositionWorker(sourceFile, position, false, includeItemAtEndPosition, includeJsDocComment);
|
||||
}
|
||||
ts.getTouchingToken = getTouchingToken;
|
||||
function getTokenAtPosition(sourceFile, position, includeJsDocComment) {
|
||||
if (includeJsDocComment === void 0) { includeJsDocComment = false; }
|
||||
return getTokenAtPositionWorker(sourceFile, position, true, undefined, includeJsDocComment);
|
||||
}
|
||||
ts.getTokenAtPosition = getTokenAtPosition;
|
||||
function getTokenAtPositionWorker(sourceFile, position, allowPositionInLeadingTrivia, includeItemAtEndPosition, includeJsDocComment) {
|
||||
if (includeJsDocComment === void 0) { includeJsDocComment = false; }
|
||||
var current = sourceFile;
|
||||
outer: while (true) {
|
||||
if (ts.isToken(current)) {
|
||||
|
@ -58882,7 +58879,7 @@ var ts;
|
|||
}
|
||||
}
|
||||
function findTokenOnLeftOfPosition(file, position) {
|
||||
var tokenAtPosition = getTokenAtPosition(file, position, false);
|
||||
var tokenAtPosition = getTokenAtPosition(file, position);
|
||||
if (ts.isToken(tokenAtPosition) && position > tokenAtPosition.getStart(file) && position < tokenAtPosition.getEnd()) {
|
||||
return tokenAtPosition;
|
||||
}
|
||||
|
@ -58969,7 +58966,7 @@ var ts;
|
|||
}
|
||||
ts.isInString = isInString;
|
||||
function isInsideJsxElementOrAttribute(sourceFile, position) {
|
||||
var token = getTokenAtPosition(sourceFile, position, false);
|
||||
var token = getTokenAtPosition(sourceFile, position);
|
||||
if (!token) {
|
||||
return false;
|
||||
}
|
||||
|
@ -58992,12 +58989,12 @@ var ts;
|
|||
}
|
||||
ts.isInsideJsxElementOrAttribute = isInsideJsxElementOrAttribute;
|
||||
function isInTemplateString(sourceFile, position) {
|
||||
var token = getTokenAtPosition(sourceFile, position, false);
|
||||
var token = getTokenAtPosition(sourceFile, position);
|
||||
return ts.isTemplateLiteralKind(token.kind) && position > token.getStart(sourceFile);
|
||||
}
|
||||
ts.isInTemplateString = isInTemplateString;
|
||||
function isInComment(sourceFile, position, tokenAtPosition, predicate) {
|
||||
if (tokenAtPosition === void 0) { tokenAtPosition = getTokenAtPosition(sourceFile, position, false); }
|
||||
if (tokenAtPosition === void 0) { tokenAtPosition = getTokenAtPosition(sourceFile, position); }
|
||||
return position <= tokenAtPosition.getStart(sourceFile) &&
|
||||
(isInCommentRange(ts.getLeadingCommentRanges(sourceFile.text, tokenAtPosition.pos)) ||
|
||||
isInCommentRange(ts.getTrailingCommentRanges(sourceFile.text, tokenAtPosition.pos)));
|
||||
|
@ -59020,7 +59017,7 @@ var ts;
|
|||
}
|
||||
}
|
||||
function hasDocComment(sourceFile, position) {
|
||||
var token = getTokenAtPosition(sourceFile, position, false);
|
||||
var token = getTokenAtPosition(sourceFile, position);
|
||||
var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos);
|
||||
return ts.forEach(commentRanges, jsDocPrefix);
|
||||
function jsDocPrefix(c) {
|
||||
|
@ -59030,7 +59027,7 @@ var ts;
|
|||
}
|
||||
ts.hasDocComment = hasDocComment;
|
||||
function getJsDocTagAtPosition(sourceFile, position) {
|
||||
var node = ts.getTokenAtPosition(sourceFile, position, false);
|
||||
var node = ts.getTokenAtPosition(sourceFile, position);
|
||||
if (ts.isToken(node)) {
|
||||
switch (node.kind) {
|
||||
case 104:
|
||||
|
@ -59480,7 +59477,7 @@ var ts;
|
|||
}
|
||||
ts.getOpenBrace = getOpenBrace;
|
||||
function getOpenBraceOfClassLike(declaration, sourceFile) {
|
||||
return ts.getTokenAtPosition(sourceFile, declaration.members.pos - 1, false);
|
||||
return ts.getTokenAtPosition(sourceFile, declaration.members.pos - 1);
|
||||
}
|
||||
ts.getOpenBraceOfClassLike = getOpenBraceOfClassLike;
|
||||
})(ts || (ts = {}));
|
||||
|
@ -59492,7 +59489,7 @@ var ts;
|
|||
if (sourceFile.isDeclarationFile) {
|
||||
return undefined;
|
||||
}
|
||||
var tokenAtLocation = ts.getTokenAtPosition(sourceFile, position, false);
|
||||
var tokenAtLocation = ts.getTokenAtPosition(sourceFile, position);
|
||||
var lineOfPosition = sourceFile.getLineAndCharacterOfPosition(position).line;
|
||||
if (sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getStart(sourceFile)).line > lineOfPosition) {
|
||||
tokenAtLocation = ts.findPrecedingToken(tokenAtLocation.pos, sourceFile);
|
||||
|
@ -60918,7 +60915,7 @@ var ts;
|
|||
return ts.deduplicate(nonRelativeModules);
|
||||
}
|
||||
function getTripleSlashReferenceCompletion(sourceFile, position, compilerOptions, host) {
|
||||
var token = ts.getTokenAtPosition(sourceFile, position, false);
|
||||
var token = ts.getTokenAtPosition(sourceFile, position);
|
||||
if (!token) {
|
||||
return undefined;
|
||||
}
|
||||
|
@ -61371,7 +61368,7 @@ var ts;
|
|||
var requestJsDocTagName = false;
|
||||
var requestJsDocTag = false;
|
||||
var start = ts.timestamp();
|
||||
var currentToken = ts.getTokenAtPosition(sourceFile, position, false);
|
||||
var currentToken = ts.getTokenAtPosition(sourceFile, position);
|
||||
log("getCompletionData: Get current token: " + (ts.timestamp() - start));
|
||||
start = ts.timestamp();
|
||||
var insideComment = ts.isInComment(sourceFile, position, currentToken);
|
||||
|
@ -61424,7 +61421,7 @@ var ts;
|
|||
var isRightOfDot = false;
|
||||
var isRightOfOpenTag = false;
|
||||
var isStartingCloseTag = false;
|
||||
var location = ts.getTouchingPropertyName(sourceFile, position, false);
|
||||
var location = ts.getTouchingPropertyName(sourceFile, position);
|
||||
if (contextToken) {
|
||||
if (isCompletionListBlocker(contextToken)) {
|
||||
log("Returning an empty list because completion was requested in an invalid position.");
|
||||
|
@ -62165,7 +62162,7 @@ var ts;
|
|||
var DocumentHighlights;
|
||||
(function (DocumentHighlights) {
|
||||
function getDocumentHighlights(program, cancellationToken, sourceFile, position, sourceFilesToSearch) {
|
||||
var node = ts.getTouchingWord(sourceFile, position, true);
|
||||
var node = ts.getTouchingWord(sourceFile, position);
|
||||
return node && (getSemanticDocumentHighlights(node, program, cancellationToken, sourceFilesToSearch) || getSyntacticDocumentHighlights(node, sourceFile));
|
||||
}
|
||||
DocumentHighlights.getDocumentHighlights = getDocumentHighlights;
|
||||
|
@ -63255,16 +63252,13 @@ var ts;
|
|||
}
|
||||
FindAllReferences.findReferencedSymbols = findReferencedSymbols;
|
||||
function getImplementationsAtPosition(program, cancellationToken, sourceFiles, sourceFile, position) {
|
||||
var node = ts.getTouchingPropertyName(sourceFile, position, false);
|
||||
var node = ts.getTouchingPropertyName(sourceFile, position);
|
||||
var referenceEntries = getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node);
|
||||
var checker = program.getTypeChecker();
|
||||
return ts.map(referenceEntries, function (entry) { return toImplementationLocation(entry, checker); });
|
||||
}
|
||||
FindAllReferences.getImplementationsAtPosition = getImplementationsAtPosition;
|
||||
function getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node) {
|
||||
if (node.kind === 265) {
|
||||
return undefined;
|
||||
}
|
||||
var checker = program.getTypeChecker();
|
||||
if (node.parent.kind === 262) {
|
||||
var result_5 = [];
|
||||
|
@ -63735,7 +63729,7 @@ var ts;
|
|||
var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, labelName, container);
|
||||
for (var _i = 0, possiblePositions_1 = possiblePositions; _i < possiblePositions_1.length; _i++) {
|
||||
var position = possiblePositions_1[_i];
|
||||
var node = ts.getTouchingWord(sourceFile, position, false);
|
||||
var node = ts.getTouchingWord(sourceFile, position);
|
||||
if (node && (node === targetLabel || (ts.isJumpStatementTarget(node) && ts.getTargetLabel(node, labelName) === targetLabel))) {
|
||||
references.push(FindAllReferences.nodeEntry(node));
|
||||
}
|
||||
|
@ -63765,10 +63759,10 @@ var ts;
|
|||
return references.length ? [{ definition: { type: "keyword", node: references[0].node }, references: references }] : undefined;
|
||||
}
|
||||
function addReferencesForKeywordInFile(sourceFile, kind, searchText, references) {
|
||||
var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, searchText, sourceFile, true);
|
||||
var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, searchText);
|
||||
for (var _i = 0, possiblePositions_2 = possiblePositions; _i < possiblePositions_2.length; _i++) {
|
||||
var position = possiblePositions_2[_i];
|
||||
var referenceLocation = ts.getTouchingPropertyName(sourceFile, position, true);
|
||||
var referenceLocation = ts.getTouchingPropertyName(sourceFile, position);
|
||||
if (referenceLocation.kind === kind) {
|
||||
references.push(FindAllReferences.nodeEntry(referenceLocation));
|
||||
}
|
||||
|
@ -63782,13 +63776,13 @@ var ts;
|
|||
if (!state.markSearchedSymbol(sourceFile, search.symbol)) {
|
||||
return;
|
||||
}
|
||||
for (var _i = 0, _a = getPossibleSymbolReferencePositions(sourceFile, search.text, container, state.findInComments || container.jsDoc !== undefined); _i < _a.length; _i++) {
|
||||
for (var _i = 0, _a = getPossibleSymbolReferencePositions(sourceFile, search.text, container, state.findInComments); _i < _a.length; _i++) {
|
||||
var position = _a[_i];
|
||||
getReferencesAtLocation(sourceFile, position, search, state);
|
||||
}
|
||||
}
|
||||
function getReferencesAtLocation(sourceFile, position, search, state) {
|
||||
var referenceLocation = ts.getTouchingPropertyName(sourceFile, position, true);
|
||||
var referenceLocation = ts.getTouchingPropertyName(sourceFile, position);
|
||||
if (!isValidReferencePosition(referenceLocation, search.text)) {
|
||||
if (!state.implementations && (state.findInStrings && ts.isInString(sourceFile, position) || state.findInComments && ts.isInNonReferenceComment(sourceFile, position))) {
|
||||
state.addStringOrCommentReference(sourceFile.fileName, ts.createTextSpan(position, search.text.length));
|
||||
|
@ -64124,7 +64118,7 @@ var ts;
|
|||
var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "super", searchSpaceNode);
|
||||
for (var _i = 0, possiblePositions_3 = possiblePositions; _i < possiblePositions_3.length; _i++) {
|
||||
var position = possiblePositions_3[_i];
|
||||
var node = ts.getTouchingWord(sourceFile, position, false);
|
||||
var node = ts.getTouchingWord(sourceFile, position);
|
||||
if (!node || node.kind !== 97) {
|
||||
continue;
|
||||
}
|
||||
|
@ -64182,7 +64176,7 @@ var ts;
|
|||
}];
|
||||
function getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, result) {
|
||||
ts.forEach(possiblePositions, function (position) {
|
||||
var node = ts.getTouchingWord(sourceFile, position, false);
|
||||
var node = ts.getTouchingWord(sourceFile, position);
|
||||
if (!node || !ts.isThis(node)) {
|
||||
return;
|
||||
}
|
||||
|
@ -64230,7 +64224,7 @@ var ts;
|
|||
function getReferencesForStringLiteralInFile(sourceFile, searchText, possiblePositions, references) {
|
||||
for (var _i = 0, possiblePositions_4 = possiblePositions; _i < possiblePositions_4.length; _i++) {
|
||||
var position = possiblePositions_4[_i];
|
||||
var node_7 = ts.getTouchingWord(sourceFile, position, false);
|
||||
var node_7 = ts.getTouchingWord(sourceFile, position);
|
||||
if (node_7 && node_7.kind === 9 && node_7.text === searchText) {
|
||||
references.push(FindAllReferences.nodeEntry(node_7, true));
|
||||
}
|
||||
|
@ -64492,7 +64486,7 @@ var ts;
|
|||
return referenceFile && referenceFile.resolvedFileName &&
|
||||
[getDefinitionInfoForFileReference(typeReferenceDirective.fileName, referenceFile.resolvedFileName)];
|
||||
}
|
||||
var node = ts.getTouchingPropertyName(sourceFile, position, true);
|
||||
var node = ts.getTouchingPropertyName(sourceFile, position);
|
||||
if (node === sourceFile) {
|
||||
return undefined;
|
||||
}
|
||||
|
@ -64537,7 +64531,7 @@ var ts;
|
|||
}
|
||||
GoToDefinition.getDefinitionAtPosition = getDefinitionAtPosition;
|
||||
function getTypeDefinitionAtPosition(typeChecker, sourceFile, position) {
|
||||
var node = ts.getTouchingPropertyName(sourceFile, position, true);
|
||||
var node = ts.getTouchingPropertyName(sourceFile, position);
|
||||
if (node === sourceFile) {
|
||||
return undefined;
|
||||
}
|
||||
|
@ -64838,7 +64832,7 @@ var ts;
|
|||
if (ts.isInString(sourceFile, position) || ts.isInComment(sourceFile, position) || ts.hasDocComment(sourceFile, position)) {
|
||||
return undefined;
|
||||
}
|
||||
var tokenAtPos = ts.getTokenAtPosition(sourceFile, position, false);
|
||||
var tokenAtPos = ts.getTokenAtPosition(sourceFile, position);
|
||||
var tokenStart = tokenAtPos.getStart();
|
||||
if (!tokenAtPos || tokenStart < position) {
|
||||
return undefined;
|
||||
|
@ -70182,7 +70176,7 @@ var ts;
|
|||
return this;
|
||||
}
|
||||
if (index !== containingList.length - 1) {
|
||||
var nextToken = ts.getTokenAtPosition(sourceFile, node.end, false);
|
||||
var nextToken = ts.getTokenAtPosition(sourceFile, node.end);
|
||||
if (nextToken && isSeparator(node, nextToken)) {
|
||||
var startPosition = ts.skipTrivia(sourceFile.text, getAdjustedStartPosition(sourceFile, node, {}, Position.FullStart), false, true);
|
||||
var nextElement = containingList[index + 1];
|
||||
|
@ -70191,7 +70185,7 @@ var ts;
|
|||
}
|
||||
}
|
||||
else {
|
||||
var previousToken = ts.getTokenAtPosition(sourceFile, containingList[index - 1].end, false);
|
||||
var previousToken = ts.getTokenAtPosition(sourceFile, containingList[index - 1].end);
|
||||
if (previousToken && isSeparator(node, previousToken)) {
|
||||
this.deleteNodeRange(sourceFile, previousToken, node);
|
||||
}
|
||||
|
@ -70259,7 +70253,7 @@ var ts;
|
|||
}
|
||||
var end = after.getEnd();
|
||||
if (index !== containingList.length - 1) {
|
||||
var nextToken = ts.getTokenAtPosition(sourceFile, after.end, false);
|
||||
var nextToken = ts.getTokenAtPosition(sourceFile, after.end);
|
||||
if (nextToken && isSeparator(after, nextToken)) {
|
||||
var lineAndCharOfNextElement = ts.getLineAndCharacterOfPosition(sourceFile, skipWhitespacesAndLineBreaks(sourceFile.text, containingList[index + 1].getFullStart()));
|
||||
var lineAndCharOfNextToken = ts.getLineAndCharacterOfPosition(sourceFile, nextToken.end);
|
||||
|
@ -70629,7 +70623,7 @@ var ts;
|
|||
function getActionForClassLikeIncorrectImplementsInterface(context) {
|
||||
var sourceFile = context.sourceFile;
|
||||
var start = context.span.start;
|
||||
var token = ts.getTokenAtPosition(sourceFile, start, false);
|
||||
var token = ts.getTokenAtPosition(sourceFile, start);
|
||||
var checker = context.program.getTypeChecker();
|
||||
var classDeclaration = ts.getContainingClass(token);
|
||||
if (!classDeclaration) {
|
||||
|
@ -70689,7 +70683,7 @@ var ts;
|
|||
function getActionsForAddMissingMember(context) {
|
||||
var sourceFile = context.sourceFile;
|
||||
var start = context.span.start;
|
||||
var token = ts.getTokenAtPosition(sourceFile, start, false);
|
||||
var token = ts.getTokenAtPosition(sourceFile, start);
|
||||
if (token.kind !== 71) {
|
||||
return undefined;
|
||||
}
|
||||
|
@ -70785,7 +70779,7 @@ var ts;
|
|||
});
|
||||
function getActionsForCorrectSpelling(context) {
|
||||
var sourceFile = context.sourceFile;
|
||||
var node = ts.getTokenAtPosition(sourceFile, context.span.start, false);
|
||||
var node = ts.getTokenAtPosition(sourceFile, context.span.start);
|
||||
var checker = context.program.getTypeChecker();
|
||||
var suggestion;
|
||||
if (node.kind === 71 && ts.isPropertyAccessExpression(node.parent)) {
|
||||
|
@ -70839,7 +70833,7 @@ var ts;
|
|||
function getActionForClassLikeMissingAbstractMember(context) {
|
||||
var sourceFile = context.sourceFile;
|
||||
var start = context.span.start;
|
||||
var token = ts.getTokenAtPosition(sourceFile, start, false);
|
||||
var token = ts.getTokenAtPosition(sourceFile, start);
|
||||
var checker = context.program.getTypeChecker();
|
||||
if (ts.isClassLike(token.parent)) {
|
||||
var classDeclaration = token.parent;
|
||||
|
@ -70874,7 +70868,7 @@ var ts;
|
|||
errorCodes: [ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class.code],
|
||||
getCodeActions: function (context) {
|
||||
var sourceFile = context.sourceFile;
|
||||
var token = ts.getTokenAtPosition(sourceFile, context.span.start, false);
|
||||
var token = ts.getTokenAtPosition(sourceFile, context.span.start);
|
||||
if (token.kind !== 99) {
|
||||
return undefined;
|
||||
}
|
||||
|
@ -70919,7 +70913,7 @@ var ts;
|
|||
errorCodes: [ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code],
|
||||
getCodeActions: function (context) {
|
||||
var sourceFile = context.sourceFile;
|
||||
var token = ts.getTokenAtPosition(sourceFile, context.span.start, false);
|
||||
var token = ts.getTokenAtPosition(sourceFile, context.span.start);
|
||||
if (token.kind !== 123) {
|
||||
return undefined;
|
||||
}
|
||||
|
@ -70943,7 +70937,7 @@ var ts;
|
|||
getCodeActions: function (context) {
|
||||
var sourceFile = context.sourceFile;
|
||||
var start = context.span.start;
|
||||
var token = ts.getTokenAtPosition(sourceFile, start, false);
|
||||
var token = ts.getTokenAtPosition(sourceFile, start);
|
||||
var classDeclNode = ts.getContainingClass(token);
|
||||
if (!(token.kind === 71 && ts.isClassLike(classDeclNode))) {
|
||||
return undefined;
|
||||
|
@ -70981,7 +70975,7 @@ var ts;
|
|||
errorCodes: [ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code],
|
||||
getCodeActions: function (context) {
|
||||
var sourceFile = context.sourceFile;
|
||||
var token = ts.getTokenAtPosition(sourceFile, context.span.start, false);
|
||||
var token = ts.getTokenAtPosition(sourceFile, context.span.start);
|
||||
if (token.kind !== 71) {
|
||||
return undefined;
|
||||
}
|
||||
|
@ -71007,9 +71001,9 @@ var ts;
|
|||
getCodeActions: function (context) {
|
||||
var sourceFile = context.sourceFile;
|
||||
var start = context.span.start;
|
||||
var token = ts.getTokenAtPosition(sourceFile, start, false);
|
||||
var token = ts.getTokenAtPosition(sourceFile, start);
|
||||
if (token.kind === 21) {
|
||||
token = ts.getTokenAtPosition(sourceFile, start + 1, false);
|
||||
token = ts.getTokenAtPosition(sourceFile, start + 1);
|
||||
}
|
||||
switch (token.kind) {
|
||||
case 71:
|
||||
|
@ -71038,11 +71032,11 @@ var ts;
|
|||
case 145:
|
||||
var typeParameters = token.parent.parent.typeParameters;
|
||||
if (typeParameters.length === 1) {
|
||||
var previousToken = ts.getTokenAtPosition(sourceFile, typeParameters.pos - 1, false);
|
||||
var previousToken = ts.getTokenAtPosition(sourceFile, typeParameters.pos - 1);
|
||||
if (!previousToken || previousToken.kind !== 27) {
|
||||
return deleteRange(typeParameters);
|
||||
}
|
||||
var nextToken = ts.getTokenAtPosition(sourceFile, typeParameters.end, false);
|
||||
var nextToken = ts.getTokenAtPosition(sourceFile, typeParameters.end);
|
||||
if (!nextToken || nextToken.kind !== 29) {
|
||||
return deleteRange(typeParameters);
|
||||
}
|
||||
|
@ -71079,7 +71073,7 @@ var ts;
|
|||
}
|
||||
else {
|
||||
var start_4 = importClause.name.getStart(sourceFile);
|
||||
var nextToken = ts.getTokenAtPosition(sourceFile, importClause.name.end, false);
|
||||
var nextToken = ts.getTokenAtPosition(sourceFile, importClause.name.end);
|
||||
if (nextToken && nextToken.kind === 26) {
|
||||
return deleteRange({ pos: start_4, end: ts.skipTrivia(sourceFile.text, nextToken.end, false, true) });
|
||||
}
|
||||
|
@ -71094,7 +71088,7 @@ var ts;
|
|||
return deleteNode(importDecl);
|
||||
}
|
||||
else {
|
||||
var previousToken = ts.getTokenAtPosition(sourceFile, namespaceImport.pos - 1, false);
|
||||
var previousToken = ts.getTokenAtPosition(sourceFile, namespaceImport.pos - 1);
|
||||
if (previousToken && previousToken.kind === 26) {
|
||||
var startPosition = ts.textChanges.getAdjustedStartPosition(sourceFile, previousToken, {}, ts.textChanges.Position.FullStart);
|
||||
return deleteRange({ pos: startPosition, end: namespaceImport.end });
|
||||
|
@ -71258,7 +71252,7 @@ var ts;
|
|||
var checker = context.program.getTypeChecker();
|
||||
var allSourceFiles = context.program.getSourceFiles();
|
||||
var useCaseSensitiveFileNames = context.host.useCaseSensitiveFileNames ? context.host.useCaseSensitiveFileNames() : false;
|
||||
var token = ts.getTokenAtPosition(sourceFile, context.span.start, false);
|
||||
var token = ts.getTokenAtPosition(sourceFile, context.span.start);
|
||||
var name = token.getText();
|
||||
var symbolIdActionMap = new ImportCodeActionMap();
|
||||
var cachedImportDeclarations = [];
|
||||
|
@ -71603,7 +71597,7 @@ var ts;
|
|||
var lineStartPosition = ts.getStartPositionOfLine(line, sourceFile);
|
||||
var startPosition = ts.getFirstNonSpaceCharacterPosition(sourceFile.text, lineStartPosition);
|
||||
if (!ts.isInComment(sourceFile, startPosition) && !ts.isInString(sourceFile, startPosition) && !ts.isInTemplateString(sourceFile, startPosition)) {
|
||||
var token = ts.getTouchingToken(sourceFile, startPosition, false);
|
||||
var token = ts.getTouchingToken(sourceFile, startPosition);
|
||||
var tokenLeadingCommnets = ts.getLeadingCommentRangesOfNode(token, sourceFile);
|
||||
if (!tokenLeadingCommnets || !tokenLeadingCommnets.length || tokenLeadingCommnets[0].pos >= startPosition) {
|
||||
return {
|
||||
|
@ -71816,7 +71810,7 @@ var ts;
|
|||
refactor.registerRefactor(convertFunctionToES6Class);
|
||||
function isApplicable(context) {
|
||||
var start = context.startPosition;
|
||||
var node = ts.getTokenAtPosition(context.file, start, false);
|
||||
var node = ts.getTokenAtPosition(context.file, start);
|
||||
var checker = context.program.getTypeChecker();
|
||||
var symbol = checker.getSymbolAtLocation(node);
|
||||
if (symbol && ts.isDeclarationOfFunctionOrClassExpression(symbol)) {
|
||||
|
@ -71828,7 +71822,7 @@ var ts;
|
|||
var start = context.startPosition;
|
||||
var sourceFile = context.file;
|
||||
var checker = context.program.getTypeChecker();
|
||||
var token = ts.getTokenAtPosition(sourceFile, start, false);
|
||||
var token = ts.getTokenAtPosition(sourceFile, start);
|
||||
var ctorSymbol = checker.getSymbolAtLocation(token);
|
||||
var newLine = context.rulesProvider.getFormatOptions().newLineCharacter;
|
||||
var deletedNodes = [];
|
||||
|
@ -72021,7 +72015,6 @@ var ts;
|
|||
ts.scanner.setTextPos(pos);
|
||||
while (pos < end) {
|
||||
var token = useJSDocScanner ? ts.scanner.scanJSDocToken() : ts.scanner.scan();
|
||||
ts.Debug.assert(token !== 1);
|
||||
var textPos = ts.scanner.getTextPos();
|
||||
if (textPos <= end) {
|
||||
nodes.push(createNode(token, pos, textPos, this));
|
||||
|
@ -72049,31 +72042,27 @@ var ts;
|
|||
};
|
||||
NodeObject.prototype.createChildren = function (sourceFile) {
|
||||
var _this = this;
|
||||
if (ts.isJSDocTag(this)) {
|
||||
var children_3 = [];
|
||||
this.forEachChild(function (child) { children_3.push(child); });
|
||||
this._children = children_3;
|
||||
}
|
||||
else if (this.kind >= 143) {
|
||||
var children_4 = [];
|
||||
var children;
|
||||
if (this.kind >= 143) {
|
||||
ts.scanner.setText((sourceFile || this.getSourceFile()).text);
|
||||
children = [];
|
||||
var pos_3 = this.pos;
|
||||
var useJSDocScanner_1 = this.kind >= 283 && this.kind <= 293;
|
||||
var processNode = function (node) {
|
||||
var isJSDocTagNode = ts.isJSDocTag(node);
|
||||
if (!isJSDocTagNode && pos_3 < node.pos) {
|
||||
pos_3 = _this.addSyntheticNodes(children_4, pos_3, node.pos, useJSDocScanner_1);
|
||||
pos_3 = _this.addSyntheticNodes(children, pos_3, node.pos, useJSDocScanner_1);
|
||||
}
|
||||
children_4.push(node);
|
||||
children.push(node);
|
||||
if (!isJSDocTagNode) {
|
||||
pos_3 = node.end;
|
||||
}
|
||||
};
|
||||
var processNodes = function (nodes) {
|
||||
if (pos_3 < nodes.pos) {
|
||||
pos_3 = _this.addSyntheticNodes(children_4, pos_3, nodes.pos, useJSDocScanner_1);
|
||||
pos_3 = _this.addSyntheticNodes(children, pos_3, nodes.pos, useJSDocScanner_1);
|
||||
}
|
||||
children_4.push(_this.createSyntaxList(nodes));
|
||||
children.push(_this.createSyntaxList(nodes));
|
||||
pos_3 = nodes.end;
|
||||
};
|
||||
if (this.jsDoc) {
|
||||
|
@ -72085,14 +72074,11 @@ var ts;
|
|||
pos_3 = this.pos;
|
||||
ts.forEachChild(this, processNode, processNodes);
|
||||
if (pos_3 < this.end) {
|
||||
this.addSyntheticNodes(children_4, pos_3, this.end);
|
||||
this.addSyntheticNodes(children, pos_3, this.end);
|
||||
}
|
||||
ts.scanner.setText(undefined);
|
||||
this._children = children_4;
|
||||
}
|
||||
else {
|
||||
this._children = ts.emptyArray;
|
||||
}
|
||||
this._children = children || ts.emptyArray;
|
||||
};
|
||||
NodeObject.prototype.getChildCount = function (sourceFile) {
|
||||
if (!this._children)
|
||||
|
@ -72906,7 +72892,7 @@ var ts;
|
|||
function getQuickInfoAtPosition(fileName, position) {
|
||||
synchronizeHostData();
|
||||
var sourceFile = getValidSourceFile(fileName);
|
||||
var node = ts.getTouchingPropertyName(sourceFile, position, true);
|
||||
var node = ts.getTouchingPropertyName(sourceFile, position);
|
||||
if (node === sourceFile) {
|
||||
return undefined;
|
||||
}
|
||||
|
@ -73046,7 +73032,7 @@ var ts;
|
|||
}
|
||||
function getNameOrDottedNameSpan(fileName, startPos, _endPos) {
|
||||
var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
|
||||
var node = ts.getTouchingPropertyName(sourceFile, startPos, false);
|
||||
var node = ts.getTouchingPropertyName(sourceFile, startPos);
|
||||
if (node === sourceFile) {
|
||||
return;
|
||||
}
|
||||
|
@ -73126,7 +73112,7 @@ var ts;
|
|||
function getBraceMatchingAtPosition(fileName, position) {
|
||||
var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
|
||||
var result = [];
|
||||
var token = ts.getTouchingToken(sourceFile, position, false);
|
||||
var token = ts.getTouchingToken(sourceFile, position);
|
||||
if (token.getStart(sourceFile) === position) {
|
||||
var matchKind = getMatchingTokenKind(token);
|
||||
if (matchKind) {
|
||||
|
@ -80515,3 +80501,5 @@ var ts;
|
|||
ioSession.listen();
|
||||
})(server = ts.server || (ts.server = {}));
|
||||
})(ts || (ts = {}));
|
||||
|
||||
//# sourceMappingURL=tsserver.js.map
|
||||
|
|
3
lib/tsserverlibrary.d.ts
vendored
3
lib/tsserverlibrary.d.ts
vendored
|
@ -2473,7 +2473,6 @@ declare namespace ts {
|
|||
function getParseTreeNode(node: Node): Node;
|
||||
function getParseTreeNode<T extends Node>(node: Node, nodeTest?: (node: Node) => node is T): T;
|
||||
function unescapeIdentifier(identifier: string): string;
|
||||
function getNameOfDeclaration(declaration: Declaration): DeclarationName | undefined;
|
||||
}
|
||||
declare namespace ts {
|
||||
function createNodeArray<T extends Node>(elements?: T[], hasTrailingComma?: boolean): NodeArray<T>;
|
||||
|
@ -2787,7 +2786,7 @@ declare namespace ts {
|
|||
}
|
||||
declare namespace ts {
|
||||
function createNode(kind: SyntaxKind, pos?: number, end?: number): Node;
|
||||
function forEachChild<T>(node: Node, cbNode: (node: Node) => T | undefined, cbNodeArray?: (nodes: NodeArray<Node>) => T | undefined): T | undefined;
|
||||
function forEachChild<T>(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T | undefined;
|
||||
function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean, scriptKind?: ScriptKind): SourceFile;
|
||||
function parseIsolatedEntityName(text: string, languageVersion: ScriptTarget): EntityName;
|
||||
function isExternalModule(file: SourceFile): boolean;
|
||||
|
|
|
@ -9450,6 +9450,9 @@ var ts;
|
|||
}
|
||||
ts.getJSDocs = getJSDocs;
|
||||
function getJSDocParameterTags(param) {
|
||||
if (!isParameter(param)) {
|
||||
return undefined;
|
||||
}
|
||||
var func = param.parent;
|
||||
var tags = getJSDocTags(func, 286);
|
||||
if (!param.name) {
|
||||
|
@ -9468,18 +9471,6 @@ var ts;
|
|||
}
|
||||
}
|
||||
ts.getJSDocParameterTags = getJSDocParameterTags;
|
||||
function getParameterFromJSDoc(node) {
|
||||
var name = node.parameterName.text;
|
||||
var grandParent = node.parent.parent;
|
||||
ts.Debug.assert(node.parent.kind === 283);
|
||||
if (!isFunctionLike(grandParent)) {
|
||||
return undefined;
|
||||
}
|
||||
return ts.find(grandParent.parameters, function (p) {
|
||||
return p.name.kind === 71 && p.name.text === name;
|
||||
});
|
||||
}
|
||||
ts.getParameterFromJSDoc = getParameterFromJSDoc;
|
||||
function getJSDocType(node) {
|
||||
var tag = getFirstJSDocTag(node, 288);
|
||||
if (!tag && node.kind === 146) {
|
||||
|
@ -9616,6 +9607,36 @@ var ts;
|
|||
}
|
||||
}
|
||||
ts.isDeclarationName = isDeclarationName;
|
||||
function getNameOfDeclaration(declaration) {
|
||||
if (!declaration) {
|
||||
return undefined;
|
||||
}
|
||||
if (declaration.kind === 194) {
|
||||
var kind = getSpecialPropertyAssignmentKind(declaration);
|
||||
var lhs = declaration.left;
|
||||
switch (kind) {
|
||||
case 0:
|
||||
case 2:
|
||||
return undefined;
|
||||
case 1:
|
||||
if (lhs.kind === 71) {
|
||||
return lhs.name;
|
||||
}
|
||||
else {
|
||||
return lhs.expression.name;
|
||||
}
|
||||
case 4:
|
||||
case 5:
|
||||
return lhs.name;
|
||||
case 3:
|
||||
return lhs.expression.name;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return declaration.name;
|
||||
}
|
||||
}
|
||||
ts.getNameOfDeclaration = getNameOfDeclaration;
|
||||
function isLiteralComputedPropertyDeclarationName(node) {
|
||||
return (node.kind === 9 || node.kind === 8) &&
|
||||
node.parent.kind === 144 &&
|
||||
|
@ -9806,7 +9827,7 @@ var ts;
|
|||
}
|
||||
ts.isStringOrNumericLiteral = isStringOrNumericLiteral;
|
||||
function hasDynamicName(declaration) {
|
||||
var name = ts.getNameOfDeclaration(declaration);
|
||||
var name = getNameOfDeclaration(declaration);
|
||||
return name && isDynamicName(name);
|
||||
}
|
||||
ts.hasDynamicName = hasDynamicName;
|
||||
|
@ -11961,27 +11982,6 @@ var ts;
|
|||
return identifier.length >= 3 && identifier.charCodeAt(0) === 95 && identifier.charCodeAt(1) === 95 && identifier.charCodeAt(2) === 95 ? identifier.substr(1) : identifier;
|
||||
}
|
||||
ts.unescapeIdentifier = unescapeIdentifier;
|
||||
function getNameOfDeclaration(declaration) {
|
||||
if (!declaration) {
|
||||
return undefined;
|
||||
}
|
||||
if (declaration.kind === 194) {
|
||||
var expr = declaration;
|
||||
switch (ts.getSpecialPropertyAssignmentKind(expr)) {
|
||||
case 1:
|
||||
case 4:
|
||||
case 5:
|
||||
case 3:
|
||||
return expr.left.name;
|
||||
default:
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return declaration.name;
|
||||
}
|
||||
}
|
||||
ts.getNameOfDeclaration = getNameOfDeclaration;
|
||||
})(ts || (ts = {}));
|
||||
var ts;
|
||||
(function (ts) {
|
||||
|
@ -21014,8 +21014,15 @@ var ts;
|
|||
case 243:
|
||||
return node.isExportEquals ? "export=" : "default";
|
||||
case 194:
|
||||
if (ts.getSpecialPropertyAssignmentKind(node) === 2) {
|
||||
return "export=";
|
||||
switch (ts.getSpecialPropertyAssignmentKind(node)) {
|
||||
case 2:
|
||||
return "export=";
|
||||
case 1:
|
||||
case 4:
|
||||
case 5:
|
||||
return node.left.name.text;
|
||||
case 3:
|
||||
return node.left.expression.name.text;
|
||||
}
|
||||
ts.Debug.fail("Unknown binary declaration kind");
|
||||
break;
|
||||
|
@ -21107,8 +21114,6 @@ var ts;
|
|||
}
|
||||
}
|
||||
else {
|
||||
if (node.kind === 290)
|
||||
ts.Debug.assert(ts.isInJavaScriptFile(node));
|
||||
var isJSDocTypedefInJSDocNamespace = node.kind === 290 &&
|
||||
node.name &&
|
||||
node.name.kind === 71 &&
|
||||
|
@ -21238,7 +21243,9 @@ var ts;
|
|||
ts.forEachChild(node, bind, bindEach);
|
||||
}
|
||||
function bindChildrenWorker(node) {
|
||||
ts.forEach(node.jsDoc, bind);
|
||||
if (ts.isInJavaScriptFile(node) && node.jsDoc) {
|
||||
ts.forEach(node.jsDoc, bind);
|
||||
}
|
||||
if (checkUnreachable(node)) {
|
||||
bindEachChild(node);
|
||||
return;
|
||||
|
@ -22288,7 +22295,9 @@ var ts;
|
|||
}
|
||||
node.parent = parent;
|
||||
var saveInStrictMode = inStrictMode;
|
||||
bindJSDocTypedefTagIfAny(node);
|
||||
if (ts.isInJavaScriptFile(node)) {
|
||||
bindJSDocTypedefTagIfAny(node);
|
||||
}
|
||||
bindWorker(node);
|
||||
if (node.kind > 142) {
|
||||
var saveParent = parent;
|
||||
|
@ -22348,7 +22357,7 @@ var ts;
|
|||
function bindWorker(node) {
|
||||
switch (node.kind) {
|
||||
case 71:
|
||||
if (ts.isInJavaScriptFile(node) && node.isInJSDocNamespace) {
|
||||
if (node.isInJSDocNamespace) {
|
||||
var parentNode = node.parent;
|
||||
while (parentNode && parentNode.kind !== 290) {
|
||||
parentNode = parentNode.parent;
|
||||
|
@ -22416,7 +22425,10 @@ var ts;
|
|||
return bindVariableDeclarationOrBindingElement(node);
|
||||
case 149:
|
||||
case 148:
|
||||
return bindPropertyWorker(node);
|
||||
case 276:
|
||||
return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 67108864 : 0), 0);
|
||||
case 291:
|
||||
return bindJSDocProperty(node);
|
||||
case 261:
|
||||
case 262:
|
||||
return bindPropertyOrMethodOrAccessor(node, 4, 0);
|
||||
|
@ -22454,10 +22466,13 @@ var ts;
|
|||
return bindPropertyOrMethodOrAccessor(node, 65536, 74687);
|
||||
case 160:
|
||||
case 161:
|
||||
case 279:
|
||||
return bindFunctionOrConstructorType(node);
|
||||
case 163:
|
||||
case 172:
|
||||
return bindAnonymousTypeWorker(node);
|
||||
case 292:
|
||||
case 275:
|
||||
return bindAnonymousDeclaration(node, 2048, "__type");
|
||||
case 178:
|
||||
return bindObjectLiteralExpression(node);
|
||||
case 186:
|
||||
|
@ -22474,6 +22489,11 @@ var ts;
|
|||
return bindClassLikeDeclaration(node);
|
||||
case 230:
|
||||
return bindBlockScopedDeclaration(node, 64, 792968);
|
||||
case 290:
|
||||
if (!node.fullName || node.fullName.kind === 71) {
|
||||
return bindBlockScopedDeclaration(node, 524288, 793064);
|
||||
}
|
||||
break;
|
||||
case 231:
|
||||
return bindBlockScopedDeclaration(node, 524288, 793064);
|
||||
case 232:
|
||||
|
@ -22506,37 +22526,8 @@ var ts;
|
|||
}
|
||||
case 234:
|
||||
return updateStrictModeStatementList(node.statements);
|
||||
default:
|
||||
if (ts.isInJavaScriptFile(node))
|
||||
return bindJSDocWorker(node);
|
||||
}
|
||||
}
|
||||
function bindJSDocWorker(node) {
|
||||
switch (node.kind) {
|
||||
case 276:
|
||||
return bindPropertyWorker(node);
|
||||
case 291:
|
||||
return declareSymbolAndAddToSymbolTable(node, 4, 0);
|
||||
case 279:
|
||||
return bindFunctionOrConstructorType(node);
|
||||
case 292:
|
||||
case 275:
|
||||
return bindAnonymousTypeWorker(node);
|
||||
case 290: {
|
||||
var fullName = node.fullName;
|
||||
if (!fullName || fullName.kind === 71) {
|
||||
return bindBlockScopedDeclaration(node, 524288, 793064);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
function bindPropertyWorker(node) {
|
||||
return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 67108864 : 0), 0);
|
||||
}
|
||||
function bindAnonymousTypeWorker(node) {
|
||||
return bindAnonymousDeclaration(node, 2048, "__type");
|
||||
}
|
||||
function checkTypePredicate(node) {
|
||||
var parameterName = node.parameterName, type = node.type;
|
||||
if (parameterName && parameterName.kind === 71) {
|
||||
|
@ -22796,8 +22787,10 @@ var ts;
|
|||
return bindAnonymousDeclaration(node, 16, bindingName);
|
||||
}
|
||||
function bindPropertyOrMethodOrAccessor(node, symbolFlags, symbolExcludes) {
|
||||
if (!file.isDeclarationFile && !ts.isInAmbientContext(node) && ts.isAsyncFunction(node)) {
|
||||
emitFlags |= 1024;
|
||||
if (!file.isDeclarationFile && !ts.isInAmbientContext(node)) {
|
||||
if (ts.isAsyncFunction(node)) {
|
||||
emitFlags |= 1024;
|
||||
}
|
||||
}
|
||||
if (currentFlow && ts.isObjectLiteralOrClassExpressionMethod(node)) {
|
||||
node.flowNode = currentFlow;
|
||||
|
@ -22806,6 +22799,9 @@ var ts;
|
|||
? bindAnonymousDeclaration(node, symbolFlags, "__computed")
|
||||
: declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes);
|
||||
}
|
||||
function bindJSDocProperty(node) {
|
||||
return declareSymbolAndAddToSymbolTable(node, 4, 0);
|
||||
}
|
||||
function shouldReportErrorOnModuleDeclaration(node) {
|
||||
var instanceState = getModuleInstanceState(node);
|
||||
return instanceState === 1 || (instanceState === 2 && options.preserveConstEnums);
|
||||
|
@ -40744,10 +40740,6 @@ var ts;
|
|||
return entityNameSymbol;
|
||||
}
|
||||
}
|
||||
if (entityName.parent.kind === 286) {
|
||||
var parameter = ts.getParameterFromJSDoc(entityName.parent);
|
||||
return parameter && parameter.symbol;
|
||||
}
|
||||
if (ts.isPartOfExpression(entityName)) {
|
||||
if (ts.nodeIsMissing(entityName)) {
|
||||
return undefined;
|
||||
|
@ -58836,22 +58828,27 @@ var ts;
|
|||
}
|
||||
ts.findContainingList = findContainingList;
|
||||
function getTouchingWord(sourceFile, position, includeJsDocComment) {
|
||||
return getTouchingToken(sourceFile, position, includeJsDocComment, function (n) { return isWord(n.kind); });
|
||||
if (includeJsDocComment === void 0) { includeJsDocComment = false; }
|
||||
return getTouchingToken(sourceFile, position, function (n) { return isWord(n.kind); }, includeJsDocComment);
|
||||
}
|
||||
ts.getTouchingWord = getTouchingWord;
|
||||
function getTouchingPropertyName(sourceFile, position, includeJsDocComment) {
|
||||
return getTouchingToken(sourceFile, position, includeJsDocComment, function (n) { return isPropertyName(n.kind); });
|
||||
if (includeJsDocComment === void 0) { includeJsDocComment = false; }
|
||||
return getTouchingToken(sourceFile, position, function (n) { return isPropertyName(n.kind); }, includeJsDocComment);
|
||||
}
|
||||
ts.getTouchingPropertyName = getTouchingPropertyName;
|
||||
function getTouchingToken(sourceFile, position, includeJsDocComment, includeItemAtEndPosition) {
|
||||
function getTouchingToken(sourceFile, position, includeItemAtEndPosition, includeJsDocComment) {
|
||||
if (includeJsDocComment === void 0) { includeJsDocComment = false; }
|
||||
return getTokenAtPositionWorker(sourceFile, position, false, includeItemAtEndPosition, includeJsDocComment);
|
||||
}
|
||||
ts.getTouchingToken = getTouchingToken;
|
||||
function getTokenAtPosition(sourceFile, position, includeJsDocComment) {
|
||||
if (includeJsDocComment === void 0) { includeJsDocComment = false; }
|
||||
return getTokenAtPositionWorker(sourceFile, position, true, undefined, includeJsDocComment);
|
||||
}
|
||||
ts.getTokenAtPosition = getTokenAtPosition;
|
||||
function getTokenAtPositionWorker(sourceFile, position, allowPositionInLeadingTrivia, includeItemAtEndPosition, includeJsDocComment) {
|
||||
if (includeJsDocComment === void 0) { includeJsDocComment = false; }
|
||||
var current = sourceFile;
|
||||
outer: while (true) {
|
||||
if (ts.isToken(current)) {
|
||||
|
@ -58882,7 +58879,7 @@ var ts;
|
|||
}
|
||||
}
|
||||
function findTokenOnLeftOfPosition(file, position) {
|
||||
var tokenAtPosition = getTokenAtPosition(file, position, false);
|
||||
var tokenAtPosition = getTokenAtPosition(file, position);
|
||||
if (ts.isToken(tokenAtPosition) && position > tokenAtPosition.getStart(file) && position < tokenAtPosition.getEnd()) {
|
||||
return tokenAtPosition;
|
||||
}
|
||||
|
@ -58969,7 +58966,7 @@ var ts;
|
|||
}
|
||||
ts.isInString = isInString;
|
||||
function isInsideJsxElementOrAttribute(sourceFile, position) {
|
||||
var token = getTokenAtPosition(sourceFile, position, false);
|
||||
var token = getTokenAtPosition(sourceFile, position);
|
||||
if (!token) {
|
||||
return false;
|
||||
}
|
||||
|
@ -58992,12 +58989,12 @@ var ts;
|
|||
}
|
||||
ts.isInsideJsxElementOrAttribute = isInsideJsxElementOrAttribute;
|
||||
function isInTemplateString(sourceFile, position) {
|
||||
var token = getTokenAtPosition(sourceFile, position, false);
|
||||
var token = getTokenAtPosition(sourceFile, position);
|
||||
return ts.isTemplateLiteralKind(token.kind) && position > token.getStart(sourceFile);
|
||||
}
|
||||
ts.isInTemplateString = isInTemplateString;
|
||||
function isInComment(sourceFile, position, tokenAtPosition, predicate) {
|
||||
if (tokenAtPosition === void 0) { tokenAtPosition = getTokenAtPosition(sourceFile, position, false); }
|
||||
if (tokenAtPosition === void 0) { tokenAtPosition = getTokenAtPosition(sourceFile, position); }
|
||||
return position <= tokenAtPosition.getStart(sourceFile) &&
|
||||
(isInCommentRange(ts.getLeadingCommentRanges(sourceFile.text, tokenAtPosition.pos)) ||
|
||||
isInCommentRange(ts.getTrailingCommentRanges(sourceFile.text, tokenAtPosition.pos)));
|
||||
|
@ -59020,7 +59017,7 @@ var ts;
|
|||
}
|
||||
}
|
||||
function hasDocComment(sourceFile, position) {
|
||||
var token = getTokenAtPosition(sourceFile, position, false);
|
||||
var token = getTokenAtPosition(sourceFile, position);
|
||||
var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos);
|
||||
return ts.forEach(commentRanges, jsDocPrefix);
|
||||
function jsDocPrefix(c) {
|
||||
|
@ -59030,7 +59027,7 @@ var ts;
|
|||
}
|
||||
ts.hasDocComment = hasDocComment;
|
||||
function getJsDocTagAtPosition(sourceFile, position) {
|
||||
var node = ts.getTokenAtPosition(sourceFile, position, false);
|
||||
var node = ts.getTokenAtPosition(sourceFile, position);
|
||||
if (ts.isToken(node)) {
|
||||
switch (node.kind) {
|
||||
case 104:
|
||||
|
@ -59480,7 +59477,7 @@ var ts;
|
|||
}
|
||||
ts.getOpenBrace = getOpenBrace;
|
||||
function getOpenBraceOfClassLike(declaration, sourceFile) {
|
||||
return ts.getTokenAtPosition(sourceFile, declaration.members.pos - 1, false);
|
||||
return ts.getTokenAtPosition(sourceFile, declaration.members.pos - 1);
|
||||
}
|
||||
ts.getOpenBraceOfClassLike = getOpenBraceOfClassLike;
|
||||
})(ts || (ts = {}));
|
||||
|
@ -59492,7 +59489,7 @@ var ts;
|
|||
if (sourceFile.isDeclarationFile) {
|
||||
return undefined;
|
||||
}
|
||||
var tokenAtLocation = ts.getTokenAtPosition(sourceFile, position, false);
|
||||
var tokenAtLocation = ts.getTokenAtPosition(sourceFile, position);
|
||||
var lineOfPosition = sourceFile.getLineAndCharacterOfPosition(position).line;
|
||||
if (sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getStart(sourceFile)).line > lineOfPosition) {
|
||||
tokenAtLocation = ts.findPrecedingToken(tokenAtLocation.pos, sourceFile);
|
||||
|
@ -60918,7 +60915,7 @@ var ts;
|
|||
return ts.deduplicate(nonRelativeModules);
|
||||
}
|
||||
function getTripleSlashReferenceCompletion(sourceFile, position, compilerOptions, host) {
|
||||
var token = ts.getTokenAtPosition(sourceFile, position, false);
|
||||
var token = ts.getTokenAtPosition(sourceFile, position);
|
||||
if (!token) {
|
||||
return undefined;
|
||||
}
|
||||
|
@ -61371,7 +61368,7 @@ var ts;
|
|||
var requestJsDocTagName = false;
|
||||
var requestJsDocTag = false;
|
||||
var start = ts.timestamp();
|
||||
var currentToken = ts.getTokenAtPosition(sourceFile, position, false);
|
||||
var currentToken = ts.getTokenAtPosition(sourceFile, position);
|
||||
log("getCompletionData: Get current token: " + (ts.timestamp() - start));
|
||||
start = ts.timestamp();
|
||||
var insideComment = ts.isInComment(sourceFile, position, currentToken);
|
||||
|
@ -61424,7 +61421,7 @@ var ts;
|
|||
var isRightOfDot = false;
|
||||
var isRightOfOpenTag = false;
|
||||
var isStartingCloseTag = false;
|
||||
var location = ts.getTouchingPropertyName(sourceFile, position, false);
|
||||
var location = ts.getTouchingPropertyName(sourceFile, position);
|
||||
if (contextToken) {
|
||||
if (isCompletionListBlocker(contextToken)) {
|
||||
log("Returning an empty list because completion was requested in an invalid position.");
|
||||
|
@ -62165,7 +62162,7 @@ var ts;
|
|||
var DocumentHighlights;
|
||||
(function (DocumentHighlights) {
|
||||
function getDocumentHighlights(program, cancellationToken, sourceFile, position, sourceFilesToSearch) {
|
||||
var node = ts.getTouchingWord(sourceFile, position, true);
|
||||
var node = ts.getTouchingWord(sourceFile, position);
|
||||
return node && (getSemanticDocumentHighlights(node, program, cancellationToken, sourceFilesToSearch) || getSyntacticDocumentHighlights(node, sourceFile));
|
||||
}
|
||||
DocumentHighlights.getDocumentHighlights = getDocumentHighlights;
|
||||
|
@ -63255,16 +63252,13 @@ var ts;
|
|||
}
|
||||
FindAllReferences.findReferencedSymbols = findReferencedSymbols;
|
||||
function getImplementationsAtPosition(program, cancellationToken, sourceFiles, sourceFile, position) {
|
||||
var node = ts.getTouchingPropertyName(sourceFile, position, false);
|
||||
var node = ts.getTouchingPropertyName(sourceFile, position);
|
||||
var referenceEntries = getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node);
|
||||
var checker = program.getTypeChecker();
|
||||
return ts.map(referenceEntries, function (entry) { return toImplementationLocation(entry, checker); });
|
||||
}
|
||||
FindAllReferences.getImplementationsAtPosition = getImplementationsAtPosition;
|
||||
function getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node) {
|
||||
if (node.kind === 265) {
|
||||
return undefined;
|
||||
}
|
||||
var checker = program.getTypeChecker();
|
||||
if (node.parent.kind === 262) {
|
||||
var result_5 = [];
|
||||
|
@ -63735,7 +63729,7 @@ var ts;
|
|||
var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, labelName, container);
|
||||
for (var _i = 0, possiblePositions_1 = possiblePositions; _i < possiblePositions_1.length; _i++) {
|
||||
var position = possiblePositions_1[_i];
|
||||
var node = ts.getTouchingWord(sourceFile, position, false);
|
||||
var node = ts.getTouchingWord(sourceFile, position);
|
||||
if (node && (node === targetLabel || (ts.isJumpStatementTarget(node) && ts.getTargetLabel(node, labelName) === targetLabel))) {
|
||||
references.push(FindAllReferences.nodeEntry(node));
|
||||
}
|
||||
|
@ -63765,10 +63759,10 @@ var ts;
|
|||
return references.length ? [{ definition: { type: "keyword", node: references[0].node }, references: references }] : undefined;
|
||||
}
|
||||
function addReferencesForKeywordInFile(sourceFile, kind, searchText, references) {
|
||||
var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, searchText, sourceFile, true);
|
||||
var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, searchText);
|
||||
for (var _i = 0, possiblePositions_2 = possiblePositions; _i < possiblePositions_2.length; _i++) {
|
||||
var position = possiblePositions_2[_i];
|
||||
var referenceLocation = ts.getTouchingPropertyName(sourceFile, position, true);
|
||||
var referenceLocation = ts.getTouchingPropertyName(sourceFile, position);
|
||||
if (referenceLocation.kind === kind) {
|
||||
references.push(FindAllReferences.nodeEntry(referenceLocation));
|
||||
}
|
||||
|
@ -63782,13 +63776,13 @@ var ts;
|
|||
if (!state.markSearchedSymbol(sourceFile, search.symbol)) {
|
||||
return;
|
||||
}
|
||||
for (var _i = 0, _a = getPossibleSymbolReferencePositions(sourceFile, search.text, container, state.findInComments || container.jsDoc !== undefined); _i < _a.length; _i++) {
|
||||
for (var _i = 0, _a = getPossibleSymbolReferencePositions(sourceFile, search.text, container, state.findInComments); _i < _a.length; _i++) {
|
||||
var position = _a[_i];
|
||||
getReferencesAtLocation(sourceFile, position, search, state);
|
||||
}
|
||||
}
|
||||
function getReferencesAtLocation(sourceFile, position, search, state) {
|
||||
var referenceLocation = ts.getTouchingPropertyName(sourceFile, position, true);
|
||||
var referenceLocation = ts.getTouchingPropertyName(sourceFile, position);
|
||||
if (!isValidReferencePosition(referenceLocation, search.text)) {
|
||||
if (!state.implementations && (state.findInStrings && ts.isInString(sourceFile, position) || state.findInComments && ts.isInNonReferenceComment(sourceFile, position))) {
|
||||
state.addStringOrCommentReference(sourceFile.fileName, ts.createTextSpan(position, search.text.length));
|
||||
|
@ -64124,7 +64118,7 @@ var ts;
|
|||
var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "super", searchSpaceNode);
|
||||
for (var _i = 0, possiblePositions_3 = possiblePositions; _i < possiblePositions_3.length; _i++) {
|
||||
var position = possiblePositions_3[_i];
|
||||
var node = ts.getTouchingWord(sourceFile, position, false);
|
||||
var node = ts.getTouchingWord(sourceFile, position);
|
||||
if (!node || node.kind !== 97) {
|
||||
continue;
|
||||
}
|
||||
|
@ -64182,7 +64176,7 @@ var ts;
|
|||
}];
|
||||
function getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, result) {
|
||||
ts.forEach(possiblePositions, function (position) {
|
||||
var node = ts.getTouchingWord(sourceFile, position, false);
|
||||
var node = ts.getTouchingWord(sourceFile, position);
|
||||
if (!node || !ts.isThis(node)) {
|
||||
return;
|
||||
}
|
||||
|
@ -64230,7 +64224,7 @@ var ts;
|
|||
function getReferencesForStringLiteralInFile(sourceFile, searchText, possiblePositions, references) {
|
||||
for (var _i = 0, possiblePositions_4 = possiblePositions; _i < possiblePositions_4.length; _i++) {
|
||||
var position = possiblePositions_4[_i];
|
||||
var node_7 = ts.getTouchingWord(sourceFile, position, false);
|
||||
var node_7 = ts.getTouchingWord(sourceFile, position);
|
||||
if (node_7 && node_7.kind === 9 && node_7.text === searchText) {
|
||||
references.push(FindAllReferences.nodeEntry(node_7, true));
|
||||
}
|
||||
|
@ -64492,7 +64486,7 @@ var ts;
|
|||
return referenceFile && referenceFile.resolvedFileName &&
|
||||
[getDefinitionInfoForFileReference(typeReferenceDirective.fileName, referenceFile.resolvedFileName)];
|
||||
}
|
||||
var node = ts.getTouchingPropertyName(sourceFile, position, true);
|
||||
var node = ts.getTouchingPropertyName(sourceFile, position);
|
||||
if (node === sourceFile) {
|
||||
return undefined;
|
||||
}
|
||||
|
@ -64537,7 +64531,7 @@ var ts;
|
|||
}
|
||||
GoToDefinition.getDefinitionAtPosition = getDefinitionAtPosition;
|
||||
function getTypeDefinitionAtPosition(typeChecker, sourceFile, position) {
|
||||
var node = ts.getTouchingPropertyName(sourceFile, position, true);
|
||||
var node = ts.getTouchingPropertyName(sourceFile, position);
|
||||
if (node === sourceFile) {
|
||||
return undefined;
|
||||
}
|
||||
|
@ -64838,7 +64832,7 @@ var ts;
|
|||
if (ts.isInString(sourceFile, position) || ts.isInComment(sourceFile, position) || ts.hasDocComment(sourceFile, position)) {
|
||||
return undefined;
|
||||
}
|
||||
var tokenAtPos = ts.getTokenAtPosition(sourceFile, position, false);
|
||||
var tokenAtPos = ts.getTokenAtPosition(sourceFile, position);
|
||||
var tokenStart = tokenAtPos.getStart();
|
||||
if (!tokenAtPos || tokenStart < position) {
|
||||
return undefined;
|
||||
|
@ -70182,7 +70176,7 @@ var ts;
|
|||
return this;
|
||||
}
|
||||
if (index !== containingList.length - 1) {
|
||||
var nextToken = ts.getTokenAtPosition(sourceFile, node.end, false);
|
||||
var nextToken = ts.getTokenAtPosition(sourceFile, node.end);
|
||||
if (nextToken && isSeparator(node, nextToken)) {
|
||||
var startPosition = ts.skipTrivia(sourceFile.text, getAdjustedStartPosition(sourceFile, node, {}, Position.FullStart), false, true);
|
||||
var nextElement = containingList[index + 1];
|
||||
|
@ -70191,7 +70185,7 @@ var ts;
|
|||
}
|
||||
}
|
||||
else {
|
||||
var previousToken = ts.getTokenAtPosition(sourceFile, containingList[index - 1].end, false);
|
||||
var previousToken = ts.getTokenAtPosition(sourceFile, containingList[index - 1].end);
|
||||
if (previousToken && isSeparator(node, previousToken)) {
|
||||
this.deleteNodeRange(sourceFile, previousToken, node);
|
||||
}
|
||||
|
@ -70259,7 +70253,7 @@ var ts;
|
|||
}
|
||||
var end = after.getEnd();
|
||||
if (index !== containingList.length - 1) {
|
||||
var nextToken = ts.getTokenAtPosition(sourceFile, after.end, false);
|
||||
var nextToken = ts.getTokenAtPosition(sourceFile, after.end);
|
||||
if (nextToken && isSeparator(after, nextToken)) {
|
||||
var lineAndCharOfNextElement = ts.getLineAndCharacterOfPosition(sourceFile, skipWhitespacesAndLineBreaks(sourceFile.text, containingList[index + 1].getFullStart()));
|
||||
var lineAndCharOfNextToken = ts.getLineAndCharacterOfPosition(sourceFile, nextToken.end);
|
||||
|
@ -70629,7 +70623,7 @@ var ts;
|
|||
function getActionForClassLikeIncorrectImplementsInterface(context) {
|
||||
var sourceFile = context.sourceFile;
|
||||
var start = context.span.start;
|
||||
var token = ts.getTokenAtPosition(sourceFile, start, false);
|
||||
var token = ts.getTokenAtPosition(sourceFile, start);
|
||||
var checker = context.program.getTypeChecker();
|
||||
var classDeclaration = ts.getContainingClass(token);
|
||||
if (!classDeclaration) {
|
||||
|
@ -70689,7 +70683,7 @@ var ts;
|
|||
function getActionsForAddMissingMember(context) {
|
||||
var sourceFile = context.sourceFile;
|
||||
var start = context.span.start;
|
||||
var token = ts.getTokenAtPosition(sourceFile, start, false);
|
||||
var token = ts.getTokenAtPosition(sourceFile, start);
|
||||
if (token.kind !== 71) {
|
||||
return undefined;
|
||||
}
|
||||
|
@ -70785,7 +70779,7 @@ var ts;
|
|||
});
|
||||
function getActionsForCorrectSpelling(context) {
|
||||
var sourceFile = context.sourceFile;
|
||||
var node = ts.getTokenAtPosition(sourceFile, context.span.start, false);
|
||||
var node = ts.getTokenAtPosition(sourceFile, context.span.start);
|
||||
var checker = context.program.getTypeChecker();
|
||||
var suggestion;
|
||||
if (node.kind === 71 && ts.isPropertyAccessExpression(node.parent)) {
|
||||
|
@ -70839,7 +70833,7 @@ var ts;
|
|||
function getActionForClassLikeMissingAbstractMember(context) {
|
||||
var sourceFile = context.sourceFile;
|
||||
var start = context.span.start;
|
||||
var token = ts.getTokenAtPosition(sourceFile, start, false);
|
||||
var token = ts.getTokenAtPosition(sourceFile, start);
|
||||
var checker = context.program.getTypeChecker();
|
||||
if (ts.isClassLike(token.parent)) {
|
||||
var classDeclaration = token.parent;
|
||||
|
@ -70874,7 +70868,7 @@ var ts;
|
|||
errorCodes: [ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class.code],
|
||||
getCodeActions: function (context) {
|
||||
var sourceFile = context.sourceFile;
|
||||
var token = ts.getTokenAtPosition(sourceFile, context.span.start, false);
|
||||
var token = ts.getTokenAtPosition(sourceFile, context.span.start);
|
||||
if (token.kind !== 99) {
|
||||
return undefined;
|
||||
}
|
||||
|
@ -70919,7 +70913,7 @@ var ts;
|
|||
errorCodes: [ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code],
|
||||
getCodeActions: function (context) {
|
||||
var sourceFile = context.sourceFile;
|
||||
var token = ts.getTokenAtPosition(sourceFile, context.span.start, false);
|
||||
var token = ts.getTokenAtPosition(sourceFile, context.span.start);
|
||||
if (token.kind !== 123) {
|
||||
return undefined;
|
||||
}
|
||||
|
@ -70943,7 +70937,7 @@ var ts;
|
|||
getCodeActions: function (context) {
|
||||
var sourceFile = context.sourceFile;
|
||||
var start = context.span.start;
|
||||
var token = ts.getTokenAtPosition(sourceFile, start, false);
|
||||
var token = ts.getTokenAtPosition(sourceFile, start);
|
||||
var classDeclNode = ts.getContainingClass(token);
|
||||
if (!(token.kind === 71 && ts.isClassLike(classDeclNode))) {
|
||||
return undefined;
|
||||
|
@ -70981,7 +70975,7 @@ var ts;
|
|||
errorCodes: [ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code],
|
||||
getCodeActions: function (context) {
|
||||
var sourceFile = context.sourceFile;
|
||||
var token = ts.getTokenAtPosition(sourceFile, context.span.start, false);
|
||||
var token = ts.getTokenAtPosition(sourceFile, context.span.start);
|
||||
if (token.kind !== 71) {
|
||||
return undefined;
|
||||
}
|
||||
|
@ -71007,9 +71001,9 @@ var ts;
|
|||
getCodeActions: function (context) {
|
||||
var sourceFile = context.sourceFile;
|
||||
var start = context.span.start;
|
||||
var token = ts.getTokenAtPosition(sourceFile, start, false);
|
||||
var token = ts.getTokenAtPosition(sourceFile, start);
|
||||
if (token.kind === 21) {
|
||||
token = ts.getTokenAtPosition(sourceFile, start + 1, false);
|
||||
token = ts.getTokenAtPosition(sourceFile, start + 1);
|
||||
}
|
||||
switch (token.kind) {
|
||||
case 71:
|
||||
|
@ -71038,11 +71032,11 @@ var ts;
|
|||
case 145:
|
||||
var typeParameters = token.parent.parent.typeParameters;
|
||||
if (typeParameters.length === 1) {
|
||||
var previousToken = ts.getTokenAtPosition(sourceFile, typeParameters.pos - 1, false);
|
||||
var previousToken = ts.getTokenAtPosition(sourceFile, typeParameters.pos - 1);
|
||||
if (!previousToken || previousToken.kind !== 27) {
|
||||
return deleteRange(typeParameters);
|
||||
}
|
||||
var nextToken = ts.getTokenAtPosition(sourceFile, typeParameters.end, false);
|
||||
var nextToken = ts.getTokenAtPosition(sourceFile, typeParameters.end);
|
||||
if (!nextToken || nextToken.kind !== 29) {
|
||||
return deleteRange(typeParameters);
|
||||
}
|
||||
|
@ -71079,7 +71073,7 @@ var ts;
|
|||
}
|
||||
else {
|
||||
var start_4 = importClause.name.getStart(sourceFile);
|
||||
var nextToken = ts.getTokenAtPosition(sourceFile, importClause.name.end, false);
|
||||
var nextToken = ts.getTokenAtPosition(sourceFile, importClause.name.end);
|
||||
if (nextToken && nextToken.kind === 26) {
|
||||
return deleteRange({ pos: start_4, end: ts.skipTrivia(sourceFile.text, nextToken.end, false, true) });
|
||||
}
|
||||
|
@ -71094,7 +71088,7 @@ var ts;
|
|||
return deleteNode(importDecl);
|
||||
}
|
||||
else {
|
||||
var previousToken = ts.getTokenAtPosition(sourceFile, namespaceImport.pos - 1, false);
|
||||
var previousToken = ts.getTokenAtPosition(sourceFile, namespaceImport.pos - 1);
|
||||
if (previousToken && previousToken.kind === 26) {
|
||||
var startPosition = ts.textChanges.getAdjustedStartPosition(sourceFile, previousToken, {}, ts.textChanges.Position.FullStart);
|
||||
return deleteRange({ pos: startPosition, end: namespaceImport.end });
|
||||
|
@ -71258,7 +71252,7 @@ var ts;
|
|||
var checker = context.program.getTypeChecker();
|
||||
var allSourceFiles = context.program.getSourceFiles();
|
||||
var useCaseSensitiveFileNames = context.host.useCaseSensitiveFileNames ? context.host.useCaseSensitiveFileNames() : false;
|
||||
var token = ts.getTokenAtPosition(sourceFile, context.span.start, false);
|
||||
var token = ts.getTokenAtPosition(sourceFile, context.span.start);
|
||||
var name = token.getText();
|
||||
var symbolIdActionMap = new ImportCodeActionMap();
|
||||
var cachedImportDeclarations = [];
|
||||
|
@ -71603,7 +71597,7 @@ var ts;
|
|||
var lineStartPosition = ts.getStartPositionOfLine(line, sourceFile);
|
||||
var startPosition = ts.getFirstNonSpaceCharacterPosition(sourceFile.text, lineStartPosition);
|
||||
if (!ts.isInComment(sourceFile, startPosition) && !ts.isInString(sourceFile, startPosition) && !ts.isInTemplateString(sourceFile, startPosition)) {
|
||||
var token = ts.getTouchingToken(sourceFile, startPosition, false);
|
||||
var token = ts.getTouchingToken(sourceFile, startPosition);
|
||||
var tokenLeadingCommnets = ts.getLeadingCommentRangesOfNode(token, sourceFile);
|
||||
if (!tokenLeadingCommnets || !tokenLeadingCommnets.length || tokenLeadingCommnets[0].pos >= startPosition) {
|
||||
return {
|
||||
|
@ -71816,7 +71810,7 @@ var ts;
|
|||
refactor.registerRefactor(convertFunctionToES6Class);
|
||||
function isApplicable(context) {
|
||||
var start = context.startPosition;
|
||||
var node = ts.getTokenAtPosition(context.file, start, false);
|
||||
var node = ts.getTokenAtPosition(context.file, start);
|
||||
var checker = context.program.getTypeChecker();
|
||||
var symbol = checker.getSymbolAtLocation(node);
|
||||
if (symbol && ts.isDeclarationOfFunctionOrClassExpression(symbol)) {
|
||||
|
@ -71828,7 +71822,7 @@ var ts;
|
|||
var start = context.startPosition;
|
||||
var sourceFile = context.file;
|
||||
var checker = context.program.getTypeChecker();
|
||||
var token = ts.getTokenAtPosition(sourceFile, start, false);
|
||||
var token = ts.getTokenAtPosition(sourceFile, start);
|
||||
var ctorSymbol = checker.getSymbolAtLocation(token);
|
||||
var newLine = context.rulesProvider.getFormatOptions().newLineCharacter;
|
||||
var deletedNodes = [];
|
||||
|
@ -72021,7 +72015,6 @@ var ts;
|
|||
ts.scanner.setTextPos(pos);
|
||||
while (pos < end) {
|
||||
var token = useJSDocScanner ? ts.scanner.scanJSDocToken() : ts.scanner.scan();
|
||||
ts.Debug.assert(token !== 1);
|
||||
var textPos = ts.scanner.getTextPos();
|
||||
if (textPos <= end) {
|
||||
nodes.push(createNode(token, pos, textPos, this));
|
||||
|
@ -72049,31 +72042,27 @@ var ts;
|
|||
};
|
||||
NodeObject.prototype.createChildren = function (sourceFile) {
|
||||
var _this = this;
|
||||
if (ts.isJSDocTag(this)) {
|
||||
var children_3 = [];
|
||||
this.forEachChild(function (child) { children_3.push(child); });
|
||||
this._children = children_3;
|
||||
}
|
||||
else if (this.kind >= 143) {
|
||||
var children_4 = [];
|
||||
var children;
|
||||
if (this.kind >= 143) {
|
||||
ts.scanner.setText((sourceFile || this.getSourceFile()).text);
|
||||
children = [];
|
||||
var pos_3 = this.pos;
|
||||
var useJSDocScanner_1 = this.kind >= 283 && this.kind <= 293;
|
||||
var processNode = function (node) {
|
||||
var isJSDocTagNode = ts.isJSDocTag(node);
|
||||
if (!isJSDocTagNode && pos_3 < node.pos) {
|
||||
pos_3 = _this.addSyntheticNodes(children_4, pos_3, node.pos, useJSDocScanner_1);
|
||||
pos_3 = _this.addSyntheticNodes(children, pos_3, node.pos, useJSDocScanner_1);
|
||||
}
|
||||
children_4.push(node);
|
||||
children.push(node);
|
||||
if (!isJSDocTagNode) {
|
||||
pos_3 = node.end;
|
||||
}
|
||||
};
|
||||
var processNodes = function (nodes) {
|
||||
if (pos_3 < nodes.pos) {
|
||||
pos_3 = _this.addSyntheticNodes(children_4, pos_3, nodes.pos, useJSDocScanner_1);
|
||||
pos_3 = _this.addSyntheticNodes(children, pos_3, nodes.pos, useJSDocScanner_1);
|
||||
}
|
||||
children_4.push(_this.createSyntaxList(nodes));
|
||||
children.push(_this.createSyntaxList(nodes));
|
||||
pos_3 = nodes.end;
|
||||
};
|
||||
if (this.jsDoc) {
|
||||
|
@ -72085,14 +72074,11 @@ var ts;
|
|||
pos_3 = this.pos;
|
||||
ts.forEachChild(this, processNode, processNodes);
|
||||
if (pos_3 < this.end) {
|
||||
this.addSyntheticNodes(children_4, pos_3, this.end);
|
||||
this.addSyntheticNodes(children, pos_3, this.end);
|
||||
}
|
||||
ts.scanner.setText(undefined);
|
||||
this._children = children_4;
|
||||
}
|
||||
else {
|
||||
this._children = ts.emptyArray;
|
||||
}
|
||||
this._children = children || ts.emptyArray;
|
||||
};
|
||||
NodeObject.prototype.getChildCount = function (sourceFile) {
|
||||
if (!this._children)
|
||||
|
@ -72906,7 +72892,7 @@ var ts;
|
|||
function getQuickInfoAtPosition(fileName, position) {
|
||||
synchronizeHostData();
|
||||
var sourceFile = getValidSourceFile(fileName);
|
||||
var node = ts.getTouchingPropertyName(sourceFile, position, true);
|
||||
var node = ts.getTouchingPropertyName(sourceFile, position);
|
||||
if (node === sourceFile) {
|
||||
return undefined;
|
||||
}
|
||||
|
@ -73046,7 +73032,7 @@ var ts;
|
|||
}
|
||||
function getNameOrDottedNameSpan(fileName, startPos, _endPos) {
|
||||
var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
|
||||
var node = ts.getTouchingPropertyName(sourceFile, startPos, false);
|
||||
var node = ts.getTouchingPropertyName(sourceFile, startPos);
|
||||
if (node === sourceFile) {
|
||||
return;
|
||||
}
|
||||
|
@ -73126,7 +73112,7 @@ var ts;
|
|||
function getBraceMatchingAtPosition(fileName, position) {
|
||||
var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
|
||||
var result = [];
|
||||
var token = ts.getTouchingToken(sourceFile, position, false);
|
||||
var token = ts.getTouchingToken(sourceFile, position);
|
||||
if (token.getStart(sourceFile) === position) {
|
||||
var matchKind = getMatchingTokenKind(token);
|
||||
if (matchKind) {
|
||||
|
@ -79927,3 +79913,5 @@ var TypeScript;
|
|||
})(Services = TypeScript.Services || (TypeScript.Services = {}));
|
||||
})(TypeScript || (TypeScript = {}));
|
||||
var toolsVersion = "2.4";
|
||||
|
||||
//# sourceMappingURL=tsserverlibrary.js.map
|
||||
|
|
3
lib/typescript.d.ts
vendored
3
lib/typescript.d.ts
vendored
|
@ -2722,7 +2722,6 @@ declare namespace ts {
|
|||
* @returns The unescaped identifier text.
|
||||
*/
|
||||
function unescapeIdentifier(identifier: string): string;
|
||||
function getNameOfDeclaration(declaration: Declaration): DeclarationName | undefined;
|
||||
}
|
||||
declare namespace ts {
|
||||
/**
|
||||
|
@ -3110,7 +3109,7 @@ declare namespace ts {
|
|||
}
|
||||
declare namespace ts {
|
||||
function createNode(kind: SyntaxKind, pos?: number, end?: number): Node;
|
||||
function forEachChild<T>(node: Node, cbNode: (node: Node) => T | undefined, cbNodeArray?: (nodes: NodeArray<Node>) => T | undefined): T | undefined;
|
||||
function forEachChild<T>(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T | undefined;
|
||||
function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean, scriptKind?: ScriptKind): SourceFile;
|
||||
function parseIsolatedEntityName(text: string, languageVersion: ScriptTarget): EntityName;
|
||||
function isExternalModule(file: SourceFile): boolean;
|
||||
|
|
|
@ -8167,6 +8167,9 @@ var ts;
|
|||
}
|
||||
ts.getJSDocs = getJSDocs;
|
||||
function getJSDocParameterTags(param) {
|
||||
if (!isParameter(param)) {
|
||||
return undefined;
|
||||
}
|
||||
var func = param.parent;
|
||||
var tags = getJSDocTags(func, 286 /* JSDocParameterTag */);
|
||||
if (!param.name) {
|
||||
|
@ -8188,19 +8191,6 @@ var ts;
|
|||
}
|
||||
}
|
||||
ts.getJSDocParameterTags = getJSDocParameterTags;
|
||||
/** Does the opposite of `getJSDocParameterTags`: given a JSDoc parameter, finds the parameter corresponding to it. */
|
||||
function getParameterFromJSDoc(node) {
|
||||
var name = node.parameterName.text;
|
||||
var grandParent = node.parent.parent;
|
||||
ts.Debug.assert(node.parent.kind === 283 /* JSDocComment */);
|
||||
if (!isFunctionLike(grandParent)) {
|
||||
return undefined;
|
||||
}
|
||||
return ts.find(grandParent.parameters, function (p) {
|
||||
return p.name.kind === 71 /* Identifier */ && p.name.text === name;
|
||||
});
|
||||
}
|
||||
ts.getParameterFromJSDoc = getParameterFromJSDoc;
|
||||
function getJSDocType(node) {
|
||||
var tag = getFirstJSDocTag(node, 288 /* JSDocTypeTag */);
|
||||
if (!tag && node.kind === 146 /* Parameter */) {
|
||||
|
@ -8343,6 +8333,36 @@ var ts;
|
|||
}
|
||||
}
|
||||
ts.isDeclarationName = isDeclarationName;
|
||||
function getNameOfDeclaration(declaration) {
|
||||
if (!declaration) {
|
||||
return undefined;
|
||||
}
|
||||
if (declaration.kind === 194 /* BinaryExpression */) {
|
||||
var kind = getSpecialPropertyAssignmentKind(declaration);
|
||||
var lhs = declaration.left;
|
||||
switch (kind) {
|
||||
case 0 /* None */:
|
||||
case 2 /* ModuleExports */:
|
||||
return undefined;
|
||||
case 1 /* ExportsProperty */:
|
||||
if (lhs.kind === 71 /* Identifier */) {
|
||||
return lhs.name;
|
||||
}
|
||||
else {
|
||||
return lhs.expression.name;
|
||||
}
|
||||
case 4 /* ThisProperty */:
|
||||
case 5 /* Property */:
|
||||
return lhs.name;
|
||||
case 3 /* PrototypeProperty */:
|
||||
return lhs.expression.name;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return declaration.name;
|
||||
}
|
||||
}
|
||||
ts.getNameOfDeclaration = getNameOfDeclaration;
|
||||
function isLiteralComputedPropertyDeclarationName(node) {
|
||||
return (node.kind === 9 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) &&
|
||||
node.parent.kind === 144 /* ComputedPropertyName */ &&
|
||||
|
@ -8554,7 +8574,7 @@ var ts;
|
|||
* Symbol.
|
||||
*/
|
||||
function hasDynamicName(declaration) {
|
||||
var name = ts.getNameOfDeclaration(declaration);
|
||||
var name = getNameOfDeclaration(declaration);
|
||||
return name && isDynamicName(name);
|
||||
}
|
||||
ts.hasDynamicName = hasDynamicName;
|
||||
|
@ -11051,27 +11071,6 @@ var ts;
|
|||
return identifier.length >= 3 && identifier.charCodeAt(0) === 95 /* _ */ && identifier.charCodeAt(1) === 95 /* _ */ && identifier.charCodeAt(2) === 95 /* _ */ ? identifier.substr(1) : identifier;
|
||||
}
|
||||
ts.unescapeIdentifier = unescapeIdentifier;
|
||||
function getNameOfDeclaration(declaration) {
|
||||
if (!declaration) {
|
||||
return undefined;
|
||||
}
|
||||
if (declaration.kind === 194 /* BinaryExpression */) {
|
||||
var expr = declaration;
|
||||
switch (ts.getSpecialPropertyAssignmentKind(expr)) {
|
||||
case 1 /* ExportsProperty */:
|
||||
case 4 /* ThisProperty */:
|
||||
case 5 /* Property */:
|
||||
case 3 /* PrototypeProperty */:
|
||||
return expr.left.name;
|
||||
default:
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return declaration.name;
|
||||
}
|
||||
}
|
||||
ts.getNameOfDeclaration = getNameOfDeclaration;
|
||||
})(ts || (ts = {}));
|
||||
/// <reference path="core.ts"/>
|
||||
/// <reference path="utilities.ts"/>
|
||||
|
@ -21893,9 +21892,18 @@ var ts;
|
|||
case 243 /* ExportAssignment */:
|
||||
return node.isExportEquals ? "export=" : "default";
|
||||
case 194 /* BinaryExpression */:
|
||||
if (ts.getSpecialPropertyAssignmentKind(node) === 2 /* ModuleExports */) {
|
||||
// module.exports = ...
|
||||
return "export=";
|
||||
switch (ts.getSpecialPropertyAssignmentKind(node)) {
|
||||
case 2 /* ModuleExports */:
|
||||
// module.exports = ...
|
||||
return "export=";
|
||||
case 1 /* ExportsProperty */:
|
||||
case 4 /* ThisProperty */:
|
||||
case 5 /* Property */:
|
||||
// exports.x = ... or this.y = ...
|
||||
return node.left.name.text;
|
||||
case 3 /* PrototypeProperty */:
|
||||
// className.prototype.methodName = ...
|
||||
return node.left.expression.name.text;
|
||||
}
|
||||
ts.Debug.fail("Unknown binary declaration kind");
|
||||
break;
|
||||
|
@ -22047,8 +22055,6 @@ var ts;
|
|||
// during global merging in the checker. Why? The only case when ambient module is permitted inside another module is module augmentation
|
||||
// and this case is specially handled. Module augmentations should only be merged with original module definition
|
||||
// and should never be merged directly with other augmentation, and the latter case would be possible if automatic merge is allowed.
|
||||
if (node.kind === 290 /* JSDocTypedefTag */)
|
||||
ts.Debug.assert(ts.isInJavaScriptFile(node)); // We shouldn't add symbols for JSDoc nodes if not in a JS file.
|
||||
var isJSDocTypedefInJSDocNamespace = node.kind === 290 /* JSDocTypedefTag */ &&
|
||||
node.name &&
|
||||
node.name.kind === 71 /* Identifier */ &&
|
||||
|
@ -22207,7 +22213,9 @@ var ts;
|
|||
// Binding of JsDocComment should be done before the current block scope container changes.
|
||||
// because the scope of JsDocComment should not be affected by whether the current node is a
|
||||
// container or not.
|
||||
ts.forEach(node.jsDoc, bind);
|
||||
if (ts.isInJavaScriptFile(node) && node.jsDoc) {
|
||||
ts.forEach(node.jsDoc, bind);
|
||||
}
|
||||
if (checkUnreachable(node)) {
|
||||
bindEachChild(node);
|
||||
return;
|
||||
|
@ -23393,7 +23401,9 @@ var ts;
|
|||
// Here the current node is "foo", which is a container, but the scope of "MyType" should
|
||||
// not be inside "foo". Therefore we always bind @typedef before bind the parent node,
|
||||
// and skip binding this tag later when binding all the other jsdoc tags.
|
||||
bindJSDocTypedefTagIfAny(node);
|
||||
if (ts.isInJavaScriptFile(node)) {
|
||||
bindJSDocTypedefTagIfAny(node);
|
||||
}
|
||||
// First we bind declaration nodes to a symbol if possible. We'll both create a symbol
|
||||
// and then potentially add the symbol to an appropriate symbol table. Possible
|
||||
// destination symbol tables are:
|
||||
|
@ -23475,7 +23485,7 @@ var ts;
|
|||
// for typedef type names with namespaces, bind the new jsdoc type symbol here
|
||||
// because it requires all containing namespaces to be in effect, namely the
|
||||
// current "blockScopeContainer" needs to be set to its immediate namespace parent.
|
||||
if (ts.isInJavaScriptFile(node) && node.isInJSDocNamespace) {
|
||||
if (node.isInJSDocNamespace) {
|
||||
var parentNode = node.parent;
|
||||
while (parentNode && parentNode.kind !== 290 /* JSDocTypedefTag */) {
|
||||
parentNode = parentNode.parent;
|
||||
|
@ -23545,7 +23555,10 @@ var ts;
|
|||
return bindVariableDeclarationOrBindingElement(node);
|
||||
case 149 /* PropertyDeclaration */:
|
||||
case 148 /* PropertySignature */:
|
||||
return bindPropertyWorker(node);
|
||||
case 276 /* JSDocRecordMember */:
|
||||
return bindPropertyOrMethodOrAccessor(node, 4 /* Property */ | (node.questionToken ? 67108864 /* Optional */ : 0 /* None */), 0 /* PropertyExcludes */);
|
||||
case 291 /* JSDocPropertyTag */:
|
||||
return bindJSDocProperty(node);
|
||||
case 261 /* PropertyAssignment */:
|
||||
case 262 /* ShorthandPropertyAssignment */:
|
||||
return bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 0 /* PropertyExcludes */);
|
||||
|
@ -23587,10 +23600,13 @@ var ts;
|
|||
return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 74687 /* SetAccessorExcludes */);
|
||||
case 160 /* FunctionType */:
|
||||
case 161 /* ConstructorType */:
|
||||
case 279 /* JSDocFunctionType */:
|
||||
return bindFunctionOrConstructorType(node);
|
||||
case 163 /* TypeLiteral */:
|
||||
case 172 /* MappedType */:
|
||||
return bindAnonymousTypeWorker(node);
|
||||
case 292 /* JSDocTypeLiteral */:
|
||||
case 275 /* JSDocRecordType */:
|
||||
return bindAnonymousDeclaration(node, 2048 /* TypeLiteral */, "__type");
|
||||
case 178 /* ObjectLiteralExpression */:
|
||||
return bindObjectLiteralExpression(node);
|
||||
case 186 /* FunctionExpression */:
|
||||
|
@ -23609,6 +23625,11 @@ var ts;
|
|||
return bindClassLikeDeclaration(node);
|
||||
case 230 /* InterfaceDeclaration */:
|
||||
return bindBlockScopedDeclaration(node, 64 /* Interface */, 792968 /* InterfaceExcludes */);
|
||||
case 290 /* JSDocTypedefTag */:
|
||||
if (!node.fullName || node.fullName.kind === 71 /* Identifier */) {
|
||||
return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */);
|
||||
}
|
||||
break;
|
||||
case 231 /* TypeAliasDeclaration */:
|
||||
return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */);
|
||||
case 232 /* EnumDeclaration */:
|
||||
|
@ -23644,37 +23665,8 @@ var ts;
|
|||
// falls through
|
||||
case 234 /* ModuleBlock */:
|
||||
return updateStrictModeStatementList(node.statements);
|
||||
default:
|
||||
if (ts.isInJavaScriptFile(node))
|
||||
return bindJSDocWorker(node);
|
||||
}
|
||||
}
|
||||
function bindJSDocWorker(node) {
|
||||
switch (node.kind) {
|
||||
case 276 /* JSDocRecordMember */:
|
||||
return bindPropertyWorker(node);
|
||||
case 291 /* JSDocPropertyTag */:
|
||||
return declareSymbolAndAddToSymbolTable(node, 4 /* Property */, 0 /* PropertyExcludes */);
|
||||
case 279 /* JSDocFunctionType */:
|
||||
return bindFunctionOrConstructorType(node);
|
||||
case 292 /* JSDocTypeLiteral */:
|
||||
case 275 /* JSDocRecordType */:
|
||||
return bindAnonymousTypeWorker(node);
|
||||
case 290 /* JSDocTypedefTag */: {
|
||||
var fullName = node.fullName;
|
||||
if (!fullName || fullName.kind === 71 /* Identifier */) {
|
||||
return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
function bindPropertyWorker(node) {
|
||||
return bindPropertyOrMethodOrAccessor(node, 4 /* Property */ | (node.questionToken ? 67108864 /* Optional */ : 0 /* None */), 0 /* PropertyExcludes */);
|
||||
}
|
||||
function bindAnonymousTypeWorker(node) {
|
||||
return bindAnonymousDeclaration(node, 2048 /* TypeLiteral */, "__type");
|
||||
}
|
||||
function checkTypePredicate(node) {
|
||||
var parameterName = node.parameterName, type = node.type;
|
||||
if (parameterName && parameterName.kind === 71 /* Identifier */) {
|
||||
|
@ -23991,8 +23983,10 @@ var ts;
|
|||
return bindAnonymousDeclaration(node, 16 /* Function */, bindingName);
|
||||
}
|
||||
function bindPropertyOrMethodOrAccessor(node, symbolFlags, symbolExcludes) {
|
||||
if (!file.isDeclarationFile && !ts.isInAmbientContext(node) && ts.isAsyncFunction(node)) {
|
||||
emitFlags |= 1024 /* HasAsyncFunctions */;
|
||||
if (!file.isDeclarationFile && !ts.isInAmbientContext(node)) {
|
||||
if (ts.isAsyncFunction(node)) {
|
||||
emitFlags |= 1024 /* HasAsyncFunctions */;
|
||||
}
|
||||
}
|
||||
if (currentFlow && ts.isObjectLiteralOrClassExpressionMethod(node)) {
|
||||
node.flowNode = currentFlow;
|
||||
|
@ -24001,6 +23995,9 @@ var ts;
|
|||
? bindAnonymousDeclaration(node, symbolFlags, "__computed")
|
||||
: declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes);
|
||||
}
|
||||
function bindJSDocProperty(node) {
|
||||
return declareSymbolAndAddToSymbolTable(node, 4 /* Property */, 0 /* PropertyExcludes */);
|
||||
}
|
||||
// reachability checks
|
||||
function shouldReportErrorOnModuleDeclaration(node) {
|
||||
var instanceState = getModuleInstanceState(node);
|
||||
|
@ -46117,10 +46114,6 @@ var ts;
|
|||
return entityNameSymbol;
|
||||
}
|
||||
}
|
||||
if (entityName.parent.kind === 286 /* JSDocParameterTag */) {
|
||||
var parameter = ts.getParameterFromJSDoc(entityName.parent);
|
||||
return parameter && parameter.symbol;
|
||||
}
|
||||
if (ts.isPartOfExpression(entityName)) {
|
||||
if (ts.nodeIsMissing(entityName)) {
|
||||
// Missing entity name.
|
||||
|
@ -71501,28 +71494,33 @@ var ts;
|
|||
* position >= start and (position < end or (position === end && token is keyword or identifier))
|
||||
*/
|
||||
function getTouchingWord(sourceFile, position, includeJsDocComment) {
|
||||
return getTouchingToken(sourceFile, position, includeJsDocComment, function (n) { return isWord(n.kind); });
|
||||
if (includeJsDocComment === void 0) { includeJsDocComment = false; }
|
||||
return getTouchingToken(sourceFile, position, function (n) { return isWord(n.kind); }, includeJsDocComment);
|
||||
}
|
||||
ts.getTouchingWord = getTouchingWord;
|
||||
/* Gets the token whose text has range [start, end) and position >= start
|
||||
* and (position < end or (position === end && token is keyword or identifier or numeric/string literal))
|
||||
*/
|
||||
function getTouchingPropertyName(sourceFile, position, includeJsDocComment) {
|
||||
return getTouchingToken(sourceFile, position, includeJsDocComment, function (n) { return isPropertyName(n.kind); });
|
||||
if (includeJsDocComment === void 0) { includeJsDocComment = false; }
|
||||
return getTouchingToken(sourceFile, position, function (n) { return isPropertyName(n.kind); }, includeJsDocComment);
|
||||
}
|
||||
ts.getTouchingPropertyName = getTouchingPropertyName;
|
||||
/** Returns the token if position is in [start, end) or if position === end and includeItemAtEndPosition(token) === true */
|
||||
function getTouchingToken(sourceFile, position, includeJsDocComment, includeItemAtEndPosition) {
|
||||
function getTouchingToken(sourceFile, position, includeItemAtEndPosition, includeJsDocComment) {
|
||||
if (includeJsDocComment === void 0) { includeJsDocComment = false; }
|
||||
return getTokenAtPositionWorker(sourceFile, position, /*allowPositionInLeadingTrivia*/ false, includeItemAtEndPosition, includeJsDocComment);
|
||||
}
|
||||
ts.getTouchingToken = getTouchingToken;
|
||||
/** Returns a token if position is in [start-of-leading-trivia, end) */
|
||||
function getTokenAtPosition(sourceFile, position, includeJsDocComment) {
|
||||
if (includeJsDocComment === void 0) { includeJsDocComment = false; }
|
||||
return getTokenAtPositionWorker(sourceFile, position, /*allowPositionInLeadingTrivia*/ true, /*includeItemAtEndPosition*/ undefined, includeJsDocComment);
|
||||
}
|
||||
ts.getTokenAtPosition = getTokenAtPosition;
|
||||
/** Get the token whose text contains the position */
|
||||
function getTokenAtPositionWorker(sourceFile, position, allowPositionInLeadingTrivia, includeItemAtEndPosition, includeJsDocComment) {
|
||||
if (includeJsDocComment === void 0) { includeJsDocComment = false; }
|
||||
var current = sourceFile;
|
||||
outer: while (true) {
|
||||
if (ts.isToken(current)) {
|
||||
|
@ -71565,7 +71563,7 @@ var ts;
|
|||
function findTokenOnLeftOfPosition(file, position) {
|
||||
// Ideally, getTokenAtPosition should return a token. However, it is currently
|
||||
// broken, so we do a check to make sure the result was indeed a token.
|
||||
var tokenAtPosition = getTokenAtPosition(file, position, /*includeJsDocComment*/ false);
|
||||
var tokenAtPosition = getTokenAtPosition(file, position);
|
||||
if (ts.isToken(tokenAtPosition) && position > tokenAtPosition.getStart(file) && position < tokenAtPosition.getEnd()) {
|
||||
return tokenAtPosition;
|
||||
}
|
||||
|
@ -71678,7 +71676,7 @@ var ts;
|
|||
* returns true if the position is in between the open and close elements of an JSX expression.
|
||||
*/
|
||||
function isInsideJsxElementOrAttribute(sourceFile, position) {
|
||||
var token = getTokenAtPosition(sourceFile, position, /*includeJsDocComment*/ false);
|
||||
var token = getTokenAtPosition(sourceFile, position);
|
||||
if (!token) {
|
||||
return false;
|
||||
}
|
||||
|
@ -71707,7 +71705,7 @@ var ts;
|
|||
}
|
||||
ts.isInsideJsxElementOrAttribute = isInsideJsxElementOrAttribute;
|
||||
function isInTemplateString(sourceFile, position) {
|
||||
var token = getTokenAtPosition(sourceFile, position, /*includeJsDocComment*/ false);
|
||||
var token = getTokenAtPosition(sourceFile, position);
|
||||
return ts.isTemplateLiteralKind(token.kind) && position > token.getStart(sourceFile);
|
||||
}
|
||||
ts.isInTemplateString = isInTemplateString;
|
||||
|
@ -71718,7 +71716,7 @@ var ts;
|
|||
* @param predicate Additional predicate to test on the comment range.
|
||||
*/
|
||||
function isInComment(sourceFile, position, tokenAtPosition, predicate) {
|
||||
if (tokenAtPosition === void 0) { tokenAtPosition = getTokenAtPosition(sourceFile, position, /*includeJsDocComment*/ false); }
|
||||
if (tokenAtPosition === void 0) { tokenAtPosition = getTokenAtPosition(sourceFile, position); }
|
||||
return position <= tokenAtPosition.getStart(sourceFile) &&
|
||||
(isInCommentRange(ts.getLeadingCommentRanges(sourceFile.text, tokenAtPosition.pos)) ||
|
||||
isInCommentRange(ts.getTrailingCommentRanges(sourceFile.text, tokenAtPosition.pos)));
|
||||
|
@ -71752,7 +71750,7 @@ var ts;
|
|||
}
|
||||
}
|
||||
function hasDocComment(sourceFile, position) {
|
||||
var token = getTokenAtPosition(sourceFile, position, /*includeJsDocComment*/ false);
|
||||
var token = getTokenAtPosition(sourceFile, position);
|
||||
// First, we have to see if this position actually landed in a comment.
|
||||
var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos);
|
||||
return ts.forEach(commentRanges, jsDocPrefix);
|
||||
|
@ -71766,7 +71764,7 @@ var ts;
|
|||
* Get the corresponding JSDocTag node if the position is in a jsDoc comment
|
||||
*/
|
||||
function getJsDocTagAtPosition(sourceFile, position) {
|
||||
var node = ts.getTokenAtPosition(sourceFile, position, /*includeJsDocComment*/ false);
|
||||
var node = ts.getTokenAtPosition(sourceFile, position);
|
||||
if (ts.isToken(node)) {
|
||||
switch (node.kind) {
|
||||
case 104 /* VarKeyword */:
|
||||
|
@ -72249,7 +72247,7 @@ var ts;
|
|||
}
|
||||
ts.getOpenBrace = getOpenBrace;
|
||||
function getOpenBraceOfClassLike(declaration, sourceFile) {
|
||||
return ts.getTokenAtPosition(sourceFile, declaration.members.pos - 1, /*includeJsDocComment*/ false);
|
||||
return ts.getTokenAtPosition(sourceFile, declaration.members.pos - 1);
|
||||
}
|
||||
ts.getOpenBraceOfClassLike = getOpenBraceOfClassLike;
|
||||
})(ts || (ts = {}));
|
||||
|
@ -73390,7 +73388,7 @@ var ts;
|
|||
return ts.deduplicate(nonRelativeModules);
|
||||
}
|
||||
function getTripleSlashReferenceCompletion(sourceFile, position, compilerOptions, host) {
|
||||
var token = ts.getTokenAtPosition(sourceFile, position, /*includeJsDocComment*/ false);
|
||||
var token = ts.getTokenAtPosition(sourceFile, position);
|
||||
if (!token) {
|
||||
return undefined;
|
||||
}
|
||||
|
@ -73935,7 +73933,7 @@ var ts;
|
|||
// JsDoc tag includes both "@" and tag-name
|
||||
var requestJsDocTag = false;
|
||||
var start = ts.timestamp();
|
||||
var currentToken = ts.getTokenAtPosition(sourceFile, position, /*includeJsDocComment*/ false); // TODO: GH#15853
|
||||
var currentToken = ts.getTokenAtPosition(sourceFile, position);
|
||||
log("getCompletionData: Get current token: " + (ts.timestamp() - start));
|
||||
start = ts.timestamp();
|
||||
// Completion not allowed inside comments, bail out if this is the case
|
||||
|
@ -74019,7 +74017,7 @@ var ts;
|
|||
var isRightOfDot = false;
|
||||
var isRightOfOpenTag = false;
|
||||
var isStartingCloseTag = false;
|
||||
var location = ts.getTouchingPropertyName(sourceFile, position, /*includeJsDocComment*/ false); // TODO: GH#15853
|
||||
var location = ts.getTouchingPropertyName(sourceFile, position);
|
||||
if (contextToken) {
|
||||
// Bail out if this is a known invalid completion location
|
||||
if (isCompletionListBlocker(contextToken)) {
|
||||
|
@ -74961,7 +74959,7 @@ var ts;
|
|||
var DocumentHighlights;
|
||||
(function (DocumentHighlights) {
|
||||
function getDocumentHighlights(program, cancellationToken, sourceFile, position, sourceFilesToSearch) {
|
||||
var node = ts.getTouchingWord(sourceFile, position, /*includeJsDocComment*/ true);
|
||||
var node = ts.getTouchingWord(sourceFile, position);
|
||||
return node && (getSemanticDocumentHighlights(node, program, cancellationToken, sourceFilesToSearch) || getSyntacticDocumentHighlights(node, sourceFile));
|
||||
}
|
||||
DocumentHighlights.getDocumentHighlights = getDocumentHighlights;
|
||||
|
@ -76158,17 +76156,13 @@ var ts;
|
|||
}
|
||||
FindAllReferences.findReferencedSymbols = findReferencedSymbols;
|
||||
function getImplementationsAtPosition(program, cancellationToken, sourceFiles, sourceFile, position) {
|
||||
// A node in a JSDoc comment can't have an implementation anyway.
|
||||
var node = ts.getTouchingPropertyName(sourceFile, position, /*includeJsDocComment*/ false);
|
||||
var node = ts.getTouchingPropertyName(sourceFile, position);
|
||||
var referenceEntries = getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node);
|
||||
var checker = program.getTypeChecker();
|
||||
return ts.map(referenceEntries, function (entry) { return toImplementationLocation(entry, checker); });
|
||||
}
|
||||
FindAllReferences.getImplementationsAtPosition = getImplementationsAtPosition;
|
||||
function getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node) {
|
||||
if (node.kind === 265 /* SourceFile */) {
|
||||
return undefined;
|
||||
}
|
||||
var checker = program.getTypeChecker();
|
||||
// If invoked directly on a shorthand property assignment, then return
|
||||
// the declaration of the symbol being assigned (not the symbol being assigned to).
|
||||
|
@ -76705,7 +76699,7 @@ var ts;
|
|||
var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, labelName, container);
|
||||
for (var _i = 0, possiblePositions_1 = possiblePositions; _i < possiblePositions_1.length; _i++) {
|
||||
var position = possiblePositions_1[_i];
|
||||
var node = ts.getTouchingWord(sourceFile, position, /*includeJsDocComment*/ false);
|
||||
var node = ts.getTouchingWord(sourceFile, position);
|
||||
// Only pick labels that are either the target label, or have a target that is the target label
|
||||
if (node && (node === targetLabel || (ts.isJumpStatementTarget(node) && ts.getTargetLabel(node, labelName) === targetLabel))) {
|
||||
references.push(FindAllReferences.nodeEntry(node));
|
||||
|
@ -76737,11 +76731,10 @@ var ts;
|
|||
return references.length ? [{ definition: { type: "keyword", node: references[0].node }, references: references }] : undefined;
|
||||
}
|
||||
function addReferencesForKeywordInFile(sourceFile, kind, searchText, references) {
|
||||
// Want fullStart so we can find the symbol in JSDoc comments
|
||||
var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, searchText, sourceFile, /*fullStart*/ true);
|
||||
var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, searchText);
|
||||
for (var _i = 0, possiblePositions_2 = possiblePositions; _i < possiblePositions_2.length; _i++) {
|
||||
var position = possiblePositions_2[_i];
|
||||
var referenceLocation = ts.getTouchingPropertyName(sourceFile, position, /*includeJsDocComment*/ true);
|
||||
var referenceLocation = ts.getTouchingPropertyName(sourceFile, position);
|
||||
if (referenceLocation.kind === kind) {
|
||||
references.push(FindAllReferences.nodeEntry(referenceLocation));
|
||||
}
|
||||
|
@ -76760,13 +76753,13 @@ var ts;
|
|||
if (!state.markSearchedSymbol(sourceFile, search.symbol)) {
|
||||
return;
|
||||
}
|
||||
for (var _i = 0, _a = getPossibleSymbolReferencePositions(sourceFile, search.text, container, /*fullStart*/ state.findInComments || container.jsDoc !== undefined); _i < _a.length; _i++) {
|
||||
for (var _i = 0, _a = getPossibleSymbolReferencePositions(sourceFile, search.text, container, /*fullStart*/ state.findInComments); _i < _a.length; _i++) {
|
||||
var position = _a[_i];
|
||||
getReferencesAtLocation(sourceFile, position, search, state);
|
||||
}
|
||||
}
|
||||
function getReferencesAtLocation(sourceFile, position, search, state) {
|
||||
var referenceLocation = ts.getTouchingPropertyName(sourceFile, position, /*includeJsDocComment*/ true);
|
||||
var referenceLocation = ts.getTouchingPropertyName(sourceFile, position);
|
||||
if (!isValidReferencePosition(referenceLocation, search.text)) {
|
||||
// This wasn't the start of a token. Check to see if it might be a
|
||||
// match in a comment or string if that's what the caller is asking
|
||||
|
@ -77161,7 +77154,7 @@ var ts;
|
|||
var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "super", searchSpaceNode);
|
||||
for (var _i = 0, possiblePositions_3 = possiblePositions; _i < possiblePositions_3.length; _i++) {
|
||||
var position = possiblePositions_3[_i];
|
||||
var node = ts.getTouchingWord(sourceFile, position, /*includeJsDocComment*/ false);
|
||||
var node = ts.getTouchingWord(sourceFile, position);
|
||||
if (!node || node.kind !== 97 /* SuperKeyword */) {
|
||||
continue;
|
||||
}
|
||||
|
@ -77227,7 +77220,7 @@ var ts;
|
|||
}];
|
||||
function getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, result) {
|
||||
ts.forEach(possiblePositions, function (position) {
|
||||
var node = ts.getTouchingWord(sourceFile, position, /*includeJsDocComment*/ false);
|
||||
var node = ts.getTouchingWord(sourceFile, position);
|
||||
if (!node || !ts.isThis(node)) {
|
||||
return;
|
||||
}
|
||||
|
@ -77277,7 +77270,7 @@ var ts;
|
|||
function getReferencesForStringLiteralInFile(sourceFile, searchText, possiblePositions, references) {
|
||||
for (var _i = 0, possiblePositions_4 = possiblePositions; _i < possiblePositions_4.length; _i++) {
|
||||
var position = possiblePositions_4[_i];
|
||||
var node_7 = ts.getTouchingWord(sourceFile, position, /*includeJsDocComment*/ false);
|
||||
var node_7 = ts.getTouchingWord(sourceFile, position);
|
||||
if (node_7 && node_7.kind === 9 /* StringLiteral */ && node_7.text === searchText) {
|
||||
references.push(FindAllReferences.nodeEntry(node_7, /*isInString*/ true));
|
||||
}
|
||||
|
@ -77630,7 +77623,7 @@ var ts;
|
|||
return referenceFile && referenceFile.resolvedFileName &&
|
||||
[getDefinitionInfoForFileReference(typeReferenceDirective.fileName, referenceFile.resolvedFileName)];
|
||||
}
|
||||
var node = ts.getTouchingPropertyName(sourceFile, position, /*includeJsDocComment*/ true);
|
||||
var node = ts.getTouchingPropertyName(sourceFile, position);
|
||||
if (node === sourceFile) {
|
||||
return undefined;
|
||||
}
|
||||
|
@ -77697,7 +77690,7 @@ var ts;
|
|||
GoToDefinition.getDefinitionAtPosition = getDefinitionAtPosition;
|
||||
/// Goto type
|
||||
function getTypeDefinitionAtPosition(typeChecker, sourceFile, position) {
|
||||
var node = ts.getTouchingPropertyName(sourceFile, position, /*includeJsDocComment*/ true);
|
||||
var node = ts.getTouchingPropertyName(sourceFile, position);
|
||||
if (node === sourceFile) {
|
||||
return undefined;
|
||||
}
|
||||
|
@ -78046,7 +78039,7 @@ var ts;
|
|||
if (ts.isInString(sourceFile, position) || ts.isInComment(sourceFile, position) || ts.hasDocComment(sourceFile, position)) {
|
||||
return undefined;
|
||||
}
|
||||
var tokenAtPos = ts.getTokenAtPosition(sourceFile, position, /*includeJsDocComment*/ false);
|
||||
var tokenAtPos = ts.getTokenAtPosition(sourceFile, position);
|
||||
var tokenStart = tokenAtPos.getStart();
|
||||
if (!tokenAtPos || tokenStart < position) {
|
||||
return undefined;
|
||||
|
@ -84348,7 +84341,7 @@ var ts;
|
|||
return this;
|
||||
}
|
||||
if (index !== containingList.length - 1) {
|
||||
var nextToken = ts.getTokenAtPosition(sourceFile, node.end, /*includeJsDocComment*/ false);
|
||||
var nextToken = ts.getTokenAtPosition(sourceFile, node.end);
|
||||
if (nextToken && isSeparator(node, nextToken)) {
|
||||
// find first non-whitespace position in the leading trivia of the node
|
||||
var startPosition = ts.skipTrivia(sourceFile.text, getAdjustedStartPosition(sourceFile, node, {}, Position.FullStart), /*stopAfterLineBreak*/ false, /*stopAtComments*/ true);
|
||||
|
@ -84360,7 +84353,7 @@ var ts;
|
|||
}
|
||||
}
|
||||
else {
|
||||
var previousToken = ts.getTokenAtPosition(sourceFile, containingList[index - 1].end, /*includeJsDocComment*/ false);
|
||||
var previousToken = ts.getTokenAtPosition(sourceFile, containingList[index - 1].end);
|
||||
if (previousToken && isSeparator(node, previousToken)) {
|
||||
this.deleteNodeRange(sourceFile, previousToken, node);
|
||||
}
|
||||
|
@ -84437,7 +84430,7 @@ var ts;
|
|||
if (index !== containingList.length - 1) {
|
||||
// any element except the last one
|
||||
// use next sibling as an anchor
|
||||
var nextToken = ts.getTokenAtPosition(sourceFile, after.end, /*includeJsDocComment*/ false);
|
||||
var nextToken = ts.getTokenAtPosition(sourceFile, after.end);
|
||||
if (nextToken && isSeparator(after, nextToken)) {
|
||||
// for list
|
||||
// a, b, c
|
||||
|
@ -84867,7 +84860,7 @@ var ts;
|
|||
function getActionForClassLikeIncorrectImplementsInterface(context) {
|
||||
var sourceFile = context.sourceFile;
|
||||
var start = context.span.start;
|
||||
var token = ts.getTokenAtPosition(sourceFile, start, /*includeJsDocComment*/ false);
|
||||
var token = ts.getTokenAtPosition(sourceFile, start);
|
||||
var checker = context.program.getTypeChecker();
|
||||
var classDeclaration = ts.getContainingClass(token);
|
||||
if (!classDeclaration) {
|
||||
|
@ -84933,7 +84926,7 @@ var ts;
|
|||
// This is the identifier of the missing property. eg:
|
||||
// this.missing = 1;
|
||||
// ^^^^^^^
|
||||
var token = ts.getTokenAtPosition(sourceFile, start, /*includeJsDocComment*/ false);
|
||||
var token = ts.getTokenAtPosition(sourceFile, start);
|
||||
if (token.kind !== 71 /* Identifier */) {
|
||||
return undefined;
|
||||
}
|
||||
|
@ -85044,7 +85037,7 @@ var ts;
|
|||
// This is the identifier of the misspelled word. eg:
|
||||
// this.speling = 1;
|
||||
// ^^^^^^^
|
||||
var node = ts.getTokenAtPosition(sourceFile, context.span.start, /*includeJsDocComment*/ false); // TODO: GH#15852
|
||||
var node = ts.getTokenAtPosition(sourceFile, context.span.start);
|
||||
var checker = context.program.getTypeChecker();
|
||||
var suggestion;
|
||||
if (node.kind === 71 /* Identifier */ && ts.isPropertyAccessExpression(node.parent)) {
|
||||
|
@ -85101,7 +85094,7 @@ var ts;
|
|||
var start = context.span.start;
|
||||
// This is the identifier in the case of a class declaration
|
||||
// or the class keyword token in the case of a class expression.
|
||||
var token = ts.getTokenAtPosition(sourceFile, start, /*includeJsDocComment*/ false);
|
||||
var token = ts.getTokenAtPosition(sourceFile, start);
|
||||
var checker = context.program.getTypeChecker();
|
||||
if (ts.isClassLike(token.parent)) {
|
||||
var classDeclaration = token.parent;
|
||||
|
@ -85139,7 +85132,7 @@ var ts;
|
|||
errorCodes: [ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class.code],
|
||||
getCodeActions: function (context) {
|
||||
var sourceFile = context.sourceFile;
|
||||
var token = ts.getTokenAtPosition(sourceFile, context.span.start, /*includeJsDocComment*/ false);
|
||||
var token = ts.getTokenAtPosition(sourceFile, context.span.start);
|
||||
if (token.kind !== 99 /* ThisKeyword */) {
|
||||
return undefined;
|
||||
}
|
||||
|
@ -85187,7 +85180,7 @@ var ts;
|
|||
errorCodes: [ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code],
|
||||
getCodeActions: function (context) {
|
||||
var sourceFile = context.sourceFile;
|
||||
var token = ts.getTokenAtPosition(sourceFile, context.span.start, /*includeJsDocComment*/ false);
|
||||
var token = ts.getTokenAtPosition(sourceFile, context.span.start);
|
||||
if (token.kind !== 123 /* ConstructorKeyword */) {
|
||||
return undefined;
|
||||
}
|
||||
|
@ -85212,7 +85205,7 @@ var ts;
|
|||
getCodeActions: function (context) {
|
||||
var sourceFile = context.sourceFile;
|
||||
var start = context.span.start;
|
||||
var token = ts.getTokenAtPosition(sourceFile, start, /*includeJsDocComment*/ false);
|
||||
var token = ts.getTokenAtPosition(sourceFile, start);
|
||||
var classDeclNode = ts.getContainingClass(token);
|
||||
if (!(token.kind === 71 /* Identifier */ && ts.isClassLike(classDeclNode))) {
|
||||
return undefined;
|
||||
|
@ -85252,7 +85245,7 @@ var ts;
|
|||
errorCodes: [ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code],
|
||||
getCodeActions: function (context) {
|
||||
var sourceFile = context.sourceFile;
|
||||
var token = ts.getTokenAtPosition(sourceFile, context.span.start, /*includeJsDocComment*/ false);
|
||||
var token = ts.getTokenAtPosition(sourceFile, context.span.start);
|
||||
if (token.kind !== 71 /* Identifier */) {
|
||||
return undefined;
|
||||
}
|
||||
|
@ -85279,10 +85272,10 @@ var ts;
|
|||
getCodeActions: function (context) {
|
||||
var sourceFile = context.sourceFile;
|
||||
var start = context.span.start;
|
||||
var token = ts.getTokenAtPosition(sourceFile, start, /*includeJsDocComment*/ false);
|
||||
var token = ts.getTokenAtPosition(sourceFile, start);
|
||||
// this handles var ["computed"] = 12;
|
||||
if (token.kind === 21 /* OpenBracketToken */) {
|
||||
token = ts.getTokenAtPosition(sourceFile, start + 1, /*includeJsDocComment*/ false);
|
||||
token = ts.getTokenAtPosition(sourceFile, start + 1);
|
||||
}
|
||||
switch (token.kind) {
|
||||
case 71 /* Identifier */:
|
||||
|
@ -85311,11 +85304,11 @@ var ts;
|
|||
case 145 /* TypeParameter */:
|
||||
var typeParameters = token.parent.parent.typeParameters;
|
||||
if (typeParameters.length === 1) {
|
||||
var previousToken = ts.getTokenAtPosition(sourceFile, typeParameters.pos - 1, /*includeJsDocComment*/ false);
|
||||
var previousToken = ts.getTokenAtPosition(sourceFile, typeParameters.pos - 1);
|
||||
if (!previousToken || previousToken.kind !== 27 /* LessThanToken */) {
|
||||
return deleteRange(typeParameters);
|
||||
}
|
||||
var nextToken = ts.getTokenAtPosition(sourceFile, typeParameters.end, /*includeJsDocComment*/ false);
|
||||
var nextToken = ts.getTokenAtPosition(sourceFile, typeParameters.end);
|
||||
if (!nextToken || nextToken.kind !== 29 /* GreaterThanToken */) {
|
||||
return deleteRange(typeParameters);
|
||||
}
|
||||
|
@ -85358,7 +85351,7 @@ var ts;
|
|||
else {
|
||||
// import |d,| * as ns from './file'
|
||||
var start_4 = importClause.name.getStart(sourceFile);
|
||||
var nextToken = ts.getTokenAtPosition(sourceFile, importClause.name.end, /*includeJsDocComment*/ false);
|
||||
var nextToken = ts.getTokenAtPosition(sourceFile, importClause.name.end);
|
||||
if (nextToken && nextToken.kind === 26 /* CommaToken */) {
|
||||
// shift first non-whitespace position after comma to the start position of the node
|
||||
return deleteRange({ pos: start_4, end: ts.skipTrivia(sourceFile.text, nextToken.end, /*stopAfterLineBreaks*/ false, /*stopAtComments*/ true) });
|
||||
|
@ -85374,7 +85367,7 @@ var ts;
|
|||
return deleteNode(importDecl);
|
||||
}
|
||||
else {
|
||||
var previousToken = ts.getTokenAtPosition(sourceFile, namespaceImport.pos - 1, /*includeJsDocComment*/ false);
|
||||
var previousToken = ts.getTokenAtPosition(sourceFile, namespaceImport.pos - 1);
|
||||
if (previousToken && previousToken.kind === 26 /* CommaToken */) {
|
||||
var startPosition = ts.textChanges.getAdjustedStartPosition(sourceFile, previousToken, {}, ts.textChanges.Position.FullStart);
|
||||
return deleteRange({ pos: startPosition, end: namespaceImport.end });
|
||||
|
@ -85557,7 +85550,7 @@ var ts;
|
|||
var checker = context.program.getTypeChecker();
|
||||
var allSourceFiles = context.program.getSourceFiles();
|
||||
var useCaseSensitiveFileNames = context.host.useCaseSensitiveFileNames ? context.host.useCaseSensitiveFileNames() : false;
|
||||
var token = ts.getTokenAtPosition(sourceFile, context.span.start, /*includeJsDocComment*/ false);
|
||||
var token = ts.getTokenAtPosition(sourceFile, context.span.start);
|
||||
var name = token.getText();
|
||||
var symbolIdActionMap = new ImportCodeActionMap();
|
||||
// this is a module id -> module import declaration map
|
||||
|
@ -85965,7 +85958,7 @@ var ts;
|
|||
// We also want to check if the previous line holds a comment for a node on the next line
|
||||
// if so, we do not want to separate the node from its comment if we can.
|
||||
if (!ts.isInComment(sourceFile, startPosition) && !ts.isInString(sourceFile, startPosition) && !ts.isInTemplateString(sourceFile, startPosition)) {
|
||||
var token = ts.getTouchingToken(sourceFile, startPosition, /*includeJsDocComment*/ false);
|
||||
var token = ts.getTouchingToken(sourceFile, startPosition);
|
||||
var tokenLeadingCommnets = ts.getLeadingCommentRangesOfNode(token, sourceFile);
|
||||
if (!tokenLeadingCommnets || !tokenLeadingCommnets.length || tokenLeadingCommnets[0].pos >= startPosition) {
|
||||
return {
|
||||
|
@ -86231,7 +86224,7 @@ var ts;
|
|||
refactor.registerRefactor(convertFunctionToES6Class);
|
||||
function isApplicable(context) {
|
||||
var start = context.startPosition;
|
||||
var node = ts.getTokenAtPosition(context.file, start, /*includeJsDocComment*/ false);
|
||||
var node = ts.getTokenAtPosition(context.file, start);
|
||||
var checker = context.program.getTypeChecker();
|
||||
var symbol = checker.getSymbolAtLocation(node);
|
||||
if (symbol && ts.isDeclarationOfFunctionOrClassExpression(symbol)) {
|
||||
|
@ -86243,7 +86236,7 @@ var ts;
|
|||
var start = context.startPosition;
|
||||
var sourceFile = context.file;
|
||||
var checker = context.program.getTypeChecker();
|
||||
var token = ts.getTokenAtPosition(sourceFile, start, /*includeJsDocComment*/ false);
|
||||
var token = ts.getTokenAtPosition(sourceFile, start);
|
||||
var ctorSymbol = checker.getSymbolAtLocation(token);
|
||||
var newLine = context.rulesProvider.getFormatOptions().newLineCharacter;
|
||||
var deletedNodes = [];
|
||||
|
@ -86484,7 +86477,6 @@ var ts;
|
|||
ts.scanner.setTextPos(pos);
|
||||
while (pos < end) {
|
||||
var token = useJSDocScanner ? ts.scanner.scanJSDocToken() : ts.scanner.scan();
|
||||
ts.Debug.assert(token !== 1 /* EndOfFileToken */); // Else it would infinitely loop
|
||||
var textPos = ts.scanner.getTextPos();
|
||||
if (textPos <= end) {
|
||||
nodes.push(createNode(token, pos, textPos, this));
|
||||
|
@ -86512,32 +86504,27 @@ var ts;
|
|||
};
|
||||
NodeObject.prototype.createChildren = function (sourceFile) {
|
||||
var _this = this;
|
||||
if (ts.isJSDocTag(this)) {
|
||||
/** Don't add trivia for "tokens" since this is in a comment. */
|
||||
var children_3 = [];
|
||||
this.forEachChild(function (child) { children_3.push(child); });
|
||||
this._children = children_3;
|
||||
}
|
||||
else if (this.kind >= 143 /* FirstNode */) {
|
||||
var children_4 = [];
|
||||
var children;
|
||||
if (this.kind >= 143 /* FirstNode */) {
|
||||
ts.scanner.setText((sourceFile || this.getSourceFile()).text);
|
||||
children = [];
|
||||
var pos_3 = this.pos;
|
||||
var useJSDocScanner_1 = this.kind >= 283 /* FirstJSDocTagNode */ && this.kind <= 293 /* LastJSDocTagNode */;
|
||||
var processNode = function (node) {
|
||||
var isJSDocTagNode = ts.isJSDocTag(node);
|
||||
if (!isJSDocTagNode && pos_3 < node.pos) {
|
||||
pos_3 = _this.addSyntheticNodes(children_4, pos_3, node.pos, useJSDocScanner_1);
|
||||
pos_3 = _this.addSyntheticNodes(children, pos_3, node.pos, useJSDocScanner_1);
|
||||
}
|
||||
children_4.push(node);
|
||||
children.push(node);
|
||||
if (!isJSDocTagNode) {
|
||||
pos_3 = node.end;
|
||||
}
|
||||
};
|
||||
var processNodes = function (nodes) {
|
||||
if (pos_3 < nodes.pos) {
|
||||
pos_3 = _this.addSyntheticNodes(children_4, pos_3, nodes.pos, useJSDocScanner_1);
|
||||
pos_3 = _this.addSyntheticNodes(children, pos_3, nodes.pos, useJSDocScanner_1);
|
||||
}
|
||||
children_4.push(_this.createSyntaxList(nodes));
|
||||
children.push(_this.createSyntaxList(nodes));
|
||||
pos_3 = nodes.end;
|
||||
};
|
||||
// jsDocComments need to be the first children
|
||||
|
@ -86553,14 +86540,11 @@ var ts;
|
|||
pos_3 = this.pos;
|
||||
ts.forEachChild(this, processNode, processNodes);
|
||||
if (pos_3 < this.end) {
|
||||
this.addSyntheticNodes(children_4, pos_3, this.end);
|
||||
this.addSyntheticNodes(children, pos_3, this.end);
|
||||
}
|
||||
ts.scanner.setText(undefined);
|
||||
this._children = children_4;
|
||||
}
|
||||
else {
|
||||
this._children = ts.emptyArray;
|
||||
}
|
||||
this._children = children || ts.emptyArray;
|
||||
};
|
||||
NodeObject.prototype.getChildCount = function (sourceFile) {
|
||||
if (!this._children)
|
||||
|
@ -87481,7 +87465,7 @@ var ts;
|
|||
function getQuickInfoAtPosition(fileName, position) {
|
||||
synchronizeHostData();
|
||||
var sourceFile = getValidSourceFile(fileName);
|
||||
var node = ts.getTouchingPropertyName(sourceFile, position, /*includeJsDocComment*/ true);
|
||||
var node = ts.getTouchingPropertyName(sourceFile, position);
|
||||
if (node === sourceFile) {
|
||||
return undefined;
|
||||
}
|
||||
|
@ -87635,7 +87619,7 @@ var ts;
|
|||
function getNameOrDottedNameSpan(fileName, startPos, _endPos) {
|
||||
var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
|
||||
// Get node at the location
|
||||
var node = ts.getTouchingPropertyName(sourceFile, startPos, /*includeJsDocComment*/ false);
|
||||
var node = ts.getTouchingPropertyName(sourceFile, startPos);
|
||||
if (node === sourceFile) {
|
||||
return;
|
||||
}
|
||||
|
@ -87729,7 +87713,7 @@ var ts;
|
|||
function getBraceMatchingAtPosition(fileName, position) {
|
||||
var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
|
||||
var result = [];
|
||||
var token = ts.getTouchingToken(sourceFile, position, /*includeJsDocComment*/ false);
|
||||
var token = ts.getTouchingToken(sourceFile, position);
|
||||
if (token.getStart(sourceFile) === position) {
|
||||
var matchKind = getMatchingTokenKind(token);
|
||||
// Ensure that there is a corresponding token to match ours.
|
||||
|
@ -88191,7 +88175,7 @@ var ts;
|
|||
if (sourceFile.isDeclarationFile) {
|
||||
return undefined;
|
||||
}
|
||||
var tokenAtLocation = ts.getTokenAtPosition(sourceFile, position, /*includeJsDocComment*/ false);
|
||||
var tokenAtLocation = ts.getTokenAtPosition(sourceFile, position);
|
||||
var lineOfPosition = sourceFile.getLineAndCharacterOfPosition(position).line;
|
||||
if (sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getStart(sourceFile)).line > lineOfPosition) {
|
||||
// Get previous token if the token is returned starts on new line
|
||||
|
@ -89583,3 +89567,5 @@ var TypeScript;
|
|||
// TODO: it should be moved into a namespace though.
|
||||
/* @internal */
|
||||
var toolsVersion = "2.4";
|
||||
|
||||
//# sourceMappingURL=typescriptServices.js.map
|
||||
|
|
3
lib/typescriptServices.d.ts
vendored
3
lib/typescriptServices.d.ts
vendored
|
@ -2722,7 +2722,6 @@ declare namespace ts {
|
|||
* @returns The unescaped identifier text.
|
||||
*/
|
||||
function unescapeIdentifier(identifier: string): string;
|
||||
function getNameOfDeclaration(declaration: Declaration): DeclarationName | undefined;
|
||||
}
|
||||
declare namespace ts {
|
||||
/**
|
||||
|
@ -3110,7 +3109,7 @@ declare namespace ts {
|
|||
}
|
||||
declare namespace ts {
|
||||
function createNode(kind: SyntaxKind, pos?: number, end?: number): Node;
|
||||
function forEachChild<T>(node: Node, cbNode: (node: Node) => T | undefined, cbNodeArray?: (nodes: NodeArray<Node>) => T | undefined): T | undefined;
|
||||
function forEachChild<T>(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T | undefined;
|
||||
function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean, scriptKind?: ScriptKind): SourceFile;
|
||||
function parseIsolatedEntityName(text: string, languageVersion: ScriptTarget): EntityName;
|
||||
function isExternalModule(file: SourceFile): boolean;
|
||||
|
|
|
@ -8167,6 +8167,9 @@ var ts;
|
|||
}
|
||||
ts.getJSDocs = getJSDocs;
|
||||
function getJSDocParameterTags(param) {
|
||||
if (!isParameter(param)) {
|
||||
return undefined;
|
||||
}
|
||||
var func = param.parent;
|
||||
var tags = getJSDocTags(func, 286 /* JSDocParameterTag */);
|
||||
if (!param.name) {
|
||||
|
@ -8188,19 +8191,6 @@ var ts;
|
|||
}
|
||||
}
|
||||
ts.getJSDocParameterTags = getJSDocParameterTags;
|
||||
/** Does the opposite of `getJSDocParameterTags`: given a JSDoc parameter, finds the parameter corresponding to it. */
|
||||
function getParameterFromJSDoc(node) {
|
||||
var name = node.parameterName.text;
|
||||
var grandParent = node.parent.parent;
|
||||
ts.Debug.assert(node.parent.kind === 283 /* JSDocComment */);
|
||||
if (!isFunctionLike(grandParent)) {
|
||||
return undefined;
|
||||
}
|
||||
return ts.find(grandParent.parameters, function (p) {
|
||||
return p.name.kind === 71 /* Identifier */ && p.name.text === name;
|
||||
});
|
||||
}
|
||||
ts.getParameterFromJSDoc = getParameterFromJSDoc;
|
||||
function getJSDocType(node) {
|
||||
var tag = getFirstJSDocTag(node, 288 /* JSDocTypeTag */);
|
||||
if (!tag && node.kind === 146 /* Parameter */) {
|
||||
|
@ -8343,6 +8333,36 @@ var ts;
|
|||
}
|
||||
}
|
||||
ts.isDeclarationName = isDeclarationName;
|
||||
function getNameOfDeclaration(declaration) {
|
||||
if (!declaration) {
|
||||
return undefined;
|
||||
}
|
||||
if (declaration.kind === 194 /* BinaryExpression */) {
|
||||
var kind = getSpecialPropertyAssignmentKind(declaration);
|
||||
var lhs = declaration.left;
|
||||
switch (kind) {
|
||||
case 0 /* None */:
|
||||
case 2 /* ModuleExports */:
|
||||
return undefined;
|
||||
case 1 /* ExportsProperty */:
|
||||
if (lhs.kind === 71 /* Identifier */) {
|
||||
return lhs.name;
|
||||
}
|
||||
else {
|
||||
return lhs.expression.name;
|
||||
}
|
||||
case 4 /* ThisProperty */:
|
||||
case 5 /* Property */:
|
||||
return lhs.name;
|
||||
case 3 /* PrototypeProperty */:
|
||||
return lhs.expression.name;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return declaration.name;
|
||||
}
|
||||
}
|
||||
ts.getNameOfDeclaration = getNameOfDeclaration;
|
||||
function isLiteralComputedPropertyDeclarationName(node) {
|
||||
return (node.kind === 9 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) &&
|
||||
node.parent.kind === 144 /* ComputedPropertyName */ &&
|
||||
|
@ -8554,7 +8574,7 @@ var ts;
|
|||
* Symbol.
|
||||
*/
|
||||
function hasDynamicName(declaration) {
|
||||
var name = ts.getNameOfDeclaration(declaration);
|
||||
var name = getNameOfDeclaration(declaration);
|
||||
return name && isDynamicName(name);
|
||||
}
|
||||
ts.hasDynamicName = hasDynamicName;
|
||||
|
@ -11051,27 +11071,6 @@ var ts;
|
|||
return identifier.length >= 3 && identifier.charCodeAt(0) === 95 /* _ */ && identifier.charCodeAt(1) === 95 /* _ */ && identifier.charCodeAt(2) === 95 /* _ */ ? identifier.substr(1) : identifier;
|
||||
}
|
||||
ts.unescapeIdentifier = unescapeIdentifier;
|
||||
function getNameOfDeclaration(declaration) {
|
||||
if (!declaration) {
|
||||
return undefined;
|
||||
}
|
||||
if (declaration.kind === 194 /* BinaryExpression */) {
|
||||
var expr = declaration;
|
||||
switch (ts.getSpecialPropertyAssignmentKind(expr)) {
|
||||
case 1 /* ExportsProperty */:
|
||||
case 4 /* ThisProperty */:
|
||||
case 5 /* Property */:
|
||||
case 3 /* PrototypeProperty */:
|
||||
return expr.left.name;
|
||||
default:
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return declaration.name;
|
||||
}
|
||||
}
|
||||
ts.getNameOfDeclaration = getNameOfDeclaration;
|
||||
})(ts || (ts = {}));
|
||||
/// <reference path="core.ts"/>
|
||||
/// <reference path="utilities.ts"/>
|
||||
|
@ -21893,9 +21892,18 @@ var ts;
|
|||
case 243 /* ExportAssignment */:
|
||||
return node.isExportEquals ? "export=" : "default";
|
||||
case 194 /* BinaryExpression */:
|
||||
if (ts.getSpecialPropertyAssignmentKind(node) === 2 /* ModuleExports */) {
|
||||
// module.exports = ...
|
||||
return "export=";
|
||||
switch (ts.getSpecialPropertyAssignmentKind(node)) {
|
||||
case 2 /* ModuleExports */:
|
||||
// module.exports = ...
|
||||
return "export=";
|
||||
case 1 /* ExportsProperty */:
|
||||
case 4 /* ThisProperty */:
|
||||
case 5 /* Property */:
|
||||
// exports.x = ... or this.y = ...
|
||||
return node.left.name.text;
|
||||
case 3 /* PrototypeProperty */:
|
||||
// className.prototype.methodName = ...
|
||||
return node.left.expression.name.text;
|
||||
}
|
||||
ts.Debug.fail("Unknown binary declaration kind");
|
||||
break;
|
||||
|
@ -22047,8 +22055,6 @@ var ts;
|
|||
// during global merging in the checker. Why? The only case when ambient module is permitted inside another module is module augmentation
|
||||
// and this case is specially handled. Module augmentations should only be merged with original module definition
|
||||
// and should never be merged directly with other augmentation, and the latter case would be possible if automatic merge is allowed.
|
||||
if (node.kind === 290 /* JSDocTypedefTag */)
|
||||
ts.Debug.assert(ts.isInJavaScriptFile(node)); // We shouldn't add symbols for JSDoc nodes if not in a JS file.
|
||||
var isJSDocTypedefInJSDocNamespace = node.kind === 290 /* JSDocTypedefTag */ &&
|
||||
node.name &&
|
||||
node.name.kind === 71 /* Identifier */ &&
|
||||
|
@ -22207,7 +22213,9 @@ var ts;
|
|||
// Binding of JsDocComment should be done before the current block scope container changes.
|
||||
// because the scope of JsDocComment should not be affected by whether the current node is a
|
||||
// container or not.
|
||||
ts.forEach(node.jsDoc, bind);
|
||||
if (ts.isInJavaScriptFile(node) && node.jsDoc) {
|
||||
ts.forEach(node.jsDoc, bind);
|
||||
}
|
||||
if (checkUnreachable(node)) {
|
||||
bindEachChild(node);
|
||||
return;
|
||||
|
@ -23393,7 +23401,9 @@ var ts;
|
|||
// Here the current node is "foo", which is a container, but the scope of "MyType" should
|
||||
// not be inside "foo". Therefore we always bind @typedef before bind the parent node,
|
||||
// and skip binding this tag later when binding all the other jsdoc tags.
|
||||
bindJSDocTypedefTagIfAny(node);
|
||||
if (ts.isInJavaScriptFile(node)) {
|
||||
bindJSDocTypedefTagIfAny(node);
|
||||
}
|
||||
// First we bind declaration nodes to a symbol if possible. We'll both create a symbol
|
||||
// and then potentially add the symbol to an appropriate symbol table. Possible
|
||||
// destination symbol tables are:
|
||||
|
@ -23475,7 +23485,7 @@ var ts;
|
|||
// for typedef type names with namespaces, bind the new jsdoc type symbol here
|
||||
// because it requires all containing namespaces to be in effect, namely the
|
||||
// current "blockScopeContainer" needs to be set to its immediate namespace parent.
|
||||
if (ts.isInJavaScriptFile(node) && node.isInJSDocNamespace) {
|
||||
if (node.isInJSDocNamespace) {
|
||||
var parentNode = node.parent;
|
||||
while (parentNode && parentNode.kind !== 290 /* JSDocTypedefTag */) {
|
||||
parentNode = parentNode.parent;
|
||||
|
@ -23545,7 +23555,10 @@ var ts;
|
|||
return bindVariableDeclarationOrBindingElement(node);
|
||||
case 149 /* PropertyDeclaration */:
|
||||
case 148 /* PropertySignature */:
|
||||
return bindPropertyWorker(node);
|
||||
case 276 /* JSDocRecordMember */:
|
||||
return bindPropertyOrMethodOrAccessor(node, 4 /* Property */ | (node.questionToken ? 67108864 /* Optional */ : 0 /* None */), 0 /* PropertyExcludes */);
|
||||
case 291 /* JSDocPropertyTag */:
|
||||
return bindJSDocProperty(node);
|
||||
case 261 /* PropertyAssignment */:
|
||||
case 262 /* ShorthandPropertyAssignment */:
|
||||
return bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 0 /* PropertyExcludes */);
|
||||
|
@ -23587,10 +23600,13 @@ var ts;
|
|||
return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 74687 /* SetAccessorExcludes */);
|
||||
case 160 /* FunctionType */:
|
||||
case 161 /* ConstructorType */:
|
||||
case 279 /* JSDocFunctionType */:
|
||||
return bindFunctionOrConstructorType(node);
|
||||
case 163 /* TypeLiteral */:
|
||||
case 172 /* MappedType */:
|
||||
return bindAnonymousTypeWorker(node);
|
||||
case 292 /* JSDocTypeLiteral */:
|
||||
case 275 /* JSDocRecordType */:
|
||||
return bindAnonymousDeclaration(node, 2048 /* TypeLiteral */, "__type");
|
||||
case 178 /* ObjectLiteralExpression */:
|
||||
return bindObjectLiteralExpression(node);
|
||||
case 186 /* FunctionExpression */:
|
||||
|
@ -23609,6 +23625,11 @@ var ts;
|
|||
return bindClassLikeDeclaration(node);
|
||||
case 230 /* InterfaceDeclaration */:
|
||||
return bindBlockScopedDeclaration(node, 64 /* Interface */, 792968 /* InterfaceExcludes */);
|
||||
case 290 /* JSDocTypedefTag */:
|
||||
if (!node.fullName || node.fullName.kind === 71 /* Identifier */) {
|
||||
return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */);
|
||||
}
|
||||
break;
|
||||
case 231 /* TypeAliasDeclaration */:
|
||||
return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */);
|
||||
case 232 /* EnumDeclaration */:
|
||||
|
@ -23644,37 +23665,8 @@ var ts;
|
|||
// falls through
|
||||
case 234 /* ModuleBlock */:
|
||||
return updateStrictModeStatementList(node.statements);
|
||||
default:
|
||||
if (ts.isInJavaScriptFile(node))
|
||||
return bindJSDocWorker(node);
|
||||
}
|
||||
}
|
||||
function bindJSDocWorker(node) {
|
||||
switch (node.kind) {
|
||||
case 276 /* JSDocRecordMember */:
|
||||
return bindPropertyWorker(node);
|
||||
case 291 /* JSDocPropertyTag */:
|
||||
return declareSymbolAndAddToSymbolTable(node, 4 /* Property */, 0 /* PropertyExcludes */);
|
||||
case 279 /* JSDocFunctionType */:
|
||||
return bindFunctionOrConstructorType(node);
|
||||
case 292 /* JSDocTypeLiteral */:
|
||||
case 275 /* JSDocRecordType */:
|
||||
return bindAnonymousTypeWorker(node);
|
||||
case 290 /* JSDocTypedefTag */: {
|
||||
var fullName = node.fullName;
|
||||
if (!fullName || fullName.kind === 71 /* Identifier */) {
|
||||
return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
function bindPropertyWorker(node) {
|
||||
return bindPropertyOrMethodOrAccessor(node, 4 /* Property */ | (node.questionToken ? 67108864 /* Optional */ : 0 /* None */), 0 /* PropertyExcludes */);
|
||||
}
|
||||
function bindAnonymousTypeWorker(node) {
|
||||
return bindAnonymousDeclaration(node, 2048 /* TypeLiteral */, "__type");
|
||||
}
|
||||
function checkTypePredicate(node) {
|
||||
var parameterName = node.parameterName, type = node.type;
|
||||
if (parameterName && parameterName.kind === 71 /* Identifier */) {
|
||||
|
@ -23991,8 +23983,10 @@ var ts;
|
|||
return bindAnonymousDeclaration(node, 16 /* Function */, bindingName);
|
||||
}
|
||||
function bindPropertyOrMethodOrAccessor(node, symbolFlags, symbolExcludes) {
|
||||
if (!file.isDeclarationFile && !ts.isInAmbientContext(node) && ts.isAsyncFunction(node)) {
|
||||
emitFlags |= 1024 /* HasAsyncFunctions */;
|
||||
if (!file.isDeclarationFile && !ts.isInAmbientContext(node)) {
|
||||
if (ts.isAsyncFunction(node)) {
|
||||
emitFlags |= 1024 /* HasAsyncFunctions */;
|
||||
}
|
||||
}
|
||||
if (currentFlow && ts.isObjectLiteralOrClassExpressionMethod(node)) {
|
||||
node.flowNode = currentFlow;
|
||||
|
@ -24001,6 +23995,9 @@ var ts;
|
|||
? bindAnonymousDeclaration(node, symbolFlags, "__computed")
|
||||
: declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes);
|
||||
}
|
||||
function bindJSDocProperty(node) {
|
||||
return declareSymbolAndAddToSymbolTable(node, 4 /* Property */, 0 /* PropertyExcludes */);
|
||||
}
|
||||
// reachability checks
|
||||
function shouldReportErrorOnModuleDeclaration(node) {
|
||||
var instanceState = getModuleInstanceState(node);
|
||||
|
@ -46117,10 +46114,6 @@ var ts;
|
|||
return entityNameSymbol;
|
||||
}
|
||||
}
|
||||
if (entityName.parent.kind === 286 /* JSDocParameterTag */) {
|
||||
var parameter = ts.getParameterFromJSDoc(entityName.parent);
|
||||
return parameter && parameter.symbol;
|
||||
}
|
||||
if (ts.isPartOfExpression(entityName)) {
|
||||
if (ts.nodeIsMissing(entityName)) {
|
||||
// Missing entity name.
|
||||
|
@ -71501,28 +71494,33 @@ var ts;
|
|||
* position >= start and (position < end or (position === end && token is keyword or identifier))
|
||||
*/
|
||||
function getTouchingWord(sourceFile, position, includeJsDocComment) {
|
||||
return getTouchingToken(sourceFile, position, includeJsDocComment, function (n) { return isWord(n.kind); });
|
||||
if (includeJsDocComment === void 0) { includeJsDocComment = false; }
|
||||
return getTouchingToken(sourceFile, position, function (n) { return isWord(n.kind); }, includeJsDocComment);
|
||||
}
|
||||
ts.getTouchingWord = getTouchingWord;
|
||||
/* Gets the token whose text has range [start, end) and position >= start
|
||||
* and (position < end or (position === end && token is keyword or identifier or numeric/string literal))
|
||||
*/
|
||||
function getTouchingPropertyName(sourceFile, position, includeJsDocComment) {
|
||||
return getTouchingToken(sourceFile, position, includeJsDocComment, function (n) { return isPropertyName(n.kind); });
|
||||
if (includeJsDocComment === void 0) { includeJsDocComment = false; }
|
||||
return getTouchingToken(sourceFile, position, function (n) { return isPropertyName(n.kind); }, includeJsDocComment);
|
||||
}
|
||||
ts.getTouchingPropertyName = getTouchingPropertyName;
|
||||
/** Returns the token if position is in [start, end) or if position === end and includeItemAtEndPosition(token) === true */
|
||||
function getTouchingToken(sourceFile, position, includeJsDocComment, includeItemAtEndPosition) {
|
||||
function getTouchingToken(sourceFile, position, includeItemAtEndPosition, includeJsDocComment) {
|
||||
if (includeJsDocComment === void 0) { includeJsDocComment = false; }
|
||||
return getTokenAtPositionWorker(sourceFile, position, /*allowPositionInLeadingTrivia*/ false, includeItemAtEndPosition, includeJsDocComment);
|
||||
}
|
||||
ts.getTouchingToken = getTouchingToken;
|
||||
/** Returns a token if position is in [start-of-leading-trivia, end) */
|
||||
function getTokenAtPosition(sourceFile, position, includeJsDocComment) {
|
||||
if (includeJsDocComment === void 0) { includeJsDocComment = false; }
|
||||
return getTokenAtPositionWorker(sourceFile, position, /*allowPositionInLeadingTrivia*/ true, /*includeItemAtEndPosition*/ undefined, includeJsDocComment);
|
||||
}
|
||||
ts.getTokenAtPosition = getTokenAtPosition;
|
||||
/** Get the token whose text contains the position */
|
||||
function getTokenAtPositionWorker(sourceFile, position, allowPositionInLeadingTrivia, includeItemAtEndPosition, includeJsDocComment) {
|
||||
if (includeJsDocComment === void 0) { includeJsDocComment = false; }
|
||||
var current = sourceFile;
|
||||
outer: while (true) {
|
||||
if (ts.isToken(current)) {
|
||||
|
@ -71565,7 +71563,7 @@ var ts;
|
|||
function findTokenOnLeftOfPosition(file, position) {
|
||||
// Ideally, getTokenAtPosition should return a token. However, it is currently
|
||||
// broken, so we do a check to make sure the result was indeed a token.
|
||||
var tokenAtPosition = getTokenAtPosition(file, position, /*includeJsDocComment*/ false);
|
||||
var tokenAtPosition = getTokenAtPosition(file, position);
|
||||
if (ts.isToken(tokenAtPosition) && position > tokenAtPosition.getStart(file) && position < tokenAtPosition.getEnd()) {
|
||||
return tokenAtPosition;
|
||||
}
|
||||
|
@ -71678,7 +71676,7 @@ var ts;
|
|||
* returns true if the position is in between the open and close elements of an JSX expression.
|
||||
*/
|
||||
function isInsideJsxElementOrAttribute(sourceFile, position) {
|
||||
var token = getTokenAtPosition(sourceFile, position, /*includeJsDocComment*/ false);
|
||||
var token = getTokenAtPosition(sourceFile, position);
|
||||
if (!token) {
|
||||
return false;
|
||||
}
|
||||
|
@ -71707,7 +71705,7 @@ var ts;
|
|||
}
|
||||
ts.isInsideJsxElementOrAttribute = isInsideJsxElementOrAttribute;
|
||||
function isInTemplateString(sourceFile, position) {
|
||||
var token = getTokenAtPosition(sourceFile, position, /*includeJsDocComment*/ false);
|
||||
var token = getTokenAtPosition(sourceFile, position);
|
||||
return ts.isTemplateLiteralKind(token.kind) && position > token.getStart(sourceFile);
|
||||
}
|
||||
ts.isInTemplateString = isInTemplateString;
|
||||
|
@ -71718,7 +71716,7 @@ var ts;
|
|||
* @param predicate Additional predicate to test on the comment range.
|
||||
*/
|
||||
function isInComment(sourceFile, position, tokenAtPosition, predicate) {
|
||||
if (tokenAtPosition === void 0) { tokenAtPosition = getTokenAtPosition(sourceFile, position, /*includeJsDocComment*/ false); }
|
||||
if (tokenAtPosition === void 0) { tokenAtPosition = getTokenAtPosition(sourceFile, position); }
|
||||
return position <= tokenAtPosition.getStart(sourceFile) &&
|
||||
(isInCommentRange(ts.getLeadingCommentRanges(sourceFile.text, tokenAtPosition.pos)) ||
|
||||
isInCommentRange(ts.getTrailingCommentRanges(sourceFile.text, tokenAtPosition.pos)));
|
||||
|
@ -71752,7 +71750,7 @@ var ts;
|
|||
}
|
||||
}
|
||||
function hasDocComment(sourceFile, position) {
|
||||
var token = getTokenAtPosition(sourceFile, position, /*includeJsDocComment*/ false);
|
||||
var token = getTokenAtPosition(sourceFile, position);
|
||||
// First, we have to see if this position actually landed in a comment.
|
||||
var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos);
|
||||
return ts.forEach(commentRanges, jsDocPrefix);
|
||||
|
@ -71766,7 +71764,7 @@ var ts;
|
|||
* Get the corresponding JSDocTag node if the position is in a jsDoc comment
|
||||
*/
|
||||
function getJsDocTagAtPosition(sourceFile, position) {
|
||||
var node = ts.getTokenAtPosition(sourceFile, position, /*includeJsDocComment*/ false);
|
||||
var node = ts.getTokenAtPosition(sourceFile, position);
|
||||
if (ts.isToken(node)) {
|
||||
switch (node.kind) {
|
||||
case 104 /* VarKeyword */:
|
||||
|
@ -72249,7 +72247,7 @@ var ts;
|
|||
}
|
||||
ts.getOpenBrace = getOpenBrace;
|
||||
function getOpenBraceOfClassLike(declaration, sourceFile) {
|
||||
return ts.getTokenAtPosition(sourceFile, declaration.members.pos - 1, /*includeJsDocComment*/ false);
|
||||
return ts.getTokenAtPosition(sourceFile, declaration.members.pos - 1);
|
||||
}
|
||||
ts.getOpenBraceOfClassLike = getOpenBraceOfClassLike;
|
||||
})(ts || (ts = {}));
|
||||
|
@ -73390,7 +73388,7 @@ var ts;
|
|||
return ts.deduplicate(nonRelativeModules);
|
||||
}
|
||||
function getTripleSlashReferenceCompletion(sourceFile, position, compilerOptions, host) {
|
||||
var token = ts.getTokenAtPosition(sourceFile, position, /*includeJsDocComment*/ false);
|
||||
var token = ts.getTokenAtPosition(sourceFile, position);
|
||||
if (!token) {
|
||||
return undefined;
|
||||
}
|
||||
|
@ -73935,7 +73933,7 @@ var ts;
|
|||
// JsDoc tag includes both "@" and tag-name
|
||||
var requestJsDocTag = false;
|
||||
var start = ts.timestamp();
|
||||
var currentToken = ts.getTokenAtPosition(sourceFile, position, /*includeJsDocComment*/ false); // TODO: GH#15853
|
||||
var currentToken = ts.getTokenAtPosition(sourceFile, position);
|
||||
log("getCompletionData: Get current token: " + (ts.timestamp() - start));
|
||||
start = ts.timestamp();
|
||||
// Completion not allowed inside comments, bail out if this is the case
|
||||
|
@ -74019,7 +74017,7 @@ var ts;
|
|||
var isRightOfDot = false;
|
||||
var isRightOfOpenTag = false;
|
||||
var isStartingCloseTag = false;
|
||||
var location = ts.getTouchingPropertyName(sourceFile, position, /*includeJsDocComment*/ false); // TODO: GH#15853
|
||||
var location = ts.getTouchingPropertyName(sourceFile, position);
|
||||
if (contextToken) {
|
||||
// Bail out if this is a known invalid completion location
|
||||
if (isCompletionListBlocker(contextToken)) {
|
||||
|
@ -74961,7 +74959,7 @@ var ts;
|
|||
var DocumentHighlights;
|
||||
(function (DocumentHighlights) {
|
||||
function getDocumentHighlights(program, cancellationToken, sourceFile, position, sourceFilesToSearch) {
|
||||
var node = ts.getTouchingWord(sourceFile, position, /*includeJsDocComment*/ true);
|
||||
var node = ts.getTouchingWord(sourceFile, position);
|
||||
return node && (getSemanticDocumentHighlights(node, program, cancellationToken, sourceFilesToSearch) || getSyntacticDocumentHighlights(node, sourceFile));
|
||||
}
|
||||
DocumentHighlights.getDocumentHighlights = getDocumentHighlights;
|
||||
|
@ -76158,17 +76156,13 @@ var ts;
|
|||
}
|
||||
FindAllReferences.findReferencedSymbols = findReferencedSymbols;
|
||||
function getImplementationsAtPosition(program, cancellationToken, sourceFiles, sourceFile, position) {
|
||||
// A node in a JSDoc comment can't have an implementation anyway.
|
||||
var node = ts.getTouchingPropertyName(sourceFile, position, /*includeJsDocComment*/ false);
|
||||
var node = ts.getTouchingPropertyName(sourceFile, position);
|
||||
var referenceEntries = getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node);
|
||||
var checker = program.getTypeChecker();
|
||||
return ts.map(referenceEntries, function (entry) { return toImplementationLocation(entry, checker); });
|
||||
}
|
||||
FindAllReferences.getImplementationsAtPosition = getImplementationsAtPosition;
|
||||
function getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node) {
|
||||
if (node.kind === 265 /* SourceFile */) {
|
||||
return undefined;
|
||||
}
|
||||
var checker = program.getTypeChecker();
|
||||
// If invoked directly on a shorthand property assignment, then return
|
||||
// the declaration of the symbol being assigned (not the symbol being assigned to).
|
||||
|
@ -76705,7 +76699,7 @@ var ts;
|
|||
var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, labelName, container);
|
||||
for (var _i = 0, possiblePositions_1 = possiblePositions; _i < possiblePositions_1.length; _i++) {
|
||||
var position = possiblePositions_1[_i];
|
||||
var node = ts.getTouchingWord(sourceFile, position, /*includeJsDocComment*/ false);
|
||||
var node = ts.getTouchingWord(sourceFile, position);
|
||||
// Only pick labels that are either the target label, or have a target that is the target label
|
||||
if (node && (node === targetLabel || (ts.isJumpStatementTarget(node) && ts.getTargetLabel(node, labelName) === targetLabel))) {
|
||||
references.push(FindAllReferences.nodeEntry(node));
|
||||
|
@ -76737,11 +76731,10 @@ var ts;
|
|||
return references.length ? [{ definition: { type: "keyword", node: references[0].node }, references: references }] : undefined;
|
||||
}
|
||||
function addReferencesForKeywordInFile(sourceFile, kind, searchText, references) {
|
||||
// Want fullStart so we can find the symbol in JSDoc comments
|
||||
var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, searchText, sourceFile, /*fullStart*/ true);
|
||||
var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, searchText);
|
||||
for (var _i = 0, possiblePositions_2 = possiblePositions; _i < possiblePositions_2.length; _i++) {
|
||||
var position = possiblePositions_2[_i];
|
||||
var referenceLocation = ts.getTouchingPropertyName(sourceFile, position, /*includeJsDocComment*/ true);
|
||||
var referenceLocation = ts.getTouchingPropertyName(sourceFile, position);
|
||||
if (referenceLocation.kind === kind) {
|
||||
references.push(FindAllReferences.nodeEntry(referenceLocation));
|
||||
}
|
||||
|
@ -76760,13 +76753,13 @@ var ts;
|
|||
if (!state.markSearchedSymbol(sourceFile, search.symbol)) {
|
||||
return;
|
||||
}
|
||||
for (var _i = 0, _a = getPossibleSymbolReferencePositions(sourceFile, search.text, container, /*fullStart*/ state.findInComments || container.jsDoc !== undefined); _i < _a.length; _i++) {
|
||||
for (var _i = 0, _a = getPossibleSymbolReferencePositions(sourceFile, search.text, container, /*fullStart*/ state.findInComments); _i < _a.length; _i++) {
|
||||
var position = _a[_i];
|
||||
getReferencesAtLocation(sourceFile, position, search, state);
|
||||
}
|
||||
}
|
||||
function getReferencesAtLocation(sourceFile, position, search, state) {
|
||||
var referenceLocation = ts.getTouchingPropertyName(sourceFile, position, /*includeJsDocComment*/ true);
|
||||
var referenceLocation = ts.getTouchingPropertyName(sourceFile, position);
|
||||
if (!isValidReferencePosition(referenceLocation, search.text)) {
|
||||
// This wasn't the start of a token. Check to see if it might be a
|
||||
// match in a comment or string if that's what the caller is asking
|
||||
|
@ -77161,7 +77154,7 @@ var ts;
|
|||
var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "super", searchSpaceNode);
|
||||
for (var _i = 0, possiblePositions_3 = possiblePositions; _i < possiblePositions_3.length; _i++) {
|
||||
var position = possiblePositions_3[_i];
|
||||
var node = ts.getTouchingWord(sourceFile, position, /*includeJsDocComment*/ false);
|
||||
var node = ts.getTouchingWord(sourceFile, position);
|
||||
if (!node || node.kind !== 97 /* SuperKeyword */) {
|
||||
continue;
|
||||
}
|
||||
|
@ -77227,7 +77220,7 @@ var ts;
|
|||
}];
|
||||
function getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, result) {
|
||||
ts.forEach(possiblePositions, function (position) {
|
||||
var node = ts.getTouchingWord(sourceFile, position, /*includeJsDocComment*/ false);
|
||||
var node = ts.getTouchingWord(sourceFile, position);
|
||||
if (!node || !ts.isThis(node)) {
|
||||
return;
|
||||
}
|
||||
|
@ -77277,7 +77270,7 @@ var ts;
|
|||
function getReferencesForStringLiteralInFile(sourceFile, searchText, possiblePositions, references) {
|
||||
for (var _i = 0, possiblePositions_4 = possiblePositions; _i < possiblePositions_4.length; _i++) {
|
||||
var position = possiblePositions_4[_i];
|
||||
var node_7 = ts.getTouchingWord(sourceFile, position, /*includeJsDocComment*/ false);
|
||||
var node_7 = ts.getTouchingWord(sourceFile, position);
|
||||
if (node_7 && node_7.kind === 9 /* StringLiteral */ && node_7.text === searchText) {
|
||||
references.push(FindAllReferences.nodeEntry(node_7, /*isInString*/ true));
|
||||
}
|
||||
|
@ -77630,7 +77623,7 @@ var ts;
|
|||
return referenceFile && referenceFile.resolvedFileName &&
|
||||
[getDefinitionInfoForFileReference(typeReferenceDirective.fileName, referenceFile.resolvedFileName)];
|
||||
}
|
||||
var node = ts.getTouchingPropertyName(sourceFile, position, /*includeJsDocComment*/ true);
|
||||
var node = ts.getTouchingPropertyName(sourceFile, position);
|
||||
if (node === sourceFile) {
|
||||
return undefined;
|
||||
}
|
||||
|
@ -77697,7 +77690,7 @@ var ts;
|
|||
GoToDefinition.getDefinitionAtPosition = getDefinitionAtPosition;
|
||||
/// Goto type
|
||||
function getTypeDefinitionAtPosition(typeChecker, sourceFile, position) {
|
||||
var node = ts.getTouchingPropertyName(sourceFile, position, /*includeJsDocComment*/ true);
|
||||
var node = ts.getTouchingPropertyName(sourceFile, position);
|
||||
if (node === sourceFile) {
|
||||
return undefined;
|
||||
}
|
||||
|
@ -78046,7 +78039,7 @@ var ts;
|
|||
if (ts.isInString(sourceFile, position) || ts.isInComment(sourceFile, position) || ts.hasDocComment(sourceFile, position)) {
|
||||
return undefined;
|
||||
}
|
||||
var tokenAtPos = ts.getTokenAtPosition(sourceFile, position, /*includeJsDocComment*/ false);
|
||||
var tokenAtPos = ts.getTokenAtPosition(sourceFile, position);
|
||||
var tokenStart = tokenAtPos.getStart();
|
||||
if (!tokenAtPos || tokenStart < position) {
|
||||
return undefined;
|
||||
|
@ -84348,7 +84341,7 @@ var ts;
|
|||
return this;
|
||||
}
|
||||
if (index !== containingList.length - 1) {
|
||||
var nextToken = ts.getTokenAtPosition(sourceFile, node.end, /*includeJsDocComment*/ false);
|
||||
var nextToken = ts.getTokenAtPosition(sourceFile, node.end);
|
||||
if (nextToken && isSeparator(node, nextToken)) {
|
||||
// find first non-whitespace position in the leading trivia of the node
|
||||
var startPosition = ts.skipTrivia(sourceFile.text, getAdjustedStartPosition(sourceFile, node, {}, Position.FullStart), /*stopAfterLineBreak*/ false, /*stopAtComments*/ true);
|
||||
|
@ -84360,7 +84353,7 @@ var ts;
|
|||
}
|
||||
}
|
||||
else {
|
||||
var previousToken = ts.getTokenAtPosition(sourceFile, containingList[index - 1].end, /*includeJsDocComment*/ false);
|
||||
var previousToken = ts.getTokenAtPosition(sourceFile, containingList[index - 1].end);
|
||||
if (previousToken && isSeparator(node, previousToken)) {
|
||||
this.deleteNodeRange(sourceFile, previousToken, node);
|
||||
}
|
||||
|
@ -84437,7 +84430,7 @@ var ts;
|
|||
if (index !== containingList.length - 1) {
|
||||
// any element except the last one
|
||||
// use next sibling as an anchor
|
||||
var nextToken = ts.getTokenAtPosition(sourceFile, after.end, /*includeJsDocComment*/ false);
|
||||
var nextToken = ts.getTokenAtPosition(sourceFile, after.end);
|
||||
if (nextToken && isSeparator(after, nextToken)) {
|
||||
// for list
|
||||
// a, b, c
|
||||
|
@ -84867,7 +84860,7 @@ var ts;
|
|||
function getActionForClassLikeIncorrectImplementsInterface(context) {
|
||||
var sourceFile = context.sourceFile;
|
||||
var start = context.span.start;
|
||||
var token = ts.getTokenAtPosition(sourceFile, start, /*includeJsDocComment*/ false);
|
||||
var token = ts.getTokenAtPosition(sourceFile, start);
|
||||
var checker = context.program.getTypeChecker();
|
||||
var classDeclaration = ts.getContainingClass(token);
|
||||
if (!classDeclaration) {
|
||||
|
@ -84933,7 +84926,7 @@ var ts;
|
|||
// This is the identifier of the missing property. eg:
|
||||
// this.missing = 1;
|
||||
// ^^^^^^^
|
||||
var token = ts.getTokenAtPosition(sourceFile, start, /*includeJsDocComment*/ false);
|
||||
var token = ts.getTokenAtPosition(sourceFile, start);
|
||||
if (token.kind !== 71 /* Identifier */) {
|
||||
return undefined;
|
||||
}
|
||||
|
@ -85044,7 +85037,7 @@ var ts;
|
|||
// This is the identifier of the misspelled word. eg:
|
||||
// this.speling = 1;
|
||||
// ^^^^^^^
|
||||
var node = ts.getTokenAtPosition(sourceFile, context.span.start, /*includeJsDocComment*/ false); // TODO: GH#15852
|
||||
var node = ts.getTokenAtPosition(sourceFile, context.span.start);
|
||||
var checker = context.program.getTypeChecker();
|
||||
var suggestion;
|
||||
if (node.kind === 71 /* Identifier */ && ts.isPropertyAccessExpression(node.parent)) {
|
||||
|
@ -85101,7 +85094,7 @@ var ts;
|
|||
var start = context.span.start;
|
||||
// This is the identifier in the case of a class declaration
|
||||
// or the class keyword token in the case of a class expression.
|
||||
var token = ts.getTokenAtPosition(sourceFile, start, /*includeJsDocComment*/ false);
|
||||
var token = ts.getTokenAtPosition(sourceFile, start);
|
||||
var checker = context.program.getTypeChecker();
|
||||
if (ts.isClassLike(token.parent)) {
|
||||
var classDeclaration = token.parent;
|
||||
|
@ -85139,7 +85132,7 @@ var ts;
|
|||
errorCodes: [ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class.code],
|
||||
getCodeActions: function (context) {
|
||||
var sourceFile = context.sourceFile;
|
||||
var token = ts.getTokenAtPosition(sourceFile, context.span.start, /*includeJsDocComment*/ false);
|
||||
var token = ts.getTokenAtPosition(sourceFile, context.span.start);
|
||||
if (token.kind !== 99 /* ThisKeyword */) {
|
||||
return undefined;
|
||||
}
|
||||
|
@ -85187,7 +85180,7 @@ var ts;
|
|||
errorCodes: [ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code],
|
||||
getCodeActions: function (context) {
|
||||
var sourceFile = context.sourceFile;
|
||||
var token = ts.getTokenAtPosition(sourceFile, context.span.start, /*includeJsDocComment*/ false);
|
||||
var token = ts.getTokenAtPosition(sourceFile, context.span.start);
|
||||
if (token.kind !== 123 /* ConstructorKeyword */) {
|
||||
return undefined;
|
||||
}
|
||||
|
@ -85212,7 +85205,7 @@ var ts;
|
|||
getCodeActions: function (context) {
|
||||
var sourceFile = context.sourceFile;
|
||||
var start = context.span.start;
|
||||
var token = ts.getTokenAtPosition(sourceFile, start, /*includeJsDocComment*/ false);
|
||||
var token = ts.getTokenAtPosition(sourceFile, start);
|
||||
var classDeclNode = ts.getContainingClass(token);
|
||||
if (!(token.kind === 71 /* Identifier */ && ts.isClassLike(classDeclNode))) {
|
||||
return undefined;
|
||||
|
@ -85252,7 +85245,7 @@ var ts;
|
|||
errorCodes: [ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code],
|
||||
getCodeActions: function (context) {
|
||||
var sourceFile = context.sourceFile;
|
||||
var token = ts.getTokenAtPosition(sourceFile, context.span.start, /*includeJsDocComment*/ false);
|
||||
var token = ts.getTokenAtPosition(sourceFile, context.span.start);
|
||||
if (token.kind !== 71 /* Identifier */) {
|
||||
return undefined;
|
||||
}
|
||||
|
@ -85279,10 +85272,10 @@ var ts;
|
|||
getCodeActions: function (context) {
|
||||
var sourceFile = context.sourceFile;
|
||||
var start = context.span.start;
|
||||
var token = ts.getTokenAtPosition(sourceFile, start, /*includeJsDocComment*/ false);
|
||||
var token = ts.getTokenAtPosition(sourceFile, start);
|
||||
// this handles var ["computed"] = 12;
|
||||
if (token.kind === 21 /* OpenBracketToken */) {
|
||||
token = ts.getTokenAtPosition(sourceFile, start + 1, /*includeJsDocComment*/ false);
|
||||
token = ts.getTokenAtPosition(sourceFile, start + 1);
|
||||
}
|
||||
switch (token.kind) {
|
||||
case 71 /* Identifier */:
|
||||
|
@ -85311,11 +85304,11 @@ var ts;
|
|||
case 145 /* TypeParameter */:
|
||||
var typeParameters = token.parent.parent.typeParameters;
|
||||
if (typeParameters.length === 1) {
|
||||
var previousToken = ts.getTokenAtPosition(sourceFile, typeParameters.pos - 1, /*includeJsDocComment*/ false);
|
||||
var previousToken = ts.getTokenAtPosition(sourceFile, typeParameters.pos - 1);
|
||||
if (!previousToken || previousToken.kind !== 27 /* LessThanToken */) {
|
||||
return deleteRange(typeParameters);
|
||||
}
|
||||
var nextToken = ts.getTokenAtPosition(sourceFile, typeParameters.end, /*includeJsDocComment*/ false);
|
||||
var nextToken = ts.getTokenAtPosition(sourceFile, typeParameters.end);
|
||||
if (!nextToken || nextToken.kind !== 29 /* GreaterThanToken */) {
|
||||
return deleteRange(typeParameters);
|
||||
}
|
||||
|
@ -85358,7 +85351,7 @@ var ts;
|
|||
else {
|
||||
// import |d,| * as ns from './file'
|
||||
var start_4 = importClause.name.getStart(sourceFile);
|
||||
var nextToken = ts.getTokenAtPosition(sourceFile, importClause.name.end, /*includeJsDocComment*/ false);
|
||||
var nextToken = ts.getTokenAtPosition(sourceFile, importClause.name.end);
|
||||
if (nextToken && nextToken.kind === 26 /* CommaToken */) {
|
||||
// shift first non-whitespace position after comma to the start position of the node
|
||||
return deleteRange({ pos: start_4, end: ts.skipTrivia(sourceFile.text, nextToken.end, /*stopAfterLineBreaks*/ false, /*stopAtComments*/ true) });
|
||||
|
@ -85374,7 +85367,7 @@ var ts;
|
|||
return deleteNode(importDecl);
|
||||
}
|
||||
else {
|
||||
var previousToken = ts.getTokenAtPosition(sourceFile, namespaceImport.pos - 1, /*includeJsDocComment*/ false);
|
||||
var previousToken = ts.getTokenAtPosition(sourceFile, namespaceImport.pos - 1);
|
||||
if (previousToken && previousToken.kind === 26 /* CommaToken */) {
|
||||
var startPosition = ts.textChanges.getAdjustedStartPosition(sourceFile, previousToken, {}, ts.textChanges.Position.FullStart);
|
||||
return deleteRange({ pos: startPosition, end: namespaceImport.end });
|
||||
|
@ -85557,7 +85550,7 @@ var ts;
|
|||
var checker = context.program.getTypeChecker();
|
||||
var allSourceFiles = context.program.getSourceFiles();
|
||||
var useCaseSensitiveFileNames = context.host.useCaseSensitiveFileNames ? context.host.useCaseSensitiveFileNames() : false;
|
||||
var token = ts.getTokenAtPosition(sourceFile, context.span.start, /*includeJsDocComment*/ false);
|
||||
var token = ts.getTokenAtPosition(sourceFile, context.span.start);
|
||||
var name = token.getText();
|
||||
var symbolIdActionMap = new ImportCodeActionMap();
|
||||
// this is a module id -> module import declaration map
|
||||
|
@ -85965,7 +85958,7 @@ var ts;
|
|||
// We also want to check if the previous line holds a comment for a node on the next line
|
||||
// if so, we do not want to separate the node from its comment if we can.
|
||||
if (!ts.isInComment(sourceFile, startPosition) && !ts.isInString(sourceFile, startPosition) && !ts.isInTemplateString(sourceFile, startPosition)) {
|
||||
var token = ts.getTouchingToken(sourceFile, startPosition, /*includeJsDocComment*/ false);
|
||||
var token = ts.getTouchingToken(sourceFile, startPosition);
|
||||
var tokenLeadingCommnets = ts.getLeadingCommentRangesOfNode(token, sourceFile);
|
||||
if (!tokenLeadingCommnets || !tokenLeadingCommnets.length || tokenLeadingCommnets[0].pos >= startPosition) {
|
||||
return {
|
||||
|
@ -86231,7 +86224,7 @@ var ts;
|
|||
refactor.registerRefactor(convertFunctionToES6Class);
|
||||
function isApplicable(context) {
|
||||
var start = context.startPosition;
|
||||
var node = ts.getTokenAtPosition(context.file, start, /*includeJsDocComment*/ false);
|
||||
var node = ts.getTokenAtPosition(context.file, start);
|
||||
var checker = context.program.getTypeChecker();
|
||||
var symbol = checker.getSymbolAtLocation(node);
|
||||
if (symbol && ts.isDeclarationOfFunctionOrClassExpression(symbol)) {
|
||||
|
@ -86243,7 +86236,7 @@ var ts;
|
|||
var start = context.startPosition;
|
||||
var sourceFile = context.file;
|
||||
var checker = context.program.getTypeChecker();
|
||||
var token = ts.getTokenAtPosition(sourceFile, start, /*includeJsDocComment*/ false);
|
||||
var token = ts.getTokenAtPosition(sourceFile, start);
|
||||
var ctorSymbol = checker.getSymbolAtLocation(token);
|
||||
var newLine = context.rulesProvider.getFormatOptions().newLineCharacter;
|
||||
var deletedNodes = [];
|
||||
|
@ -86484,7 +86477,6 @@ var ts;
|
|||
ts.scanner.setTextPos(pos);
|
||||
while (pos < end) {
|
||||
var token = useJSDocScanner ? ts.scanner.scanJSDocToken() : ts.scanner.scan();
|
||||
ts.Debug.assert(token !== 1 /* EndOfFileToken */); // Else it would infinitely loop
|
||||
var textPos = ts.scanner.getTextPos();
|
||||
if (textPos <= end) {
|
||||
nodes.push(createNode(token, pos, textPos, this));
|
||||
|
@ -86512,32 +86504,27 @@ var ts;
|
|||
};
|
||||
NodeObject.prototype.createChildren = function (sourceFile) {
|
||||
var _this = this;
|
||||
if (ts.isJSDocTag(this)) {
|
||||
/** Don't add trivia for "tokens" since this is in a comment. */
|
||||
var children_3 = [];
|
||||
this.forEachChild(function (child) { children_3.push(child); });
|
||||
this._children = children_3;
|
||||
}
|
||||
else if (this.kind >= 143 /* FirstNode */) {
|
||||
var children_4 = [];
|
||||
var children;
|
||||
if (this.kind >= 143 /* FirstNode */) {
|
||||
ts.scanner.setText((sourceFile || this.getSourceFile()).text);
|
||||
children = [];
|
||||
var pos_3 = this.pos;
|
||||
var useJSDocScanner_1 = this.kind >= 283 /* FirstJSDocTagNode */ && this.kind <= 293 /* LastJSDocTagNode */;
|
||||
var processNode = function (node) {
|
||||
var isJSDocTagNode = ts.isJSDocTag(node);
|
||||
if (!isJSDocTagNode && pos_3 < node.pos) {
|
||||
pos_3 = _this.addSyntheticNodes(children_4, pos_3, node.pos, useJSDocScanner_1);
|
||||
pos_3 = _this.addSyntheticNodes(children, pos_3, node.pos, useJSDocScanner_1);
|
||||
}
|
||||
children_4.push(node);
|
||||
children.push(node);
|
||||
if (!isJSDocTagNode) {
|
||||
pos_3 = node.end;
|
||||
}
|
||||
};
|
||||
var processNodes = function (nodes) {
|
||||
if (pos_3 < nodes.pos) {
|
||||
pos_3 = _this.addSyntheticNodes(children_4, pos_3, nodes.pos, useJSDocScanner_1);
|
||||
pos_3 = _this.addSyntheticNodes(children, pos_3, nodes.pos, useJSDocScanner_1);
|
||||
}
|
||||
children_4.push(_this.createSyntaxList(nodes));
|
||||
children.push(_this.createSyntaxList(nodes));
|
||||
pos_3 = nodes.end;
|
||||
};
|
||||
// jsDocComments need to be the first children
|
||||
|
@ -86553,14 +86540,11 @@ var ts;
|
|||
pos_3 = this.pos;
|
||||
ts.forEachChild(this, processNode, processNodes);
|
||||
if (pos_3 < this.end) {
|
||||
this.addSyntheticNodes(children_4, pos_3, this.end);
|
||||
this.addSyntheticNodes(children, pos_3, this.end);
|
||||
}
|
||||
ts.scanner.setText(undefined);
|
||||
this._children = children_4;
|
||||
}
|
||||
else {
|
||||
this._children = ts.emptyArray;
|
||||
}
|
||||
this._children = children || ts.emptyArray;
|
||||
};
|
||||
NodeObject.prototype.getChildCount = function (sourceFile) {
|
||||
if (!this._children)
|
||||
|
@ -87481,7 +87465,7 @@ var ts;
|
|||
function getQuickInfoAtPosition(fileName, position) {
|
||||
synchronizeHostData();
|
||||
var sourceFile = getValidSourceFile(fileName);
|
||||
var node = ts.getTouchingPropertyName(sourceFile, position, /*includeJsDocComment*/ true);
|
||||
var node = ts.getTouchingPropertyName(sourceFile, position);
|
||||
if (node === sourceFile) {
|
||||
return undefined;
|
||||
}
|
||||
|
@ -87635,7 +87619,7 @@ var ts;
|
|||
function getNameOrDottedNameSpan(fileName, startPos, _endPos) {
|
||||
var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
|
||||
// Get node at the location
|
||||
var node = ts.getTouchingPropertyName(sourceFile, startPos, /*includeJsDocComment*/ false);
|
||||
var node = ts.getTouchingPropertyName(sourceFile, startPos);
|
||||
if (node === sourceFile) {
|
||||
return;
|
||||
}
|
||||
|
@ -87729,7 +87713,7 @@ var ts;
|
|||
function getBraceMatchingAtPosition(fileName, position) {
|
||||
var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
|
||||
var result = [];
|
||||
var token = ts.getTouchingToken(sourceFile, position, /*includeJsDocComment*/ false);
|
||||
var token = ts.getTouchingToken(sourceFile, position);
|
||||
if (token.getStart(sourceFile) === position) {
|
||||
var matchKind = getMatchingTokenKind(token);
|
||||
// Ensure that there is a corresponding token to match ours.
|
||||
|
@ -88191,7 +88175,7 @@ var ts;
|
|||
if (sourceFile.isDeclarationFile) {
|
||||
return undefined;
|
||||
}
|
||||
var tokenAtLocation = ts.getTokenAtPosition(sourceFile, position, /*includeJsDocComment*/ false);
|
||||
var tokenAtLocation = ts.getTokenAtPosition(sourceFile, position);
|
||||
var lineOfPosition = sourceFile.getLineAndCharacterOfPosition(position).line;
|
||||
if (sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getStart(sourceFile)).line > lineOfPosition) {
|
||||
// Get previous token if the token is returned starts on new line
|
||||
|
@ -89583,3 +89567,5 @@ var TypeScript;
|
|||
// TODO: it should be moved into a namespace though.
|
||||
/* @internal */
|
||||
var toolsVersion = "2.4";
|
||||
|
||||
//# sourceMappingURL=typescriptServices.js.map
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -2177,7 +2177,7 @@ namespace FourSlash {
|
|||
}
|
||||
|
||||
ts.zipWith(expected, actual, (expectedClassification, actualClassification) => {
|
||||
const expectedType: string = (<any>ts.ClassificationTypeNames)[expectedClassification.classificationType];
|
||||
const expectedType = expectedClassification.classificationType;
|
||||
if (expectedType !== actualClassification.classificationType) {
|
||||
this.raiseError("verifyClassifications failed - expected classifications type to be " +
|
||||
expectedType + ", but was " +
|
||||
|
@ -3879,7 +3879,7 @@ namespace FourSlashInterface {
|
|||
/**
|
||||
* This method *requires* an ordered stream of classifications for a file, and spans are highly recommended.
|
||||
*/
|
||||
public semanticClassificationsAre(...classifications: { classificationType: string; text: string; textSpan?: FourSlash.TextSpan }[]) {
|
||||
public semanticClassificationsAre(...classifications: Classification[]) {
|
||||
this.state.verifySemanticClassifications(classifications);
|
||||
}
|
||||
|
||||
|
@ -4074,102 +4074,107 @@ namespace FourSlashInterface {
|
|||
}
|
||||
}
|
||||
|
||||
interface Classification {
|
||||
classificationType: ts.ClassificationTypeNames;
|
||||
text: string;
|
||||
textSpan?: FourSlash.TextSpan;
|
||||
}
|
||||
export namespace Classification {
|
||||
export function comment(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("comment", text, position);
|
||||
export function comment(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.comment, text, position);
|
||||
}
|
||||
|
||||
export function identifier(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("identifier", text, position);
|
||||
export function identifier(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.identifier, text, position);
|
||||
}
|
||||
|
||||
export function keyword(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("keyword", text, position);
|
||||
export function keyword(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.keyword, text, position);
|
||||
}
|
||||
|
||||
export function numericLiteral(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("numericLiteral", text, position);
|
||||
export function numericLiteral(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.numericLiteral, text, position);
|
||||
}
|
||||
|
||||
export function operator(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("operator", text, position);
|
||||
export function operator(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.operator, text, position);
|
||||
}
|
||||
|
||||
export function stringLiteral(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("stringLiteral", text, position);
|
||||
export function stringLiteral(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.stringLiteral, text, position);
|
||||
}
|
||||
|
||||
export function whiteSpace(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("whiteSpace", text, position);
|
||||
export function whiteSpace(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.whiteSpace, text, position);
|
||||
}
|
||||
|
||||
export function text(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("text", text, position);
|
||||
export function text(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.text, text, position);
|
||||
}
|
||||
|
||||
export function punctuation(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("punctuation", text, position);
|
||||
export function punctuation(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.punctuation, text, position);
|
||||
}
|
||||
|
||||
export function docCommentTagName(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("docCommentTagName", text, position);
|
||||
export function docCommentTagName(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.docCommentTagName, text, position);
|
||||
}
|
||||
|
||||
export function className(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("className", text, position);
|
||||
export function className(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.className, text, position);
|
||||
}
|
||||
|
||||
export function enumName(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("enumName", text, position);
|
||||
export function enumName(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.enumName, text, position);
|
||||
}
|
||||
|
||||
export function interfaceName(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("interfaceName", text, position);
|
||||
export function interfaceName(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.interfaceName, text, position);
|
||||
}
|
||||
|
||||
export function moduleName(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("moduleName", text, position);
|
||||
export function moduleName(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.moduleName, text, position);
|
||||
}
|
||||
|
||||
export function typeParameterName(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("typeParameterName", text, position);
|
||||
export function typeParameterName(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.typeParameterName, text, position);
|
||||
}
|
||||
|
||||
export function parameterName(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("parameterName", text, position);
|
||||
export function parameterName(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.parameterName, text, position);
|
||||
}
|
||||
|
||||
export function typeAliasName(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("typeAliasName", text, position);
|
||||
export function typeAliasName(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.typeAliasName, text, position);
|
||||
}
|
||||
|
||||
export function jsxOpenTagName(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("jsxOpenTagName", text, position);
|
||||
export function jsxOpenTagName(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.jsxOpenTagName, text, position);
|
||||
}
|
||||
|
||||
export function jsxCloseTagName(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("jsxCloseTagName", text, position);
|
||||
export function jsxCloseTagName(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.jsxCloseTagName, text, position);
|
||||
}
|
||||
|
||||
export function jsxSelfClosingTagName(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("jsxSelfClosingTagName", text, position);
|
||||
export function jsxSelfClosingTagName(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.jsxSelfClosingTagName, text, position);
|
||||
}
|
||||
|
||||
export function jsxAttribute(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("jsxAttribute", text, position);
|
||||
export function jsxAttribute(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.jsxAttribute, text, position);
|
||||
}
|
||||
|
||||
export function jsxText(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("jsxText", text, position);
|
||||
export function jsxText(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.jsxText, text, position);
|
||||
}
|
||||
|
||||
export function jsxAttributeStringLiteralValue(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("jsxAttributeStringLiteralValue", text, position);
|
||||
export function jsxAttributeStringLiteralValue(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.jsxAttributeStringLiteralValue, text, position);
|
||||
}
|
||||
|
||||
function getClassification(type: string, text: string, position?: number) {
|
||||
function getClassification(classificationType: ts.ClassificationTypeNames, text: string, position?: number): Classification {
|
||||
return {
|
||||
classificationType: type,
|
||||
classificationType,
|
||||
text: text,
|
||||
textSpan: position === undefined ? undefined : { start: position, end: position + text.length }
|
||||
};
|
||||
|
|
|
@ -134,7 +134,7 @@ namespace ts.server {
|
|||
type: "request",
|
||||
arguments: {
|
||||
formatOptions: {
|
||||
indentStyle: "Block"
|
||||
indentStyle: protocol.IndentStyle.Block,
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -149,11 +149,11 @@ namespace ts.server {
|
|||
type: "request",
|
||||
arguments: {
|
||||
options: {
|
||||
module: "System",
|
||||
target: "ES5",
|
||||
jsx: "React",
|
||||
newLine: "Lf",
|
||||
moduleResolution: "Node"
|
||||
module: protocol.ModuleKind.System,
|
||||
target: protocol.ScriptTarget.ES5,
|
||||
jsx: protocol.JsxEmit.React,
|
||||
newLine: protocol.NewLineKind.Lf,
|
||||
moduleResolution: protocol.ModuleResolutionKind.Node,
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -172,12 +172,81 @@ namespace ts.server {
|
|||
});
|
||||
|
||||
describe("onMessage", () => {
|
||||
const allCommandNames: CommandNames[] = [
|
||||
CommandNames.Brace,
|
||||
CommandNames.BraceFull,
|
||||
CommandNames.BraceCompletion,
|
||||
CommandNames.Change,
|
||||
CommandNames.Close,
|
||||
CommandNames.Completions,
|
||||
CommandNames.CompletionsFull,
|
||||
CommandNames.CompletionDetails,
|
||||
CommandNames.CompileOnSaveAffectedFileList,
|
||||
CommandNames.Configure,
|
||||
CommandNames.Definition,
|
||||
CommandNames.DefinitionFull,
|
||||
CommandNames.Implementation,
|
||||
CommandNames.ImplementationFull,
|
||||
CommandNames.Exit,
|
||||
CommandNames.Format,
|
||||
CommandNames.Formatonkey,
|
||||
CommandNames.FormatFull,
|
||||
CommandNames.FormatonkeyFull,
|
||||
CommandNames.FormatRangeFull,
|
||||
CommandNames.Geterr,
|
||||
CommandNames.GeterrForProject,
|
||||
CommandNames.SemanticDiagnosticsSync,
|
||||
CommandNames.SyntacticDiagnosticsSync,
|
||||
CommandNames.NavBar,
|
||||
CommandNames.NavBarFull,
|
||||
CommandNames.Navto,
|
||||
CommandNames.NavtoFull,
|
||||
CommandNames.NavTree,
|
||||
CommandNames.NavTreeFull,
|
||||
CommandNames.Occurrences,
|
||||
CommandNames.DocumentHighlights,
|
||||
CommandNames.DocumentHighlightsFull,
|
||||
CommandNames.Open,
|
||||
CommandNames.Quickinfo,
|
||||
CommandNames.QuickinfoFull,
|
||||
CommandNames.References,
|
||||
CommandNames.ReferencesFull,
|
||||
CommandNames.Reload,
|
||||
CommandNames.Rename,
|
||||
CommandNames.RenameInfoFull,
|
||||
CommandNames.RenameLocationsFull,
|
||||
CommandNames.Saveto,
|
||||
CommandNames.SignatureHelp,
|
||||
CommandNames.SignatureHelpFull,
|
||||
CommandNames.TypeDefinition,
|
||||
CommandNames.ProjectInfo,
|
||||
CommandNames.ReloadProjects,
|
||||
CommandNames.Unknown,
|
||||
CommandNames.OpenExternalProject,
|
||||
CommandNames.CloseExternalProject,
|
||||
CommandNames.SynchronizeProjectList,
|
||||
CommandNames.ApplyChangedToOpenFiles,
|
||||
CommandNames.EncodedSemanticClassificationsFull,
|
||||
CommandNames.Cleanup,
|
||||
CommandNames.OutliningSpans,
|
||||
CommandNames.TodoComments,
|
||||
CommandNames.Indentation,
|
||||
CommandNames.DocCommentTemplate,
|
||||
CommandNames.CompilerOptionsDiagnosticsFull,
|
||||
CommandNames.NameOrDottedNameSpan,
|
||||
CommandNames.BreakpointStatement,
|
||||
CommandNames.CompilerOptionsForInferredProjects,
|
||||
CommandNames.GetCodeFixes,
|
||||
CommandNames.GetCodeFixesFull,
|
||||
CommandNames.GetSupportedCodeFixes,
|
||||
CommandNames.GetApplicableRefactors,
|
||||
CommandNames.GetRefactorCodeActions,
|
||||
CommandNames.GetRefactorCodeActionsFull,
|
||||
];
|
||||
|
||||
it("should not throw when commands are executed with invalid arguments", () => {
|
||||
let i = 0;
|
||||
for (const name in CommandNames) {
|
||||
if (!Object.prototype.hasOwnProperty.call(CommandNames, name)) {
|
||||
continue;
|
||||
}
|
||||
for (const name of allCommandNames) {
|
||||
const req: protocol.Request = {
|
||||
command: name,
|
||||
seq: i,
|
||||
|
|
|
@ -224,7 +224,7 @@ namespace ts.server {
|
|||
return { name, kind, kindModifiers, sortText, replacementSpan: convertedSpan };
|
||||
}
|
||||
|
||||
return entry as { name: string, kind: string, kindModifiers: string, sortText: string };
|
||||
return entry as { name: string, kind: ScriptElementKind, kindModifiers: string, sortText: string };
|
||||
})
|
||||
};
|
||||
}
|
||||
|
@ -265,7 +265,7 @@ namespace ts.server {
|
|||
return {
|
||||
name: entry.name,
|
||||
containerName: entry.containerName || "",
|
||||
containerKind: entry.containerKind || "",
|
||||
containerKind: entry.containerKind || ScriptElementKind.unknown,
|
||||
kind: entry.kind,
|
||||
kindModifiers: entry.kindModifiers,
|
||||
matchKind: entry.matchKind,
|
||||
|
@ -330,11 +330,11 @@ namespace ts.server {
|
|||
const start = this.lineOffsetToPosition(fileName, entry.start);
|
||||
const end = this.lineOffsetToPosition(fileName, entry.end);
|
||||
return {
|
||||
containerKind: "",
|
||||
containerKind: ScriptElementKind.unknown,
|
||||
containerName: "",
|
||||
fileName: fileName,
|
||||
textSpan: ts.createTextSpanFromBounds(start, end),
|
||||
kind: "",
|
||||
kind: ScriptElementKind.unknown,
|
||||
name: ""
|
||||
};
|
||||
});
|
||||
|
@ -356,11 +356,11 @@ namespace ts.server {
|
|||
const start = this.lineOffsetToPosition(fileName, entry.start);
|
||||
const end = this.lineOffsetToPosition(fileName, entry.end);
|
||||
return {
|
||||
containerKind: "",
|
||||
containerKind: ScriptElementKind.unknown,
|
||||
containerName: "",
|
||||
fileName: fileName,
|
||||
textSpan: ts.createTextSpanFromBounds(start, end),
|
||||
kind: "",
|
||||
kind: ScriptElementKind.unknown,
|
||||
name: ""
|
||||
};
|
||||
});
|
||||
|
|
|
@ -2,103 +2,104 @@
|
|||
* Declaration module describing the TypeScript Server protocol
|
||||
*/
|
||||
namespace ts.server.protocol {
|
||||
export namespace CommandTypes {
|
||||
export type Brace = "brace";
|
||||
// NOTE: If updating this, be sure to also update `allCommandNames` in `harness/unittests/session.ts`.
|
||||
export const enum CommandTypes {
|
||||
Brace = "brace",
|
||||
/* @internal */
|
||||
export type BraceFull = "brace-full";
|
||||
export type BraceCompletion = "braceCompletion";
|
||||
export type Change = "change";
|
||||
export type Close = "close";
|
||||
export type Completions = "completions";
|
||||
BraceFull = "brace-full",
|
||||
BraceCompletion = "braceCompletion",
|
||||
Change = "change",
|
||||
Close = "close",
|
||||
Completions = "completions",
|
||||
/* @internal */
|
||||
export type CompletionsFull = "completions-full";
|
||||
export type CompletionDetails = "completionEntryDetails";
|
||||
export type CompileOnSaveAffectedFileList = "compileOnSaveAffectedFileList";
|
||||
export type CompileOnSaveEmitFile = "compileOnSaveEmitFile";
|
||||
export type Configure = "configure";
|
||||
export type Definition = "definition";
|
||||
CompletionsFull = "completions-full",
|
||||
CompletionDetails = "completionEntryDetails",
|
||||
CompileOnSaveAffectedFileList = "compileOnSaveAffectedFileList",
|
||||
CompileOnSaveEmitFile = "compileOnSaveEmitFile",
|
||||
Configure = "configure",
|
||||
Definition = "definition",
|
||||
/* @internal */
|
||||
export type DefinitionFull = "definition-full";
|
||||
export type Implementation = "implementation";
|
||||
DefinitionFull = "definition-full",
|
||||
Implementation = "implementation",
|
||||
/* @internal */
|
||||
export type ImplementationFull = "implementation-full";
|
||||
export type Exit = "exit";
|
||||
export type Format = "format";
|
||||
export type Formatonkey = "formatonkey";
|
||||
ImplementationFull = "implementation-full",
|
||||
Exit = "exit",
|
||||
Format = "format",
|
||||
Formatonkey = "formatonkey",
|
||||
/* @internal */
|
||||
export type FormatFull = "format-full";
|
||||
FormatFull = "format-full",
|
||||
/* @internal */
|
||||
export type FormatonkeyFull = "formatonkey-full";
|
||||
FormatonkeyFull = "formatonkey-full",
|
||||
/* @internal */
|
||||
export type FormatRangeFull = "formatRange-full";
|
||||
export type Geterr = "geterr";
|
||||
export type GeterrForProject = "geterrForProject";
|
||||
export type SemanticDiagnosticsSync = "semanticDiagnosticsSync";
|
||||
export type SyntacticDiagnosticsSync = "syntacticDiagnosticsSync";
|
||||
export type NavBar = "navbar";
|
||||
FormatRangeFull = "formatRange-full",
|
||||
Geterr = "geterr",
|
||||
GeterrForProject = "geterrForProject",
|
||||
SemanticDiagnosticsSync = "semanticDiagnosticsSync",
|
||||
SyntacticDiagnosticsSync = "syntacticDiagnosticsSync",
|
||||
NavBar = "navbar",
|
||||
/* @internal */
|
||||
export type NavBarFull = "navbar-full";
|
||||
export type Navto = "navto";
|
||||
NavBarFull = "navbar-full",
|
||||
Navto = "navto",
|
||||
/* @internal */
|
||||
export type NavtoFull = "navto-full";
|
||||
export type NavTree = "navtree";
|
||||
export type NavTreeFull = "navtree-full";
|
||||
export type Occurrences = "occurrences";
|
||||
export type DocumentHighlights = "documentHighlights";
|
||||
NavtoFull = "navto-full",
|
||||
NavTree = "navtree",
|
||||
NavTreeFull = "navtree-full",
|
||||
Occurrences = "occurrences",
|
||||
DocumentHighlights = "documentHighlights",
|
||||
/* @internal */
|
||||
export type DocumentHighlightsFull = "documentHighlights-full";
|
||||
export type Open = "open";
|
||||
export type Quickinfo = "quickinfo";
|
||||
DocumentHighlightsFull = "documentHighlights-full",
|
||||
Open = "open",
|
||||
Quickinfo = "quickinfo",
|
||||
/* @internal */
|
||||
export type QuickinfoFull = "quickinfo-full";
|
||||
export type References = "references";
|
||||
QuickinfoFull = "quickinfo-full",
|
||||
References = "references",
|
||||
/* @internal */
|
||||
export type ReferencesFull = "references-full";
|
||||
export type Reload = "reload";
|
||||
export type Rename = "rename";
|
||||
ReferencesFull = "references-full",
|
||||
Reload = "reload",
|
||||
Rename = "rename",
|
||||
/* @internal */
|
||||
export type RenameInfoFull = "rename-full";
|
||||
RenameInfoFull = "rename-full",
|
||||
/* @internal */
|
||||
export type RenameLocationsFull = "renameLocations-full";
|
||||
export type Saveto = "saveto";
|
||||
export type SignatureHelp = "signatureHelp";
|
||||
RenameLocationsFull = "renameLocations-full",
|
||||
Saveto = "saveto",
|
||||
SignatureHelp = "signatureHelp",
|
||||
/* @internal */
|
||||
export type SignatureHelpFull = "signatureHelp-full";
|
||||
export type TypeDefinition = "typeDefinition";
|
||||
export type ProjectInfo = "projectInfo";
|
||||
export type ReloadProjects = "reloadProjects";
|
||||
export type Unknown = "unknown";
|
||||
export type OpenExternalProject = "openExternalProject";
|
||||
export type OpenExternalProjects = "openExternalProjects";
|
||||
export type CloseExternalProject = "closeExternalProject";
|
||||
SignatureHelpFull = "signatureHelp-full",
|
||||
TypeDefinition = "typeDefinition",
|
||||
ProjectInfo = "projectInfo",
|
||||
ReloadProjects = "reloadProjects",
|
||||
Unknown = "unknown",
|
||||
OpenExternalProject = "openExternalProject",
|
||||
OpenExternalProjects = "openExternalProjects",
|
||||
CloseExternalProject = "closeExternalProject",
|
||||
/* @internal */
|
||||
export type SynchronizeProjectList = "synchronizeProjectList";
|
||||
SynchronizeProjectList = "synchronizeProjectList",
|
||||
/* @internal */
|
||||
export type ApplyChangedToOpenFiles = "applyChangedToOpenFiles";
|
||||
ApplyChangedToOpenFiles = "applyChangedToOpenFiles",
|
||||
/* @internal */
|
||||
export type EncodedSemanticClassificationsFull = "encodedSemanticClassifications-full";
|
||||
EncodedSemanticClassificationsFull = "encodedSemanticClassifications-full",
|
||||
/* @internal */
|
||||
export type Cleanup = "cleanup";
|
||||
Cleanup = "cleanup",
|
||||
/* @internal */
|
||||
export type OutliningSpans = "outliningSpans";
|
||||
export type TodoComments = "todoComments";
|
||||
export type Indentation = "indentation";
|
||||
export type DocCommentTemplate = "docCommentTemplate";
|
||||
OutliningSpans = "outliningSpans",
|
||||
TodoComments = "todoComments",
|
||||
Indentation = "indentation",
|
||||
DocCommentTemplate = "docCommentTemplate",
|
||||
/* @internal */
|
||||
export type CompilerOptionsDiagnosticsFull = "compilerOptionsDiagnostics-full";
|
||||
CompilerOptionsDiagnosticsFull = "compilerOptionsDiagnostics-full",
|
||||
/* @internal */
|
||||
export type NameOrDottedNameSpan = "nameOrDottedNameSpan";
|
||||
NameOrDottedNameSpan = "nameOrDottedNameSpan",
|
||||
/* @internal */
|
||||
export type BreakpointStatement = "breakpointStatement";
|
||||
export type CompilerOptionsForInferredProjects = "compilerOptionsForInferredProjects";
|
||||
export type GetCodeFixes = "getCodeFixes";
|
||||
BreakpointStatement = "breakpointStatement",
|
||||
CompilerOptionsForInferredProjects = "compilerOptionsForInferredProjects",
|
||||
GetCodeFixes = "getCodeFixes",
|
||||
/* @internal */
|
||||
export type GetCodeFixesFull = "getCodeFixes-full";
|
||||
export type GetSupportedCodeFixes = "getSupportedCodeFixes";
|
||||
GetCodeFixesFull = "getCodeFixes-full",
|
||||
GetSupportedCodeFixes = "getSupportedCodeFixes",
|
||||
|
||||
export type GetApplicableRefactors = "getApplicableRefactors";
|
||||
export type GetRefactorCodeActions = "getRefactorCodeActions";
|
||||
export type GetRefactorCodeActionsFull = "getRefactorCodeActions-full";
|
||||
GetApplicableRefactors = "getApplicableRefactors",
|
||||
GetRefactorCodeActions = "getRefactorCodeActions",
|
||||
GetRefactorCodeActionsFull = "getRefactorCodeActions-full",
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -698,10 +699,9 @@ namespace ts.server.protocol {
|
|||
|
||||
/**
|
||||
* Span augmented with extra information that denotes the kind of the highlighting to be used for span.
|
||||
* Kind is taken from HighlightSpanKind type.
|
||||
*/
|
||||
export interface HighlightSpan extends TextSpan {
|
||||
kind: string;
|
||||
kind: HighlightSpanKind;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -838,7 +838,7 @@ namespace ts.server.protocol {
|
|||
/**
|
||||
* The items's kind (such as 'className' or 'parameterName' or plain 'text').
|
||||
*/
|
||||
kind: string;
|
||||
kind: ScriptElementKind;
|
||||
|
||||
/**
|
||||
* Optional modifiers for the kind (such as 'public').
|
||||
|
@ -1352,7 +1352,7 @@ namespace ts.server.protocol {
|
|||
/**
|
||||
* The symbol's kind (such as 'className' or 'parameterName' or plain 'text').
|
||||
*/
|
||||
kind: string;
|
||||
kind: ScriptElementKind;
|
||||
|
||||
/**
|
||||
* Optional modifiers for the kind (such as 'public').
|
||||
|
@ -1571,7 +1571,7 @@ namespace ts.server.protocol {
|
|||
/**
|
||||
* The symbol's kind (such as 'className' or 'parameterName').
|
||||
*/
|
||||
kind: string;
|
||||
kind: ScriptElementKind;
|
||||
/**
|
||||
* Optional modifiers for the kind (such as 'public').
|
||||
*/
|
||||
|
@ -1599,7 +1599,7 @@ namespace ts.server.protocol {
|
|||
/**
|
||||
* The symbol's kind (such as 'className' or 'parameterName').
|
||||
*/
|
||||
kind: string;
|
||||
kind: ScriptElementKind;
|
||||
/**
|
||||
* Optional modifiers for the kind (such as 'public').
|
||||
*/
|
||||
|
@ -2058,7 +2058,7 @@ namespace ts.server.protocol {
|
|||
/**
|
||||
* The symbol's kind (such as 'className' or 'parameterName').
|
||||
*/
|
||||
kind: string;
|
||||
kind: ScriptElementKind;
|
||||
|
||||
/**
|
||||
* exact, substring, or prefix.
|
||||
|
@ -2099,7 +2099,7 @@ namespace ts.server.protocol {
|
|||
/**
|
||||
* Kind of symbol's container symbol (if any).
|
||||
*/
|
||||
containerKind?: string;
|
||||
containerKind?: ScriptElementKind;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2172,7 +2172,7 @@ namespace ts.server.protocol {
|
|||
/**
|
||||
* The symbol's kind (such as 'className' or 'parameterName').
|
||||
*/
|
||||
kind: string;
|
||||
kind: ScriptElementKind;
|
||||
|
||||
/**
|
||||
* Optional modifiers for the kind (such as 'public').
|
||||
|
@ -2198,7 +2198,7 @@ namespace ts.server.protocol {
|
|||
/** protocol.NavigationTree is identical to ts.NavigationTree, except using protocol.TextSpan instead of ts.TextSpan */
|
||||
export interface NavigationTree {
|
||||
text: string;
|
||||
kind: string;
|
||||
kind: ScriptElementKind;
|
||||
kindModifiers: string;
|
||||
spans: TextSpan[];
|
||||
childItems?: NavigationTree[];
|
||||
|
@ -2292,14 +2292,12 @@ namespace ts.server.protocol {
|
|||
body?: NavigationTree;
|
||||
}
|
||||
|
||||
export namespace IndentStyle {
|
||||
export type None = "None";
|
||||
export type Block = "Block";
|
||||
export type Smart = "Smart";
|
||||
export const enum IndentStyle {
|
||||
None = "None",
|
||||
Block = "Block",
|
||||
Smart = "Smart",
|
||||
}
|
||||
|
||||
export type IndentStyle = IndentStyle.None | IndentStyle.Block | IndentStyle.Smart;
|
||||
|
||||
export interface EditorSettings {
|
||||
baseIndentSize?: number;
|
||||
indentSize?: number;
|
||||
|
@ -2396,47 +2394,37 @@ namespace ts.server.protocol {
|
|||
[option: string]: CompilerOptionsValue | undefined;
|
||||
}
|
||||
|
||||
export namespace JsxEmit {
|
||||
export type None = "None";
|
||||
export type Preserve = "Preserve";
|
||||
export type ReactNative = "ReactNative";
|
||||
export type React = "React";
|
||||
export const enum JsxEmit {
|
||||
None = "None",
|
||||
Preserve = "Preserve",
|
||||
ReactNative = "ReactNative",
|
||||
React = "React",
|
||||
}
|
||||
|
||||
export type JsxEmit = JsxEmit.None | JsxEmit.Preserve | JsxEmit.React | JsxEmit.ReactNative;
|
||||
|
||||
export namespace ModuleKind {
|
||||
export type None = "None";
|
||||
export type CommonJS = "CommonJS";
|
||||
export type AMD = "AMD";
|
||||
export type UMD = "UMD";
|
||||
export type System = "System";
|
||||
export type ES6 = "ES6";
|
||||
export type ES2015 = "ES2015";
|
||||
export const enum ModuleKind {
|
||||
None = "None",
|
||||
CommonJS = "CommonJS",
|
||||
AMD = "AMD",
|
||||
UMD = "UMD",
|
||||
System = "System",
|
||||
ES6 = "ES6",
|
||||
ES2015 = "ES2015",
|
||||
}
|
||||
|
||||
export type ModuleKind = ModuleKind.None | ModuleKind.CommonJS | ModuleKind.AMD | ModuleKind.UMD | ModuleKind.System | ModuleKind.ES6 | ModuleKind.ES2015;
|
||||
|
||||
export namespace ModuleResolutionKind {
|
||||
export type Classic = "Classic";
|
||||
export type Node = "Node";
|
||||
export const enum ModuleResolutionKind {
|
||||
Classic = "Classic",
|
||||
Node = "Node",
|
||||
}
|
||||
|
||||
export type ModuleResolutionKind = ModuleResolutionKind.Classic | ModuleResolutionKind.Node;
|
||||
|
||||
export namespace NewLineKind {
|
||||
export type Crlf = "Crlf";
|
||||
export type Lf = "Lf";
|
||||
export const enum NewLineKind {
|
||||
Crlf = "Crlf",
|
||||
Lf = "Lf",
|
||||
}
|
||||
|
||||
export type NewLineKind = NewLineKind.Crlf | NewLineKind.Lf;
|
||||
|
||||
export namespace ScriptTarget {
|
||||
export type ES3 = "ES3";
|
||||
export type ES5 = "ES5";
|
||||
export type ES6 = "ES6";
|
||||
export type ES2015 = "ES2015";
|
||||
export const enum ScriptTarget {
|
||||
ES3 = "ES3",
|
||||
ES5 = "ES5",
|
||||
ES6 = "ES6",
|
||||
ES2015 = "ES2015",
|
||||
}
|
||||
|
||||
export type ScriptTarget = ScriptTarget.ES3 | ScriptTarget.ES5 | ScriptTarget.ES6 | ScriptTarget.ES2015;
|
||||
}
|
||||
|
|
|
@ -112,104 +112,7 @@ namespace ts.server {
|
|||
return true;
|
||||
}
|
||||
|
||||
export namespace CommandNames {
|
||||
export const Brace: protocol.CommandTypes.Brace = "brace";
|
||||
/* @internal */
|
||||
export const BraceFull: protocol.CommandTypes.BraceFull = "brace-full";
|
||||
export const BraceCompletion: protocol.CommandTypes.BraceCompletion = "braceCompletion";
|
||||
export const Change: protocol.CommandTypes.Change = "change";
|
||||
export const Close: protocol.CommandTypes.Close = "close";
|
||||
export const Completions: protocol.CommandTypes.Completions = "completions";
|
||||
/* @internal */
|
||||
export const CompletionsFull: protocol.CommandTypes.CompletionsFull = "completions-full";
|
||||
export const CompletionDetails: protocol.CommandTypes.CompletionDetails = "completionEntryDetails";
|
||||
export const CompileOnSaveAffectedFileList: protocol.CommandTypes.CompileOnSaveAffectedFileList = "compileOnSaveAffectedFileList";
|
||||
export const CompileOnSaveEmitFile: protocol.CommandTypes.CompileOnSaveEmitFile = "compileOnSaveEmitFile";
|
||||
export const Configure: protocol.CommandTypes.Configure = "configure";
|
||||
export const Definition: protocol.CommandTypes.Definition = "definition";
|
||||
/* @internal */
|
||||
export const DefinitionFull: protocol.CommandTypes.DefinitionFull = "definition-full";
|
||||
export const Exit: protocol.CommandTypes.Exit = "exit";
|
||||
export const Format: protocol.CommandTypes.Format = "format";
|
||||
export const Formatonkey: protocol.CommandTypes.Formatonkey = "formatonkey";
|
||||
/* @internal */
|
||||
export const FormatFull: protocol.CommandTypes.FormatFull = "format-full";
|
||||
/* @internal */
|
||||
export const FormatonkeyFull: protocol.CommandTypes.FormatonkeyFull = "formatonkey-full";
|
||||
/* @internal */
|
||||
export const FormatRangeFull: protocol.CommandTypes.FormatRangeFull = "formatRange-full";
|
||||
export const Geterr: protocol.CommandTypes.Geterr = "geterr";
|
||||
export const GeterrForProject: protocol.CommandTypes.GeterrForProject = "geterrForProject";
|
||||
export const Implementation: protocol.CommandTypes.Implementation = "implementation";
|
||||
/* @internal */
|
||||
export const ImplementationFull: protocol.CommandTypes.ImplementationFull = "implementation-full";
|
||||
export const SemanticDiagnosticsSync: protocol.CommandTypes.SemanticDiagnosticsSync = "semanticDiagnosticsSync";
|
||||
export const SyntacticDiagnosticsSync: protocol.CommandTypes.SyntacticDiagnosticsSync = "syntacticDiagnosticsSync";
|
||||
export const NavBar: protocol.CommandTypes.NavBar = "navbar";
|
||||
/* @internal */
|
||||
export const NavBarFull: protocol.CommandTypes.NavBarFull = "navbar-full";
|
||||
export const NavTree: protocol.CommandTypes.NavTree = "navtree";
|
||||
export const NavTreeFull: protocol.CommandTypes.NavTreeFull = "navtree-full";
|
||||
export const Navto: protocol.CommandTypes.Navto = "navto";
|
||||
/* @internal */
|
||||
export const NavtoFull: protocol.CommandTypes.NavtoFull = "navto-full";
|
||||
export const Occurrences: protocol.CommandTypes.Occurrences = "occurrences";
|
||||
export const DocumentHighlights: protocol.CommandTypes.DocumentHighlights = "documentHighlights";
|
||||
/* @internal */
|
||||
export const DocumentHighlightsFull: protocol.CommandTypes.DocumentHighlightsFull = "documentHighlights-full";
|
||||
export const Open: protocol.CommandTypes.Open = "open";
|
||||
export const Quickinfo: protocol.CommandTypes.Quickinfo = "quickinfo";
|
||||
/* @internal */
|
||||
export const QuickinfoFull: protocol.CommandTypes.QuickinfoFull = "quickinfo-full";
|
||||
export const References: protocol.CommandTypes.References = "references";
|
||||
/* @internal */
|
||||
export const ReferencesFull: protocol.CommandTypes.ReferencesFull = "references-full";
|
||||
export const Reload: protocol.CommandTypes.Reload = "reload";
|
||||
export const Rename: protocol.CommandTypes.Rename = "rename";
|
||||
/* @internal */
|
||||
export const RenameInfoFull: protocol.CommandTypes.RenameInfoFull = "rename-full";
|
||||
/* @internal */
|
||||
export const RenameLocationsFull: protocol.CommandTypes.RenameLocationsFull = "renameLocations-full";
|
||||
export const Saveto: protocol.CommandTypes.Saveto = "saveto";
|
||||
export const SignatureHelp: protocol.CommandTypes.SignatureHelp = "signatureHelp";
|
||||
/* @internal */
|
||||
export const SignatureHelpFull: protocol.CommandTypes.SignatureHelpFull = "signatureHelp-full";
|
||||
export const TypeDefinition: protocol.CommandTypes.TypeDefinition = "typeDefinition";
|
||||
export const ProjectInfo: protocol.CommandTypes.ProjectInfo = "projectInfo";
|
||||
export const ReloadProjects: protocol.CommandTypes.ReloadProjects = "reloadProjects";
|
||||
export const Unknown: protocol.CommandTypes.Unknown = "unknown";
|
||||
export const OpenExternalProject: protocol.CommandTypes.OpenExternalProject = "openExternalProject";
|
||||
export const OpenExternalProjects: protocol.CommandTypes.OpenExternalProjects = "openExternalProjects";
|
||||
export const CloseExternalProject: protocol.CommandTypes.CloseExternalProject = "closeExternalProject";
|
||||
/* @internal */
|
||||
export const SynchronizeProjectList: protocol.CommandTypes.SynchronizeProjectList = "synchronizeProjectList";
|
||||
/* @internal */
|
||||
export const ApplyChangedToOpenFiles: protocol.CommandTypes.ApplyChangedToOpenFiles = "applyChangedToOpenFiles";
|
||||
/* @internal */
|
||||
export const EncodedSemanticClassificationsFull: protocol.CommandTypes.EncodedSemanticClassificationsFull = "encodedSemanticClassifications-full";
|
||||
/* @internal */
|
||||
export const Cleanup: protocol.CommandTypes.Cleanup = "cleanup";
|
||||
/* @internal */
|
||||
export const OutliningSpans: protocol.CommandTypes.OutliningSpans = "outliningSpans";
|
||||
export const TodoComments: protocol.CommandTypes.TodoComments = "todoComments";
|
||||
export const Indentation: protocol.CommandTypes.Indentation = "indentation";
|
||||
export const DocCommentTemplate: protocol.CommandTypes.DocCommentTemplate = "docCommentTemplate";
|
||||
/* @internal */
|
||||
export const CompilerOptionsDiagnosticsFull: protocol.CommandTypes.CompilerOptionsDiagnosticsFull = "compilerOptionsDiagnostics-full";
|
||||
/* @internal */
|
||||
export const NameOrDottedNameSpan: protocol.CommandTypes.NameOrDottedNameSpan = "nameOrDottedNameSpan";
|
||||
/* @internal */
|
||||
export const BreakpointStatement: protocol.CommandTypes.BreakpointStatement = "breakpointStatement";
|
||||
export const CompilerOptionsForInferredProjects: protocol.CommandTypes.CompilerOptionsForInferredProjects = "compilerOptionsForInferredProjects";
|
||||
export const GetCodeFixes: protocol.CommandTypes.GetCodeFixes = "getCodeFixes";
|
||||
/* @internal */
|
||||
export const GetCodeFixesFull: protocol.CommandTypes.GetCodeFixesFull = "getCodeFixes-full";
|
||||
export const GetSupportedCodeFixes: protocol.CommandTypes.GetSupportedCodeFixes = "getSupportedCodeFixes";
|
||||
|
||||
export const GetApplicableRefactors: protocol.CommandTypes.GetApplicableRefactors = "getApplicableRefactors";
|
||||
export const GetRefactorCodeActions: protocol.CommandTypes.GetRefactorCodeActions = "getRefactorCodeActions";
|
||||
export const GetRefactorCodeActionsFull: protocol.CommandTypes.GetRefactorCodeActionsFull = "getRefactorCodeActions-full";
|
||||
}
|
||||
export import CommandNames = protocol.CommandTypes;
|
||||
|
||||
export function formatMessage<T extends protocol.Message>(msg: T, logger: server.Logger, byteLength: (s: string, encoding: string) => number, newLine: string): string {
|
||||
const verboseLogging = logger.hasLevel(LogLevel.verbose);
|
||||
|
|
|
@ -573,7 +573,7 @@ namespace ts {
|
|||
}
|
||||
}
|
||||
|
||||
function getClassificationTypeName(type: ClassificationType) {
|
||||
function getClassificationTypeName(type: ClassificationType): ClassificationTypeNames {
|
||||
switch (type) {
|
||||
case ClassificationType.comment: return ClassificationTypeNames.comment;
|
||||
case ClassificationType.identifier: return ClassificationTypeNames.identifier;
|
||||
|
|
|
@ -150,7 +150,7 @@ namespace ts.FindAllReferences {
|
|||
const { node, name, kind, displayParts } = info;
|
||||
const sourceFile = node.getSourceFile();
|
||||
return {
|
||||
containerKind: "",
|
||||
containerKind: ScriptElementKind.unknown,
|
||||
containerName: "",
|
||||
fileName: sourceFile.fileName,
|
||||
kind,
|
||||
|
@ -160,7 +160,7 @@ namespace ts.FindAllReferences {
|
|||
};
|
||||
}
|
||||
|
||||
function getDefinitionKindAndDisplayParts(symbol: Symbol, node: Node, checker: TypeChecker): { displayParts: SymbolDisplayPart[], kind: string } {
|
||||
function getDefinitionKindAndDisplayParts(symbol: Symbol, node: Node, checker: TypeChecker): { displayParts: SymbolDisplayPart[], kind: ScriptElementKind } {
|
||||
const { displayParts, symbolKind } =
|
||||
SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(checker, symbol, node.getSourceFile(), getContainerNode(node), node);
|
||||
return { displayParts, kind: symbolKind };
|
||||
|
@ -191,7 +191,7 @@ namespace ts.FindAllReferences {
|
|||
}
|
||||
}
|
||||
|
||||
function implementationKindDisplayParts(node: ts.Node, checker: ts.TypeChecker): { kind: string, displayParts: SymbolDisplayPart[] } {
|
||||
function implementationKindDisplayParts(node: ts.Node, checker: ts.TypeChecker): { kind: ScriptElementKind, displayParts: SymbolDisplayPart[] } {
|
||||
const symbol = checker.getSymbolAtLocation(isDeclaration(node) && node.name ? node.name : node);
|
||||
if (symbol) {
|
||||
return getDefinitionKindAndDisplayParts(symbol, node, checker);
|
||||
|
|
|
@ -165,7 +165,7 @@ namespace ts.GoToDefinition {
|
|||
|
||||
return result;
|
||||
|
||||
function tryAddConstructSignature(symbol: Symbol, location: Node, symbolKind: string, symbolName: string, containerName: string, result: DefinitionInfo[]) {
|
||||
function tryAddConstructSignature(symbol: Symbol, location: Node, symbolKind: ScriptElementKind, symbolName: string, containerName: string, result: DefinitionInfo[]) {
|
||||
// Applicable only if we are in a new expression, or we are on a constructor declaration
|
||||
// and in either case the symbol has a construct signature definition, i.e. class
|
||||
if (isNewExpressionTarget(location) || location.kind === SyntaxKind.ConstructorKeyword) {
|
||||
|
@ -173,12 +173,8 @@ namespace ts.GoToDefinition {
|
|||
// Find the first class-like declaration and try to get the construct signature.
|
||||
for (const declaration of symbol.getDeclarations()) {
|
||||
if (isClassLike(declaration)) {
|
||||
return tryAddSignature(declaration.members,
|
||||
/*selectConstructors*/ true,
|
||||
symbolKind,
|
||||
symbolName,
|
||||
containerName,
|
||||
result);
|
||||
return tryAddSignature(
|
||||
declaration.members, /*selectConstructors*/ true, symbolKind, symbolName, containerName, result);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -188,14 +184,14 @@ namespace ts.GoToDefinition {
|
|||
return false;
|
||||
}
|
||||
|
||||
function tryAddCallSignature(symbol: Symbol, location: Node, symbolKind: string, symbolName: string, containerName: string, result: DefinitionInfo[]) {
|
||||
function tryAddCallSignature(symbol: Symbol, location: Node, symbolKind: ScriptElementKind, symbolName: string, containerName: string, result: DefinitionInfo[]) {
|
||||
if (isCallExpressionTarget(location) || isNewExpressionTarget(location) || isNameOfFunctionDeclaration(location)) {
|
||||
return tryAddSignature(symbol.declarations, /*selectConstructors*/ false, symbolKind, symbolName, containerName, result);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function tryAddSignature(signatureDeclarations: Declaration[] | undefined, selectConstructors: boolean, symbolKind: string, symbolName: string, containerName: string, result: DefinitionInfo[]) {
|
||||
function tryAddSignature(signatureDeclarations: Declaration[] | undefined, selectConstructors: boolean, symbolKind: ScriptElementKind, symbolName: string, containerName: string, result: DefinitionInfo[]) {
|
||||
if (!signatureDeclarations) {
|
||||
return false;
|
||||
}
|
||||
|
@ -231,12 +227,12 @@ namespace ts.GoToDefinition {
|
|||
}
|
||||
|
||||
/** Creates a DefinitionInfo from a Declaration, using the declaration's name if possible. */
|
||||
function createDefinitionInfo(node: Declaration, symbolKind: string, symbolName: string, containerName: string): DefinitionInfo {
|
||||
function createDefinitionInfo(node: Declaration, symbolKind: ScriptElementKind, symbolName: string, containerName: string): DefinitionInfo {
|
||||
return createDefinitionInfoFromName(getNameOfDeclaration(node) || node, symbolKind, symbolName, containerName);
|
||||
}
|
||||
|
||||
/** Creates a DefinitionInfo directly from the name of a declaration. */
|
||||
function createDefinitionInfoFromName(name: Node, symbolKind: string, symbolName: string, containerName: string): DefinitionInfo {
|
||||
function createDefinitionInfoFromName(name: Node, symbolKind: ScriptElementKind, symbolName: string, containerName: string): DefinitionInfo {
|
||||
const sourceFile = name.getSourceFile();
|
||||
return {
|
||||
fileName: sourceFile.fileName,
|
||||
|
|
|
@ -205,7 +205,7 @@ namespace ts.NavigateTo {
|
|||
textSpan: createTextSpanFromNode(declaration),
|
||||
// TODO(jfreeman): What should be the containerName when the container has a computed name?
|
||||
containerName: containerName ? (<Identifier>containerName).text : "",
|
||||
containerKind: containerName ? getNodeKind(container) : ""
|
||||
containerKind: containerName ? getNodeKind(container) : ScriptElementKind.unknown
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -455,7 +455,7 @@ namespace ts.Completions.PathCompletions {
|
|||
}
|
||||
}
|
||||
|
||||
function createCompletionEntryForModule(name: string, kind: string, replacementSpan: TextSpan): CompletionEntry {
|
||||
function createCompletionEntryForModule(name: string, kind: ScriptElementKind, replacementSpan: TextSpan): CompletionEntry {
|
||||
return { name, kind, kindModifiers: ScriptElementKindModifier.none, sortText: name, replacementSpan };
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ namespace ts.Rename {
|
|||
}
|
||||
}
|
||||
|
||||
function getRenameInfoSuccess(displayName: string, fullDisplayName: string, kind: string, kindModifiers: string, node: Node, sourceFile: SourceFile): RenameInfo {
|
||||
function getRenameInfoSuccess(displayName: string, fullDisplayName: string, kind: ScriptElementKind, kindModifiers: string, node: Node, sourceFile: SourceFile): RenameInfo {
|
||||
return {
|
||||
canRename: true,
|
||||
kind,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* @internal */
|
||||
namespace ts.SymbolDisplay {
|
||||
// TODO(drosen): use contextual SemanticMeaning.
|
||||
export function getSymbolKind(typeChecker: TypeChecker, symbol: Symbol, location: Node): string {
|
||||
export function getSymbolKind(typeChecker: TypeChecker, symbol: Symbol, location: Node): ScriptElementKind {
|
||||
const { flags } = symbol;
|
||||
|
||||
if (flags & SymbolFlags.Class) return getDeclarationOfKind(symbol, SyntaxKind.ClassExpression) ?
|
||||
|
@ -22,7 +22,7 @@ namespace ts.SymbolDisplay {
|
|||
return result;
|
||||
}
|
||||
|
||||
function getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker: TypeChecker, symbol: Symbol, location: Node) {
|
||||
function getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker: TypeChecker, symbol: Symbol, location: Node): ScriptElementKind {
|
||||
if (typeChecker.isUndefinedSymbol(symbol)) {
|
||||
return ScriptElementKind.variableElement;
|
||||
}
|
||||
|
|
|
@ -286,7 +286,7 @@ namespace ts {
|
|||
|
||||
export interface ClassifiedSpan {
|
||||
textSpan: TextSpan;
|
||||
classificationType: string; // ClassificationTypeNames
|
||||
classificationType: ClassificationTypeNames;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -297,7 +297,7 @@ namespace ts {
|
|||
*/
|
||||
export interface NavigationBarItem {
|
||||
text: string;
|
||||
kind: string;
|
||||
kind: ScriptElementKind;
|
||||
kindModifiers: string;
|
||||
spans: TextSpan[];
|
||||
childItems: NavigationBarItem[];
|
||||
|
@ -313,8 +313,7 @@ namespace ts {
|
|||
export interface NavigationTree {
|
||||
/** Name of the declaration, or a short description, e.g. "<class>". */
|
||||
text: string;
|
||||
/** A ScriptElementKind */
|
||||
kind: string;
|
||||
kind: ScriptElementKind;
|
||||
/** ScriptElementKindModifier separated by commas, e.g. "public,abstract" */
|
||||
kindModifiers: string;
|
||||
/**
|
||||
|
@ -380,7 +379,7 @@ namespace ts {
|
|||
}
|
||||
|
||||
export interface ImplementationLocation extends DocumentSpan {
|
||||
kind: string;
|
||||
kind: ScriptElementKind;
|
||||
displayParts: SymbolDisplayPart[];
|
||||
}
|
||||
|
||||
|
@ -389,30 +388,30 @@ namespace ts {
|
|||
highlightSpans: HighlightSpan[];
|
||||
}
|
||||
|
||||
export namespace HighlightSpanKind {
|
||||
export const none = "none";
|
||||
export const definition = "definition";
|
||||
export const reference = "reference";
|
||||
export const writtenReference = "writtenReference";
|
||||
export const enum HighlightSpanKind {
|
||||
none = "none",
|
||||
definition = "definition",
|
||||
reference = "reference",
|
||||
writtenReference = "writtenReference",
|
||||
}
|
||||
|
||||
export interface HighlightSpan {
|
||||
fileName?: string;
|
||||
isInString?: true;
|
||||
textSpan: TextSpan;
|
||||
kind: string;
|
||||
kind: HighlightSpanKind;
|
||||
}
|
||||
|
||||
export interface NavigateToItem {
|
||||
name: string;
|
||||
kind: string;
|
||||
kind: ScriptElementKind;
|
||||
kindModifiers: string;
|
||||
matchKind: string;
|
||||
matchKind: string; // TODO: keyof typeof PatternMatchKind; (https://github.com/Microsoft/TypeScript/issues/15102)
|
||||
isCaseSensitive: boolean;
|
||||
fileName: string;
|
||||
textSpan: TextSpan;
|
||||
containerName: string;
|
||||
containerKind: string;
|
||||
containerKind: ScriptElementKind;
|
||||
}
|
||||
|
||||
export enum IndentStyle {
|
||||
|
@ -480,9 +479,9 @@ namespace ts {
|
|||
export interface DefinitionInfo {
|
||||
fileName: string;
|
||||
textSpan: TextSpan;
|
||||
kind: string;
|
||||
kind: ScriptElementKind;
|
||||
name: string;
|
||||
containerKind: string;
|
||||
containerKind: ScriptElementKind;
|
||||
containerName: string;
|
||||
}
|
||||
|
||||
|
@ -522,7 +521,7 @@ namespace ts {
|
|||
|
||||
export interface SymbolDisplayPart {
|
||||
text: string;
|
||||
kind: string; // A ScriptElementKind
|
||||
kind: string;
|
||||
}
|
||||
|
||||
export interface JSDocTagInfo {
|
||||
|
@ -531,7 +530,7 @@ namespace ts {
|
|||
}
|
||||
|
||||
export interface QuickInfo {
|
||||
kind: string;
|
||||
kind: ScriptElementKind;
|
||||
kindModifiers: string;
|
||||
textSpan: TextSpan;
|
||||
displayParts: SymbolDisplayPart[];
|
||||
|
@ -544,7 +543,7 @@ namespace ts {
|
|||
localizedErrorMessage: string;
|
||||
displayName: string;
|
||||
fullDisplayName: string;
|
||||
kind: string;
|
||||
kind: ScriptElementKind;
|
||||
kindModifiers: string;
|
||||
triggerSpan: TextSpan;
|
||||
}
|
||||
|
@ -597,7 +596,7 @@ namespace ts {
|
|||
|
||||
export interface CompletionEntry {
|
||||
name: string;
|
||||
kind: string; // see ScriptElementKind
|
||||
kind: ScriptElementKind;
|
||||
kindModifiers: string; // see ScriptElementKindModifier, comma separated
|
||||
sortText: string;
|
||||
/**
|
||||
|
@ -610,7 +609,7 @@ namespace ts {
|
|||
|
||||
export interface CompletionEntryDetails {
|
||||
name: string;
|
||||
kind: string; // see ScriptElementKind
|
||||
kind: ScriptElementKind;
|
||||
kindModifiers: string; // see ScriptElementKindModifier, comma separated
|
||||
displayParts: SymbolDisplayPart[];
|
||||
documentation: SymbolDisplayPart[];
|
||||
|
@ -708,141 +707,140 @@ namespace ts {
|
|||
getEncodedLexicalClassifications(text: string, endOfLineState: EndOfLineState, syntacticClassifierAbsent: boolean): Classifications;
|
||||
}
|
||||
|
||||
// TODO: move these to enums
|
||||
export namespace ScriptElementKind {
|
||||
export const unknown = "";
|
||||
export const warning = "warning";
|
||||
export const enum ScriptElementKind {
|
||||
unknown = "",
|
||||
warning = "warning",
|
||||
|
||||
/** predefined type (void) or keyword (class) */
|
||||
export const keyword = "keyword";
|
||||
keyword = "keyword",
|
||||
|
||||
/** top level script node */
|
||||
export const scriptElement = "script";
|
||||
scriptElement = "script",
|
||||
|
||||
/** module foo {} */
|
||||
export const moduleElement = "module";
|
||||
moduleElement = "module",
|
||||
|
||||
/** class X {} */
|
||||
export const classElement = "class";
|
||||
classElement = "class",
|
||||
|
||||
/** var x = class X {} */
|
||||
export const localClassElement = "local class";
|
||||
localClassElement = "local class",
|
||||
|
||||
/** interface Y {} */
|
||||
export const interfaceElement = "interface";
|
||||
interfaceElement = "interface",
|
||||
|
||||
/** type T = ... */
|
||||
export const typeElement = "type";
|
||||
typeElement = "type",
|
||||
|
||||
/** enum E */
|
||||
export const enumElement = "enum";
|
||||
export const enumMemberElement = "enum member";
|
||||
enumElement = "enum",
|
||||
enumMemberElement = "enum member",
|
||||
|
||||
/**
|
||||
* Inside module and script only
|
||||
* const v = ..
|
||||
*/
|
||||
export const variableElement = "var";
|
||||
variableElement = "var",
|
||||
|
||||
/** Inside function */
|
||||
export const localVariableElement = "local var";
|
||||
localVariableElement = "local var",
|
||||
|
||||
/**
|
||||
* Inside module and script only
|
||||
* function f() { }
|
||||
*/
|
||||
export const functionElement = "function";
|
||||
functionElement = "function",
|
||||
|
||||
/** Inside function */
|
||||
export const localFunctionElement = "local function";
|
||||
localFunctionElement = "local function",
|
||||
|
||||
/** class X { [public|private]* foo() {} } */
|
||||
export const memberFunctionElement = "method";
|
||||
memberFunctionElement = "method",
|
||||
|
||||
/** class X { [public|private]* [get|set] foo:number; } */
|
||||
export const memberGetAccessorElement = "getter";
|
||||
export const memberSetAccessorElement = "setter";
|
||||
memberGetAccessorElement = "getter",
|
||||
memberSetAccessorElement = "setter",
|
||||
|
||||
/**
|
||||
* class X { [public|private]* foo:number; }
|
||||
* interface Y { foo:number; }
|
||||
*/
|
||||
export const memberVariableElement = "property";
|
||||
memberVariableElement = "property",
|
||||
|
||||
/** class X { constructor() { } } */
|
||||
export const constructorImplementationElement = "constructor";
|
||||
constructorImplementationElement = "constructor",
|
||||
|
||||
/** interface Y { ():number; } */
|
||||
export const callSignatureElement = "call";
|
||||
callSignatureElement = "call",
|
||||
|
||||
/** interface Y { []:number; } */
|
||||
export const indexSignatureElement = "index";
|
||||
indexSignatureElement = "index",
|
||||
|
||||
/** interface Y { new():Y; } */
|
||||
export const constructSignatureElement = "construct";
|
||||
constructSignatureElement = "construct",
|
||||
|
||||
/** function foo(*Y*: string) */
|
||||
export const parameterElement = "parameter";
|
||||
parameterElement = "parameter",
|
||||
|
||||
export const typeParameterElement = "type parameter";
|
||||
typeParameterElement = "type parameter",
|
||||
|
||||
export const primitiveType = "primitive type";
|
||||
primitiveType = "primitive type",
|
||||
|
||||
export const label = "label";
|
||||
label = "label",
|
||||
|
||||
export const alias = "alias";
|
||||
alias = "alias",
|
||||
|
||||
export const constElement = "const";
|
||||
constElement = "const",
|
||||
|
||||
export const letElement = "let";
|
||||
letElement = "let",
|
||||
|
||||
export const directory = "directory";
|
||||
directory = "directory",
|
||||
|
||||
export const externalModuleName = "external module name";
|
||||
externalModuleName = "external module name",
|
||||
|
||||
/**
|
||||
* <JsxTagName attribute1 attribute2={0} />
|
||||
*/
|
||||
export const jsxAttribute = "JSX attribute";
|
||||
jsxAttribute = "JSX attribute",
|
||||
}
|
||||
|
||||
export namespace ScriptElementKindModifier {
|
||||
export const none = "";
|
||||
export const publicMemberModifier = "public";
|
||||
export const privateMemberModifier = "private";
|
||||
export const protectedMemberModifier = "protected";
|
||||
export const exportedModifier = "export";
|
||||
export const ambientModifier = "declare";
|
||||
export const staticModifier = "static";
|
||||
export const abstractModifier = "abstract";
|
||||
export const enum ScriptElementKindModifier {
|
||||
none = "",
|
||||
publicMemberModifier = "public",
|
||||
privateMemberModifier = "private",
|
||||
protectedMemberModifier = "protected",
|
||||
exportedModifier = "export",
|
||||
ambientModifier = "declare",
|
||||
staticModifier = "static",
|
||||
abstractModifier = "abstract",
|
||||
}
|
||||
|
||||
export class ClassificationTypeNames {
|
||||
public static comment = "comment";
|
||||
public static identifier = "identifier";
|
||||
public static keyword = "keyword";
|
||||
public static numericLiteral = "number";
|
||||
public static operator = "operator";
|
||||
public static stringLiteral = "string";
|
||||
public static whiteSpace = "whitespace";
|
||||
public static text = "text";
|
||||
export const enum ClassificationTypeNames {
|
||||
comment = "comment",
|
||||
identifier = "identifier",
|
||||
keyword = "keyword",
|
||||
numericLiteral = "number",
|
||||
operator = "operator",
|
||||
stringLiteral = "string",
|
||||
whiteSpace = "whitespace",
|
||||
text = "text",
|
||||
|
||||
public static punctuation = "punctuation";
|
||||
punctuation = "punctuation",
|
||||
|
||||
public static className = "class name";
|
||||
public static enumName = "enum name";
|
||||
public static interfaceName = "interface name";
|
||||
public static moduleName = "module name";
|
||||
public static typeParameterName = "type parameter name";
|
||||
public static typeAliasName = "type alias name";
|
||||
public static parameterName = "parameter name";
|
||||
public static docCommentTagName = "doc comment tag name";
|
||||
public static jsxOpenTagName = "jsx open tag name";
|
||||
public static jsxCloseTagName = "jsx close tag name";
|
||||
public static jsxSelfClosingTagName = "jsx self closing tag name";
|
||||
public static jsxAttribute = "jsx attribute";
|
||||
public static jsxText = "jsx text";
|
||||
public static jsxAttributeStringLiteralValue = "jsx attribute string literal value";
|
||||
className = "class name",
|
||||
enumName = "enum name",
|
||||
interfaceName = "interface name",
|
||||
moduleName = "module name",
|
||||
typeParameterName = "type parameter name",
|
||||
typeAliasName = "type alias name",
|
||||
parameterName = "parameter name",
|
||||
docCommentTagName = "doc comment tag name",
|
||||
jsxOpenTagName = "jsx open tag name",
|
||||
jsxCloseTagName = "jsx close tag name",
|
||||
jsxSelfClosingTagName = "jsx self closing tag name",
|
||||
jsxAttribute = "jsx attribute",
|
||||
jsxText = "jsx text",
|
||||
jsxAttributeStringLiteralValue = "jsx attribute string literal value",
|
||||
}
|
||||
|
||||
export const enum ClassificationType {
|
||||
|
|
|
@ -279,7 +279,7 @@ namespace ts {
|
|||
}
|
||||
}
|
||||
|
||||
export function getNodeKind(node: Node): string {
|
||||
export function getNodeKind(node: Node): ScriptElementKind {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.SourceFile:
|
||||
return isExternalModule(<SourceFile>node) ? ScriptElementKind.moduleElement : ScriptElementKind.scriptElement;
|
||||
|
@ -326,7 +326,7 @@ namespace ts {
|
|||
return ScriptElementKind.unknown;
|
||||
}
|
||||
|
||||
function getKindOfVariableDeclaration(v: VariableDeclaration): string {
|
||||
function getKindOfVariableDeclaration(v: VariableDeclaration): ScriptElementKind {
|
||||
return isConst(v)
|
||||
? ScriptElementKind.constElement
|
||||
: isLet(v)
|
||||
|
|
Loading…
Reference in a new issue