mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-18 03:43:28 -06:00
Merge branch 'transforms-transformer-es7' into transforms-transformer-es6
This commit is contained in:
commit
dc0b0438aa
@ -1798,7 +1798,7 @@ namespace ts {
|
||||
* @param node The node to analyze
|
||||
* @param subtreeFlags Transform flags computed for this node's subtree
|
||||
*/
|
||||
export function computeTransformFlagsForNode(node: Node, subtreeFlags: TransformFlags) {
|
||||
export function computeTransformFlagsForNode(node: Node, subtreeFlags: TransformFlags): TransformFlags {
|
||||
// Ambient nodes are TypeScript syntax and the flags of their subtree are ignored.
|
||||
if (node.flags & NodeFlags.Ambient) {
|
||||
return (node.transformFlags = TransformFlags.AssertTypeScript)
|
||||
|
||||
@ -130,11 +130,12 @@ namespace ts {
|
||||
return -1;
|
||||
}
|
||||
|
||||
export function countWhere<T>(array: T[], predicate: (x: T) => boolean): number {
|
||||
export function countWhere<T>(array: T[], predicate: (x: T, i: number) => boolean): number {
|
||||
let count = 0;
|
||||
if (array) {
|
||||
for (const v of array) {
|
||||
if (predicate(v)) {
|
||||
for (let i = 0; i < array.length; i++) {
|
||||
const v = array[i];
|
||||
if (predicate(v, i)) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
@ -170,7 +171,10 @@ namespace ts {
|
||||
return result;
|
||||
}
|
||||
|
||||
export function flatMap<T, U>(array: T[], f: (x: T, i: number) => U[]): U[] {
|
||||
/**
|
||||
* Maps an array. If the mapped value is an array, it is spread into the result.
|
||||
*/
|
||||
export function flatMap<T, U>(array: T[], f: (x: T, i: number) => U | U[]): U[] {
|
||||
let result: U[];
|
||||
if (array) {
|
||||
result = [];
|
||||
@ -178,7 +182,9 @@ namespace ts {
|
||||
const v = array[i];
|
||||
const ar = f(v, i);
|
||||
if (ar) {
|
||||
result = result.concat(ar);
|
||||
// We cast to <U> here to leverage the behavior of Array#concat
|
||||
// which will append a single value here.
|
||||
result = result.concat(<U[]>ar);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -191,18 +197,6 @@ namespace ts {
|
||||
return [...array1, ...array2];
|
||||
}
|
||||
|
||||
export function append<T>(array: T[], value: T): T[] {
|
||||
if (value === undefined) return array;
|
||||
if (!array || !array.length) return [value];
|
||||
return [...array, value];
|
||||
}
|
||||
|
||||
export function prepend<T>(array: T[], value: T): T[] {
|
||||
if (value === undefined) return array;
|
||||
if (!array || !array.length) return [value];
|
||||
return [value, ...array];
|
||||
}
|
||||
|
||||
export function deduplicate<T>(array: T[]): T[] {
|
||||
let result: T[];
|
||||
if (array) {
|
||||
@ -216,6 +210,27 @@ namespace ts {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compacts an array, removing any falsey elements.
|
||||
*/
|
||||
export function compact<T>(array: T[]): T[] {
|
||||
let result: T[];
|
||||
if (array) {
|
||||
for (let i = 0; i < array.length; i++) {
|
||||
const v = array[i];
|
||||
if (result || !v) {
|
||||
if (!result) {
|
||||
result = array.slice(0, i);
|
||||
}
|
||||
if (v) {
|
||||
result.push(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result || array;
|
||||
}
|
||||
|
||||
export function sum(array: any[], prop: string): number {
|
||||
let result = 0;
|
||||
for (const v of array) {
|
||||
|
||||
@ -22,7 +22,7 @@ namespace ts {
|
||||
return node;
|
||||
}
|
||||
|
||||
export function createNodeArray<T extends Node>(elements?: T[], location?: TextRange): NodeArray<T> {
|
||||
export function createNodeArray<T extends Node>(elements?: T[], location?: TextRange, hasTrailingComma?: boolean): NodeArray<T> {
|
||||
if (elements) {
|
||||
if (isNodeArray(elements)) {
|
||||
return elements;
|
||||
@ -42,6 +42,10 @@ namespace ts {
|
||||
array.end = -1;
|
||||
}
|
||||
|
||||
if (hasTrailingComma) {
|
||||
array.hasTrailingComma = true;
|
||||
}
|
||||
|
||||
array.arrayKind = ArrayKind.NodeArray;
|
||||
return array;
|
||||
}
|
||||
@ -145,6 +149,13 @@ namespace ts {
|
||||
return clone;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a shallow, memberwise clone of a node for mutation.
|
||||
*/
|
||||
export function getMutableNode<T extends Node>(node: T): T {
|
||||
return cloneNode<T>(node, node, node.flags, node.parent, node);
|
||||
}
|
||||
|
||||
export function createNodeArrayNode<T extends Node>(elements: T[]): NodeArrayNode<T> {
|
||||
const node = <NodeArrayNode<T>>createSynthesizedNode(SyntaxKind.NodeArrayNode);
|
||||
node.nodes = createNodeArray(elements);
|
||||
@ -279,7 +290,6 @@ namespace ts {
|
||||
return node;
|
||||
}
|
||||
|
||||
|
||||
// Expression
|
||||
|
||||
export function createArrayLiteral(elements?: Expression[]) {
|
||||
@ -364,6 +374,13 @@ namespace ts {
|
||||
return node;
|
||||
}
|
||||
|
||||
export function createPrefix(operator: SyntaxKind, operand: Expression, location?: TextRange) {
|
||||
const node = <PrefixUnaryExpression>createNode(SyntaxKind.PrefixUnaryExpression, location);
|
||||
node.operator = operator;
|
||||
node.operand = parenthesizePrefixOperand(operand);
|
||||
return node;
|
||||
}
|
||||
|
||||
export function createPostfix(operand: Expression, operator: SyntaxKind, location?: TextRange) {
|
||||
const node = <PostfixUnaryExpression>createNode(SyntaxKind.PostfixUnaryExpression, location);
|
||||
node.operand = parenthesizePostfixOperand(operand);
|
||||
@ -512,6 +529,14 @@ namespace ts {
|
||||
return node;
|
||||
}
|
||||
|
||||
export function createForOf(initializer: ForInitializer, expression: Expression, statement: Statement, location?: TextRange) {
|
||||
const node = <ForOfStatement>createNode(SyntaxKind.ForOfStatement, location);
|
||||
node.initializer = initializer;
|
||||
node.expression = expression;
|
||||
node.statement = statement;
|
||||
return node;
|
||||
}
|
||||
|
||||
export function createReturn(expression?: Expression, location?: TextRange): ReturnStatement {
|
||||
const node = <ReturnStatement>createNode(SyntaxKind.ReturnStatement, location);
|
||||
node.expression = expression;
|
||||
@ -630,6 +655,10 @@ namespace ts {
|
||||
return createBinary(left, SyntaxKind.BarBarToken, right);
|
||||
}
|
||||
|
||||
export function createLogicalNot(operand: Expression) {
|
||||
return createPrefix(SyntaxKind.ExclamationToken, operand);
|
||||
}
|
||||
|
||||
export function createVoidZero() {
|
||||
return createVoid(createLiteral(0));
|
||||
}
|
||||
@ -840,6 +869,13 @@ namespace ts {
|
||||
);
|
||||
}
|
||||
|
||||
export function createHasOwnProperty(target: LeftHandSideExpression, propertyName: Expression) {
|
||||
return createCall(
|
||||
createPropertyAccess(target, "hasOwnProperty"),
|
||||
[propertyName]
|
||||
);
|
||||
}
|
||||
|
||||
function createObjectCreate(prototype: Expression) {
|
||||
return createCall(
|
||||
createPropertyAccess(createIdentifier("Object"), "create"),
|
||||
@ -855,7 +891,7 @@ namespace ts {
|
||||
target,
|
||||
createIdentifier("name")
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function createSeti(target: LeftHandSideExpression) {
|
||||
@ -1014,8 +1050,8 @@ namespace ts {
|
||||
: cloneNode(memberName, location);
|
||||
}
|
||||
|
||||
|
||||
// Utilities
|
||||
|
||||
/**
|
||||
* Wraps the operand to a BinaryExpression in parentheses if they are needed to preserve the intended
|
||||
* order of operations.
|
||||
|
||||
@ -216,7 +216,7 @@ const _super = (function (geti, seti) {
|
||||
onAfterEmitNode = undefined;
|
||||
isUniqueName = undefined;
|
||||
temporaryVariables = undefined;
|
||||
tempFlags = 0;
|
||||
tempFlags = TempFlags.Auto;
|
||||
currentSourceFile = undefined;
|
||||
currentText = undefined;
|
||||
extendsEmitted = false;
|
||||
@ -1838,7 +1838,11 @@ const _super = (function (geti, seti) {
|
||||
}
|
||||
}
|
||||
|
||||
function emitPrologueDirectives(statements: Node[], startWithNewLine?: boolean) {
|
||||
/**
|
||||
* Emits any prologue directives at the start of a Statement list, returning the
|
||||
* number of prologue directives written to the output.
|
||||
*/
|
||||
function emitPrologueDirectives(statements: Node[], startWithNewLine?: boolean): number {
|
||||
for (let i = 0; i < statements.length; i++) {
|
||||
if (isPrologueDirective(statements[i])) {
|
||||
if (startWithNewLine || i > 0) {
|
||||
|
||||
@ -968,7 +968,8 @@ namespace ts {
|
||||
|
||||
const start = new Date().getTime();
|
||||
|
||||
const emitResult = (options.experimentalTransforms ? printFiles : emitFiles)(
|
||||
const fileEmitter = options.experimentalTransforms ? printFiles : emitFiles;
|
||||
const emitResult = fileEmitter(
|
||||
emitResolver,
|
||||
getEmitHost(writeFileCallback),
|
||||
sourceFile);
|
||||
|
||||
@ -1,50 +1,15 @@
|
||||
/// <reference path="visitor.ts" />
|
||||
/// <reference path="transformers/ts.ts" />
|
||||
/// <reference path="transformers/jsx.ts" />
|
||||
/// <reference path="transformers/es7.ts" />
|
||||
/// <reference path="transformers/es6.ts" />
|
||||
/// <reference path="transformers/module/module.ts" />
|
||||
/// <reference path="transformers/module/system.ts" />
|
||||
/// <reference path="transformers/module/es6.ts" />
|
||||
|
||||
|
||||
/* @internal */
|
||||
namespace ts {
|
||||
const moduleTransformerMap: Map<Transformer> = {
|
||||
[ModuleKind.ES6]: transformES6Module,
|
||||
[ModuleKind.System]: transformSystemModule,
|
||||
[ModuleKind.AMD]: transformModule,
|
||||
[ModuleKind.CommonJS]: transformModule,
|
||||
[ModuleKind.UMD]: transformModule,
|
||||
[ModuleKind.None]: transformModule
|
||||
};
|
||||
|
||||
const enum SyntaxKindFeatureFlags {
|
||||
ExpressionSubstitution = 1 << 0,
|
||||
EmitNotifications = 1 << 1,
|
||||
}
|
||||
|
||||
|
||||
export function getTransformers(compilerOptions: CompilerOptions) {
|
||||
const jsx = compilerOptions.jsx;
|
||||
const languageVersion = getEmitScriptTarget(compilerOptions);
|
||||
const moduleKind = getEmitModuleKind(compilerOptions);
|
||||
const transformers: Transformer[] = [];
|
||||
|
||||
transformers.push(transformTypeScript);
|
||||
transformers.push(moduleTransformerMap[moduleKind]);
|
||||
if (jsx === JsxEmit.React) {
|
||||
transformers.push(transformJsx);
|
||||
}
|
||||
|
||||
if (languageVersion < ScriptTarget.ES7) {
|
||||
transformers.push(transformES7);
|
||||
}
|
||||
|
||||
if (languageVersion < ScriptTarget.ES6) {
|
||||
transformers.push(transformES6);
|
||||
}
|
||||
|
||||
// TODO(rbuckton): Add transformers
|
||||
return transformers;
|
||||
}
|
||||
|
||||
@ -63,7 +28,6 @@ namespace ts {
|
||||
const lexicalEnvironmentVariableDeclarationsStack: VariableDeclaration[][] = [];
|
||||
const lexicalEnvironmentFunctionDeclarationsStack: FunctionDeclaration[][] = [];
|
||||
const enabledSyntaxKindFeatures = new Array<SyntaxKindFeatureFlags>(SyntaxKind.Count);
|
||||
|
||||
let lexicalEnvironmentStackOffset = 0;
|
||||
let hoistedVariableDeclarations: VariableDeclaration[];
|
||||
let hoistedFunctionDeclarations: FunctionDeclaration[];
|
||||
@ -322,12 +286,17 @@ namespace ts {
|
||||
}
|
||||
|
||||
if (hoistedVariableDeclarations) {
|
||||
statements = append(statements,
|
||||
createVariableStatement(
|
||||
/*modifiers*/ undefined,
|
||||
createVariableDeclarationList(hoistedVariableDeclarations)
|
||||
)
|
||||
const statement = createVariableStatement(
|
||||
/*modifiers*/ undefined,
|
||||
createVariableDeclarationList(hoistedVariableDeclarations)
|
||||
);
|
||||
|
||||
if (!statements) {
|
||||
statements = [statement];
|
||||
}
|
||||
else {
|
||||
statements.push(statement);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -659,7 +659,7 @@ namespace ts {
|
||||
);
|
||||
}
|
||||
|
||||
function visitVariableDeclaration(node: VariableDeclaration): OneOrMore<VariableDeclaration> {
|
||||
function visitVariableDeclaration(node: VariableDeclaration): OneOrMany<VariableDeclaration> {
|
||||
const name = node.name;
|
||||
if (isBindingPattern(name)) {
|
||||
return createNodeArrayNode(
|
||||
|
||||
@ -1795,7 +1795,7 @@ namespace ts {
|
||||
*
|
||||
* @param node The function node.
|
||||
*/
|
||||
function visitFunctionDeclaration(node: FunctionDeclaration): OneOrMore<Statement> {
|
||||
function visitFunctionDeclaration(node: FunctionDeclaration): OneOrMany<Statement> {
|
||||
if (shouldElideFunctionLikeDeclaration(node)) {
|
||||
return undefined;
|
||||
}
|
||||
@ -2446,7 +2446,7 @@ namespace ts {
|
||||
*
|
||||
* @param node The import equals declaration node.
|
||||
*/
|
||||
function visitImportEqualsDeclaration(node: ImportEqualsDeclaration): OneOrMore<Statement> {
|
||||
function visitImportEqualsDeclaration(node: ImportEqualsDeclaration): OneOrMany<Statement> {
|
||||
Debug.assert(!isExternalModuleImportEqualsDeclaration(node));
|
||||
if (shouldElideImportEqualsDeclaration(node)) {
|
||||
return undefined;
|
||||
|
||||
@ -1126,7 +1126,7 @@ namespace ts {
|
||||
// @kind(SyntaxKind.Block)
|
||||
export interface Block extends Statement {
|
||||
statements: NodeArray<Statement>;
|
||||
multiLine?: boolean;
|
||||
/*@internal*/ multiLine?: boolean;
|
||||
}
|
||||
|
||||
// @kind(SyntaxKind.VariableStatement)
|
||||
@ -2512,10 +2512,8 @@ namespace ts {
|
||||
ES3 = 0,
|
||||
ES5 = 1,
|
||||
ES6 = 2,
|
||||
ES7 = 3,
|
||||
ES2015 = ES6,
|
||||
ES2016 = ES7,
|
||||
Latest = ES7,
|
||||
Latest = ES6,
|
||||
}
|
||||
|
||||
export const enum LanguageVariant {
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
/* @internal */
|
||||
namespace ts {
|
||||
export type OneOrMore<T extends Node> = T | NodeArrayNode<T>;
|
||||
export type OneOrMany<T extends Node> = T | NodeArrayNode<T>;
|
||||
|
||||
/**
|
||||
* Describes an edge of a Node, used when traversing a syntax tree.
|
||||
@ -20,6 +20,7 @@ namespace ts {
|
||||
/** A callback used to lift a NodeArrayNode into a valid node. */
|
||||
lift?: (nodes: NodeArray<Node>) => Node;
|
||||
|
||||
/** A callback used to parenthesize a node to preserve the intended order of operations. */
|
||||
parenthesize?: (value: Node, parentNode: Node) => Node;
|
||||
};
|
||||
|
||||
@ -531,7 +532,7 @@ namespace ts {
|
||||
// Visit each original node.
|
||||
for (let i = 0; i < count; i++) {
|
||||
const node = nodes[i + start];
|
||||
const visited = node && <OneOrMore<T>>visitor(node);
|
||||
const visited = node && <OneOrMany<T>>visitor(node);
|
||||
if (updated !== undefined || visited === undefined || visited !== node) {
|
||||
if (updated === undefined) {
|
||||
// Ensure we have a copy of `nodes`, up to the current index.
|
||||
@ -549,7 +550,7 @@ namespace ts {
|
||||
if (updated !== undefined) {
|
||||
return <TArray>(isModifiersArray(nodes)
|
||||
? createModifiersArray(updated, nodes)
|
||||
: setHasTrailingComma(createNodeArray(updated, nodes), nodes.hasTrailingComma));
|
||||
: createNodeArray(updated, nodes, nodes.hasTrailingComma));
|
||||
}
|
||||
|
||||
return nodes;
|
||||
@ -589,7 +590,8 @@ namespace ts {
|
||||
|
||||
if (updated !== undefined || visited !== value) {
|
||||
if (updated === undefined) {
|
||||
updated = cloneNode(node, /*location*/ node, node.flags & ~NodeFlags.Modifier, /*parent*/ undefined, /*original*/ node);
|
||||
updated = getMutableNode(node);
|
||||
updated.flags &= ~NodeFlags.Modifier;
|
||||
}
|
||||
|
||||
if (modifiers) {
|
||||
@ -624,17 +626,6 @@ namespace ts {
|
||||
return updated;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of an edge, adjusting the value as necessary for cases such as expression precedence.
|
||||
*/
|
||||
function setEdgeValue(parentNode: Node & Map<any>, edge: NodeEdge, value: Node | NodeArray<Node>) {
|
||||
if (value && edge.parenthesize && !isArray(value)) {
|
||||
value = parenthesizeEdge(<Node>value, parentNode, edge.parenthesize, edge.test);
|
||||
}
|
||||
|
||||
parentNode[edge.name] = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Visits a node edge.
|
||||
*
|
||||
@ -648,6 +639,17 @@ namespace ts {
|
||||
: visitNode(<Node>value, visitor, !edge.parenthesize ? edge.test : undefined, edge.optional, edge.lift);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of an edge, adjusting the value as necessary for cases such as expression precedence.
|
||||
*/
|
||||
function setEdgeValue(parentNode: Node & Map<any>, edge: NodeEdge, value: Node | NodeArray<Node>) {
|
||||
if (value && edge.parenthesize && !isArray(value)) {
|
||||
value = parenthesizeEdge(<Node>value, parentNode, edge.parenthesize, edge.test);
|
||||
}
|
||||
|
||||
parentNode[edge.name] = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies parentheses to a node to ensure the correct precedence.
|
||||
*/
|
||||
@ -660,7 +662,7 @@ namespace ts {
|
||||
/**
|
||||
* Flattens an array of nodes that could contain NodeArrayNodes.
|
||||
*/
|
||||
export function flattenNodes<T extends Node>(nodes: OneOrMore<T>[]): T[] {
|
||||
export function flattenNodes<T extends Node>(nodes: OneOrMany<T>[]): T[] {
|
||||
let result: T[];
|
||||
if (nodes) {
|
||||
result = [];
|
||||
@ -678,7 +680,7 @@ namespace ts {
|
||||
* @param to The destination array.
|
||||
* @param from The source Node or NodeArrayNode.
|
||||
*/
|
||||
export function addNode<T extends Node>(to: T[], from: OneOrMore<T>, startOnNewLine?: boolean) {
|
||||
export function addNode<T extends Node>(to: T[], from: OneOrMany<T>, startOnNewLine?: boolean) {
|
||||
addNodeWorker(to, from, startOnNewLine, /*test*/ undefined)
|
||||
}
|
||||
|
||||
@ -688,7 +690,7 @@ namespace ts {
|
||||
* @param to The destination NodeArray.
|
||||
* @param from The source array of Node or NodeArrayNode.
|
||||
*/
|
||||
export function addNodes<T extends Node>(to: T[], from: OneOrMore<T>[], startOnNewLine?: boolean) {
|
||||
export function addNodes<T extends Node>(to: T[], from: OneOrMany<T>[], startOnNewLine?: boolean) {
|
||||
addNodesWorker(to, from, startOnNewLine, /*test*/ undefined);
|
||||
}
|
||||
|
||||
@ -698,7 +700,7 @@ namespace ts {
|
||||
* @param to The destination array.
|
||||
* @param from The source Node or NodeArrayNode.
|
||||
*/
|
||||
export function addLine<T extends Node>(to: T[], from: OneOrMore<T>) {
|
||||
export function addLine<T extends Node>(to: T[], from: OneOrMany<T>) {
|
||||
addNodeWorker(to, from, /*addOnNewLine*/ true, /*test*/ undefined);
|
||||
}
|
||||
|
||||
@ -708,11 +710,11 @@ namespace ts {
|
||||
* @param to The destination NodeArray.
|
||||
* @param from The source array of Node or NodeArrayNode.
|
||||
*/
|
||||
export function addLines<T extends Node>(to: T[], from: OneOrMore<T>[]) {
|
||||
export function addLines<T extends Node>(to: T[], from: OneOrMany<T>[]) {
|
||||
addNodesWorker(to, from, /*addOnNewLine*/ true, /*test*/ undefined);
|
||||
}
|
||||
|
||||
function addNodeWorker<T extends Node>(to: T[], from: OneOrMore<T>, addOnNewLine: boolean, test: (node: Node) => boolean) {
|
||||
function addNodeWorker<T extends Node>(to: T[], from: OneOrMany<T>, addOnNewLine: boolean, test: (node: Node) => boolean) {
|
||||
if (to && from) {
|
||||
if (isNodeArrayNode(from)) {
|
||||
addNodesWorker(to, from.nodes, addOnNewLine, test);
|
||||
@ -728,7 +730,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
function addNodesWorker<T extends Node>(to: T[], from: OneOrMore<T>[], addOnNewLine: boolean, test: (node: Node) => boolean) {
|
||||
function addNodesWorker<T extends Node>(to: T[], from: OneOrMany<T>[], addOnNewLine: boolean, test: (node: Node) => boolean) {
|
||||
if (to && from) {
|
||||
for (const node of from) {
|
||||
addNodeWorker(to, node, addOnNewLine, test);
|
||||
@ -896,7 +898,7 @@ namespace ts {
|
||||
*
|
||||
* @param nodes The NodeArray.
|
||||
*/
|
||||
function liftToBlock(nodes: NodeArray<Node>) {
|
||||
export function liftToBlock(nodes: NodeArray<Node>) {
|
||||
Debug.assert(every(nodes, isStatement), "Cannot lift nodes to a Block.");
|
||||
return createBlock(<NodeArray<Statement>>nodes);
|
||||
}
|
||||
|
||||
116
src/server/protocol.d.ts
vendored
116
src/server/protocol.d.ts
vendored
@ -1,54 +1,54 @@
|
||||
/**
|
||||
* Declaration module describing the TypeScript Server protocol
|
||||
/**
|
||||
* Declaration module describing the TypeScript Server protocol
|
||||
*/
|
||||
declare namespace ts.server.protocol {
|
||||
/**
|
||||
* A TypeScript Server message
|
||||
/**
|
||||
* A TypeScript Server message
|
||||
*/
|
||||
export interface Message {
|
||||
/**
|
||||
* Sequence number of the message
|
||||
/**
|
||||
* Sequence number of the message
|
||||
*/
|
||||
seq: number;
|
||||
|
||||
/**
|
||||
* One of "request", "response", or "event"
|
||||
* One of "request", "response", or "event"
|
||||
*/
|
||||
type: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Client-initiated request message
|
||||
/**
|
||||
* Client-initiated request message
|
||||
*/
|
||||
export interface Request extends Message {
|
||||
/**
|
||||
* The command to execute
|
||||
* The command to execute
|
||||
*/
|
||||
command: string;
|
||||
|
||||
/**
|
||||
* Object containing arguments for the command
|
||||
/**
|
||||
* Object containing arguments for the command
|
||||
*/
|
||||
arguments?: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Request to reload the project structure for all the opened files
|
||||
* Request to reload the project structure for all the opened files
|
||||
*/
|
||||
export interface ReloadProjectsRequest extends Message {
|
||||
}
|
||||
|
||||
/**
|
||||
* Server-initiated event message
|
||||
/**
|
||||
* Server-initiated event message
|
||||
*/
|
||||
export interface Event extends Message {
|
||||
/**
|
||||
* Name of event
|
||||
/**
|
||||
* Name of event
|
||||
*/
|
||||
event: string;
|
||||
|
||||
/**
|
||||
* Event-specific information
|
||||
/**
|
||||
* Event-specific information
|
||||
*/
|
||||
body?: any;
|
||||
}
|
||||
@ -62,18 +62,18 @@ declare namespace ts.server.protocol {
|
||||
*/
|
||||
request_seq: number;
|
||||
|
||||
/**
|
||||
* Outcome of the request.
|
||||
/**
|
||||
* Outcome of the request.
|
||||
*/
|
||||
success: boolean;
|
||||
|
||||
/**
|
||||
/**
|
||||
* The command requested.
|
||||
*/
|
||||
command: string;
|
||||
|
||||
/**
|
||||
* Contains error message if success === false.
|
||||
/**
|
||||
* Contains error message if success === false.
|
||||
*/
|
||||
message?: string;
|
||||
|
||||
@ -83,7 +83,7 @@ declare namespace ts.server.protocol {
|
||||
body?: any;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Arguments for FileRequest messages.
|
||||
*/
|
||||
export interface FileRequestArgs {
|
||||
@ -93,7 +93,7 @@ declare namespace ts.server.protocol {
|
||||
file: string;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Arguments for ProjectInfoRequest request.
|
||||
*/
|
||||
export interface ProjectInfoRequestArgs extends FileRequestArgs {
|
||||
@ -110,7 +110,7 @@ declare namespace ts.server.protocol {
|
||||
arguments: ProjectInfoRequestArgs;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Response message body for "projectInfo" request
|
||||
*/
|
||||
export interface ProjectInfo {
|
||||
@ -125,7 +125,7 @@ declare namespace ts.server.protocol {
|
||||
fileNames?: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Response message for "projectInfo" request
|
||||
*/
|
||||
export interface ProjectInfoResponse extends Response {
|
||||
@ -144,12 +144,12 @@ declare namespace ts.server.protocol {
|
||||
* (file, line, character offset), where line and character offset are 1-based.
|
||||
*/
|
||||
export interface FileLocationRequestArgs extends FileRequestArgs {
|
||||
/**
|
||||
/**
|
||||
* The line number for the request (1-based).
|
||||
*/
|
||||
line: number;
|
||||
|
||||
/**
|
||||
/**
|
||||
* The character offset (on the line) for the request (1-based).
|
||||
*/
|
||||
offset: number;
|
||||
@ -216,7 +216,7 @@ declare namespace ts.server.protocol {
|
||||
* Object found in response messages defining a span of text in a specific source file.
|
||||
*/
|
||||
export interface FileSpan extends TextSpan {
|
||||
/**
|
||||
/**
|
||||
* File containing text span.
|
||||
*/
|
||||
file: string;
|
||||
@ -300,14 +300,14 @@ declare namespace ts.server.protocol {
|
||||
*/
|
||||
lineText: string;
|
||||
|
||||
/**
|
||||
/**
|
||||
* True if reference is a write location, false otherwise.
|
||||
*/
|
||||
isWriteAccess: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* The body of a "references" response message.
|
||||
* The body of a "references" response message.
|
||||
*/
|
||||
export interface ReferencesResponseBody {
|
||||
/**
|
||||
@ -325,7 +325,7 @@ declare namespace ts.server.protocol {
|
||||
*/
|
||||
symbolStartOffset: number;
|
||||
|
||||
/**
|
||||
/**
|
||||
* The full display name of the symbol.
|
||||
*/
|
||||
symbolDisplayString: string;
|
||||
@ -355,7 +355,7 @@ declare namespace ts.server.protocol {
|
||||
}
|
||||
|
||||
/**
|
||||
* Information about the item to be renamed.
|
||||
* Information about the item to be renamed.
|
||||
*/
|
||||
export interface RenameInfo {
|
||||
/**
|
||||
@ -373,7 +373,7 @@ declare namespace ts.server.protocol {
|
||||
*/
|
||||
displayName: string;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Full display name of item to be renamed.
|
||||
*/
|
||||
fullDisplayName: string;
|
||||
@ -383,7 +383,7 @@ declare namespace ts.server.protocol {
|
||||
*/
|
||||
kind: string;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Optional modifiers for the kind (such as 'public').
|
||||
*/
|
||||
kindModifiers: string;
|
||||
@ -469,7 +469,7 @@ declare namespace ts.server.protocol {
|
||||
placeOpenBraceOnNewLineForControlBlocks?: boolean;
|
||||
|
||||
/** Index operator */
|
||||
[key: string] : string | number | boolean;
|
||||
[key: string]: string | number | boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -477,7 +477,7 @@ declare namespace ts.server.protocol {
|
||||
*/
|
||||
export interface ConfigureRequestArguments {
|
||||
|
||||
/**
|
||||
/**
|
||||
* Information about the host, for example 'Emacs 24.4' or
|
||||
* 'Sublime Text version 3075'
|
||||
*/
|
||||
@ -495,7 +495,7 @@ declare namespace ts.server.protocol {
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure request; value of command field is "configure". Specifies
|
||||
* Configure request; value of command field is "configure". Specifies
|
||||
* host information, such as host type, tab size, and indent size.
|
||||
*/
|
||||
export interface ConfigureRequest extends Request {
|
||||
@ -514,8 +514,8 @@ declare namespace ts.server.protocol {
|
||||
*/
|
||||
export interface OpenRequestArgs extends FileRequestArgs {
|
||||
/**
|
||||
* Used when a version of the file content is known to be more up to date than the one on disk.
|
||||
* Then the known content will be used upon opening instead of the disk copy
|
||||
* Used when a version of the file content is known to be more up to date than the one on disk.
|
||||
* Then the known content will be used upon opening instead of the disk copy
|
||||
*/
|
||||
fileContent?: string;
|
||||
}
|
||||
@ -751,7 +751,7 @@ declare namespace ts.server.protocol {
|
||||
* Optional modifiers for the kind (such as 'public').
|
||||
*/
|
||||
kindModifiers: string;
|
||||
/**
|
||||
/**
|
||||
* A string that is used for comparing completion items so that they can be ordered. This
|
||||
* is often the same as the name but may be different in certain circumstances.
|
||||
*/
|
||||
@ -794,7 +794,7 @@ declare namespace ts.server.protocol {
|
||||
}
|
||||
|
||||
/**
|
||||
* Signature help information for a single parameter
|
||||
* Signature help information for a single parameter
|
||||
*/
|
||||
export interface SignatureHelpParameter {
|
||||
|
||||
@ -814,18 +814,18 @@ declare namespace ts.server.protocol {
|
||||
displayParts: SymbolDisplayPart[];
|
||||
|
||||
/**
|
||||
* Whether the parameter is optional or not.
|
||||
* Whether the parameter is optional or not.
|
||||
*/
|
||||
isOptional: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a single signature to show in signature help.
|
||||
* Represents a single signature to show in signature help.
|
||||
*/
|
||||
export interface SignatureHelpItem {
|
||||
|
||||
/**
|
||||
* Whether the signature accepts a variable number of arguments.
|
||||
* Whether the signature accepts a variable number of arguments.
|
||||
*/
|
||||
isVariadic: boolean;
|
||||
|
||||
@ -845,7 +845,7 @@ declare namespace ts.server.protocol {
|
||||
separatorDisplayParts: SymbolDisplayPart[];
|
||||
|
||||
/**
|
||||
* The signature helps items for the parameters.
|
||||
* The signature helps items for the parameters.
|
||||
*/
|
||||
parameters: SignatureHelpParameter[];
|
||||
|
||||
@ -861,17 +861,17 @@ declare namespace ts.server.protocol {
|
||||
export interface SignatureHelpItems {
|
||||
|
||||
/**
|
||||
* The signature help items.
|
||||
* The signature help items.
|
||||
*/
|
||||
items: SignatureHelpItem[];
|
||||
|
||||
/**
|
||||
* The span for which signature help should appear on a signature
|
||||
* The span for which signature help should appear on a signature
|
||||
*/
|
||||
applicableSpan: TextSpan;
|
||||
|
||||
/**
|
||||
* The item selected in the set of available help items.
|
||||
* The item selected in the set of available help items.
|
||||
*/
|
||||
selectedItemIndex: number;
|
||||
|
||||
@ -895,7 +895,7 @@ declare namespace ts.server.protocol {
|
||||
|
||||
/**
|
||||
* Signature help request; value of command field is "signatureHelp".
|
||||
* Given a file location (file, line, col), return the signature
|
||||
* Given a file location (file, line, col), return the signature
|
||||
* help.
|
||||
*/
|
||||
export interface SignatureHelpRequest extends FileLocationRequest {
|
||||
@ -926,8 +926,8 @@ declare namespace ts.server.protocol {
|
||||
}
|
||||
|
||||
/**
|
||||
* GeterrForProjectRequest request; value of command field is
|
||||
* "geterrForProject". It works similarly with 'Geterr', only
|
||||
* GeterrForProjectRequest request; value of command field is
|
||||
* "geterrForProject". It works similarly with 'Geterr', only
|
||||
* it request for every file in this project.
|
||||
*/
|
||||
export interface GeterrForProjectRequest extends Request {
|
||||
@ -997,7 +997,7 @@ declare namespace ts.server.protocol {
|
||||
diagnostics: Diagnostic[];
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Event message for "syntaxDiag" and "semanticDiag" event types.
|
||||
* These events provide syntactic and semantic errors for a file.
|
||||
*/
|
||||
@ -1033,7 +1033,7 @@ declare namespace ts.server.protocol {
|
||||
export interface ReloadResponse extends Response {
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Arguments for saveto request.
|
||||
*/
|
||||
export interface SavetoRequestArgs extends FileRequestArgs {
|
||||
@ -1109,7 +1109,7 @@ declare namespace ts.server.protocol {
|
||||
*/
|
||||
kindModifiers?: string;
|
||||
|
||||
/**
|
||||
/**
|
||||
* The file in which the symbol is found.
|
||||
*/
|
||||
file: string;
|
||||
@ -1156,7 +1156,7 @@ declare namespace ts.server.protocol {
|
||||
|
||||
/**
|
||||
* Change request message; value of command field is "change".
|
||||
* Update the server's view of the file named by argument 'file'.
|
||||
* Update the server's view of the file named by argument 'file'.
|
||||
* Server does not currently send a response to a change request.
|
||||
*/
|
||||
export interface ChangeRequest extends FileLocationRequest {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user