mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Revert string enum changes (#16569)
* Revert "Convert Extension to a string enum (#16425)" This reverts commit09321b3834. * Revert "Also convert ClassificationTypeNames and CommandTypes/CommandNames" This reverts commitf94818da36. * Revert "Make ScriptElementKind and HighlightSpanKind string enums" This reverts commitb162097c3c. * Revert "Make ScriptElementKind and HighlightSpanKind string enums" This reverts commitb162097c3c. # Conflicts: # lib/lib.d.ts # lib/lib.es2016.full.d.ts # lib/lib.es2017.full.d.ts # lib/lib.es5.d.ts # lib/lib.es6.d.ts # lib/lib.esnext.full.d.ts # lib/tsc.js # lib/tsserver.js # lib/tsserverlibrary.d.ts # lib/tsserverlibrary.js # lib/typescript.d.ts # lib/typescript.js # lib/typescriptServices.d.ts # lib/typescriptServices.js # lib/typingsInstaller.js * Update LKG * Revert "Make CommandTypes a const enum and use `allCommandTypes` for unit test" This reverts commitf6240cb6f9.
This commit is contained in:
Vendored
+92
-86
@@ -2,53 +2,54 @@
|
||||
* Declaration module describing the TypeScript Server protocol
|
||||
*/
|
||||
declare namespace ts.server.protocol {
|
||||
const enum CommandTypes {
|
||||
Brace = "brace",
|
||||
BraceCompletion = "braceCompletion",
|
||||
Change = "change",
|
||||
Close = "close",
|
||||
Completions = "completions",
|
||||
CompletionDetails = "completionEntryDetails",
|
||||
CompileOnSaveAffectedFileList = "compileOnSaveAffectedFileList",
|
||||
CompileOnSaveEmitFile = "compileOnSaveEmitFile",
|
||||
Configure = "configure",
|
||||
Definition = "definition",
|
||||
Implementation = "implementation",
|
||||
Exit = "exit",
|
||||
Format = "format",
|
||||
Formatonkey = "formatonkey",
|
||||
Geterr = "geterr",
|
||||
GeterrForProject = "geterrForProject",
|
||||
SemanticDiagnosticsSync = "semanticDiagnosticsSync",
|
||||
SyntacticDiagnosticsSync = "syntacticDiagnosticsSync",
|
||||
NavBar = "navbar",
|
||||
Navto = "navto",
|
||||
NavTree = "navtree",
|
||||
NavTreeFull = "navtree-full",
|
||||
Occurrences = "occurrences",
|
||||
DocumentHighlights = "documentHighlights",
|
||||
Open = "open",
|
||||
Quickinfo = "quickinfo",
|
||||
References = "references",
|
||||
Reload = "reload",
|
||||
Rename = "rename",
|
||||
Saveto = "saveto",
|
||||
SignatureHelp = "signatureHelp",
|
||||
TypeDefinition = "typeDefinition",
|
||||
ProjectInfo = "projectInfo",
|
||||
ReloadProjects = "reloadProjects",
|
||||
Unknown = "unknown",
|
||||
OpenExternalProject = "openExternalProject",
|
||||
OpenExternalProjects = "openExternalProjects",
|
||||
CloseExternalProject = "closeExternalProject",
|
||||
TodoComments = "todoComments",
|
||||
Indentation = "indentation",
|
||||
DocCommentTemplate = "docCommentTemplate",
|
||||
CompilerOptionsForInferredProjects = "compilerOptionsForInferredProjects",
|
||||
GetCodeFixes = "getCodeFixes",
|
||||
GetSupportedCodeFixes = "getSupportedCodeFixes",
|
||||
GetApplicableRefactors = "getApplicableRefactors",
|
||||
GetEditsForRefactor = "getEditsForRefactor",
|
||||
namespace CommandTypes {
|
||||
type Brace = "brace";
|
||||
type BraceCompletion = "braceCompletion";
|
||||
type Change = "change";
|
||||
type Close = "close";
|
||||
type Completions = "completions";
|
||||
type CompletionDetails = "completionEntryDetails";
|
||||
type CompileOnSaveAffectedFileList = "compileOnSaveAffectedFileList";
|
||||
type CompileOnSaveEmitFile = "compileOnSaveEmitFile";
|
||||
type Configure = "configure";
|
||||
type Definition = "definition";
|
||||
type Implementation = "implementation";
|
||||
type Exit = "exit";
|
||||
type Format = "format";
|
||||
type Formatonkey = "formatonkey";
|
||||
type Geterr = "geterr";
|
||||
type GeterrForProject = "geterrForProject";
|
||||
type SemanticDiagnosticsSync = "semanticDiagnosticsSync";
|
||||
type SyntacticDiagnosticsSync = "syntacticDiagnosticsSync";
|
||||
type NavBar = "navbar";
|
||||
type Navto = "navto";
|
||||
type NavTree = "navtree";
|
||||
type NavTreeFull = "navtree-full";
|
||||
type Occurrences = "occurrences";
|
||||
type DocumentHighlights = "documentHighlights";
|
||||
type Open = "open";
|
||||
type Quickinfo = "quickinfo";
|
||||
type References = "references";
|
||||
type Reload = "reload";
|
||||
type Rename = "rename";
|
||||
type Saveto = "saveto";
|
||||
type SignatureHelp = "signatureHelp";
|
||||
type TypeDefinition = "typeDefinition";
|
||||
type ProjectInfo = "projectInfo";
|
||||
type ReloadProjects = "reloadProjects";
|
||||
type Unknown = "unknown";
|
||||
type OpenExternalProject = "openExternalProject";
|
||||
type OpenExternalProjects = "openExternalProjects";
|
||||
type CloseExternalProject = "closeExternalProject";
|
||||
type TodoComments = "todoComments";
|
||||
type Indentation = "indentation";
|
||||
type DocCommentTemplate = "docCommentTemplate";
|
||||
type CompilerOptionsForInferredProjects = "compilerOptionsForInferredProjects";
|
||||
type GetCodeFixes = "getCodeFixes";
|
||||
type GetSupportedCodeFixes = "getSupportedCodeFixes";
|
||||
type GetApplicableRefactors = "getApplicableRefactors";
|
||||
type GetRefactorCodeActions = "getRefactorCodeActions";
|
||||
type GetEditsForRefactor = "getEditsForRefactor";
|
||||
}
|
||||
/**
|
||||
* A TypeScript Server message
|
||||
@@ -571,9 +572,10 @@ declare 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.
|
||||
*/
|
||||
interface HighlightSpan extends TextSpan {
|
||||
kind: HighlightSpanKind;
|
||||
kind: string;
|
||||
}
|
||||
/**
|
||||
* Represents a set of highligh spans for a give name
|
||||
@@ -691,7 +693,7 @@ declare namespace ts.server.protocol {
|
||||
/**
|
||||
* The items's kind (such as 'className' or 'parameterName' or plain 'text').
|
||||
*/
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
/**
|
||||
* Optional modifiers for the kind (such as 'public').
|
||||
*/
|
||||
@@ -1039,7 +1041,7 @@ declare namespace ts.server.protocol {
|
||||
/**
|
||||
* The symbol's kind (such as 'className' or 'parameterName' or plain 'text').
|
||||
*/
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
/**
|
||||
* Optional modifiers for the kind (such as 'public').
|
||||
*/
|
||||
@@ -1225,7 +1227,7 @@ declare namespace ts.server.protocol {
|
||||
/**
|
||||
* The symbol's kind (such as 'className' or 'parameterName').
|
||||
*/
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
/**
|
||||
* Optional modifiers for the kind (such as 'public').
|
||||
*/
|
||||
@@ -1252,7 +1254,7 @@ declare namespace ts.server.protocol {
|
||||
/**
|
||||
* The symbol's kind (such as 'className' or 'parameterName').
|
||||
*/
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
/**
|
||||
* Optional modifiers for the kind (such as 'public').
|
||||
*/
|
||||
@@ -1645,7 +1647,7 @@ declare namespace ts.server.protocol {
|
||||
/**
|
||||
* The symbol's kind (such as 'className' or 'parameterName').
|
||||
*/
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
/**
|
||||
* exact, substring, or prefix.
|
||||
*/
|
||||
@@ -1678,7 +1680,7 @@ declare namespace ts.server.protocol {
|
||||
/**
|
||||
* Kind of symbol's container symbol (if any).
|
||||
*/
|
||||
containerKind?: ScriptElementKind;
|
||||
containerKind?: string;
|
||||
}
|
||||
/**
|
||||
* Navto response message. Body is an array of navto items. Each
|
||||
@@ -1742,7 +1744,7 @@ declare namespace ts.server.protocol {
|
||||
/**
|
||||
* The symbol's kind (such as 'className' or 'parameterName').
|
||||
*/
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
/**
|
||||
* Optional modifiers for the kind (such as 'public').
|
||||
*/
|
||||
@@ -1763,7 +1765,7 @@ declare namespace ts.server.protocol {
|
||||
/** protocol.NavigationTree is identical to ts.NavigationTree, except using protocol.TextSpan instead of ts.TextSpan */
|
||||
interface NavigationTree {
|
||||
text: string;
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
kindModifiers: string;
|
||||
spans: TextSpan[];
|
||||
childItems?: NavigationTree[];
|
||||
@@ -1838,11 +1840,12 @@ declare namespace ts.server.protocol {
|
||||
interface NavTreeResponse extends Response {
|
||||
body?: NavigationTree;
|
||||
}
|
||||
const enum IndentStyle {
|
||||
None = "None",
|
||||
Block = "Block",
|
||||
Smart = "Smart",
|
||||
namespace IndentStyle {
|
||||
type None = "None";
|
||||
type Block = "Block";
|
||||
type Smart = "Smart";
|
||||
}
|
||||
type IndentStyle = IndentStyle.None | IndentStyle.Block | IndentStyle.Smart;
|
||||
interface EditorSettings {
|
||||
baseIndentSize?: number;
|
||||
indentSize?: number;
|
||||
@@ -1936,35 +1939,40 @@ declare namespace ts.server.protocol {
|
||||
typeRoots?: string[];
|
||||
[option: string]: CompilerOptionsValue | undefined;
|
||||
}
|
||||
const enum JsxEmit {
|
||||
None = "None",
|
||||
Preserve = "Preserve",
|
||||
ReactNative = "ReactNative",
|
||||
React = "React",
|
||||
namespace JsxEmit {
|
||||
type None = "None";
|
||||
type Preserve = "Preserve";
|
||||
type ReactNative = "ReactNative";
|
||||
type React = "React";
|
||||
}
|
||||
const enum ModuleKind {
|
||||
None = "None",
|
||||
CommonJS = "CommonJS",
|
||||
AMD = "AMD",
|
||||
UMD = "UMD",
|
||||
System = "System",
|
||||
ES6 = "ES6",
|
||||
ES2015 = "ES2015",
|
||||
type JsxEmit = JsxEmit.None | JsxEmit.Preserve | JsxEmit.React | JsxEmit.ReactNative;
|
||||
namespace ModuleKind {
|
||||
type None = "None";
|
||||
type CommonJS = "CommonJS";
|
||||
type AMD = "AMD";
|
||||
type UMD = "UMD";
|
||||
type System = "System";
|
||||
type ES6 = "ES6";
|
||||
type ES2015 = "ES2015";
|
||||
}
|
||||
const enum ModuleResolutionKind {
|
||||
Classic = "Classic",
|
||||
Node = "Node",
|
||||
type ModuleKind = ModuleKind.None | ModuleKind.CommonJS | ModuleKind.AMD | ModuleKind.UMD | ModuleKind.System | ModuleKind.ES6 | ModuleKind.ES2015;
|
||||
namespace ModuleResolutionKind {
|
||||
type Classic = "Classic";
|
||||
type Node = "Node";
|
||||
}
|
||||
const enum NewLineKind {
|
||||
Crlf = "Crlf",
|
||||
Lf = "Lf",
|
||||
type ModuleResolutionKind = ModuleResolutionKind.Classic | ModuleResolutionKind.Node;
|
||||
namespace NewLineKind {
|
||||
type Crlf = "Crlf";
|
||||
type Lf = "Lf";
|
||||
}
|
||||
const enum ScriptTarget {
|
||||
ES3 = "ES3",
|
||||
ES5 = "ES5",
|
||||
ES6 = "ES6",
|
||||
ES2015 = "ES2015",
|
||||
type NewLineKind = NewLineKind.Crlf | NewLineKind.Lf;
|
||||
namespace ScriptTarget {
|
||||
type ES3 = "ES3";
|
||||
type ES5 = "ES5";
|
||||
type ES6 = "ES6";
|
||||
type ES2015 = "ES2015";
|
||||
}
|
||||
type ScriptTarget = ScriptTarget.ES3 | ScriptTarget.ES5 | ScriptTarget.ES6 | ScriptTarget.ES2015;
|
||||
}
|
||||
declare namespace ts.server.protocol {
|
||||
|
||||
@@ -2020,8 +2028,6 @@ declare namespace ts.server.protocol {
|
||||
}
|
||||
declare namespace ts {
|
||||
// these types are empty stubs for types from services and should not be used directly
|
||||
export type HighlightSpanKind = never;
|
||||
export type ScriptElementKind = never;
|
||||
export type ScriptKind = never;
|
||||
export type IndentStyle = never;
|
||||
export type JsxEmit = never;
|
||||
|
||||
+38
-15
@@ -80,6 +80,15 @@ var ts;
|
||||
ModuleKind[ModuleKind["ES2015"] = 5] = "ES2015";
|
||||
ModuleKind[ModuleKind["ESNext"] = 6] = "ESNext";
|
||||
})(ModuleKind = ts.ModuleKind || (ts.ModuleKind = {}));
|
||||
var Extension;
|
||||
(function (Extension) {
|
||||
Extension[Extension["Ts"] = 0] = "Ts";
|
||||
Extension[Extension["Tsx"] = 1] = "Tsx";
|
||||
Extension[Extension["Dts"] = 2] = "Dts";
|
||||
Extension[Extension["Js"] = 3] = "Js";
|
||||
Extension[Extension["Jsx"] = 4] = "Jsx";
|
||||
Extension[Extension["LastTypeScriptExtension"] = 2] = "LastTypeScriptExtension";
|
||||
})(Extension = ts.Extension || (ts.Extension = {}));
|
||||
})(ts || (ts = {}));
|
||||
var ts;
|
||||
(function (ts) {
|
||||
@@ -2123,7 +2132,7 @@ var ts;
|
||||
}
|
||||
ts.positionIsSynthesized = positionIsSynthesized;
|
||||
function extensionIsTypeScript(ext) {
|
||||
return ext === ".ts" || ext === ".tsx" || ext === ".d.ts";
|
||||
return ext <= ts.Extension.LastTypeScriptExtension;
|
||||
}
|
||||
ts.extensionIsTypeScript = extensionIsTypeScript;
|
||||
function extensionFromPath(path) {
|
||||
@@ -2135,7 +2144,21 @@ var ts;
|
||||
}
|
||||
ts.extensionFromPath = extensionFromPath;
|
||||
function tryGetExtensionFromPath(path) {
|
||||
return find(ts.supportedTypescriptExtensionsForExtractExtension, function (e) { return fileExtensionIs(path, e); }) || find(ts.supportedJavascriptExtensions, function (e) { return fileExtensionIs(path, e); });
|
||||
if (fileExtensionIs(path, ".d.ts")) {
|
||||
return ts.Extension.Dts;
|
||||
}
|
||||
if (fileExtensionIs(path, ".ts")) {
|
||||
return ts.Extension.Ts;
|
||||
}
|
||||
if (fileExtensionIs(path, ".tsx")) {
|
||||
return ts.Extension.Tsx;
|
||||
}
|
||||
if (fileExtensionIs(path, ".js")) {
|
||||
return ts.Extension.Js;
|
||||
}
|
||||
if (fileExtensionIs(path, ".jsx")) {
|
||||
return ts.Extension.Jsx;
|
||||
}
|
||||
}
|
||||
ts.tryGetExtensionFromPath = tryGetExtensionFromPath;
|
||||
function isCheckJsEnabledForFile(sourceFile, compilerOptions) {
|
||||
@@ -21555,14 +21578,14 @@ var ts;
|
||||
}
|
||||
switch (extensions) {
|
||||
case Extensions.DtsOnly:
|
||||
return tryExtension(".d.ts");
|
||||
return tryExtension(".d.ts", ts.Extension.Dts);
|
||||
case Extensions.TypeScript:
|
||||
return tryExtension(".ts") || tryExtension(".tsx") || tryExtension(".d.ts");
|
||||
return tryExtension(".ts", ts.Extension.Ts) || tryExtension(".tsx", ts.Extension.Tsx) || tryExtension(".d.ts", ts.Extension.Dts);
|
||||
case Extensions.JavaScript:
|
||||
return tryExtension(".js") || tryExtension(".jsx");
|
||||
return tryExtension(".js", ts.Extension.Js) || tryExtension(".jsx", ts.Extension.Jsx);
|
||||
}
|
||||
function tryExtension(extension) {
|
||||
var path = tryFile(candidate + extension, failedLookupLocations, onlyRecordFailures, state);
|
||||
function tryExtension(ext, extension) {
|
||||
var path = tryFile(candidate + ext, failedLookupLocations, onlyRecordFailures, state);
|
||||
return path && { path: path, extension: extension };
|
||||
}
|
||||
}
|
||||
@@ -21632,11 +21655,11 @@ var ts;
|
||||
function extensionIsOk(extensions, extension) {
|
||||
switch (extensions) {
|
||||
case Extensions.JavaScript:
|
||||
return extension === ".js" || extension === ".jsx";
|
||||
return extension === ts.Extension.Js || extension === ts.Extension.Jsx;
|
||||
case Extensions.TypeScript:
|
||||
return extension === ".ts" || extension === ".tsx" || extension === ".d.ts";
|
||||
return extension === ts.Extension.Ts || extension === ts.Extension.Tsx || extension === ts.Extension.Dts;
|
||||
case Extensions.DtsOnly:
|
||||
return extension === ".d.ts";
|
||||
return extension === ts.Extension.Dts;
|
||||
}
|
||||
}
|
||||
function pathToPackageJson(directory) {
|
||||
@@ -56483,14 +56506,14 @@ var ts;
|
||||
function getResolutionDiagnostic(options, _a) {
|
||||
var extension = _a.extension;
|
||||
switch (extension) {
|
||||
case ".ts":
|
||||
case ".d.ts":
|
||||
case ts.Extension.Ts:
|
||||
case ts.Extension.Dts:
|
||||
return undefined;
|
||||
case ".tsx":
|
||||
case ts.Extension.Tsx:
|
||||
return needJsx();
|
||||
case ".jsx":
|
||||
case ts.Extension.Jsx:
|
||||
return needJsx() || needAllowJs();
|
||||
case ".js":
|
||||
case ts.Extension.Js:
|
||||
return needAllowJs();
|
||||
}
|
||||
function needJsx() {
|
||||
|
||||
+405
-435
File diff suppressed because it is too large
Load Diff
Vendored
+231
-176
@@ -2201,11 +2201,12 @@ declare namespace ts {
|
||||
extension: Extension;
|
||||
}
|
||||
enum Extension {
|
||||
Ts = ".ts",
|
||||
Tsx = ".tsx",
|
||||
Dts = ".d.ts",
|
||||
Js = ".js",
|
||||
Jsx = ".jsx",
|
||||
Ts = 0,
|
||||
Tsx = 1,
|
||||
Dts = 2,
|
||||
Js = 3,
|
||||
Jsx = 4,
|
||||
LastTypeScriptExtension = 2,
|
||||
}
|
||||
interface ResolvedModuleWithFailedLookupLocations {
|
||||
resolvedModule: ResolvedModuleFull | undefined;
|
||||
@@ -3215,11 +3216,11 @@ declare namespace ts {
|
||||
}
|
||||
interface ClassifiedSpan {
|
||||
textSpan: TextSpan;
|
||||
classificationType: ClassificationTypeNames;
|
||||
classificationType: string;
|
||||
}
|
||||
interface NavigationBarItem {
|
||||
text: string;
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
kindModifiers: string;
|
||||
spans: TextSpan[];
|
||||
childItems: NavigationBarItem[];
|
||||
@@ -3229,7 +3230,7 @@ declare namespace ts {
|
||||
}
|
||||
interface NavigationTree {
|
||||
text: string;
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
kindModifiers: string;
|
||||
spans: TextSpan[];
|
||||
childItems?: NavigationTree[];
|
||||
@@ -3286,35 +3287,35 @@ declare namespace ts {
|
||||
isInString?: true;
|
||||
}
|
||||
interface ImplementationLocation extends DocumentSpan {
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
displayParts: SymbolDisplayPart[];
|
||||
}
|
||||
interface DocumentHighlights {
|
||||
fileName: string;
|
||||
highlightSpans: HighlightSpan[];
|
||||
}
|
||||
enum HighlightSpanKind {
|
||||
none = "none",
|
||||
definition = "definition",
|
||||
reference = "reference",
|
||||
writtenReference = "writtenReference",
|
||||
namespace HighlightSpanKind {
|
||||
const none = "none";
|
||||
const definition = "definition";
|
||||
const reference = "reference";
|
||||
const writtenReference = "writtenReference";
|
||||
}
|
||||
interface HighlightSpan {
|
||||
fileName?: string;
|
||||
isInString?: true;
|
||||
textSpan: TextSpan;
|
||||
kind: HighlightSpanKind;
|
||||
kind: string;
|
||||
}
|
||||
interface NavigateToItem {
|
||||
name: string;
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
kindModifiers: string;
|
||||
matchKind: string;
|
||||
isCaseSensitive: boolean;
|
||||
fileName: string;
|
||||
textSpan: TextSpan;
|
||||
containerName: string;
|
||||
containerKind: ScriptElementKind;
|
||||
containerKind: string;
|
||||
}
|
||||
enum IndentStyle {
|
||||
None = 0,
|
||||
@@ -3374,9 +3375,9 @@ declare namespace ts {
|
||||
interface DefinitionInfo {
|
||||
fileName: string;
|
||||
textSpan: TextSpan;
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
name: string;
|
||||
containerKind: ScriptElementKind;
|
||||
containerKind: string;
|
||||
containerName: string;
|
||||
}
|
||||
interface ReferencedSymbolDefinitionInfo extends DefinitionInfo {
|
||||
@@ -3419,7 +3420,7 @@ declare namespace ts {
|
||||
text?: string;
|
||||
}
|
||||
interface QuickInfo {
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
kindModifiers: string;
|
||||
textSpan: TextSpan;
|
||||
displayParts: SymbolDisplayPart[];
|
||||
@@ -3431,7 +3432,7 @@ declare namespace ts {
|
||||
localizedErrorMessage: string;
|
||||
displayName: string;
|
||||
fullDisplayName: string;
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
kindModifiers: string;
|
||||
triggerSpan: TextSpan;
|
||||
}
|
||||
@@ -3465,14 +3466,14 @@ declare namespace ts {
|
||||
}
|
||||
interface CompletionEntry {
|
||||
name: string;
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
kindModifiers: string;
|
||||
sortText: string;
|
||||
replacementSpan?: TextSpan;
|
||||
}
|
||||
interface CompletionEntryDetails {
|
||||
name: string;
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
kindModifiers: string;
|
||||
displayParts: SymbolDisplayPart[];
|
||||
documentation: SymbolDisplayPart[];
|
||||
@@ -3530,75 +3531,75 @@ declare namespace ts {
|
||||
getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult;
|
||||
getEncodedLexicalClassifications(text: string, endOfLineState: EndOfLineState, syntacticClassifierAbsent: boolean): Classifications;
|
||||
}
|
||||
enum ScriptElementKind {
|
||||
unknown = "",
|
||||
warning = "warning",
|
||||
keyword = "keyword",
|
||||
scriptElement = "script",
|
||||
moduleElement = "module",
|
||||
classElement = "class",
|
||||
localClassElement = "local class",
|
||||
interfaceElement = "interface",
|
||||
typeElement = "type",
|
||||
enumElement = "enum",
|
||||
enumMemberElement = "enum member",
|
||||
variableElement = "var",
|
||||
localVariableElement = "local var",
|
||||
functionElement = "function",
|
||||
localFunctionElement = "local function",
|
||||
memberFunctionElement = "method",
|
||||
memberGetAccessorElement = "getter",
|
||||
memberSetAccessorElement = "setter",
|
||||
memberVariableElement = "property",
|
||||
constructorImplementationElement = "constructor",
|
||||
callSignatureElement = "call",
|
||||
indexSignatureElement = "index",
|
||||
constructSignatureElement = "construct",
|
||||
parameterElement = "parameter",
|
||||
typeParameterElement = "type parameter",
|
||||
primitiveType = "primitive type",
|
||||
label = "label",
|
||||
alias = "alias",
|
||||
constElement = "const",
|
||||
letElement = "let",
|
||||
directory = "directory",
|
||||
externalModuleName = "external module name",
|
||||
jsxAttribute = "JSX attribute",
|
||||
namespace ScriptElementKind {
|
||||
const unknown = "";
|
||||
const warning = "warning";
|
||||
const keyword = "keyword";
|
||||
const scriptElement = "script";
|
||||
const moduleElement = "module";
|
||||
const classElement = "class";
|
||||
const localClassElement = "local class";
|
||||
const interfaceElement = "interface";
|
||||
const typeElement = "type";
|
||||
const enumElement = "enum";
|
||||
const enumMemberElement = "enum member";
|
||||
const variableElement = "var";
|
||||
const localVariableElement = "local var";
|
||||
const functionElement = "function";
|
||||
const localFunctionElement = "local function";
|
||||
const memberFunctionElement = "method";
|
||||
const memberGetAccessorElement = "getter";
|
||||
const memberSetAccessorElement = "setter";
|
||||
const memberVariableElement = "property";
|
||||
const constructorImplementationElement = "constructor";
|
||||
const callSignatureElement = "call";
|
||||
const indexSignatureElement = "index";
|
||||
const constructSignatureElement = "construct";
|
||||
const parameterElement = "parameter";
|
||||
const typeParameterElement = "type parameter";
|
||||
const primitiveType = "primitive type";
|
||||
const label = "label";
|
||||
const alias = "alias";
|
||||
const constElement = "const";
|
||||
const letElement = "let";
|
||||
const directory = "directory";
|
||||
const externalModuleName = "external module name";
|
||||
const jsxAttribute = "JSX attribute";
|
||||
}
|
||||
enum ScriptElementKindModifier {
|
||||
none = "",
|
||||
publicMemberModifier = "public",
|
||||
privateMemberModifier = "private",
|
||||
protectedMemberModifier = "protected",
|
||||
exportedModifier = "export",
|
||||
ambientModifier = "declare",
|
||||
staticModifier = "static",
|
||||
abstractModifier = "abstract",
|
||||
namespace ScriptElementKindModifier {
|
||||
const none = "";
|
||||
const publicMemberModifier = "public";
|
||||
const privateMemberModifier = "private";
|
||||
const protectedMemberModifier = "protected";
|
||||
const exportedModifier = "export";
|
||||
const ambientModifier = "declare";
|
||||
const staticModifier = "static";
|
||||
const abstractModifier = "abstract";
|
||||
}
|
||||
enum ClassificationTypeNames {
|
||||
comment = "comment",
|
||||
identifier = "identifier",
|
||||
keyword = "keyword",
|
||||
numericLiteral = "number",
|
||||
operator = "operator",
|
||||
stringLiteral = "string",
|
||||
whiteSpace = "whitespace",
|
||||
text = "text",
|
||||
punctuation = "punctuation",
|
||||
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",
|
||||
class ClassificationTypeNames {
|
||||
static comment: string;
|
||||
static identifier: string;
|
||||
static keyword: string;
|
||||
static numericLiteral: string;
|
||||
static operator: string;
|
||||
static stringLiteral: string;
|
||||
static whiteSpace: string;
|
||||
static text: string;
|
||||
static punctuation: string;
|
||||
static className: string;
|
||||
static enumName: string;
|
||||
static interfaceName: string;
|
||||
static moduleName: string;
|
||||
static typeParameterName: string;
|
||||
static typeAliasName: string;
|
||||
static parameterName: string;
|
||||
static docCommentTagName: string;
|
||||
static jsxOpenTagName: string;
|
||||
static jsxCloseTagName: string;
|
||||
static jsxSelfClosingTagName: string;
|
||||
static jsxAttribute: string;
|
||||
static jsxText: string;
|
||||
static jsxAttributeStringLiteralValue: string;
|
||||
}
|
||||
enum ClassificationType {
|
||||
comment = 1,
|
||||
@@ -3860,53 +3861,54 @@ declare namespace ts.server {
|
||||
}
|
||||
}
|
||||
declare namespace ts.server.protocol {
|
||||
enum CommandTypes {
|
||||
Brace = "brace",
|
||||
BraceCompletion = "braceCompletion",
|
||||
Change = "change",
|
||||
Close = "close",
|
||||
Completions = "completions",
|
||||
CompletionDetails = "completionEntryDetails",
|
||||
CompileOnSaveAffectedFileList = "compileOnSaveAffectedFileList",
|
||||
CompileOnSaveEmitFile = "compileOnSaveEmitFile",
|
||||
Configure = "configure",
|
||||
Definition = "definition",
|
||||
Implementation = "implementation",
|
||||
Exit = "exit",
|
||||
Format = "format",
|
||||
Formatonkey = "formatonkey",
|
||||
Geterr = "geterr",
|
||||
GeterrForProject = "geterrForProject",
|
||||
SemanticDiagnosticsSync = "semanticDiagnosticsSync",
|
||||
SyntacticDiagnosticsSync = "syntacticDiagnosticsSync",
|
||||
NavBar = "navbar",
|
||||
Navto = "navto",
|
||||
NavTree = "navtree",
|
||||
NavTreeFull = "navtree-full",
|
||||
Occurrences = "occurrences",
|
||||
DocumentHighlights = "documentHighlights",
|
||||
Open = "open",
|
||||
Quickinfo = "quickinfo",
|
||||
References = "references",
|
||||
Reload = "reload",
|
||||
Rename = "rename",
|
||||
Saveto = "saveto",
|
||||
SignatureHelp = "signatureHelp",
|
||||
TypeDefinition = "typeDefinition",
|
||||
ProjectInfo = "projectInfo",
|
||||
ReloadProjects = "reloadProjects",
|
||||
Unknown = "unknown",
|
||||
OpenExternalProject = "openExternalProject",
|
||||
OpenExternalProjects = "openExternalProjects",
|
||||
CloseExternalProject = "closeExternalProject",
|
||||
TodoComments = "todoComments",
|
||||
Indentation = "indentation",
|
||||
DocCommentTemplate = "docCommentTemplate",
|
||||
CompilerOptionsForInferredProjects = "compilerOptionsForInferredProjects",
|
||||
GetCodeFixes = "getCodeFixes",
|
||||
GetSupportedCodeFixes = "getSupportedCodeFixes",
|
||||
GetApplicableRefactors = "getApplicableRefactors",
|
||||
GetEditsForRefactor = "getEditsForRefactor",
|
||||
namespace CommandTypes {
|
||||
type Brace = "brace";
|
||||
type BraceCompletion = "braceCompletion";
|
||||
type Change = "change";
|
||||
type Close = "close";
|
||||
type Completions = "completions";
|
||||
type CompletionDetails = "completionEntryDetails";
|
||||
type CompileOnSaveAffectedFileList = "compileOnSaveAffectedFileList";
|
||||
type CompileOnSaveEmitFile = "compileOnSaveEmitFile";
|
||||
type Configure = "configure";
|
||||
type Definition = "definition";
|
||||
type Implementation = "implementation";
|
||||
type Exit = "exit";
|
||||
type Format = "format";
|
||||
type Formatonkey = "formatonkey";
|
||||
type Geterr = "geterr";
|
||||
type GeterrForProject = "geterrForProject";
|
||||
type SemanticDiagnosticsSync = "semanticDiagnosticsSync";
|
||||
type SyntacticDiagnosticsSync = "syntacticDiagnosticsSync";
|
||||
type NavBar = "navbar";
|
||||
type Navto = "navto";
|
||||
type NavTree = "navtree";
|
||||
type NavTreeFull = "navtree-full";
|
||||
type Occurrences = "occurrences";
|
||||
type DocumentHighlights = "documentHighlights";
|
||||
type Open = "open";
|
||||
type Quickinfo = "quickinfo";
|
||||
type References = "references";
|
||||
type Reload = "reload";
|
||||
type Rename = "rename";
|
||||
type Saveto = "saveto";
|
||||
type SignatureHelp = "signatureHelp";
|
||||
type TypeDefinition = "typeDefinition";
|
||||
type ProjectInfo = "projectInfo";
|
||||
type ReloadProjects = "reloadProjects";
|
||||
type Unknown = "unknown";
|
||||
type OpenExternalProject = "openExternalProject";
|
||||
type OpenExternalProjects = "openExternalProjects";
|
||||
type CloseExternalProject = "closeExternalProject";
|
||||
type TodoComments = "todoComments";
|
||||
type Indentation = "indentation";
|
||||
type DocCommentTemplate = "docCommentTemplate";
|
||||
type CompilerOptionsForInferredProjects = "compilerOptionsForInferredProjects";
|
||||
type GetCodeFixes = "getCodeFixes";
|
||||
type GetSupportedCodeFixes = "getSupportedCodeFixes";
|
||||
type GetApplicableRefactors = "getApplicableRefactors";
|
||||
type GetRefactorCodeActions = "getRefactorCodeActions";
|
||||
type GetEditsForRefactor = "getEditsForRefactor";
|
||||
}
|
||||
interface Message {
|
||||
seq: number;
|
||||
@@ -4119,7 +4121,7 @@ declare namespace ts.server.protocol {
|
||||
arguments: DocumentHighlightsRequestArgs;
|
||||
}
|
||||
interface HighlightSpan extends TextSpan {
|
||||
kind: HighlightSpanKind;
|
||||
kind: string;
|
||||
}
|
||||
interface DocumentHighlightsItem {
|
||||
file: string;
|
||||
@@ -4158,7 +4160,7 @@ declare namespace ts.server.protocol {
|
||||
localizedErrorMessage?: string;
|
||||
displayName: string;
|
||||
fullDisplayName: string;
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
kindModifiers: string;
|
||||
}
|
||||
interface SpanGroup {
|
||||
@@ -4278,7 +4280,7 @@ declare namespace ts.server.protocol {
|
||||
command: CommandTypes.Quickinfo;
|
||||
}
|
||||
interface QuickInfoResponseBody {
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
kindModifiers: string;
|
||||
start: Location;
|
||||
end: Location;
|
||||
@@ -4345,14 +4347,14 @@ declare namespace ts.server.protocol {
|
||||
}
|
||||
interface CompletionEntry {
|
||||
name: string;
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
kindModifiers: string;
|
||||
sortText: string;
|
||||
replacementSpan?: TextSpan;
|
||||
}
|
||||
interface CompletionEntryDetails {
|
||||
name: string;
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
kindModifiers: string;
|
||||
displayParts: SymbolDisplayPart[];
|
||||
documentation: SymbolDisplayPart[];
|
||||
@@ -4500,7 +4502,7 @@ declare namespace ts.server.protocol {
|
||||
}
|
||||
interface NavtoItem {
|
||||
name: string;
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
matchKind?: string;
|
||||
isCaseSensitive?: boolean;
|
||||
kindModifiers?: string;
|
||||
@@ -4508,7 +4510,7 @@ declare namespace ts.server.protocol {
|
||||
start: Location;
|
||||
end: Location;
|
||||
containerName?: string;
|
||||
containerKind?: ScriptElementKind;
|
||||
containerKind?: string;
|
||||
}
|
||||
interface NavtoResponse extends Response {
|
||||
body?: NavtoItem[];
|
||||
@@ -4534,7 +4536,7 @@ declare namespace ts.server.protocol {
|
||||
}
|
||||
interface NavigationBarItem {
|
||||
text: string;
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
kindModifiers?: string;
|
||||
spans: TextSpan[];
|
||||
childItems?: NavigationBarItem[];
|
||||
@@ -4542,7 +4544,7 @@ declare namespace ts.server.protocol {
|
||||
}
|
||||
interface NavigationTree {
|
||||
text: string;
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
kindModifiers: string;
|
||||
spans: TextSpan[];
|
||||
childItems?: NavigationTree[];
|
||||
@@ -4599,11 +4601,12 @@ declare namespace ts.server.protocol {
|
||||
interface NavTreeResponse extends Response {
|
||||
body?: NavigationTree;
|
||||
}
|
||||
enum IndentStyle {
|
||||
None = "None",
|
||||
Block = "Block",
|
||||
Smart = "Smart",
|
||||
namespace IndentStyle {
|
||||
type None = "None";
|
||||
type Block = "Block";
|
||||
type Smart = "Smart";
|
||||
}
|
||||
type IndentStyle = IndentStyle.None | IndentStyle.Block | IndentStyle.Smart;
|
||||
interface EditorSettings {
|
||||
baseIndentSize?: number;
|
||||
indentSize?: number;
|
||||
@@ -4696,35 +4699,40 @@ declare namespace ts.server.protocol {
|
||||
typeRoots?: string[];
|
||||
[option: string]: CompilerOptionsValue | undefined;
|
||||
}
|
||||
enum JsxEmit {
|
||||
None = "None",
|
||||
Preserve = "Preserve",
|
||||
ReactNative = "ReactNative",
|
||||
React = "React",
|
||||
namespace JsxEmit {
|
||||
type None = "None";
|
||||
type Preserve = "Preserve";
|
||||
type ReactNative = "ReactNative";
|
||||
type React = "React";
|
||||
}
|
||||
enum ModuleKind {
|
||||
None = "None",
|
||||
CommonJS = "CommonJS",
|
||||
AMD = "AMD",
|
||||
UMD = "UMD",
|
||||
System = "System",
|
||||
ES6 = "ES6",
|
||||
ES2015 = "ES2015",
|
||||
type JsxEmit = JsxEmit.None | JsxEmit.Preserve | JsxEmit.React | JsxEmit.ReactNative;
|
||||
namespace ModuleKind {
|
||||
type None = "None";
|
||||
type CommonJS = "CommonJS";
|
||||
type AMD = "AMD";
|
||||
type UMD = "UMD";
|
||||
type System = "System";
|
||||
type ES6 = "ES6";
|
||||
type ES2015 = "ES2015";
|
||||
}
|
||||
enum ModuleResolutionKind {
|
||||
Classic = "Classic",
|
||||
Node = "Node",
|
||||
type ModuleKind = ModuleKind.None | ModuleKind.CommonJS | ModuleKind.AMD | ModuleKind.UMD | ModuleKind.System | ModuleKind.ES6 | ModuleKind.ES2015;
|
||||
namespace ModuleResolutionKind {
|
||||
type Classic = "Classic";
|
||||
type Node = "Node";
|
||||
}
|
||||
enum NewLineKind {
|
||||
Crlf = "Crlf",
|
||||
Lf = "Lf",
|
||||
type ModuleResolutionKind = ModuleResolutionKind.Classic | ModuleResolutionKind.Node;
|
||||
namespace NewLineKind {
|
||||
type Crlf = "Crlf";
|
||||
type Lf = "Lf";
|
||||
}
|
||||
enum ScriptTarget {
|
||||
ES3 = "ES3",
|
||||
ES5 = "ES5",
|
||||
ES6 = "ES6",
|
||||
ES2015 = "ES2015",
|
||||
type NewLineKind = NewLineKind.Crlf | NewLineKind.Lf;
|
||||
namespace ScriptTarget {
|
||||
type ES3 = "ES3";
|
||||
type ES5 = "ES5";
|
||||
type ES6 = "ES6";
|
||||
type ES2015 = "ES2015";
|
||||
}
|
||||
type ScriptTarget = ScriptTarget.ES3 | ScriptTarget.ES5 | ScriptTarget.ES6 | ScriptTarget.ES2015;
|
||||
}
|
||||
declare namespace ts.server {
|
||||
interface ServerCancellationToken extends HostCancellationToken {
|
||||
@@ -4739,8 +4747,55 @@ declare namespace ts.server {
|
||||
interface EventSender {
|
||||
event<T>(payload: T, eventName: string): void;
|
||||
}
|
||||
type CommandNames = protocol.CommandTypes;
|
||||
const CommandNames: any;
|
||||
namespace CommandNames {
|
||||
const Brace: protocol.CommandTypes.Brace;
|
||||
const BraceCompletion: protocol.CommandTypes.BraceCompletion;
|
||||
const Change: protocol.CommandTypes.Change;
|
||||
const Close: protocol.CommandTypes.Close;
|
||||
const Completions: protocol.CommandTypes.Completions;
|
||||
const CompletionDetails: protocol.CommandTypes.CompletionDetails;
|
||||
const CompileOnSaveAffectedFileList: protocol.CommandTypes.CompileOnSaveAffectedFileList;
|
||||
const CompileOnSaveEmitFile: protocol.CommandTypes.CompileOnSaveEmitFile;
|
||||
const Configure: protocol.CommandTypes.Configure;
|
||||
const Definition: protocol.CommandTypes.Definition;
|
||||
const Exit: protocol.CommandTypes.Exit;
|
||||
const Format: protocol.CommandTypes.Format;
|
||||
const Formatonkey: protocol.CommandTypes.Formatonkey;
|
||||
const Geterr: protocol.CommandTypes.Geterr;
|
||||
const GeterrForProject: protocol.CommandTypes.GeterrForProject;
|
||||
const Implementation: protocol.CommandTypes.Implementation;
|
||||
const SemanticDiagnosticsSync: protocol.CommandTypes.SemanticDiagnosticsSync;
|
||||
const SyntacticDiagnosticsSync: protocol.CommandTypes.SyntacticDiagnosticsSync;
|
||||
const NavBar: protocol.CommandTypes.NavBar;
|
||||
const NavTree: protocol.CommandTypes.NavTree;
|
||||
const NavTreeFull: protocol.CommandTypes.NavTreeFull;
|
||||
const Navto: protocol.CommandTypes.Navto;
|
||||
const Occurrences: protocol.CommandTypes.Occurrences;
|
||||
const DocumentHighlights: protocol.CommandTypes.DocumentHighlights;
|
||||
const Open: protocol.CommandTypes.Open;
|
||||
const Quickinfo: protocol.CommandTypes.Quickinfo;
|
||||
const References: protocol.CommandTypes.References;
|
||||
const Reload: protocol.CommandTypes.Reload;
|
||||
const Rename: protocol.CommandTypes.Rename;
|
||||
const Saveto: protocol.CommandTypes.Saveto;
|
||||
const SignatureHelp: protocol.CommandTypes.SignatureHelp;
|
||||
const TypeDefinition: protocol.CommandTypes.TypeDefinition;
|
||||
const ProjectInfo: protocol.CommandTypes.ProjectInfo;
|
||||
const ReloadProjects: protocol.CommandTypes.ReloadProjects;
|
||||
const Unknown: protocol.CommandTypes.Unknown;
|
||||
const OpenExternalProject: protocol.CommandTypes.OpenExternalProject;
|
||||
const OpenExternalProjects: protocol.CommandTypes.OpenExternalProjects;
|
||||
const CloseExternalProject: protocol.CommandTypes.CloseExternalProject;
|
||||
const TodoComments: protocol.CommandTypes.TodoComments;
|
||||
const Indentation: protocol.CommandTypes.Indentation;
|
||||
const DocCommentTemplate: protocol.CommandTypes.DocCommentTemplate;
|
||||
const CompilerOptionsForInferredProjects: protocol.CommandTypes.CompilerOptionsForInferredProjects;
|
||||
const GetCodeFixes: protocol.CommandTypes.GetCodeFixes;
|
||||
const GetSupportedCodeFixes: protocol.CommandTypes.GetSupportedCodeFixes;
|
||||
const GetApplicableRefactors: protocol.CommandTypes.GetApplicableRefactors;
|
||||
const GetRefactorCodeActions: protocol.CommandTypes.GetRefactorCodeActions;
|
||||
const GetEditsForRefactor: protocol.CommandTypes.GetEditsForRefactor;
|
||||
}
|
||||
function formatMessage<T extends protocol.Message>(msg: T, logger: server.Logger, byteLength: (s: string, encoding: string) => number, newLine: string): string;
|
||||
interface SessionOptions {
|
||||
host: ServerHost;
|
||||
|
||||
+405
-435
File diff suppressed because it is too large
Load Diff
Vendored
+92
-90
@@ -2333,11 +2333,12 @@ declare namespace ts {
|
||||
extension: Extension;
|
||||
}
|
||||
enum Extension {
|
||||
Ts = ".ts",
|
||||
Tsx = ".tsx",
|
||||
Dts = ".d.ts",
|
||||
Js = ".js",
|
||||
Jsx = ".jsx",
|
||||
Ts = 0,
|
||||
Tsx = 1,
|
||||
Dts = 2,
|
||||
Js = 3,
|
||||
Jsx = 4,
|
||||
LastTypeScriptExtension = 2,
|
||||
}
|
||||
interface ResolvedModuleWithFailedLookupLocations {
|
||||
resolvedModule: ResolvedModuleFull | undefined;
|
||||
@@ -3756,7 +3757,7 @@ declare namespace ts {
|
||||
}
|
||||
interface ClassifiedSpan {
|
||||
textSpan: TextSpan;
|
||||
classificationType: ClassificationTypeNames;
|
||||
classificationType: string;
|
||||
}
|
||||
/**
|
||||
* Navigation bar interface designed for visual studio's dual-column layout.
|
||||
@@ -3766,7 +3767,7 @@ declare namespace ts {
|
||||
*/
|
||||
interface NavigationBarItem {
|
||||
text: string;
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
kindModifiers: string;
|
||||
spans: TextSpan[];
|
||||
childItems: NavigationBarItem[];
|
||||
@@ -3781,7 +3782,8 @@ declare namespace ts {
|
||||
interface NavigationTree {
|
||||
/** Name of the declaration, or a short description, e.g. "<class>". */
|
||||
text: string;
|
||||
kind: ScriptElementKind;
|
||||
/** A ScriptElementKind */
|
||||
kind: string;
|
||||
/** ScriptElementKindModifier separated by commas, e.g. "public,abstract" */
|
||||
kindModifiers: string;
|
||||
/**
|
||||
@@ -3880,35 +3882,35 @@ declare namespace ts {
|
||||
isInString?: true;
|
||||
}
|
||||
interface ImplementationLocation extends DocumentSpan {
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
displayParts: SymbolDisplayPart[];
|
||||
}
|
||||
interface DocumentHighlights {
|
||||
fileName: string;
|
||||
highlightSpans: HighlightSpan[];
|
||||
}
|
||||
enum HighlightSpanKind {
|
||||
none = "none",
|
||||
definition = "definition",
|
||||
reference = "reference",
|
||||
writtenReference = "writtenReference",
|
||||
namespace HighlightSpanKind {
|
||||
const none = "none";
|
||||
const definition = "definition";
|
||||
const reference = "reference";
|
||||
const writtenReference = "writtenReference";
|
||||
}
|
||||
interface HighlightSpan {
|
||||
fileName?: string;
|
||||
isInString?: true;
|
||||
textSpan: TextSpan;
|
||||
kind: HighlightSpanKind;
|
||||
kind: string;
|
||||
}
|
||||
interface NavigateToItem {
|
||||
name: string;
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
kindModifiers: string;
|
||||
matchKind: string;
|
||||
isCaseSensitive: boolean;
|
||||
fileName: string;
|
||||
textSpan: TextSpan;
|
||||
containerName: string;
|
||||
containerKind: ScriptElementKind;
|
||||
containerKind: string;
|
||||
}
|
||||
enum IndentStyle {
|
||||
None = 0,
|
||||
@@ -3968,9 +3970,9 @@ declare namespace ts {
|
||||
interface DefinitionInfo {
|
||||
fileName: string;
|
||||
textSpan: TextSpan;
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
name: string;
|
||||
containerKind: ScriptElementKind;
|
||||
containerKind: string;
|
||||
containerName: string;
|
||||
}
|
||||
interface ReferencedSymbolDefinitionInfo extends DefinitionInfo {
|
||||
@@ -4013,7 +4015,7 @@ declare namespace ts {
|
||||
text?: string;
|
||||
}
|
||||
interface QuickInfo {
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
kindModifiers: string;
|
||||
textSpan: TextSpan;
|
||||
displayParts: SymbolDisplayPart[];
|
||||
@@ -4025,7 +4027,7 @@ declare namespace ts {
|
||||
localizedErrorMessage: string;
|
||||
displayName: string;
|
||||
fullDisplayName: string;
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
kindModifiers: string;
|
||||
triggerSpan: TextSpan;
|
||||
}
|
||||
@@ -4072,7 +4074,7 @@ declare namespace ts {
|
||||
}
|
||||
interface CompletionEntry {
|
||||
name: string;
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
kindModifiers: string;
|
||||
sortText: string;
|
||||
/**
|
||||
@@ -4084,7 +4086,7 @@ declare namespace ts {
|
||||
}
|
||||
interface CompletionEntryDetails {
|
||||
name: string;
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
kindModifiers: string;
|
||||
displayParts: SymbolDisplayPart[];
|
||||
documentation: SymbolDisplayPart[];
|
||||
@@ -4169,107 +4171,107 @@ declare namespace ts {
|
||||
getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult;
|
||||
getEncodedLexicalClassifications(text: string, endOfLineState: EndOfLineState, syntacticClassifierAbsent: boolean): Classifications;
|
||||
}
|
||||
enum ScriptElementKind {
|
||||
unknown = "",
|
||||
warning = "warning",
|
||||
namespace ScriptElementKind {
|
||||
const unknown = "";
|
||||
const warning = "warning";
|
||||
/** predefined type (void) or keyword (class) */
|
||||
keyword = "keyword",
|
||||
const keyword = "keyword";
|
||||
/** top level script node */
|
||||
scriptElement = "script",
|
||||
const scriptElement = "script";
|
||||
/** module foo {} */
|
||||
moduleElement = "module",
|
||||
const moduleElement = "module";
|
||||
/** class X {} */
|
||||
classElement = "class",
|
||||
const classElement = "class";
|
||||
/** var x = class X {} */
|
||||
localClassElement = "local class",
|
||||
const localClassElement = "local class";
|
||||
/** interface Y {} */
|
||||
interfaceElement = "interface",
|
||||
const interfaceElement = "interface";
|
||||
/** type T = ... */
|
||||
typeElement = "type",
|
||||
const typeElement = "type";
|
||||
/** enum E */
|
||||
enumElement = "enum",
|
||||
enumMemberElement = "enum member",
|
||||
const enumElement = "enum";
|
||||
const enumMemberElement = "enum member";
|
||||
/**
|
||||
* Inside module and script only
|
||||
* const v = ..
|
||||
*/
|
||||
variableElement = "var",
|
||||
const variableElement = "var";
|
||||
/** Inside function */
|
||||
localVariableElement = "local var",
|
||||
const localVariableElement = "local var";
|
||||
/**
|
||||
* Inside module and script only
|
||||
* function f() { }
|
||||
*/
|
||||
functionElement = "function",
|
||||
const functionElement = "function";
|
||||
/** Inside function */
|
||||
localFunctionElement = "local function",
|
||||
const localFunctionElement = "local function";
|
||||
/** class X { [public|private]* foo() {} } */
|
||||
memberFunctionElement = "method",
|
||||
const memberFunctionElement = "method";
|
||||
/** class X { [public|private]* [get|set] foo:number; } */
|
||||
memberGetAccessorElement = "getter",
|
||||
memberSetAccessorElement = "setter",
|
||||
const memberGetAccessorElement = "getter";
|
||||
const memberSetAccessorElement = "setter";
|
||||
/**
|
||||
* class X { [public|private]* foo:number; }
|
||||
* interface Y { foo:number; }
|
||||
*/
|
||||
memberVariableElement = "property",
|
||||
const memberVariableElement = "property";
|
||||
/** class X { constructor() { } } */
|
||||
constructorImplementationElement = "constructor",
|
||||
const constructorImplementationElement = "constructor";
|
||||
/** interface Y { ():number; } */
|
||||
callSignatureElement = "call",
|
||||
const callSignatureElement = "call";
|
||||
/** interface Y { []:number; } */
|
||||
indexSignatureElement = "index",
|
||||
const indexSignatureElement = "index";
|
||||
/** interface Y { new():Y; } */
|
||||
constructSignatureElement = "construct",
|
||||
const constructSignatureElement = "construct";
|
||||
/** function foo(*Y*: string) */
|
||||
parameterElement = "parameter",
|
||||
typeParameterElement = "type parameter",
|
||||
primitiveType = "primitive type",
|
||||
label = "label",
|
||||
alias = "alias",
|
||||
constElement = "const",
|
||||
letElement = "let",
|
||||
directory = "directory",
|
||||
externalModuleName = "external module name",
|
||||
const parameterElement = "parameter";
|
||||
const typeParameterElement = "type parameter";
|
||||
const primitiveType = "primitive type";
|
||||
const label = "label";
|
||||
const alias = "alias";
|
||||
const constElement = "const";
|
||||
const letElement = "let";
|
||||
const directory = "directory";
|
||||
const externalModuleName = "external module name";
|
||||
/**
|
||||
* <JsxTagName attribute1 attribute2={0} />
|
||||
*/
|
||||
jsxAttribute = "JSX attribute",
|
||||
const jsxAttribute = "JSX attribute";
|
||||
}
|
||||
enum ScriptElementKindModifier {
|
||||
none = "",
|
||||
publicMemberModifier = "public",
|
||||
privateMemberModifier = "private",
|
||||
protectedMemberModifier = "protected",
|
||||
exportedModifier = "export",
|
||||
ambientModifier = "declare",
|
||||
staticModifier = "static",
|
||||
abstractModifier = "abstract",
|
||||
namespace ScriptElementKindModifier {
|
||||
const none = "";
|
||||
const publicMemberModifier = "public";
|
||||
const privateMemberModifier = "private";
|
||||
const protectedMemberModifier = "protected";
|
||||
const exportedModifier = "export";
|
||||
const ambientModifier = "declare";
|
||||
const staticModifier = "static";
|
||||
const abstractModifier = "abstract";
|
||||
}
|
||||
enum ClassificationTypeNames {
|
||||
comment = "comment",
|
||||
identifier = "identifier",
|
||||
keyword = "keyword",
|
||||
numericLiteral = "number",
|
||||
operator = "operator",
|
||||
stringLiteral = "string",
|
||||
whiteSpace = "whitespace",
|
||||
text = "text",
|
||||
punctuation = "punctuation",
|
||||
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",
|
||||
class ClassificationTypeNames {
|
||||
static comment: string;
|
||||
static identifier: string;
|
||||
static keyword: string;
|
||||
static numericLiteral: string;
|
||||
static operator: string;
|
||||
static stringLiteral: string;
|
||||
static whiteSpace: string;
|
||||
static text: string;
|
||||
static punctuation: string;
|
||||
static className: string;
|
||||
static enumName: string;
|
||||
static interfaceName: string;
|
||||
static moduleName: string;
|
||||
static typeParameterName: string;
|
||||
static typeAliasName: string;
|
||||
static parameterName: string;
|
||||
static docCommentTagName: string;
|
||||
static jsxOpenTagName: string;
|
||||
static jsxCloseTagName: string;
|
||||
static jsxSelfClosingTagName: string;
|
||||
static jsxAttribute: string;
|
||||
static jsxText: string;
|
||||
static jsxAttributeStringLiteralValue: string;
|
||||
}
|
||||
enum ClassificationType {
|
||||
comment = 1,
|
||||
|
||||
+277
-257
File diff suppressed because it is too large
Load Diff
Vendored
+92
-90
@@ -2333,11 +2333,12 @@ declare namespace ts {
|
||||
extension: Extension;
|
||||
}
|
||||
enum Extension {
|
||||
Ts = ".ts",
|
||||
Tsx = ".tsx",
|
||||
Dts = ".d.ts",
|
||||
Js = ".js",
|
||||
Jsx = ".jsx",
|
||||
Ts = 0,
|
||||
Tsx = 1,
|
||||
Dts = 2,
|
||||
Js = 3,
|
||||
Jsx = 4,
|
||||
LastTypeScriptExtension = 2,
|
||||
}
|
||||
interface ResolvedModuleWithFailedLookupLocations {
|
||||
resolvedModule: ResolvedModuleFull | undefined;
|
||||
@@ -3756,7 +3757,7 @@ declare namespace ts {
|
||||
}
|
||||
interface ClassifiedSpan {
|
||||
textSpan: TextSpan;
|
||||
classificationType: ClassificationTypeNames;
|
||||
classificationType: string;
|
||||
}
|
||||
/**
|
||||
* Navigation bar interface designed for visual studio's dual-column layout.
|
||||
@@ -3766,7 +3767,7 @@ declare namespace ts {
|
||||
*/
|
||||
interface NavigationBarItem {
|
||||
text: string;
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
kindModifiers: string;
|
||||
spans: TextSpan[];
|
||||
childItems: NavigationBarItem[];
|
||||
@@ -3781,7 +3782,8 @@ declare namespace ts {
|
||||
interface NavigationTree {
|
||||
/** Name of the declaration, or a short description, e.g. "<class>". */
|
||||
text: string;
|
||||
kind: ScriptElementKind;
|
||||
/** A ScriptElementKind */
|
||||
kind: string;
|
||||
/** ScriptElementKindModifier separated by commas, e.g. "public,abstract" */
|
||||
kindModifiers: string;
|
||||
/**
|
||||
@@ -3880,35 +3882,35 @@ declare namespace ts {
|
||||
isInString?: true;
|
||||
}
|
||||
interface ImplementationLocation extends DocumentSpan {
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
displayParts: SymbolDisplayPart[];
|
||||
}
|
||||
interface DocumentHighlights {
|
||||
fileName: string;
|
||||
highlightSpans: HighlightSpan[];
|
||||
}
|
||||
enum HighlightSpanKind {
|
||||
none = "none",
|
||||
definition = "definition",
|
||||
reference = "reference",
|
||||
writtenReference = "writtenReference",
|
||||
namespace HighlightSpanKind {
|
||||
const none = "none";
|
||||
const definition = "definition";
|
||||
const reference = "reference";
|
||||
const writtenReference = "writtenReference";
|
||||
}
|
||||
interface HighlightSpan {
|
||||
fileName?: string;
|
||||
isInString?: true;
|
||||
textSpan: TextSpan;
|
||||
kind: HighlightSpanKind;
|
||||
kind: string;
|
||||
}
|
||||
interface NavigateToItem {
|
||||
name: string;
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
kindModifiers: string;
|
||||
matchKind: string;
|
||||
isCaseSensitive: boolean;
|
||||
fileName: string;
|
||||
textSpan: TextSpan;
|
||||
containerName: string;
|
||||
containerKind: ScriptElementKind;
|
||||
containerKind: string;
|
||||
}
|
||||
enum IndentStyle {
|
||||
None = 0,
|
||||
@@ -3968,9 +3970,9 @@ declare namespace ts {
|
||||
interface DefinitionInfo {
|
||||
fileName: string;
|
||||
textSpan: TextSpan;
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
name: string;
|
||||
containerKind: ScriptElementKind;
|
||||
containerKind: string;
|
||||
containerName: string;
|
||||
}
|
||||
interface ReferencedSymbolDefinitionInfo extends DefinitionInfo {
|
||||
@@ -4013,7 +4015,7 @@ declare namespace ts {
|
||||
text?: string;
|
||||
}
|
||||
interface QuickInfo {
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
kindModifiers: string;
|
||||
textSpan: TextSpan;
|
||||
displayParts: SymbolDisplayPart[];
|
||||
@@ -4025,7 +4027,7 @@ declare namespace ts {
|
||||
localizedErrorMessage: string;
|
||||
displayName: string;
|
||||
fullDisplayName: string;
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
kindModifiers: string;
|
||||
triggerSpan: TextSpan;
|
||||
}
|
||||
@@ -4072,7 +4074,7 @@ declare namespace ts {
|
||||
}
|
||||
interface CompletionEntry {
|
||||
name: string;
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
kindModifiers: string;
|
||||
sortText: string;
|
||||
/**
|
||||
@@ -4084,7 +4086,7 @@ declare namespace ts {
|
||||
}
|
||||
interface CompletionEntryDetails {
|
||||
name: string;
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
kindModifiers: string;
|
||||
displayParts: SymbolDisplayPart[];
|
||||
documentation: SymbolDisplayPart[];
|
||||
@@ -4169,107 +4171,107 @@ declare namespace ts {
|
||||
getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult;
|
||||
getEncodedLexicalClassifications(text: string, endOfLineState: EndOfLineState, syntacticClassifierAbsent: boolean): Classifications;
|
||||
}
|
||||
enum ScriptElementKind {
|
||||
unknown = "",
|
||||
warning = "warning",
|
||||
namespace ScriptElementKind {
|
||||
const unknown = "";
|
||||
const warning = "warning";
|
||||
/** predefined type (void) or keyword (class) */
|
||||
keyword = "keyword",
|
||||
const keyword = "keyword";
|
||||
/** top level script node */
|
||||
scriptElement = "script",
|
||||
const scriptElement = "script";
|
||||
/** module foo {} */
|
||||
moduleElement = "module",
|
||||
const moduleElement = "module";
|
||||
/** class X {} */
|
||||
classElement = "class",
|
||||
const classElement = "class";
|
||||
/** var x = class X {} */
|
||||
localClassElement = "local class",
|
||||
const localClassElement = "local class";
|
||||
/** interface Y {} */
|
||||
interfaceElement = "interface",
|
||||
const interfaceElement = "interface";
|
||||
/** type T = ... */
|
||||
typeElement = "type",
|
||||
const typeElement = "type";
|
||||
/** enum E */
|
||||
enumElement = "enum",
|
||||
enumMemberElement = "enum member",
|
||||
const enumElement = "enum";
|
||||
const enumMemberElement = "enum member";
|
||||
/**
|
||||
* Inside module and script only
|
||||
* const v = ..
|
||||
*/
|
||||
variableElement = "var",
|
||||
const variableElement = "var";
|
||||
/** Inside function */
|
||||
localVariableElement = "local var",
|
||||
const localVariableElement = "local var";
|
||||
/**
|
||||
* Inside module and script only
|
||||
* function f() { }
|
||||
*/
|
||||
functionElement = "function",
|
||||
const functionElement = "function";
|
||||
/** Inside function */
|
||||
localFunctionElement = "local function",
|
||||
const localFunctionElement = "local function";
|
||||
/** class X { [public|private]* foo() {} } */
|
||||
memberFunctionElement = "method",
|
||||
const memberFunctionElement = "method";
|
||||
/** class X { [public|private]* [get|set] foo:number; } */
|
||||
memberGetAccessorElement = "getter",
|
||||
memberSetAccessorElement = "setter",
|
||||
const memberGetAccessorElement = "getter";
|
||||
const memberSetAccessorElement = "setter";
|
||||
/**
|
||||
* class X { [public|private]* foo:number; }
|
||||
* interface Y { foo:number; }
|
||||
*/
|
||||
memberVariableElement = "property",
|
||||
const memberVariableElement = "property";
|
||||
/** class X { constructor() { } } */
|
||||
constructorImplementationElement = "constructor",
|
||||
const constructorImplementationElement = "constructor";
|
||||
/** interface Y { ():number; } */
|
||||
callSignatureElement = "call",
|
||||
const callSignatureElement = "call";
|
||||
/** interface Y { []:number; } */
|
||||
indexSignatureElement = "index",
|
||||
const indexSignatureElement = "index";
|
||||
/** interface Y { new():Y; } */
|
||||
constructSignatureElement = "construct",
|
||||
const constructSignatureElement = "construct";
|
||||
/** function foo(*Y*: string) */
|
||||
parameterElement = "parameter",
|
||||
typeParameterElement = "type parameter",
|
||||
primitiveType = "primitive type",
|
||||
label = "label",
|
||||
alias = "alias",
|
||||
constElement = "const",
|
||||
letElement = "let",
|
||||
directory = "directory",
|
||||
externalModuleName = "external module name",
|
||||
const parameterElement = "parameter";
|
||||
const typeParameterElement = "type parameter";
|
||||
const primitiveType = "primitive type";
|
||||
const label = "label";
|
||||
const alias = "alias";
|
||||
const constElement = "const";
|
||||
const letElement = "let";
|
||||
const directory = "directory";
|
||||
const externalModuleName = "external module name";
|
||||
/**
|
||||
* <JsxTagName attribute1 attribute2={0} />
|
||||
*/
|
||||
jsxAttribute = "JSX attribute",
|
||||
const jsxAttribute = "JSX attribute";
|
||||
}
|
||||
enum ScriptElementKindModifier {
|
||||
none = "",
|
||||
publicMemberModifier = "public",
|
||||
privateMemberModifier = "private",
|
||||
protectedMemberModifier = "protected",
|
||||
exportedModifier = "export",
|
||||
ambientModifier = "declare",
|
||||
staticModifier = "static",
|
||||
abstractModifier = "abstract",
|
||||
namespace ScriptElementKindModifier {
|
||||
const none = "";
|
||||
const publicMemberModifier = "public";
|
||||
const privateMemberModifier = "private";
|
||||
const protectedMemberModifier = "protected";
|
||||
const exportedModifier = "export";
|
||||
const ambientModifier = "declare";
|
||||
const staticModifier = "static";
|
||||
const abstractModifier = "abstract";
|
||||
}
|
||||
enum ClassificationTypeNames {
|
||||
comment = "comment",
|
||||
identifier = "identifier",
|
||||
keyword = "keyword",
|
||||
numericLiteral = "number",
|
||||
operator = "operator",
|
||||
stringLiteral = "string",
|
||||
whiteSpace = "whitespace",
|
||||
text = "text",
|
||||
punctuation = "punctuation",
|
||||
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",
|
||||
class ClassificationTypeNames {
|
||||
static comment: string;
|
||||
static identifier: string;
|
||||
static keyword: string;
|
||||
static numericLiteral: string;
|
||||
static operator: string;
|
||||
static stringLiteral: string;
|
||||
static whiteSpace: string;
|
||||
static text: string;
|
||||
static punctuation: string;
|
||||
static className: string;
|
||||
static enumName: string;
|
||||
static interfaceName: string;
|
||||
static moduleName: string;
|
||||
static typeParameterName: string;
|
||||
static typeAliasName: string;
|
||||
static parameterName: string;
|
||||
static docCommentTagName: string;
|
||||
static jsxOpenTagName: string;
|
||||
static jsxCloseTagName: string;
|
||||
static jsxSelfClosingTagName: string;
|
||||
static jsxAttribute: string;
|
||||
static jsxText: string;
|
||||
static jsxAttributeStringLiteralValue: string;
|
||||
}
|
||||
enum ClassificationType {
|
||||
comment = 1,
|
||||
|
||||
+277
-257
File diff suppressed because it is too large
Load Diff
+33
-10
@@ -90,6 +90,15 @@ var ts;
|
||||
ModuleKind[ModuleKind["ES2015"] = 5] = "ES2015";
|
||||
ModuleKind[ModuleKind["ESNext"] = 6] = "ESNext";
|
||||
})(ModuleKind = ts.ModuleKind || (ts.ModuleKind = {}));
|
||||
var Extension;
|
||||
(function (Extension) {
|
||||
Extension[Extension["Ts"] = 0] = "Ts";
|
||||
Extension[Extension["Tsx"] = 1] = "Tsx";
|
||||
Extension[Extension["Dts"] = 2] = "Dts";
|
||||
Extension[Extension["Js"] = 3] = "Js";
|
||||
Extension[Extension["Jsx"] = 4] = "Jsx";
|
||||
Extension[Extension["LastTypeScriptExtension"] = 2] = "LastTypeScriptExtension";
|
||||
})(Extension = ts.Extension || (ts.Extension = {}));
|
||||
})(ts || (ts = {}));
|
||||
var ts;
|
||||
(function (ts) {
|
||||
@@ -2133,7 +2142,7 @@ var ts;
|
||||
}
|
||||
ts.positionIsSynthesized = positionIsSynthesized;
|
||||
function extensionIsTypeScript(ext) {
|
||||
return ext === ".ts" || ext === ".tsx" || ext === ".d.ts";
|
||||
return ext <= ts.Extension.LastTypeScriptExtension;
|
||||
}
|
||||
ts.extensionIsTypeScript = extensionIsTypeScript;
|
||||
function extensionFromPath(path) {
|
||||
@@ -2145,7 +2154,21 @@ var ts;
|
||||
}
|
||||
ts.extensionFromPath = extensionFromPath;
|
||||
function tryGetExtensionFromPath(path) {
|
||||
return find(ts.supportedTypescriptExtensionsForExtractExtension, function (e) { return fileExtensionIs(path, e); }) || find(ts.supportedJavascriptExtensions, function (e) { return fileExtensionIs(path, e); });
|
||||
if (fileExtensionIs(path, ".d.ts")) {
|
||||
return ts.Extension.Dts;
|
||||
}
|
||||
if (fileExtensionIs(path, ".ts")) {
|
||||
return ts.Extension.Ts;
|
||||
}
|
||||
if (fileExtensionIs(path, ".tsx")) {
|
||||
return ts.Extension.Tsx;
|
||||
}
|
||||
if (fileExtensionIs(path, ".js")) {
|
||||
return ts.Extension.Js;
|
||||
}
|
||||
if (fileExtensionIs(path, ".jsx")) {
|
||||
return ts.Extension.Jsx;
|
||||
}
|
||||
}
|
||||
ts.tryGetExtensionFromPath = tryGetExtensionFromPath;
|
||||
function isCheckJsEnabledForFile(sourceFile, compilerOptions) {
|
||||
@@ -7174,14 +7197,14 @@ var ts;
|
||||
}
|
||||
switch (extensions) {
|
||||
case Extensions.DtsOnly:
|
||||
return tryExtension(".d.ts");
|
||||
return tryExtension(".d.ts", ts.Extension.Dts);
|
||||
case Extensions.TypeScript:
|
||||
return tryExtension(".ts") || tryExtension(".tsx") || tryExtension(".d.ts");
|
||||
return tryExtension(".ts", ts.Extension.Ts) || tryExtension(".tsx", ts.Extension.Tsx) || tryExtension(".d.ts", ts.Extension.Dts);
|
||||
case Extensions.JavaScript:
|
||||
return tryExtension(".js") || tryExtension(".jsx");
|
||||
return tryExtension(".js", ts.Extension.Js) || tryExtension(".jsx", ts.Extension.Jsx);
|
||||
}
|
||||
function tryExtension(extension) {
|
||||
var path = tryFile(candidate + extension, failedLookupLocations, onlyRecordFailures, state);
|
||||
function tryExtension(ext, extension) {
|
||||
var path = tryFile(candidate + ext, failedLookupLocations, onlyRecordFailures, state);
|
||||
return path && { path: path, extension: extension };
|
||||
}
|
||||
}
|
||||
@@ -7251,11 +7274,11 @@ var ts;
|
||||
function extensionIsOk(extensions, extension) {
|
||||
switch (extensions) {
|
||||
case Extensions.JavaScript:
|
||||
return extension === ".js" || extension === ".jsx";
|
||||
return extension === ts.Extension.Js || extension === ts.Extension.Jsx;
|
||||
case Extensions.TypeScript:
|
||||
return extension === ".ts" || extension === ".tsx" || extension === ".d.ts";
|
||||
return extension === ts.Extension.Ts || extension === ts.Extension.Tsx || extension === ts.Extension.Dts;
|
||||
case Extensions.DtsOnly:
|
||||
return extension === ".d.ts";
|
||||
return extension === ts.Extension.Dts;
|
||||
}
|
||||
}
|
||||
function pathToPackageJson(directory) {
|
||||
|
||||
+25
-11
@@ -2131,13 +2131,13 @@ namespace ts {
|
||||
export function getScriptKindFromFileName(fileName: string): ScriptKind {
|
||||
const ext = fileName.substr(fileName.lastIndexOf("."));
|
||||
switch (ext.toLowerCase()) {
|
||||
case Extension.Js:
|
||||
case ".js":
|
||||
return ScriptKind.JS;
|
||||
case Extension.Jsx:
|
||||
case ".jsx":
|
||||
return ScriptKind.JSX;
|
||||
case Extension.Ts:
|
||||
case ".ts":
|
||||
return ScriptKind.TS;
|
||||
case Extension.Tsx:
|
||||
case ".tsx":
|
||||
return ScriptKind.TSX;
|
||||
default:
|
||||
return ScriptKind.Unknown;
|
||||
@@ -2147,10 +2147,10 @@ namespace ts {
|
||||
/**
|
||||
* List of supported extensions in order of file resolution precedence.
|
||||
*/
|
||||
export const supportedTypeScriptExtensions = [Extension.Ts, Extension.Tsx, Extension.Dts];
|
||||
export const supportedTypeScriptExtensions = [".ts", ".tsx", ".d.ts"];
|
||||
/** Must have ".d.ts" first because if ".ts" goes first, that will be detected as the extension instead of ".d.ts". */
|
||||
export const supportedTypescriptExtensionsForExtractExtension = [Extension.Dts, Extension.Ts, Extension.Tsx];
|
||||
export const supportedJavascriptExtensions = [Extension.Js, Extension.Jsx];
|
||||
export const supportedTypescriptExtensionsForExtractExtension = [".d.ts", ".ts", ".tsx"];
|
||||
export const supportedJavascriptExtensions = [".js", ".jsx"];
|
||||
const allSupportedExtensions = supportedTypeScriptExtensions.concat(supportedJavascriptExtensions);
|
||||
|
||||
export function getSupportedExtensions(options?: CompilerOptions, extraFileExtensions?: JsFileExtensionInfo[]): string[] {
|
||||
@@ -2158,7 +2158,7 @@ namespace ts {
|
||||
if (!extraFileExtensions || extraFileExtensions.length === 0 || !needAllExtensions) {
|
||||
return needAllExtensions ? allSupportedExtensions : supportedTypeScriptExtensions;
|
||||
}
|
||||
const extensions: string[] = allSupportedExtensions.slice(0);
|
||||
const extensions = allSupportedExtensions.slice(0);
|
||||
for (const extInfo of extraFileExtensions) {
|
||||
if (extensions.indexOf(extInfo.extension) === -1) {
|
||||
extensions.push(extInfo.extension);
|
||||
@@ -2237,7 +2237,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
const extensionsToRemove = [Extension.Dts, Extension.Ts, Extension.Js, Extension.Tsx, Extension.Jsx];
|
||||
const extensionsToRemove = [".d.ts", ".ts", ".js", ".tsx", ".jsx"];
|
||||
export function removeFileExtension(path: string): string {
|
||||
for (const ext of extensionsToRemove) {
|
||||
const extensionless = tryRemoveExtension(path, ext);
|
||||
@@ -2491,7 +2491,7 @@ namespace ts {
|
||||
|
||||
/** True if an extension is one of the supported TypeScript extensions. */
|
||||
export function extensionIsTypeScript(ext: Extension): boolean {
|
||||
return ext === Extension.Ts || ext === Extension.Tsx || ext === Extension.Dts;
|
||||
return ext <= Extension.LastTypeScriptExtension;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2506,7 +2506,21 @@ namespace ts {
|
||||
Debug.fail(`File ${path} has unknown extension.`);
|
||||
}
|
||||
export function tryGetExtensionFromPath(path: string): Extension | undefined {
|
||||
return find(supportedTypescriptExtensionsForExtractExtension, e => fileExtensionIs(path, e)) || find(supportedJavascriptExtensions, e => fileExtensionIs(path, e));
|
||||
if (fileExtensionIs(path, ".d.ts")) {
|
||||
return Extension.Dts;
|
||||
}
|
||||
if (fileExtensionIs(path, ".ts")) {
|
||||
return Extension.Ts;
|
||||
}
|
||||
if (fileExtensionIs(path, ".tsx")) {
|
||||
return Extension.Tsx;
|
||||
}
|
||||
if (fileExtensionIs(path, ".js")) {
|
||||
return Extension.Js;
|
||||
}
|
||||
if (fileExtensionIs(path, ".jsx")) {
|
||||
return Extension.Jsx;
|
||||
}
|
||||
}
|
||||
|
||||
export function isCheckJsEnabledForFile(sourceFile: SourceFile, compilerOptions: CompilerOptions) {
|
||||
|
||||
@@ -815,15 +815,15 @@ namespace ts {
|
||||
|
||||
switch (extensions) {
|
||||
case Extensions.DtsOnly:
|
||||
return tryExtension(Extension.Dts);
|
||||
return tryExtension(".d.ts", Extension.Dts);
|
||||
case Extensions.TypeScript:
|
||||
return tryExtension(Extension.Ts) || tryExtension(Extension.Tsx) || tryExtension(Extension.Dts);
|
||||
return tryExtension(".ts", Extension.Ts) || tryExtension(".tsx", Extension.Tsx) || tryExtension(".d.ts", Extension.Dts);
|
||||
case Extensions.JavaScript:
|
||||
return tryExtension(Extension.Js) || tryExtension(Extension.Jsx);
|
||||
return tryExtension(".js", Extension.Js) || tryExtension(".jsx", Extension.Jsx);
|
||||
}
|
||||
|
||||
function tryExtension(extension: Extension): Resolved | undefined {
|
||||
const path = tryFile(candidate + extension, failedLookupLocations, onlyRecordFailures, state);
|
||||
function tryExtension(ext: string, extension: Extension): Resolved | undefined {
|
||||
const path = tryFile(candidate + ext, failedLookupLocations, onlyRecordFailures, state);
|
||||
return path && { path, extension };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -764,7 +764,7 @@ namespace ts {
|
||||
sourceFile.languageVersion = languageVersion;
|
||||
sourceFile.fileName = normalizePath(fileName);
|
||||
sourceFile.languageVariant = getLanguageVariant(scriptKind);
|
||||
sourceFile.isDeclarationFile = fileExtensionIs(sourceFile.fileName, Extension.Dts);
|
||||
sourceFile.isDeclarationFile = fileExtensionIs(sourceFile.fileName, ".d.ts");
|
||||
sourceFile.scriptKind = scriptKind;
|
||||
|
||||
return sourceFile;
|
||||
|
||||
@@ -1495,7 +1495,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
const sourceFileWithAddedExtension = forEach(supportedExtensions, extension => getSourceFile(fileName + extension));
|
||||
if (fail && !sourceFileWithAddedExtension) fail(Diagnostics.File_0_not_found, fileName + Extension.Ts);
|
||||
if (fail && !sourceFileWithAddedExtension) fail(Diagnostics.File_0_not_found, fileName + ".ts");
|
||||
return sourceFileWithAddedExtension;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3883,12 +3883,13 @@ namespace ts {
|
||||
extension: Extension;
|
||||
}
|
||||
|
||||
export const enum Extension {
|
||||
Ts = ".ts",
|
||||
Tsx = ".tsx",
|
||||
Dts = ".d.ts",
|
||||
Js = ".js",
|
||||
Jsx = ".jsx"
|
||||
export enum Extension {
|
||||
Ts,
|
||||
Tsx,
|
||||
Dts,
|
||||
Js,
|
||||
Jsx,
|
||||
LastTypeScriptExtension = Dts
|
||||
}
|
||||
|
||||
export interface ResolvedModuleWithFailedLookupLocations {
|
||||
|
||||
@@ -2501,7 +2501,7 @@ namespace ts {
|
||||
const path = outputDir
|
||||
? getSourceFilePathInNewDir(sourceFile, host, outputDir)
|
||||
: sourceFile.fileName;
|
||||
return removeFileExtension(path) + Extension.Dts;
|
||||
return removeFileExtension(path) + ".d.ts";
|
||||
}
|
||||
|
||||
export interface EmitFileNames {
|
||||
@@ -2560,7 +2560,7 @@ namespace ts {
|
||||
if (sourceFiles.length) {
|
||||
const jsFilePath = options.outFile || options.out;
|
||||
const sourceMapFilePath = getSourceMapFilePath(jsFilePath, options);
|
||||
const declarationFilePath = options.declaration ? removeFileExtension(jsFilePath) + Extension.Dts : "";
|
||||
const declarationFilePath = options.declaration ? removeFileExtension(jsFilePath) + ".d.ts" : "";
|
||||
action({ jsFilePath, sourceMapFilePath, declarationFilePath }, createBundle(sourceFiles), emitOnlyDtsFiles);
|
||||
}
|
||||
}
|
||||
@@ -2581,19 +2581,19 @@ namespace ts {
|
||||
// JavaScript files are always LanguageVariant.JSX, as JSX syntax is allowed in .js files also.
|
||||
// So for JavaScript files, '.jsx' is only emitted if the input was '.jsx', and JsxEmit.Preserve.
|
||||
// For TypeScript, the only time to emit with a '.jsx' extension, is on JSX input, and JsxEmit.Preserve
|
||||
function getOutputExtension(sourceFile: SourceFile, options: CompilerOptions): Extension {
|
||||
function getOutputExtension(sourceFile: SourceFile, options: CompilerOptions): string {
|
||||
if (options.jsx === JsxEmit.Preserve) {
|
||||
if (isSourceFileJavaScript(sourceFile)) {
|
||||
if (fileExtensionIs(sourceFile.fileName, Extension.Jsx)) {
|
||||
return Extension.Jsx;
|
||||
if (fileExtensionIs(sourceFile.fileName, ".jsx")) {
|
||||
return ".jsx";
|
||||
}
|
||||
}
|
||||
else if (sourceFile.languageVariant === LanguageVariant.JSX) {
|
||||
// TypeScript source file preserving JSX syntax
|
||||
return Extension.Jsx;
|
||||
return ".jsx";
|
||||
}
|
||||
}
|
||||
return Extension.Js;
|
||||
return ".js";
|
||||
}
|
||||
|
||||
export function getSourceFilePathInNewDir(sourceFile: SourceFile, host: EmitHost, newDirPath: string) {
|
||||
|
||||
@@ -90,7 +90,7 @@ class CompilerBaselineRunner extends RunnerBase {
|
||||
}
|
||||
|
||||
lastUnit = units[units.length - 1];
|
||||
hasNonDtsFiles = ts.forEach(units, unit => !ts.fileExtensionIs(unit.name, ts.Extension.Dts));
|
||||
hasNonDtsFiles = ts.forEach(units, unit => !ts.fileExtensionIs(unit.name, ".d.ts"));
|
||||
// We need to assemble the list of input files for the compiler and other related files on the 'filesystem' (ie in a multi-file test)
|
||||
// If the last file in a test uses require or a triple slash reference we'll assume all other files will be brought in via references,
|
||||
// otherwise, assume all files are just meant to be in the same compilation session without explicit references to one another.
|
||||
|
||||
+52
-57
@@ -1467,7 +1467,7 @@ namespace FourSlash {
|
||||
let baselineFile = this.testData.globalOptions[metadataOptionNames.baselineFile];
|
||||
if (!baselineFile) {
|
||||
baselineFile = this.activeFile.fileName.replace(this.basePath + "/breakpointValidation", "bpSpan");
|
||||
baselineFile = baselineFile.replace(ts.Extension.Ts, ".baseline");
|
||||
baselineFile = baselineFile.replace(".ts", ".baseline");
|
||||
|
||||
}
|
||||
Harness.Baseline.runBaseline(
|
||||
@@ -1537,7 +1537,7 @@ namespace FourSlash {
|
||||
public baselineQuickInfo() {
|
||||
let baselineFile = this.testData.globalOptions[metadataOptionNames.baselineFile];
|
||||
if (!baselineFile) {
|
||||
baselineFile = ts.getBaseFileName(this.activeFile.fileName).replace(ts.Extension.Ts, ".baseline");
|
||||
baselineFile = ts.getBaseFileName(this.activeFile.fileName).replace(".ts", ".baseline");
|
||||
}
|
||||
|
||||
Harness.Baseline.runBaseline(
|
||||
@@ -2182,7 +2182,7 @@ namespace FourSlash {
|
||||
}
|
||||
|
||||
ts.zipWith(expected, actual, (expectedClassification, actualClassification) => {
|
||||
const expectedType = expectedClassification.classificationType;
|
||||
const expectedType: string = (<any>ts.ClassificationTypeNames)[expectedClassification.classificationType];
|
||||
if (expectedType !== actualClassification.classificationType) {
|
||||
this.raiseError("verifyClassifications failed - expected classifications type to be " +
|
||||
expectedType + ", but was " +
|
||||
@@ -3918,7 +3918,7 @@ namespace FourSlashInterface {
|
||||
/**
|
||||
* This method *requires* an ordered stream of classifications for a file, and spans are highly recommended.
|
||||
*/
|
||||
public semanticClassificationsAre(...classifications: Classification[]) {
|
||||
public semanticClassificationsAre(...classifications: { classificationType: string; text: string; textSpan?: FourSlash.TextSpan }[]) {
|
||||
this.state.verifySemanticClassifications(classifications);
|
||||
}
|
||||
|
||||
@@ -4113,107 +4113,102 @@ namespace FourSlashInterface {
|
||||
}
|
||||
}
|
||||
|
||||
interface Classification {
|
||||
classificationType: ts.ClassificationTypeNames;
|
||||
text: string;
|
||||
textSpan?: FourSlash.TextSpan;
|
||||
}
|
||||
export namespace Classification {
|
||||
export function comment(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.comment, text, position);
|
||||
export function comment(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("comment", text, position);
|
||||
}
|
||||
|
||||
export function identifier(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.identifier, text, position);
|
||||
export function identifier(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("identifier", text, position);
|
||||
}
|
||||
|
||||
export function keyword(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.keyword, text, position);
|
||||
export function keyword(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("keyword", text, position);
|
||||
}
|
||||
|
||||
export function numericLiteral(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.numericLiteral, text, position);
|
||||
export function numericLiteral(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("numericLiteral", text, position);
|
||||
}
|
||||
|
||||
export function operator(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.operator, text, position);
|
||||
export function operator(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("operator", text, position);
|
||||
}
|
||||
|
||||
export function stringLiteral(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.stringLiteral, text, position);
|
||||
export function stringLiteral(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("stringLiteral", text, position);
|
||||
}
|
||||
|
||||
export function whiteSpace(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.whiteSpace, text, position);
|
||||
export function whiteSpace(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("whiteSpace", text, position);
|
||||
}
|
||||
|
||||
export function text(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.text, text, position);
|
||||
export function text(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("text", text, position);
|
||||
}
|
||||
|
||||
export function punctuation(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.punctuation, text, position);
|
||||
export function punctuation(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("punctuation", text, position);
|
||||
}
|
||||
|
||||
export function docCommentTagName(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.docCommentTagName, text, position);
|
||||
export function docCommentTagName(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("docCommentTagName", text, position);
|
||||
}
|
||||
|
||||
export function className(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.className, text, position);
|
||||
export function className(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("className", text, position);
|
||||
}
|
||||
|
||||
export function enumName(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.enumName, text, position);
|
||||
export function enumName(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("enumName", text, position);
|
||||
}
|
||||
|
||||
export function interfaceName(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.interfaceName, text, position);
|
||||
export function interfaceName(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("interfaceName", text, position);
|
||||
}
|
||||
|
||||
export function moduleName(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.moduleName, text, position);
|
||||
export function moduleName(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("moduleName", text, position);
|
||||
}
|
||||
|
||||
export function typeParameterName(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.typeParameterName, text, position);
|
||||
export function typeParameterName(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("typeParameterName", text, position);
|
||||
}
|
||||
|
||||
export function parameterName(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.parameterName, text, position);
|
||||
export function parameterName(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("parameterName", text, position);
|
||||
}
|
||||
|
||||
export function typeAliasName(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.typeAliasName, text, position);
|
||||
export function typeAliasName(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("typeAliasName", text, position);
|
||||
}
|
||||
|
||||
export function jsxOpenTagName(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.jsxOpenTagName, text, position);
|
||||
export function jsxOpenTagName(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("jsxOpenTagName", text, position);
|
||||
}
|
||||
|
||||
export function jsxCloseTagName(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.jsxCloseTagName, text, position);
|
||||
export function jsxCloseTagName(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("jsxCloseTagName", text, position);
|
||||
}
|
||||
|
||||
export function jsxSelfClosingTagName(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.jsxSelfClosingTagName, text, position);
|
||||
export function jsxSelfClosingTagName(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("jsxSelfClosingTagName", text, position);
|
||||
}
|
||||
|
||||
export function jsxAttribute(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.jsxAttribute, text, position);
|
||||
export function jsxAttribute(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("jsxAttribute", text, position);
|
||||
}
|
||||
|
||||
export function jsxText(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.jsxText, text, position);
|
||||
export function jsxText(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("jsxText", text, position);
|
||||
}
|
||||
|
||||
export function jsxAttributeStringLiteralValue(text: string, position?: number): Classification {
|
||||
return getClassification(ts.ClassificationTypeNames.jsxAttributeStringLiteralValue, text, position);
|
||||
export function jsxAttributeStringLiteralValue(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("jsxAttributeStringLiteralValue", text, position);
|
||||
}
|
||||
|
||||
function getClassification(classificationType: ts.ClassificationTypeNames, text: string, position?: number): Classification {
|
||||
function getClassification(type: string, text: string, position?: number) {
|
||||
return {
|
||||
classificationType,
|
||||
classificationType: type,
|
||||
text: text,
|
||||
textSpan: position === undefined ? undefined : { start: position, end: position + text.length }
|
||||
};
|
||||
|
||||
@@ -1249,7 +1249,7 @@ namespace Harness {
|
||||
sourceFileName = outFile;
|
||||
}
|
||||
|
||||
const dTsFileName = ts.removeFileExtension(sourceFileName) + ts.Extension.Dts;
|
||||
const dTsFileName = ts.removeFileExtension(sourceFileName) + ".d.ts";
|
||||
|
||||
return ts.forEach(result.declFilesCode, declFile => declFile.fileName === dTsFileName ? declFile : undefined);
|
||||
}
|
||||
@@ -1465,7 +1465,7 @@ namespace Harness {
|
||||
// When calling this function from rwc-runner, the baselinePath will have no extension.
|
||||
// As rwc test- file is stored in json which ".json" will get stripped off.
|
||||
// When calling this function from compiler-runner, the baselinePath will then has either ".ts" or ".tsx" extension
|
||||
const outputFileName = ts.endsWith(baselinePath, ts.Extension.Ts) || ts.endsWith(baselinePath, ts.Extension.Tsx) ?
|
||||
const outputFileName = ts.endsWith(baselinePath, ".ts") || ts.endsWith(baselinePath, ".tsx") ?
|
||||
baselinePath.replace(/\.tsx?/, fullExtension) : baselinePath.concat(fullExtension);
|
||||
Harness.Baseline.runBaseline(outputFileName, () => fullBaseLine, opts);
|
||||
}
|
||||
@@ -1563,7 +1563,7 @@ namespace Harness {
|
||||
}
|
||||
|
||||
// check js output
|
||||
Harness.Baseline.runBaseline(baselinePath.replace(/\.tsx?/, ts.Extension.Js), () => {
|
||||
Harness.Baseline.runBaseline(baselinePath.replace(/\.tsx?/, ".js"), () => {
|
||||
let tsCode = "";
|
||||
const tsSources = otherFiles.concat(toBeCompiled);
|
||||
if (tsSources.length > 1) {
|
||||
@@ -1651,22 +1651,22 @@ namespace Harness {
|
||||
}
|
||||
|
||||
export function isTS(fileName: string) {
|
||||
return ts.endsWith(fileName, ts.Extension.Ts);
|
||||
return ts.endsWith(fileName, ".ts");
|
||||
}
|
||||
|
||||
export function isTSX(fileName: string) {
|
||||
return ts.endsWith(fileName, ts.Extension.Tsx);
|
||||
return ts.endsWith(fileName, ".tsx");
|
||||
}
|
||||
|
||||
export function isDTS(fileName: string) {
|
||||
return ts.endsWith(fileName, ts.Extension.Dts);
|
||||
return ts.endsWith(fileName, ".d.ts");
|
||||
}
|
||||
|
||||
export function isJS(fileName: string) {
|
||||
return ts.endsWith(fileName, ts.Extension.Js);
|
||||
return ts.endsWith(fileName, ".js");
|
||||
}
|
||||
export function isJSX(fileName: string) {
|
||||
return ts.endsWith(fileName, ts.Extension.Jsx);
|
||||
return ts.endsWith(fileName, ".jsx");
|
||||
}
|
||||
|
||||
export function isJSMap(fileName: string) {
|
||||
@@ -1973,7 +1973,7 @@ namespace Harness {
|
||||
export function isDefaultLibraryFile(filePath: string): boolean {
|
||||
// We need to make sure that the filePath is prefixed with "lib." not just containing "lib." and end with ".d.ts"
|
||||
const fileName = ts.getBaseFileName(ts.normalizeSlashes(filePath));
|
||||
return ts.startsWith(fileName, "lib.") && ts.endsWith(fileName, ts.Extension.Dts);
|
||||
return ts.startsWith(fileName, "lib.") && ts.endsWith(fileName, ".d.ts");
|
||||
}
|
||||
|
||||
export function isBuiltFile(filePath: string): boolean {
|
||||
|
||||
@@ -325,8 +325,8 @@ class ProjectRunner extends RunnerBase {
|
||||
// we need to instead create files that can live in the project reference folder
|
||||
// but make sure extension of these files matches with the fileName the compiler asked to write
|
||||
diskRelativeName = "diskFile" + nonSubfolderDiskFiles +
|
||||
(Harness.Compiler.isDTS(fileName) ? ts.Extension.Dts :
|
||||
Harness.Compiler.isJS(fileName) ? ts.Extension.Js : ".js.map");
|
||||
(Harness.Compiler.isDTS(fileName) ? ".d.ts" :
|
||||
Harness.Compiler.isJS(fileName) ? ".js" : ".js.map");
|
||||
nonSubfolderDiskFiles++;
|
||||
}
|
||||
|
||||
@@ -386,14 +386,14 @@ class ProjectRunner extends RunnerBase {
|
||||
emitOutputFilePathWithoutExtension = ts.removeFileExtension(sourceFile.fileName);
|
||||
}
|
||||
|
||||
const outputDtsFileName = emitOutputFilePathWithoutExtension + ts.Extension.Dts;
|
||||
const outputDtsFileName = emitOutputFilePathWithoutExtension + ".d.ts";
|
||||
const file = findOutputDtsFile(outputDtsFileName);
|
||||
if (file) {
|
||||
allInputFiles.unshift(file);
|
||||
}
|
||||
}
|
||||
else {
|
||||
const outputDtsFileName = ts.removeFileExtension(compilerOptions.outFile || compilerOptions.out) + ts.Extension.Dts;
|
||||
const outputDtsFileName = ts.removeFileExtension(compilerOptions.outFile || compilerOptions.out) + ".d.ts";
|
||||
const outputDtsFile = findOutputDtsFile(outputDtsFileName);
|
||||
if (!ts.contains(allInputFiles, outputDtsFile)) {
|
||||
allInputFiles.unshift(outputDtsFile);
|
||||
|
||||
@@ -513,7 +513,7 @@ namespace ts.projectSystem {
|
||||
const lines = ["var x = 1;", "var y = 2;"];
|
||||
const path = "/a/app";
|
||||
const f = {
|
||||
path: path + ts.Extension.Ts,
|
||||
path: path + ".ts",
|
||||
content: lines.join(newLine)
|
||||
};
|
||||
const host = createServerHost([f], { newLine });
|
||||
@@ -530,7 +530,7 @@ namespace ts.projectSystem {
|
||||
command: "compileOnSaveEmitFile",
|
||||
arguments: { file: f.path }
|
||||
});
|
||||
const emitOutput = host.readFile(path + ts.Extension.Js);
|
||||
const emitOutput = host.readFile(path + ".js");
|
||||
assert.equal(emitOutput, f.content + newLine, "content of emit output should be identical with the input + newline");
|
||||
}
|
||||
});
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace ts {
|
||||
if (!expected === !actual) {
|
||||
if (expected) {
|
||||
assert.isTrue(expected.resolvedFileName === actual.resolvedFileName, `'resolvedFileName': expected '${expected.resolvedFileName}' to be equal to '${actual.resolvedFileName}'`);
|
||||
assert.isTrue(expected.extension === actual.extension, `'ext': expected '${expected.extension}' to be equal to '${actual.extension}'`);
|
||||
assert.isTrue(expected.extension === actual.extension, `'ext': expected '${Extension[expected.extension]}' to be equal to '${Extension[actual.extension]}'`);
|
||||
assert.isTrue(expected.isExternalLibraryImport === actual.isExternalLibraryImport, `'isExternalLibraryImport': expected '${expected.isExternalLibraryImport}' to be equal to '${actual.isExternalLibraryImport}'`);
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -134,7 +134,7 @@ namespace ts.server {
|
||||
type: "request",
|
||||
arguments: {
|
||||
formatOptions: {
|
||||
indentStyle: protocol.IndentStyle.Block,
|
||||
indentStyle: "Block"
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -149,11 +149,11 @@ namespace ts.server {
|
||||
type: "request",
|
||||
arguments: {
|
||||
options: {
|
||||
module: protocol.ModuleKind.System,
|
||||
target: protocol.ScriptTarget.ES5,
|
||||
jsx: protocol.JsxEmit.React,
|
||||
newLine: protocol.NewLineKind.Lf,
|
||||
moduleResolution: protocol.ModuleResolutionKind.Node,
|
||||
module: "System",
|
||||
target: "ES5",
|
||||
jsx: "React",
|
||||
newLine: "Lf",
|
||||
moduleResolution: "Node"
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -172,81 +172,12 @@ 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.GetEditsForRefactor,
|
||||
CommandNames.GetEditsForRefactorFull,
|
||||
];
|
||||
|
||||
it("should not throw when commands are executed with invalid arguments", () => {
|
||||
let i = 0;
|
||||
for (const name of allCommandNames) {
|
||||
for (const name in CommandNames) {
|
||||
if (!Object.prototype.hasOwnProperty.call(CommandNames, name)) {
|
||||
continue;
|
||||
}
|
||||
const req: protocol.Request = {
|
||||
command: name,
|
||||
seq: i,
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace ts {
|
||||
|
||||
transpileOptions.reportDiagnostics = true;
|
||||
|
||||
justName = "transpile/" + name.replace(/[^a-z0-9\-. ]/ig, "") + (transpileOptions.compilerOptions.jsx ? Extension.Tsx : Extension.Ts);
|
||||
justName = "transpile/" + name.replace(/[^a-z0-9\-. ]/ig, "") + (transpileOptions.compilerOptions.jsx ? ".tsx" : ".ts");
|
||||
toBeCompiled = [{
|
||||
unitName: transpileOptions.fileName,
|
||||
content: input
|
||||
@@ -88,7 +88,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
it("Correct output for " + justName, () => {
|
||||
Harness.Baseline.runBaseline(justName.replace(/\.tsx?$/, ts.Extension.Js), () => {
|
||||
Harness.Baseline.runBaseline(justName.replace(/\.tsx?$/, ".js"), () => {
|
||||
if (transpileResult.outputText) {
|
||||
return transpileResult.outputText;
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ namespace ts.server {
|
||||
return { name, kind, kindModifiers, sortText, replacementSpan: convertedSpan };
|
||||
}
|
||||
|
||||
return entry as { name: string, kind: ScriptElementKind, kindModifiers: string, sortText: string };
|
||||
return entry as { name: string, kind: string, kindModifiers: string, sortText: string };
|
||||
})
|
||||
};
|
||||
}
|
||||
@@ -265,7 +265,7 @@ namespace ts.server {
|
||||
return {
|
||||
name: entry.name,
|
||||
containerName: entry.containerName || "",
|
||||
containerKind: entry.containerKind || ScriptElementKind.unknown,
|
||||
containerKind: entry.containerKind || "",
|
||||
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: ScriptElementKind.unknown,
|
||||
containerKind: "",
|
||||
containerName: "",
|
||||
fileName: fileName,
|
||||
textSpan: ts.createTextSpanFromBounds(start, end),
|
||||
kind: ScriptElementKind.unknown,
|
||||
kind: "",
|
||||
name: ""
|
||||
};
|
||||
});
|
||||
@@ -356,11 +356,11 @@ namespace ts.server {
|
||||
const start = this.lineOffsetToPosition(fileName, entry.start);
|
||||
const end = this.lineOffsetToPosition(fileName, entry.end);
|
||||
return {
|
||||
containerKind: ScriptElementKind.unknown,
|
||||
containerKind: "",
|
||||
containerName: "",
|
||||
fileName: fileName,
|
||||
textSpan: ts.createTextSpanFromBounds(start, end),
|
||||
kind: ScriptElementKind.unknown,
|
||||
kind: "",
|
||||
name: ""
|
||||
};
|
||||
});
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace ts.server {
|
||||
result.jsx += 1;
|
||||
break;
|
||||
case ScriptKind.TS:
|
||||
fileExtensionIs(info.fileName, Extension.Dts)
|
||||
fileExtensionIs(info.fileName, ".d.ts")
|
||||
? result.dts += 1
|
||||
: result.ts += 1;
|
||||
break;
|
||||
|
||||
+150
-134
@@ -2,107 +2,110 @@
|
||||
* Declaration module describing the TypeScript Server protocol
|
||||
*/
|
||||
namespace ts.server.protocol {
|
||||
// NOTE: If updating this, be sure to also update `allCommandNames` in `harness/unittests/session.ts`.
|
||||
export const enum CommandTypes {
|
||||
Brace = "brace",
|
||||
/* @internal */
|
||||
BraceFull = "brace-full",
|
||||
BraceCompletion = "braceCompletion",
|
||||
Change = "change",
|
||||
Close = "close",
|
||||
Completions = "completions",
|
||||
/* @internal */
|
||||
CompletionsFull = "completions-full",
|
||||
CompletionDetails = "completionEntryDetails",
|
||||
CompileOnSaveAffectedFileList = "compileOnSaveAffectedFileList",
|
||||
CompileOnSaveEmitFile = "compileOnSaveEmitFile",
|
||||
Configure = "configure",
|
||||
Definition = "definition",
|
||||
/* @internal */
|
||||
DefinitionFull = "definition-full",
|
||||
Implementation = "implementation",
|
||||
/* @internal */
|
||||
ImplementationFull = "implementation-full",
|
||||
Exit = "exit",
|
||||
Format = "format",
|
||||
Formatonkey = "formatonkey",
|
||||
/* @internal */
|
||||
FormatFull = "format-full",
|
||||
/* @internal */
|
||||
FormatonkeyFull = "formatonkey-full",
|
||||
/* @internal */
|
||||
FormatRangeFull = "formatRange-full",
|
||||
Geterr = "geterr",
|
||||
GeterrForProject = "geterrForProject",
|
||||
SemanticDiagnosticsSync = "semanticDiagnosticsSync",
|
||||
SyntacticDiagnosticsSync = "syntacticDiagnosticsSync",
|
||||
NavBar = "navbar",
|
||||
/* @internal */
|
||||
NavBarFull = "navbar-full",
|
||||
Navto = "navto",
|
||||
/* @internal */
|
||||
NavtoFull = "navto-full",
|
||||
NavTree = "navtree",
|
||||
NavTreeFull = "navtree-full",
|
||||
Occurrences = "occurrences",
|
||||
DocumentHighlights = "documentHighlights",
|
||||
/* @internal */
|
||||
DocumentHighlightsFull = "documentHighlights-full",
|
||||
Open = "open",
|
||||
Quickinfo = "quickinfo",
|
||||
/* @internal */
|
||||
QuickinfoFull = "quickinfo-full",
|
||||
References = "references",
|
||||
/* @internal */
|
||||
ReferencesFull = "references-full",
|
||||
Reload = "reload",
|
||||
Rename = "rename",
|
||||
/* @internal */
|
||||
RenameInfoFull = "rename-full",
|
||||
/* @internal */
|
||||
RenameLocationsFull = "renameLocations-full",
|
||||
Saveto = "saveto",
|
||||
SignatureHelp = "signatureHelp",
|
||||
/* @internal */
|
||||
SignatureHelpFull = "signatureHelp-full",
|
||||
TypeDefinition = "typeDefinition",
|
||||
ProjectInfo = "projectInfo",
|
||||
ReloadProjects = "reloadProjects",
|
||||
Unknown = "unknown",
|
||||
OpenExternalProject = "openExternalProject",
|
||||
OpenExternalProjects = "openExternalProjects",
|
||||
CloseExternalProject = "closeExternalProject",
|
||||
/* @internal */
|
||||
SynchronizeProjectList = "synchronizeProjectList",
|
||||
/* @internal */
|
||||
ApplyChangedToOpenFiles = "applyChangedToOpenFiles",
|
||||
/* @internal */
|
||||
EncodedSemanticClassificationsFull = "encodedSemanticClassifications-full",
|
||||
/* @internal */
|
||||
Cleanup = "cleanup",
|
||||
/* @internal */
|
||||
OutliningSpans = "outliningSpans",
|
||||
TodoComments = "todoComments",
|
||||
Indentation = "indentation",
|
||||
DocCommentTemplate = "docCommentTemplate",
|
||||
/* @internal */
|
||||
CompilerOptionsDiagnosticsFull = "compilerOptionsDiagnostics-full",
|
||||
/* @internal */
|
||||
NameOrDottedNameSpan = "nameOrDottedNameSpan",
|
||||
/* @internal */
|
||||
BreakpointStatement = "breakpointStatement",
|
||||
CompilerOptionsForInferredProjects = "compilerOptionsForInferredProjects",
|
||||
GetCodeFixes = "getCodeFixes",
|
||||
/* @internal */
|
||||
GetCodeFixesFull = "getCodeFixes-full",
|
||||
GetSupportedCodeFixes = "getSupportedCodeFixes",
|
||||
|
||||
GetApplicableRefactors = "getApplicableRefactors",
|
||||
GetEditsForRefactor = "getEditsForRefactor",
|
||||
export namespace CommandTypes {
|
||||
export type Brace = "brace";
|
||||
/* @internal */
|
||||
GetEditsForRefactorFull = "getEditsForRefactor-full",
|
||||
export type BraceFull = "brace-full";
|
||||
export type BraceCompletion = "braceCompletion";
|
||||
export type Change = "change";
|
||||
export type Close = "close";
|
||||
export type 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";
|
||||
/* @internal */
|
||||
export type DefinitionFull = "definition-full";
|
||||
export type Implementation = "implementation";
|
||||
/* @internal */
|
||||
export type ImplementationFull = "implementation-full";
|
||||
export type Exit = "exit";
|
||||
export type Format = "format";
|
||||
export type Formatonkey = "formatonkey";
|
||||
/* @internal */
|
||||
export type FormatFull = "format-full";
|
||||
/* @internal */
|
||||
export type 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";
|
||||
/* @internal */
|
||||
export type NavBarFull = "navbar-full";
|
||||
export type 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";
|
||||
/* @internal */
|
||||
export type DocumentHighlightsFull = "documentHighlights-full";
|
||||
export type Open = "open";
|
||||
export type Quickinfo = "quickinfo";
|
||||
/* @internal */
|
||||
export type QuickinfoFull = "quickinfo-full";
|
||||
export type References = "references";
|
||||
/* @internal */
|
||||
export type ReferencesFull = "references-full";
|
||||
export type Reload = "reload";
|
||||
export type Rename = "rename";
|
||||
/* @internal */
|
||||
export type RenameInfoFull = "rename-full";
|
||||
/* @internal */
|
||||
export type RenameLocationsFull = "renameLocations-full";
|
||||
export type Saveto = "saveto";
|
||||
export type 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";
|
||||
/* @internal */
|
||||
export type SynchronizeProjectList = "synchronizeProjectList";
|
||||
/* @internal */
|
||||
export type ApplyChangedToOpenFiles = "applyChangedToOpenFiles";
|
||||
/* @internal */
|
||||
export type EncodedSemanticClassificationsFull = "encodedSemanticClassifications-full";
|
||||
/* @internal */
|
||||
export type Cleanup = "cleanup";
|
||||
/* @internal */
|
||||
export type OutliningSpans = "outliningSpans";
|
||||
export type TodoComments = "todoComments";
|
||||
export type Indentation = "indentation";
|
||||
export type DocCommentTemplate = "docCommentTemplate";
|
||||
/* @internal */
|
||||
export type CompilerOptionsDiagnosticsFull = "compilerOptionsDiagnostics-full";
|
||||
/* @internal */
|
||||
export type NameOrDottedNameSpan = "nameOrDottedNameSpan";
|
||||
/* @internal */
|
||||
export type BreakpointStatement = "breakpointStatement";
|
||||
export type CompilerOptionsForInferredProjects = "compilerOptionsForInferredProjects";
|
||||
export type GetCodeFixes = "getCodeFixes";
|
||||
/* @internal */
|
||||
export type GetCodeFixesFull = "getCodeFixes-full";
|
||||
export type GetSupportedCodeFixes = "getSupportedCodeFixes";
|
||||
|
||||
// NOTE: If updating this, be sure to also update `allCommandNames` in `harness/unittests/session.ts`.
|
||||
export type GetApplicableRefactors = "getApplicableRefactors";
|
||||
export type GetRefactorCodeActions = "getRefactorCodeActions";
|
||||
/* @internal */
|
||||
export type GetRefactorCodeActionsFull = "getRefactorCodeActions-full";
|
||||
|
||||
export type GetEditsForRefactor = "getEditsForRefactor";
|
||||
/* @internal */
|
||||
export type GetEditsForRefactorFull = "getEditsForRefactor-full";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -748,9 +751,10 @@ 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: HighlightSpanKind;
|
||||
kind: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -887,7 +891,7 @@ namespace ts.server.protocol {
|
||||
/**
|
||||
* The items's kind (such as 'className' or 'parameterName' or plain 'text').
|
||||
*/
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
|
||||
/**
|
||||
* Optional modifiers for the kind (such as 'public').
|
||||
@@ -1401,7 +1405,7 @@ namespace ts.server.protocol {
|
||||
/**
|
||||
* The symbol's kind (such as 'className' or 'parameterName' or plain 'text').
|
||||
*/
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
|
||||
/**
|
||||
* Optional modifiers for the kind (such as 'public').
|
||||
@@ -1620,7 +1624,7 @@ namespace ts.server.protocol {
|
||||
/**
|
||||
* The symbol's kind (such as 'className' or 'parameterName').
|
||||
*/
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
/**
|
||||
* Optional modifiers for the kind (such as 'public').
|
||||
*/
|
||||
@@ -1648,7 +1652,7 @@ namespace ts.server.protocol {
|
||||
/**
|
||||
* The symbol's kind (such as 'className' or 'parameterName').
|
||||
*/
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
/**
|
||||
* Optional modifiers for the kind (such as 'public').
|
||||
*/
|
||||
@@ -2107,7 +2111,7 @@ namespace ts.server.protocol {
|
||||
/**
|
||||
* The symbol's kind (such as 'className' or 'parameterName').
|
||||
*/
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
|
||||
/**
|
||||
* exact, substring, or prefix.
|
||||
@@ -2148,7 +2152,7 @@ namespace ts.server.protocol {
|
||||
/**
|
||||
* Kind of symbol's container symbol (if any).
|
||||
*/
|
||||
containerKind?: ScriptElementKind;
|
||||
containerKind?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2221,7 +2225,7 @@ namespace ts.server.protocol {
|
||||
/**
|
||||
* The symbol's kind (such as 'className' or 'parameterName').
|
||||
*/
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
|
||||
/**
|
||||
* Optional modifiers for the kind (such as 'public').
|
||||
@@ -2247,7 +2251,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: ScriptElementKind;
|
||||
kind: string;
|
||||
kindModifiers: string;
|
||||
spans: TextSpan[];
|
||||
childItems?: NavigationTree[];
|
||||
@@ -2341,12 +2345,14 @@ namespace ts.server.protocol {
|
||||
body?: NavigationTree;
|
||||
}
|
||||
|
||||
export const enum IndentStyle {
|
||||
None = "None",
|
||||
Block = "Block",
|
||||
Smart = "Smart",
|
||||
export namespace IndentStyle {
|
||||
export type None = "None";
|
||||
export type Block = "Block";
|
||||
export type Smart = "Smart";
|
||||
}
|
||||
|
||||
export type IndentStyle = IndentStyle.None | IndentStyle.Block | IndentStyle.Smart;
|
||||
|
||||
export interface EditorSettings {
|
||||
baseIndentSize?: number;
|
||||
indentSize?: number;
|
||||
@@ -2443,37 +2449,47 @@ namespace ts.server.protocol {
|
||||
[option: string]: CompilerOptionsValue | undefined;
|
||||
}
|
||||
|
||||
export const enum JsxEmit {
|
||||
None = "None",
|
||||
Preserve = "Preserve",
|
||||
ReactNative = "ReactNative",
|
||||
React = "React",
|
||||
export namespace JsxEmit {
|
||||
export type None = "None";
|
||||
export type Preserve = "Preserve";
|
||||
export type ReactNative = "ReactNative";
|
||||
export type React = "React";
|
||||
}
|
||||
|
||||
export const enum ModuleKind {
|
||||
None = "None",
|
||||
CommonJS = "CommonJS",
|
||||
AMD = "AMD",
|
||||
UMD = "UMD",
|
||||
System = "System",
|
||||
ES6 = "ES6",
|
||||
ES2015 = "ES2015",
|
||||
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 ModuleResolutionKind {
|
||||
Classic = "Classic",
|
||||
Node = "Node",
|
||||
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 NewLineKind {
|
||||
Crlf = "Crlf",
|
||||
Lf = "Lf",
|
||||
export type ModuleResolutionKind = ModuleResolutionKind.Classic | ModuleResolutionKind.Node;
|
||||
|
||||
export namespace NewLineKind {
|
||||
export type Crlf = "Crlf";
|
||||
export type Lf = "Lf";
|
||||
}
|
||||
|
||||
export const enum ScriptTarget {
|
||||
ES3 = "ES3",
|
||||
ES5 = "ES5",
|
||||
ES6 = "ES6",
|
||||
ES2015 = "ES2015",
|
||||
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 type ScriptTarget = ScriptTarget.ES3 | ScriptTarget.ES5 | ScriptTarget.ES6 | ScriptTarget.ES2015;
|
||||
}
|
||||
|
||||
+104
-8
@@ -112,13 +112,109 @@ namespace ts.server {
|
||||
return true;
|
||||
}
|
||||
|
||||
// CommandNames used to be exposed before TS 2.4 as a namespace
|
||||
// In TS 2.4 we switched to an enum, keep this for backward compatibility
|
||||
// The var assignment ensures that even though CommandTypes are a const enum
|
||||
// we want to ensure the value is maintained in the out since the file is
|
||||
// built using --preseveConstEnum.
|
||||
export type CommandNames = protocol.CommandTypes;
|
||||
export const CommandNames = (<any>protocol).CommandTypes;
|
||||
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";
|
||||
/* @internal */
|
||||
export const GetRefactorCodeActionsFull: protocol.CommandTypes.GetRefactorCodeActionsFull = "getRefactorCodeActions-full";
|
||||
|
||||
export const GetEditsForRefactor: protocol.CommandTypes.GetEditsForRefactor = "getEditsForRefactor";
|
||||
/* @internal */
|
||||
export const GetEditsForRefactorFull: protocol.CommandTypes.GetEditsForRefactorFull = "getEditsForRefactor-full";
|
||||
}
|
||||
|
||||
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);
|
||||
@@ -1575,7 +1671,7 @@ namespace ts.server {
|
||||
else {
|
||||
const info = this.projectService.getScriptInfo(fileNameInProject);
|
||||
if (!info.isScriptOpen()) {
|
||||
if (fileNameInProject.indexOf(Extension.Dts) > 0) {
|
||||
if (fileNameInProject.indexOf(".d.ts") > 0) {
|
||||
veryLowPriorityFiles.push(fileNameInProject);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -573,7 +573,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
function getClassificationTypeName(type: ClassificationType): ClassificationTypeNames {
|
||||
function getClassificationTypeName(type: ClassificationType) {
|
||||
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: ScriptElementKind.unknown,
|
||||
containerKind: "",
|
||||
containerName: "",
|
||||
fileName: sourceFile.fileName,
|
||||
kind,
|
||||
@@ -160,7 +160,7 @@ namespace ts.FindAllReferences {
|
||||
};
|
||||
}
|
||||
|
||||
function getDefinitionKindAndDisplayParts(symbol: Symbol, node: Node, checker: TypeChecker): { displayParts: SymbolDisplayPart[], kind: ScriptElementKind } {
|
||||
function getDefinitionKindAndDisplayParts(symbol: Symbol, node: Node, checker: TypeChecker): { displayParts: SymbolDisplayPart[], kind: string } {
|
||||
const { displayParts, symbolKind } =
|
||||
SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(checker, symbol, node.getSourceFile(), getContainerNode(node), node);
|
||||
return { displayParts, kind: symbolKind };
|
||||
@@ -192,7 +192,7 @@ namespace ts.FindAllReferences {
|
||||
}
|
||||
}
|
||||
|
||||
function implementationKindDisplayParts(node: ts.Node, checker: ts.TypeChecker): { kind: ScriptElementKind, displayParts: SymbolDisplayPart[] } {
|
||||
function implementationKindDisplayParts(node: ts.Node, checker: ts.TypeChecker): { kind: string, 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: ScriptElementKind, symbolName: string, containerName: string, result: DefinitionInfo[]) {
|
||||
function tryAddConstructSignature(symbol: Symbol, location: Node, symbolKind: string, 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,8 +173,12 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,14 +188,14 @@ namespace ts.GoToDefinition {
|
||||
return false;
|
||||
}
|
||||
|
||||
function tryAddCallSignature(symbol: Symbol, location: Node, symbolKind: ScriptElementKind, symbolName: string, containerName: string, result: DefinitionInfo[]) {
|
||||
function tryAddCallSignature(symbol: Symbol, location: Node, symbolKind: string, 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: ScriptElementKind, symbolName: string, containerName: string, result: DefinitionInfo[]) {
|
||||
function tryAddSignature(signatureDeclarations: Declaration[] | undefined, selectConstructors: boolean, symbolKind: string, symbolName: string, containerName: string, result: DefinitionInfo[]) {
|
||||
if (!signatureDeclarations) {
|
||||
return false;
|
||||
}
|
||||
@@ -227,12 +231,12 @@ namespace ts.GoToDefinition {
|
||||
}
|
||||
|
||||
/** Creates a DefinitionInfo from a Declaration, using the declaration's name if possible. */
|
||||
function createDefinitionInfo(node: Declaration, symbolKind: ScriptElementKind, symbolName: string, containerName: string): DefinitionInfo {
|
||||
function createDefinitionInfo(node: Declaration, symbolKind: string, 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: ScriptElementKind, symbolName: string, containerName: string): DefinitionInfo {
|
||||
function createDefinitionInfoFromName(name: Node, symbolKind: string, symbolName: string, containerName: string): DefinitionInfo {
|
||||
const sourceFile = name.getSourceFile();
|
||||
return {
|
||||
fileName: sourceFile.fileName,
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace ts.NavigateTo {
|
||||
for (const sourceFile of sourceFiles) {
|
||||
cancellationToken.throwIfCancellationRequested();
|
||||
|
||||
if (excludeDtsFiles && fileExtensionIs(sourceFile.fileName, Extension.Dts)) {
|
||||
if (excludeDtsFiles && fileExtensionIs(sourceFile.fileName, ".d.ts")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -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) : ScriptElementKind.unknown
|
||||
containerKind: containerName ? getNodeKind(container) : ""
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -455,7 +455,7 @@ namespace ts.Completions.PathCompletions {
|
||||
}
|
||||
}
|
||||
|
||||
function createCompletionEntryForModule(name: string, kind: ScriptElementKind, replacementSpan: TextSpan): CompletionEntry {
|
||||
function createCompletionEntryForModule(name: string, kind: string, 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: ScriptElementKind, kindModifiers: string, node: Node, sourceFile: SourceFile): RenameInfo {
|
||||
function getRenameInfoSuccess(displayName: string, fullDisplayName: string, kind: string, 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): ScriptElementKind {
|
||||
export function getSymbolKind(typeChecker: TypeChecker, symbol: Symbol, location: Node): string {
|
||||
const { flags } = symbol;
|
||||
|
||||
if (flags & SymbolFlags.Class) {
|
||||
@@ -24,7 +24,7 @@ namespace ts.SymbolDisplay {
|
||||
return result;
|
||||
}
|
||||
|
||||
function getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker: TypeChecker, symbol: Symbol, location: Node): ScriptElementKind {
|
||||
function getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker: TypeChecker, symbol: Symbol, location: Node) {
|
||||
if (typeChecker.isUndefinedSymbol(symbol)) {
|
||||
return ScriptElementKind.variableElement;
|
||||
}
|
||||
|
||||
+89
-87
@@ -291,7 +291,7 @@ namespace ts {
|
||||
|
||||
export interface ClassifiedSpan {
|
||||
textSpan: TextSpan;
|
||||
classificationType: ClassificationTypeNames;
|
||||
classificationType: string; // ClassificationTypeNames
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -302,7 +302,7 @@ namespace ts {
|
||||
*/
|
||||
export interface NavigationBarItem {
|
||||
text: string;
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
kindModifiers: string;
|
||||
spans: TextSpan[];
|
||||
childItems: NavigationBarItem[];
|
||||
@@ -318,7 +318,8 @@ namespace ts {
|
||||
export interface NavigationTree {
|
||||
/** Name of the declaration, or a short description, e.g. "<class>". */
|
||||
text: string;
|
||||
kind: ScriptElementKind;
|
||||
/** A ScriptElementKind */
|
||||
kind: string;
|
||||
/** ScriptElementKindModifier separated by commas, e.g. "public,abstract" */
|
||||
kindModifiers: string;
|
||||
/**
|
||||
@@ -433,7 +434,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
export interface ImplementationLocation extends DocumentSpan {
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
displayParts: SymbolDisplayPart[];
|
||||
}
|
||||
|
||||
@@ -442,30 +443,30 @@ namespace ts {
|
||||
highlightSpans: HighlightSpan[];
|
||||
}
|
||||
|
||||
export const enum HighlightSpanKind {
|
||||
none = "none",
|
||||
definition = "definition",
|
||||
reference = "reference",
|
||||
writtenReference = "writtenReference",
|
||||
export namespace HighlightSpanKind {
|
||||
export const none = "none";
|
||||
export const definition = "definition";
|
||||
export const reference = "reference";
|
||||
export const writtenReference = "writtenReference";
|
||||
}
|
||||
|
||||
export interface HighlightSpan {
|
||||
fileName?: string;
|
||||
isInString?: true;
|
||||
textSpan: TextSpan;
|
||||
kind: HighlightSpanKind;
|
||||
kind: string;
|
||||
}
|
||||
|
||||
export interface NavigateToItem {
|
||||
name: string;
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
kindModifiers: string;
|
||||
matchKind: string; // TODO: keyof typeof PatternMatchKind; (https://github.com/Microsoft/TypeScript/issues/15102)
|
||||
matchKind: string;
|
||||
isCaseSensitive: boolean;
|
||||
fileName: string;
|
||||
textSpan: TextSpan;
|
||||
containerName: string;
|
||||
containerKind: ScriptElementKind;
|
||||
containerKind: string;
|
||||
}
|
||||
|
||||
export enum IndentStyle {
|
||||
@@ -533,9 +534,9 @@ namespace ts {
|
||||
export interface DefinitionInfo {
|
||||
fileName: string;
|
||||
textSpan: TextSpan;
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
name: string;
|
||||
containerKind: ScriptElementKind;
|
||||
containerKind: string;
|
||||
containerName: string;
|
||||
}
|
||||
|
||||
@@ -575,7 +576,7 @@ namespace ts {
|
||||
|
||||
export interface SymbolDisplayPart {
|
||||
text: string;
|
||||
kind: string;
|
||||
kind: string; // A ScriptElementKind
|
||||
}
|
||||
|
||||
export interface JSDocTagInfo {
|
||||
@@ -584,7 +585,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
export interface QuickInfo {
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
kindModifiers: string;
|
||||
textSpan: TextSpan;
|
||||
displayParts: SymbolDisplayPart[];
|
||||
@@ -597,7 +598,7 @@ namespace ts {
|
||||
localizedErrorMessage: string;
|
||||
displayName: string;
|
||||
fullDisplayName: string;
|
||||
kind: ScriptElementKind;
|
||||
kind: string;
|
||||
kindModifiers: string;
|
||||
triggerSpan: TextSpan;
|
||||
}
|
||||
@@ -650,7 +651,7 @@ namespace ts {
|
||||
|
||||
export interface CompletionEntry {
|
||||
name: string;
|
||||
kind: ScriptElementKind;
|
||||
kind: string; // see ScriptElementKind
|
||||
kindModifiers: string; // see ScriptElementKindModifier, comma separated
|
||||
sortText: string;
|
||||
/**
|
||||
@@ -663,7 +664,7 @@ namespace ts {
|
||||
|
||||
export interface CompletionEntryDetails {
|
||||
name: string;
|
||||
kind: ScriptElementKind;
|
||||
kind: string; // see ScriptElementKind
|
||||
kindModifiers: string; // see ScriptElementKindModifier, comma separated
|
||||
displayParts: SymbolDisplayPart[];
|
||||
documentation: SymbolDisplayPart[];
|
||||
@@ -761,140 +762,141 @@ namespace ts {
|
||||
getEncodedLexicalClassifications(text: string, endOfLineState: EndOfLineState, syntacticClassifierAbsent: boolean): Classifications;
|
||||
}
|
||||
|
||||
export const enum ScriptElementKind {
|
||||
unknown = "",
|
||||
warning = "warning",
|
||||
// TODO: move these to enums
|
||||
export namespace ScriptElementKind {
|
||||
export const unknown = "";
|
||||
export const warning = "warning";
|
||||
|
||||
/** predefined type (void) or keyword (class) */
|
||||
keyword = "keyword",
|
||||
export const keyword = "keyword";
|
||||
|
||||
/** top level script node */
|
||||
scriptElement = "script",
|
||||
export const scriptElement = "script";
|
||||
|
||||
/** module foo {} */
|
||||
moduleElement = "module",
|
||||
export const moduleElement = "module";
|
||||
|
||||
/** class X {} */
|
||||
classElement = "class",
|
||||
export const classElement = "class";
|
||||
|
||||
/** var x = class X {} */
|
||||
localClassElement = "local class",
|
||||
export const localClassElement = "local class";
|
||||
|
||||
/** interface Y {} */
|
||||
interfaceElement = "interface",
|
||||
export const interfaceElement = "interface";
|
||||
|
||||
/** type T = ... */
|
||||
typeElement = "type",
|
||||
export const typeElement = "type";
|
||||
|
||||
/** enum E */
|
||||
enumElement = "enum",
|
||||
enumMemberElement = "enum member",
|
||||
export const enumElement = "enum";
|
||||
export const enumMemberElement = "enum member";
|
||||
|
||||
/**
|
||||
* Inside module and script only
|
||||
* const v = ..
|
||||
*/
|
||||
variableElement = "var",
|
||||
export const variableElement = "var";
|
||||
|
||||
/** Inside function */
|
||||
localVariableElement = "local var",
|
||||
export const localVariableElement = "local var";
|
||||
|
||||
/**
|
||||
* Inside module and script only
|
||||
* function f() { }
|
||||
*/
|
||||
functionElement = "function",
|
||||
export const functionElement = "function";
|
||||
|
||||
/** Inside function */
|
||||
localFunctionElement = "local function",
|
||||
export const localFunctionElement = "local function";
|
||||
|
||||
/** class X { [public|private]* foo() {} } */
|
||||
memberFunctionElement = "method",
|
||||
export const memberFunctionElement = "method";
|
||||
|
||||
/** class X { [public|private]* [get|set] foo:number; } */
|
||||
memberGetAccessorElement = "getter",
|
||||
memberSetAccessorElement = "setter",
|
||||
export const memberGetAccessorElement = "getter";
|
||||
export const memberSetAccessorElement = "setter";
|
||||
|
||||
/**
|
||||
* class X { [public|private]* foo:number; }
|
||||
* interface Y { foo:number; }
|
||||
*/
|
||||
memberVariableElement = "property",
|
||||
export const memberVariableElement = "property";
|
||||
|
||||
/** class X { constructor() { } } */
|
||||
constructorImplementationElement = "constructor",
|
||||
export const constructorImplementationElement = "constructor";
|
||||
|
||||
/** interface Y { ():number; } */
|
||||
callSignatureElement = "call",
|
||||
export const callSignatureElement = "call";
|
||||
|
||||
/** interface Y { []:number; } */
|
||||
indexSignatureElement = "index",
|
||||
export const indexSignatureElement = "index";
|
||||
|
||||
/** interface Y { new():Y; } */
|
||||
constructSignatureElement = "construct",
|
||||
export const constructSignatureElement = "construct";
|
||||
|
||||
/** function foo(*Y*: string) */
|
||||
parameterElement = "parameter",
|
||||
export const parameterElement = "parameter";
|
||||
|
||||
typeParameterElement = "type parameter",
|
||||
export const typeParameterElement = "type parameter";
|
||||
|
||||
primitiveType = "primitive type",
|
||||
export const primitiveType = "primitive type";
|
||||
|
||||
label = "label",
|
||||
export const label = "label";
|
||||
|
||||
alias = "alias",
|
||||
export const alias = "alias";
|
||||
|
||||
constElement = "const",
|
||||
export const constElement = "const";
|
||||
|
||||
letElement = "let",
|
||||
export const letElement = "let";
|
||||
|
||||
directory = "directory",
|
||||
export const directory = "directory";
|
||||
|
||||
externalModuleName = "external module name",
|
||||
export const externalModuleName = "external module name";
|
||||
|
||||
/**
|
||||
* <JsxTagName attribute1 attribute2={0} />
|
||||
*/
|
||||
jsxAttribute = "JSX attribute",
|
||||
export const jsxAttribute = "JSX attribute";
|
||||
}
|
||||
|
||||
export const enum ScriptElementKindModifier {
|
||||
none = "",
|
||||
publicMemberModifier = "public",
|
||||
privateMemberModifier = "private",
|
||||
protectedMemberModifier = "protected",
|
||||
exportedModifier = "export",
|
||||
ambientModifier = "declare",
|
||||
staticModifier = "static",
|
||||
abstractModifier = "abstract",
|
||||
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 ClassificationTypeNames {
|
||||
comment = "comment",
|
||||
identifier = "identifier",
|
||||
keyword = "keyword",
|
||||
numericLiteral = "number",
|
||||
operator = "operator",
|
||||
stringLiteral = "string",
|
||||
whiteSpace = "whitespace",
|
||||
text = "text",
|
||||
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";
|
||||
|
||||
punctuation = "punctuation",
|
||||
public static punctuation = "punctuation";
|
||||
|
||||
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",
|
||||
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";
|
||||
}
|
||||
|
||||
export const enum ClassificationType {
|
||||
|
||||
@@ -297,7 +297,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
export function getNodeKind(node: Node): ScriptElementKind {
|
||||
export function getNodeKind(node: Node): string {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.SourceFile:
|
||||
return isExternalModule(<SourceFile>node) ? ScriptElementKind.moduleElement : ScriptElementKind.scriptElement;
|
||||
@@ -344,7 +344,7 @@ namespace ts {
|
||||
return ScriptElementKind.unknown;
|
||||
}
|
||||
|
||||
function getKindOfVariableDeclaration(v: VariableDeclaration): ScriptElementKind {
|
||||
function getKindOfVariableDeclaration(v: VariableDeclaration): string {
|
||||
return isConst(v)
|
||||
? ScriptElementKind.constElement
|
||||
: isLet(v)
|
||||
|
||||
Reference in New Issue
Block a user