mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Update LKG
This commit is contained in:
Vendored
+1700
File diff suppressed because it is too large
Load Diff
+37
-29
@@ -125,6 +125,7 @@ var ts;
|
||||
var ts;
|
||||
(function (ts) {
|
||||
var createObject = Object.create;
|
||||
ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined;
|
||||
function createMap(template) {
|
||||
var map = createObject(null);
|
||||
map["__"] = undefined;
|
||||
@@ -682,7 +683,7 @@ var ts;
|
||||
if (b === undefined)
|
||||
return 1;
|
||||
if (ignoreCase) {
|
||||
if (String.prototype.localeCompare) {
|
||||
if (ts.collator && String.prototype.localeCompare) {
|
||||
var result = a.localeCompare(b, undefined, { usage: "sort", sensitivity: "accent" });
|
||||
return result < 0 ? -1 : result > 0 ? 1 : 0;
|
||||
}
|
||||
@@ -1710,6 +1711,9 @@ var ts;
|
||||
},
|
||||
watchDirectory: function (directoryName, callback, recursive) {
|
||||
var options;
|
||||
if (!directoryExists(directoryName)) {
|
||||
return;
|
||||
}
|
||||
if (isNode4OrLater() && (process.platform === "win32" || process.platform === "darwin")) {
|
||||
options = { persistent: true, recursive: !!recursive };
|
||||
}
|
||||
@@ -14986,14 +14990,14 @@ var ts;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function isSymbolAccessible(symbol, enclosingDeclaration, meaning) {
|
||||
function isSymbolAccessible(symbol, enclosingDeclaration, meaning, shouldComputeAliasesToMakeVisible) {
|
||||
if (symbol && enclosingDeclaration && !(symbol.flags & 262144)) {
|
||||
var initialSymbol = symbol;
|
||||
var meaningToLook = meaning;
|
||||
while (symbol) {
|
||||
var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaningToLook, false);
|
||||
if (accessibleSymbolChain) {
|
||||
var hasAccessibleDeclarations = hasVisibleDeclarations(accessibleSymbolChain[0]);
|
||||
var hasAccessibleDeclarations = hasVisibleDeclarations(accessibleSymbolChain[0], shouldComputeAliasesToMakeVisible);
|
||||
if (!hasAccessibleDeclarations) {
|
||||
return {
|
||||
accessibility: 1,
|
||||
@@ -15034,7 +15038,7 @@ var ts;
|
||||
function hasExternalModuleSymbol(declaration) {
|
||||
return ts.isAmbientModule(declaration) || (declaration.kind === 256 && ts.isExternalOrCommonJsModule(declaration));
|
||||
}
|
||||
function hasVisibleDeclarations(symbol) {
|
||||
function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) {
|
||||
var aliasesToMakeVisible;
|
||||
if (ts.forEach(symbol.declarations, function (declaration) { return !getIsDeclarationVisible(declaration); })) {
|
||||
return undefined;
|
||||
@@ -15046,14 +15050,16 @@ var ts;
|
||||
if (anyImportSyntax &&
|
||||
!(anyImportSyntax.flags & 1) &&
|
||||
isDeclarationVisible(anyImportSyntax.parent)) {
|
||||
getNodeLinks(declaration).isVisible = true;
|
||||
if (aliasesToMakeVisible) {
|
||||
if (!ts.contains(aliasesToMakeVisible, anyImportSyntax)) {
|
||||
aliasesToMakeVisible.push(anyImportSyntax);
|
||||
if (shouldComputeAliasToMakeVisible) {
|
||||
getNodeLinks(declaration).isVisible = true;
|
||||
if (aliasesToMakeVisible) {
|
||||
if (!ts.contains(aliasesToMakeVisible, anyImportSyntax)) {
|
||||
aliasesToMakeVisible.push(anyImportSyntax);
|
||||
}
|
||||
}
|
||||
else {
|
||||
aliasesToMakeVisible = [anyImportSyntax];
|
||||
}
|
||||
}
|
||||
else {
|
||||
aliasesToMakeVisible = [anyImportSyntax];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -15076,7 +15082,7 @@ var ts;
|
||||
}
|
||||
var firstIdentifier = getFirstIdentifier(entityName);
|
||||
var symbol = resolveName(enclosingDeclaration, firstIdentifier.text, meaning, undefined, undefined);
|
||||
return (symbol && hasVisibleDeclarations(symbol)) || {
|
||||
return (symbol && hasVisibleDeclarations(symbol, true)) || {
|
||||
accessibility: 1,
|
||||
errorSymbolName: ts.getTextOfNode(firstIdentifier),
|
||||
errorNode: firstIdentifier
|
||||
@@ -15293,14 +15299,10 @@ var ts;
|
||||
else if (type.flags & (32768 | 65536 | 16 | 16384)) {
|
||||
buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 793064, 0, nextFlags);
|
||||
}
|
||||
else if (!(flags & 512) && type.flags & (2097152 | 1572864) && type.aliasSymbol) {
|
||||
if (type.flags & 2097152 || !(flags & 1024)) {
|
||||
var typeArguments = type.aliasTypeArguments;
|
||||
writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, typeArguments ? typeArguments.length : 0, nextFlags);
|
||||
}
|
||||
else {
|
||||
writeUnionOrIntersectionType(type, nextFlags);
|
||||
}
|
||||
else if (!(flags & 512) && ((type.flags & 2097152 && !type.target) || type.flags & 1572864) && type.aliasSymbol &&
|
||||
isSymbolAccessible(type.aliasSymbol, enclosingDeclaration, 793064, false).accessibility === 0) {
|
||||
var typeArguments = type.aliasTypeArguments;
|
||||
writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, typeArguments ? typeArguments.length : 0, nextFlags);
|
||||
}
|
||||
else if (type.flags & 1572864) {
|
||||
writeUnionOrIntersectionType(type, nextFlags);
|
||||
@@ -29589,7 +29591,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
function trackSymbol(symbol, enclosingDeclaration, meaning) {
|
||||
handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning));
|
||||
handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning, true));
|
||||
recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForSymbol(symbol, meaning));
|
||||
}
|
||||
function reportInaccessibleThisError() {
|
||||
@@ -29606,7 +29608,7 @@ var ts;
|
||||
}
|
||||
else {
|
||||
errorNameNode = declaration.name;
|
||||
resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, 2 | 1024, writer);
|
||||
resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, 2, writer);
|
||||
errorNameNode = undefined;
|
||||
}
|
||||
}
|
||||
@@ -29618,7 +29620,7 @@ var ts;
|
||||
}
|
||||
else {
|
||||
errorNameNode = signature.name;
|
||||
resolver.writeReturnTypeOfSignatureDeclaration(signature, enclosingDeclaration, 2 | 1024, writer);
|
||||
resolver.writeReturnTypeOfSignatureDeclaration(signature, enclosingDeclaration, 2, writer);
|
||||
errorNameNode = undefined;
|
||||
}
|
||||
}
|
||||
@@ -29811,7 +29813,7 @@ var ts;
|
||||
write(tempVarName);
|
||||
write(": ");
|
||||
writer.getSymbolAccessibilityDiagnostic = getDefaultExportAccessibilityDiagnostic;
|
||||
resolver.writeTypeOfExpression(node.expression, enclosingDeclaration, 2 | 1024, writer);
|
||||
resolver.writeTypeOfExpression(node.expression, enclosingDeclaration, 2, writer);
|
||||
write(";");
|
||||
writeLine();
|
||||
write(node.isExportEquals ? "export = " : "export default ");
|
||||
@@ -30216,7 +30218,7 @@ var ts;
|
||||
}
|
||||
else {
|
||||
writer.getSymbolAccessibilityDiagnostic = getHeritageClauseVisibilityError;
|
||||
resolver.writeBaseConstructorTypeOfClass(enclosingDeclaration, enclosingDeclaration, 2 | 1024, writer);
|
||||
resolver.writeBaseConstructorTypeOfClass(enclosingDeclaration, enclosingDeclaration, 2, writer);
|
||||
}
|
||||
function getHeritageClauseVisibilityError(symbolAccessibilityResult) {
|
||||
var diagnosticMessage;
|
||||
@@ -32295,14 +32297,14 @@ var ts;
|
||||
write(" = ");
|
||||
emitObjectLiteralBody(node, firstComputedPropertyIndex);
|
||||
for (var i = firstComputedPropertyIndex, n = properties.length; i < n; i++) {
|
||||
writeComma();
|
||||
var property = properties[i];
|
||||
emitStart(property);
|
||||
if (property.kind === 149 || property.kind === 150) {
|
||||
var accessors = ts.getAllAccessorDeclarations(node.properties, property);
|
||||
if (property !== accessors.firstAccessor) {
|
||||
continue;
|
||||
}
|
||||
writeComma();
|
||||
emitStart(property);
|
||||
write("Object.defineProperty(");
|
||||
emit(tempVar);
|
||||
write(", ");
|
||||
@@ -32343,6 +32345,8 @@ var ts;
|
||||
emitEnd(property);
|
||||
}
|
||||
else {
|
||||
writeComma();
|
||||
emitStart(property);
|
||||
emitLeadingComments(property);
|
||||
emitStart(property.name);
|
||||
emit(tempVar);
|
||||
@@ -32361,8 +32365,8 @@ var ts;
|
||||
else {
|
||||
ts.Debug.fail("ObjectLiteralElement type not accounted for: " + property.kind);
|
||||
}
|
||||
emitEnd(property);
|
||||
}
|
||||
emitEnd(property);
|
||||
}
|
||||
writeComma();
|
||||
emit(tempVar);
|
||||
@@ -32806,7 +32810,11 @@ var ts;
|
||||
if (modulekind === ts.ModuleKind.System || node.kind !== 69 || ts.nodeIsSynthesized(node)) {
|
||||
return false;
|
||||
}
|
||||
return !exportEquals && exportSpecifiers && node.text in exportSpecifiers;
|
||||
if (exportEquals || !exportSpecifiers || !(node.text in exportSpecifiers)) {
|
||||
return false;
|
||||
}
|
||||
var declaration = resolver.getReferencedValueDeclaration(node);
|
||||
return declaration && ts.getEnclosingBlockScopeContainer(declaration).kind === 256;
|
||||
}
|
||||
function emitPrefixUnaryExpression(node) {
|
||||
var isPlusPlusOrMinusMinus = (node.operator === 41
|
||||
|
||||
+276
-173
@@ -130,6 +130,7 @@ var ts;
|
||||
var ts;
|
||||
(function (ts) {
|
||||
var createObject = Object.create;
|
||||
ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined;
|
||||
function createMap(template) {
|
||||
var map = createObject(null);
|
||||
map["__"] = undefined;
|
||||
@@ -687,7 +688,7 @@ var ts;
|
||||
if (b === undefined)
|
||||
return 1;
|
||||
if (ignoreCase) {
|
||||
if (String.prototype.localeCompare) {
|
||||
if (ts.collator && String.prototype.localeCompare) {
|
||||
var result = a.localeCompare(b, undefined, { usage: "sort", sensitivity: "accent" });
|
||||
return result < 0 ? -1 : result > 0 ? 1 : 0;
|
||||
}
|
||||
@@ -1715,6 +1716,9 @@ var ts;
|
||||
},
|
||||
watchDirectory: function (directoryName, callback, recursive) {
|
||||
var options;
|
||||
if (!directoryExists(directoryName)) {
|
||||
return;
|
||||
}
|
||||
if (isNode4OrLater() && (process.platform === "win32" || process.platform === "darwin")) {
|
||||
options = { persistent: true, recursive: !!recursive };
|
||||
}
|
||||
@@ -5187,10 +5191,12 @@ var ts;
|
||||
}
|
||||
}
|
||||
function getTypingNamesFromJson(jsonPath, filesToWatch) {
|
||||
if (host.fileExists(jsonPath)) {
|
||||
filesToWatch.push(jsonPath);
|
||||
}
|
||||
var result = ts.readConfigFile(jsonPath, function (path) { return host.readFile(path); });
|
||||
if (result.config) {
|
||||
var jsonConfig = result.config;
|
||||
filesToWatch.push(jsonPath);
|
||||
if (jsonConfig.dependencies) {
|
||||
mergeTypings(ts.getOwnKeys(jsonConfig.dependencies));
|
||||
}
|
||||
@@ -5391,43 +5397,44 @@ var ts;
|
||||
throw new Error("LanguageService is disabled");
|
||||
}
|
||||
server.nullLanguageService = {
|
||||
cleanupSemanticCache: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getSyntacticDiagnostics: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getSemanticDiagnostics: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getCompilerOptionsDiagnostics: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getSyntacticClassifications: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getEncodedSyntacticClassifications: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getSemanticClassifications: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getEncodedSemanticClassifications: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getCompletionsAtPosition: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
findReferences: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getCompletionEntryDetails: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getQuickInfoAtPosition: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
findRenameLocations: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getNameOrDottedNameSpan: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getBreakpointStatementAtPosition: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getBraceMatchingAtPosition: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getSignatureHelpItems: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getDefinitionAtPosition: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getRenameInfo: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getTypeDefinitionAtPosition: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getReferencesAtPosition: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getDocumentHighlights: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getOccurrencesAtPosition: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getNavigateToItems: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getNavigationBarItems: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getOutliningSpans: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getTodoComments: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getIndentationAtPosition: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getFormattingEditsForRange: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getFormattingEditsForDocument: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getFormattingEditsAfterKeystroke: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getDocCommentTemplateAtPosition: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
isValidBraceCompletionAtPosition: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getEmitOutput: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getProgram: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getNonBoundSourceFile: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
dispose: function () { return throwLanguageServiceIsDisabledError(); }
|
||||
cleanupSemanticCache: throwLanguageServiceIsDisabledError,
|
||||
getSyntacticDiagnostics: throwLanguageServiceIsDisabledError,
|
||||
getSemanticDiagnostics: throwLanguageServiceIsDisabledError,
|
||||
getCompilerOptionsDiagnostics: throwLanguageServiceIsDisabledError,
|
||||
getSyntacticClassifications: throwLanguageServiceIsDisabledError,
|
||||
getEncodedSyntacticClassifications: throwLanguageServiceIsDisabledError,
|
||||
getSemanticClassifications: throwLanguageServiceIsDisabledError,
|
||||
getEncodedSemanticClassifications: throwLanguageServiceIsDisabledError,
|
||||
getCompletionsAtPosition: throwLanguageServiceIsDisabledError,
|
||||
findReferences: throwLanguageServiceIsDisabledError,
|
||||
getCompletionEntryDetails: throwLanguageServiceIsDisabledError,
|
||||
getQuickInfoAtPosition: throwLanguageServiceIsDisabledError,
|
||||
findRenameLocations: throwLanguageServiceIsDisabledError,
|
||||
getNameOrDottedNameSpan: throwLanguageServiceIsDisabledError,
|
||||
getBreakpointStatementAtPosition: throwLanguageServiceIsDisabledError,
|
||||
getBraceMatchingAtPosition: throwLanguageServiceIsDisabledError,
|
||||
getSignatureHelpItems: throwLanguageServiceIsDisabledError,
|
||||
getDefinitionAtPosition: throwLanguageServiceIsDisabledError,
|
||||
getRenameInfo: throwLanguageServiceIsDisabledError,
|
||||
getTypeDefinitionAtPosition: throwLanguageServiceIsDisabledError,
|
||||
getReferencesAtPosition: throwLanguageServiceIsDisabledError,
|
||||
getDocumentHighlights: throwLanguageServiceIsDisabledError,
|
||||
getOccurrencesAtPosition: throwLanguageServiceIsDisabledError,
|
||||
getNavigateToItems: throwLanguageServiceIsDisabledError,
|
||||
getNavigationBarItems: throwLanguageServiceIsDisabledError,
|
||||
getNavigationTree: throwLanguageServiceIsDisabledError,
|
||||
getOutliningSpans: throwLanguageServiceIsDisabledError,
|
||||
getTodoComments: throwLanguageServiceIsDisabledError,
|
||||
getIndentationAtPosition: throwLanguageServiceIsDisabledError,
|
||||
getFormattingEditsForRange: throwLanguageServiceIsDisabledError,
|
||||
getFormattingEditsForDocument: throwLanguageServiceIsDisabledError,
|
||||
getFormattingEditsAfterKeystroke: throwLanguageServiceIsDisabledError,
|
||||
getDocCommentTemplateAtPosition: throwLanguageServiceIsDisabledError,
|
||||
isValidBraceCompletionAtPosition: throwLanguageServiceIsDisabledError,
|
||||
getEmitOutput: throwLanguageServiceIsDisabledError,
|
||||
getProgram: throwLanguageServiceIsDisabledError,
|
||||
getNonBoundSourceFile: throwLanguageServiceIsDisabledError,
|
||||
dispose: throwLanguageServiceIsDisabledError
|
||||
};
|
||||
server.nullLanguageServiceHost = {
|
||||
setCompilationSettings: function () { return undefined; },
|
||||
@@ -16372,14 +16379,14 @@ var ts;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function isSymbolAccessible(symbol, enclosingDeclaration, meaning) {
|
||||
function isSymbolAccessible(symbol, enclosingDeclaration, meaning, shouldComputeAliasesToMakeVisible) {
|
||||
if (symbol && enclosingDeclaration && !(symbol.flags & 262144)) {
|
||||
var initialSymbol = symbol;
|
||||
var meaningToLook = meaning;
|
||||
while (symbol) {
|
||||
var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaningToLook, false);
|
||||
if (accessibleSymbolChain) {
|
||||
var hasAccessibleDeclarations = hasVisibleDeclarations(accessibleSymbolChain[0]);
|
||||
var hasAccessibleDeclarations = hasVisibleDeclarations(accessibleSymbolChain[0], shouldComputeAliasesToMakeVisible);
|
||||
if (!hasAccessibleDeclarations) {
|
||||
return {
|
||||
accessibility: 1,
|
||||
@@ -16420,7 +16427,7 @@ var ts;
|
||||
function hasExternalModuleSymbol(declaration) {
|
||||
return ts.isAmbientModule(declaration) || (declaration.kind === 256 && ts.isExternalOrCommonJsModule(declaration));
|
||||
}
|
||||
function hasVisibleDeclarations(symbol) {
|
||||
function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) {
|
||||
var aliasesToMakeVisible;
|
||||
if (ts.forEach(symbol.declarations, function (declaration) { return !getIsDeclarationVisible(declaration); })) {
|
||||
return undefined;
|
||||
@@ -16432,14 +16439,16 @@ var ts;
|
||||
if (anyImportSyntax &&
|
||||
!(anyImportSyntax.flags & 1) &&
|
||||
isDeclarationVisible(anyImportSyntax.parent)) {
|
||||
getNodeLinks(declaration).isVisible = true;
|
||||
if (aliasesToMakeVisible) {
|
||||
if (!ts.contains(aliasesToMakeVisible, anyImportSyntax)) {
|
||||
aliasesToMakeVisible.push(anyImportSyntax);
|
||||
if (shouldComputeAliasToMakeVisible) {
|
||||
getNodeLinks(declaration).isVisible = true;
|
||||
if (aliasesToMakeVisible) {
|
||||
if (!ts.contains(aliasesToMakeVisible, anyImportSyntax)) {
|
||||
aliasesToMakeVisible.push(anyImportSyntax);
|
||||
}
|
||||
}
|
||||
else {
|
||||
aliasesToMakeVisible = [anyImportSyntax];
|
||||
}
|
||||
}
|
||||
else {
|
||||
aliasesToMakeVisible = [anyImportSyntax];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -16462,7 +16471,7 @@ var ts;
|
||||
}
|
||||
var firstIdentifier = getFirstIdentifier(entityName);
|
||||
var symbol = resolveName(enclosingDeclaration, firstIdentifier.text, meaning, undefined, undefined);
|
||||
return (symbol && hasVisibleDeclarations(symbol)) || {
|
||||
return (symbol && hasVisibleDeclarations(symbol, true)) || {
|
||||
accessibility: 1,
|
||||
errorSymbolName: ts.getTextOfNode(firstIdentifier),
|
||||
errorNode: firstIdentifier
|
||||
@@ -16679,14 +16688,10 @@ var ts;
|
||||
else if (type.flags & (32768 | 65536 | 16 | 16384)) {
|
||||
buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 793064, 0, nextFlags);
|
||||
}
|
||||
else if (!(flags & 512) && type.flags & (2097152 | 1572864) && type.aliasSymbol) {
|
||||
if (type.flags & 2097152 || !(flags & 1024)) {
|
||||
var typeArguments = type.aliasTypeArguments;
|
||||
writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, typeArguments ? typeArguments.length : 0, nextFlags);
|
||||
}
|
||||
else {
|
||||
writeUnionOrIntersectionType(type, nextFlags);
|
||||
}
|
||||
else if (!(flags & 512) && ((type.flags & 2097152 && !type.target) || type.flags & 1572864) && type.aliasSymbol &&
|
||||
isSymbolAccessible(type.aliasSymbol, enclosingDeclaration, 793064, false).accessibility === 0) {
|
||||
var typeArguments = type.aliasTypeArguments;
|
||||
writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, typeArguments ? typeArguments.length : 0, nextFlags);
|
||||
}
|
||||
else if (type.flags & 1572864) {
|
||||
writeUnionOrIntersectionType(type, nextFlags);
|
||||
@@ -30975,7 +30980,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
function trackSymbol(symbol, enclosingDeclaration, meaning) {
|
||||
handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning));
|
||||
handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning, true));
|
||||
recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForSymbol(symbol, meaning));
|
||||
}
|
||||
function reportInaccessibleThisError() {
|
||||
@@ -30992,7 +30997,7 @@ var ts;
|
||||
}
|
||||
else {
|
||||
errorNameNode = declaration.name;
|
||||
resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, 2 | 1024, writer);
|
||||
resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, 2, writer);
|
||||
errorNameNode = undefined;
|
||||
}
|
||||
}
|
||||
@@ -31004,7 +31009,7 @@ var ts;
|
||||
}
|
||||
else {
|
||||
errorNameNode = signature.name;
|
||||
resolver.writeReturnTypeOfSignatureDeclaration(signature, enclosingDeclaration, 2 | 1024, writer);
|
||||
resolver.writeReturnTypeOfSignatureDeclaration(signature, enclosingDeclaration, 2, writer);
|
||||
errorNameNode = undefined;
|
||||
}
|
||||
}
|
||||
@@ -31197,7 +31202,7 @@ var ts;
|
||||
write(tempVarName);
|
||||
write(": ");
|
||||
writer.getSymbolAccessibilityDiagnostic = getDefaultExportAccessibilityDiagnostic;
|
||||
resolver.writeTypeOfExpression(node.expression, enclosingDeclaration, 2 | 1024, writer);
|
||||
resolver.writeTypeOfExpression(node.expression, enclosingDeclaration, 2, writer);
|
||||
write(";");
|
||||
writeLine();
|
||||
write(node.isExportEquals ? "export = " : "export default ");
|
||||
@@ -31602,7 +31607,7 @@ var ts;
|
||||
}
|
||||
else {
|
||||
writer.getSymbolAccessibilityDiagnostic = getHeritageClauseVisibilityError;
|
||||
resolver.writeBaseConstructorTypeOfClass(enclosingDeclaration, enclosingDeclaration, 2 | 1024, writer);
|
||||
resolver.writeBaseConstructorTypeOfClass(enclosingDeclaration, enclosingDeclaration, 2, writer);
|
||||
}
|
||||
function getHeritageClauseVisibilityError(symbolAccessibilityResult) {
|
||||
var diagnosticMessage;
|
||||
@@ -33681,14 +33686,14 @@ var ts;
|
||||
write(" = ");
|
||||
emitObjectLiteralBody(node, firstComputedPropertyIndex);
|
||||
for (var i = firstComputedPropertyIndex, n = properties.length; i < n; i++) {
|
||||
writeComma();
|
||||
var property = properties[i];
|
||||
emitStart(property);
|
||||
if (property.kind === 149 || property.kind === 150) {
|
||||
var accessors = ts.getAllAccessorDeclarations(node.properties, property);
|
||||
if (property !== accessors.firstAccessor) {
|
||||
continue;
|
||||
}
|
||||
writeComma();
|
||||
emitStart(property);
|
||||
write("Object.defineProperty(");
|
||||
emit(tempVar);
|
||||
write(", ");
|
||||
@@ -33729,6 +33734,8 @@ var ts;
|
||||
emitEnd(property);
|
||||
}
|
||||
else {
|
||||
writeComma();
|
||||
emitStart(property);
|
||||
emitLeadingComments(property);
|
||||
emitStart(property.name);
|
||||
emit(tempVar);
|
||||
@@ -33747,8 +33754,8 @@ var ts;
|
||||
else {
|
||||
ts.Debug.fail("ObjectLiteralElement type not accounted for: " + property.kind);
|
||||
}
|
||||
emitEnd(property);
|
||||
}
|
||||
emitEnd(property);
|
||||
}
|
||||
writeComma();
|
||||
emit(tempVar);
|
||||
@@ -34192,7 +34199,11 @@ var ts;
|
||||
if (modulekind === ts.ModuleKind.System || node.kind !== 69 || ts.nodeIsSynthesized(node)) {
|
||||
return false;
|
||||
}
|
||||
return !exportEquals && exportSpecifiers && node.text in exportSpecifiers;
|
||||
if (exportEquals || !exportSpecifiers || !(node.text in exportSpecifiers)) {
|
||||
return false;
|
||||
}
|
||||
var declaration = resolver.getReferencedValueDeclaration(node);
|
||||
return declaration && ts.getEnclosingBlockScopeContainer(declaration).kind === 256;
|
||||
}
|
||||
function emitPrefixUnaryExpression(node) {
|
||||
var isPlusPlusOrMinusMinus = (node.operator === 41
|
||||
@@ -40506,7 +40517,6 @@ var ts;
|
||||
function getNavigateToItems(program, checker, cancellationToken, searchValue, maxResultCount, excludeDts) {
|
||||
var patternMatcher = ts.createPatternMatcher(searchValue);
|
||||
var rawItems = [];
|
||||
var baseSensitivity = { sensitivity: "base" };
|
||||
ts.forEach(program.getSourceFiles(), function (sourceFile) {
|
||||
cancellationToken.throwIfCancellationRequested();
|
||||
var nameToDeclarations = sourceFile.getNamedDeclarations();
|
||||
@@ -40638,8 +40648,8 @@ var ts;
|
||||
}
|
||||
function compareNavigateToItems(i1, i2) {
|
||||
return i1.matchKind - i2.matchKind ||
|
||||
i1.name.localeCompare(i2.name, undefined, baseSensitivity) ||
|
||||
i1.name.localeCompare(i2.name);
|
||||
ts.compareStringsCaseInsensitive(i1.name, i2.name) ||
|
||||
ts.compareStrings(i1.name, i2.name);
|
||||
}
|
||||
function createNavigateToItem(rawItem) {
|
||||
var declaration = rawItem.declaration;
|
||||
@@ -40671,6 +40681,13 @@ var ts;
|
||||
return result;
|
||||
}
|
||||
NavigationBar.getNavigationBarItems = getNavigationBarItems;
|
||||
function getNavigationTree(sourceFile) {
|
||||
curSourceFile = sourceFile;
|
||||
var result = convertToTree(rootNavigationBarNode(sourceFile));
|
||||
curSourceFile = undefined;
|
||||
return result;
|
||||
}
|
||||
NavigationBar.getNavigationTree = getNavigationTree;
|
||||
var curSourceFile;
|
||||
function nodeText(node) {
|
||||
return node.getText(curSourceFile);
|
||||
@@ -40920,9 +40937,8 @@ var ts;
|
||||
return name1 ? 1 : name2 ? -1 : navigationBarNodeKind(child1) - navigationBarNodeKind(child2);
|
||||
}
|
||||
}
|
||||
var collator = typeof Intl !== "undefined" && Intl && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined;
|
||||
var localeCompareIsCorrect = collator && collator.compare("a", "B") < 0;
|
||||
var localeCompareFix = localeCompareIsCorrect ? collator.compare : function (a, b) {
|
||||
var localeCompareIsCorrect = ts.collator && ts.collator.compare("a", "B") < 0;
|
||||
var localeCompareFix = localeCompareIsCorrect ? ts.collator.compare : function (a, b) {
|
||||
for (var i = 0; i < Math.min(a.length, b.length); i++) {
|
||||
var chA = a.charAt(i), chB = b.charAt(i);
|
||||
if (chA === "\"" && chB === "'") {
|
||||
@@ -40931,7 +40947,7 @@ var ts;
|
||||
if (chA === "'" && chB === "\"") {
|
||||
return -1;
|
||||
}
|
||||
var cmp = chA.toLocaleLowerCase().localeCompare(chB.toLocaleLowerCase());
|
||||
var cmp = ts.compareStrings(chA.toLocaleLowerCase(), chB.toLocaleLowerCase());
|
||||
if (cmp !== 0) {
|
||||
return cmp;
|
||||
}
|
||||
@@ -41075,6 +41091,15 @@ var ts;
|
||||
}
|
||||
}
|
||||
var emptyChildItemArray = [];
|
||||
function convertToTree(n) {
|
||||
return {
|
||||
text: getItemName(n.node),
|
||||
kind: ts.getNodeKind(n.node),
|
||||
kindModifiers: ts.getNodeModifiers(n.node),
|
||||
spans: getSpans(n),
|
||||
childItems: ts.map(n.children, convertToTree)
|
||||
};
|
||||
}
|
||||
function convertToTopLevelItem(n) {
|
||||
return {
|
||||
text: getItemName(n.node),
|
||||
@@ -41098,16 +41123,16 @@ var ts;
|
||||
grayed: false
|
||||
};
|
||||
}
|
||||
function getSpans(n) {
|
||||
var spans = [getNodeSpan(n.node)];
|
||||
if (n.additionalNodes) {
|
||||
for (var _i = 0, _a = n.additionalNodes; _i < _a.length; _i++) {
|
||||
var node = _a[_i];
|
||||
spans.push(getNodeSpan(node));
|
||||
}
|
||||
}
|
||||
function getSpans(n) {
|
||||
var spans = [getNodeSpan(n.node)];
|
||||
if (n.additionalNodes) {
|
||||
for (var _i = 0, _a = n.additionalNodes; _i < _a.length; _i++) {
|
||||
var node = _a[_i];
|
||||
spans.push(getNodeSpan(node));
|
||||
}
|
||||
return spans;
|
||||
}
|
||||
return spans;
|
||||
}
|
||||
function getModuleName(moduleDeclaration) {
|
||||
if (ts.isAmbientModule(moduleDeclaration)) {
|
||||
@@ -50365,8 +50390,10 @@ var ts;
|
||||
return ts.BreakpointResolver.spanInSourceFileAtLocation(sourceFile, position);
|
||||
}
|
||||
function getNavigationBarItems(fileName) {
|
||||
var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
|
||||
return ts.NavigationBar.getNavigationBarItems(sourceFile);
|
||||
return ts.NavigationBar.getNavigationBarItems(syntaxTreeCache.getCurrentSourceFile(fileName));
|
||||
}
|
||||
function getNavigationTree(fileName) {
|
||||
return ts.NavigationBar.getNavigationTree(syntaxTreeCache.getCurrentSourceFile(fileName));
|
||||
}
|
||||
function getSemanticClassifications(fileName, span) {
|
||||
return convertClassifications(getEncodedSemanticClassifications(fileName, span));
|
||||
@@ -51132,6 +51159,7 @@ var ts;
|
||||
getRenameInfo: getRenameInfo,
|
||||
findRenameLocations: findRenameLocations,
|
||||
getNavigationBarItems: getNavigationBarItems,
|
||||
getNavigationTree: getNavigationTree,
|
||||
getOutliningSpans: getOutliningSpans,
|
||||
getTodoComments: getTodoComments,
|
||||
getBraceMatchingAtPosition: getBraceMatchingAtPosition,
|
||||
@@ -51645,12 +51673,12 @@ var ts;
|
||||
var snap = this.snap();
|
||||
this.host.writeFile(fileName, snap.getText(0, snap.getLength()));
|
||||
};
|
||||
ScriptInfo.prototype.reloadFromFile = function () {
|
||||
ScriptInfo.prototype.reloadFromFile = function (tempFileName) {
|
||||
if (this.hasMixedContent) {
|
||||
this.reload("");
|
||||
}
|
||||
else {
|
||||
this.svc.reloadFromFile(this.fileName);
|
||||
this.svc.reloadFromFile(tempFileName || this.fileName);
|
||||
this.markContainingProjectsAsDirty();
|
||||
}
|
||||
};
|
||||
@@ -52558,11 +52586,11 @@ var ts;
|
||||
this.markAsDirty();
|
||||
}
|
||||
};
|
||||
Project.prototype.reloadScript = function (filename) {
|
||||
Project.prototype.reloadScript = function (filename, tempFileName) {
|
||||
var script = this.projectService.getScriptInfoForNormalizedPath(filename);
|
||||
if (script) {
|
||||
ts.Debug.assert(script.isAttached(this));
|
||||
script.reloadFromFile();
|
||||
script.reloadFromFile(tempFileName);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -52850,6 +52878,66 @@ var ts;
|
||||
var server;
|
||||
(function (server) {
|
||||
server.maxProgramSizeForNonTsFiles = 20 * 1024 * 1024;
|
||||
function prepareConvertersForEnumLikeCompilerOptions(commandLineOptions) {
|
||||
var map = ts.createMap();
|
||||
for (var _i = 0, commandLineOptions_1 = commandLineOptions; _i < commandLineOptions_1.length; _i++) {
|
||||
var option = commandLineOptions_1[_i];
|
||||
if (typeof option.type === "object") {
|
||||
var optionMap = option.type;
|
||||
for (var id in optionMap) {
|
||||
ts.Debug.assert(typeof optionMap[id] === "number");
|
||||
}
|
||||
map[option.name] = optionMap;
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
var compilerOptionConverters = prepareConvertersForEnumLikeCompilerOptions(ts.optionDeclarations);
|
||||
var indentStyle = ts.createMap({
|
||||
"none": ts.IndentStyle.None,
|
||||
"block": ts.IndentStyle.Block,
|
||||
"smart": ts.IndentStyle.Smart
|
||||
});
|
||||
function convertFormatOptions(protocolOptions) {
|
||||
if (typeof protocolOptions.indentStyle === "string") {
|
||||
protocolOptions.indentStyle = indentStyle[protocolOptions.indentStyle.toLowerCase()];
|
||||
ts.Debug.assert(protocolOptions.indentStyle !== undefined);
|
||||
}
|
||||
return protocolOptions;
|
||||
}
|
||||
server.convertFormatOptions = convertFormatOptions;
|
||||
function convertCompilerOptions(protocolOptions) {
|
||||
for (var id in compilerOptionConverters) {
|
||||
var propertyValue = protocolOptions[id];
|
||||
if (typeof propertyValue === "string") {
|
||||
var mappedValues = compilerOptionConverters[id];
|
||||
protocolOptions[id] = mappedValues[propertyValue.toLowerCase()];
|
||||
}
|
||||
}
|
||||
return protocolOptions;
|
||||
}
|
||||
server.convertCompilerOptions = convertCompilerOptions;
|
||||
function tryConvertScriptKindName(scriptKindName) {
|
||||
return typeof scriptKindName === "string"
|
||||
? convertScriptKindName(scriptKindName)
|
||||
: scriptKindName;
|
||||
}
|
||||
server.tryConvertScriptKindName = tryConvertScriptKindName;
|
||||
function convertScriptKindName(scriptKindName) {
|
||||
switch (scriptKindName) {
|
||||
case "JS":
|
||||
return 1;
|
||||
case "JSX":
|
||||
return 2;
|
||||
case "TS":
|
||||
return 3;
|
||||
case "TSX":
|
||||
return 4;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
server.convertScriptKindName = convertScriptKindName;
|
||||
function combineProjectOutput(projects, action, comparer, areEqual) {
|
||||
var result = projects.reduce(function (previous, current) { return ts.concatenate(previous, action(current)); }, []).sort(comparer);
|
||||
return projects.length > 1 ? ts.deduplicate(result, areEqual) : result;
|
||||
@@ -52862,7 +52950,7 @@ var ts;
|
||||
};
|
||||
var externalFilePropertyReader = {
|
||||
getFileName: function (x) { return x.fileName; },
|
||||
getScriptKind: function (x) { return x.scriptKind; },
|
||||
getScriptKind: function (x) { return tryConvertScriptKindName(x.scriptKind); },
|
||||
hasMixedContent: function (x) { return x.hasMixedContent; }
|
||||
};
|
||||
function findProjectByName(projectName, projects) {
|
||||
@@ -52947,6 +53035,9 @@ var ts;
|
||||
ProjectService.prototype.ensureInferredProjectsUpToDate_TestOnly = function () {
|
||||
this.ensureInferredProjectsUpToDate();
|
||||
};
|
||||
ProjectService.prototype.getCompilerOptionsForInferredProjects = function () {
|
||||
return this.compilerOptionsForInferredProjects;
|
||||
};
|
||||
ProjectService.prototype.updateTypingsForProject = function (response) {
|
||||
var project = this.findProject(response.projectName);
|
||||
if (!project) {
|
||||
@@ -52963,11 +53054,11 @@ var ts;
|
||||
}
|
||||
};
|
||||
ProjectService.prototype.setCompilerOptionsForInferredProjects = function (projectCompilerOptions) {
|
||||
this.compilerOptionsForInferredProjects = projectCompilerOptions;
|
||||
this.compilerOptionsForInferredProjects = convertCompilerOptions(projectCompilerOptions);
|
||||
this.compileOnSaveForInferredProjects = projectCompilerOptions.compileOnSave;
|
||||
for (var _i = 0, _a = this.inferredProjects; _i < _a.length; _i++) {
|
||||
var proj = _a[_i];
|
||||
proj.setCompilerOptions(projectCompilerOptions);
|
||||
proj.setCompilerOptions(this.compilerOptionsForInferredProjects);
|
||||
proj.compileOnSaveEnabled = projectCompilerOptions.compileOnSave;
|
||||
}
|
||||
this.updateProjectGraphs(this.inferredProjects);
|
||||
@@ -53313,7 +53404,7 @@ var ts;
|
||||
}
|
||||
ts.Debug.assert(!!parsedCommandLine.fileNames);
|
||||
if (parsedCommandLine.fileNames.length === 0) {
|
||||
errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.The_config_file_0_found_doesn_t_contain_any_source_files, configFilename));
|
||||
(errors || (errors = [])).push(ts.createCompilerDiagnostic(ts.Diagnostics.The_config_file_0_found_doesn_t_contain_any_source_files, configFilename));
|
||||
return { success: false, configFileErrors: errors };
|
||||
}
|
||||
var projectOptions = {
|
||||
@@ -53345,18 +53436,20 @@ var ts;
|
||||
return false;
|
||||
};
|
||||
ProjectService.prototype.createAndAddExternalProject = function (projectFileName, files, options, typingOptions) {
|
||||
var project = new server.ExternalProject(projectFileName, this, this.documentRegistry, options, !this.exceededTotalSizeLimitForNonTsFiles(options, files, externalFilePropertyReader), options.compileOnSave === undefined ? true : options.compileOnSave);
|
||||
var compilerOptions = convertCompilerOptions(options);
|
||||
var project = new server.ExternalProject(projectFileName, this, this.documentRegistry, compilerOptions, !this.exceededTotalSizeLimitForNonTsFiles(compilerOptions, files, externalFilePropertyReader), options.compileOnSave === undefined ? true : options.compileOnSave);
|
||||
this.addFilesToProjectAndUpdateGraph(project, files, externalFilePropertyReader, undefined, typingOptions, undefined);
|
||||
this.externalProjects.push(project);
|
||||
return project;
|
||||
};
|
||||
ProjectService.prototype.reportConfigFileDiagnostics = function (configFileName, diagnostics, triggerFile) {
|
||||
if (diagnostics && diagnostics.length > 0) {
|
||||
this.eventHandler({
|
||||
eventName: "configFileDiag",
|
||||
data: { configFileName: configFileName, diagnostics: diagnostics, triggerFile: triggerFile }
|
||||
});
|
||||
if (!this.eventHandler) {
|
||||
return;
|
||||
}
|
||||
this.eventHandler({
|
||||
eventName: "configFileDiag",
|
||||
data: { configFileName: configFileName, diagnostics: diagnostics || [], triggerFile: triggerFile }
|
||||
});
|
||||
};
|
||||
ProjectService.prototype.createAndAddConfiguredProject = function (configFileName, projectOptions, configFileErrors, clientFileName) {
|
||||
var _this = this;
|
||||
@@ -53563,7 +53656,7 @@ var ts;
|
||||
if (args.file) {
|
||||
var info = this.getScriptInfoForNormalizedPath(server.toNormalizedPath(args.file));
|
||||
if (info) {
|
||||
info.setFormatOptions(args.formatOptions);
|
||||
info.setFormatOptions(convertFormatOptions(args.formatOptions));
|
||||
this.logger.info("Host configuration update for file " + args.file);
|
||||
}
|
||||
}
|
||||
@@ -53573,7 +53666,7 @@ var ts;
|
||||
this.logger.info("Host information " + args.hostInfo);
|
||||
}
|
||||
if (args.formatOptions) {
|
||||
server.mergeMaps(this.hostConfiguration.formatCodeOptions, args.formatOptions);
|
||||
server.mergeMaps(this.hostConfiguration.formatCodeOptions, convertFormatOptions(args.formatOptions));
|
||||
this.logger.info("Format host information updated");
|
||||
}
|
||||
}
|
||||
@@ -53664,7 +53757,7 @@ var ts;
|
||||
var scriptInfo = this.getScriptInfo(file.fileName);
|
||||
ts.Debug.assert(!scriptInfo || !scriptInfo.isOpen);
|
||||
var normalizedPath = scriptInfo ? scriptInfo.fileName : server.toNormalizedPath(file.fileName);
|
||||
this.openClientFileWithNormalizedPath(normalizedPath, file.content, file.scriptKind, file.hasMixedContent);
|
||||
this.openClientFileWithNormalizedPath(normalizedPath, file.content, tryConvertScriptKindName(file.scriptKind), file.hasMixedContent);
|
||||
}
|
||||
}
|
||||
if (changedFiles) {
|
||||
@@ -53749,7 +53842,7 @@ var ts;
|
||||
var exisingConfigFiles;
|
||||
if (externalProject) {
|
||||
if (!tsConfigFiles) {
|
||||
this.updateNonInferredProject(externalProject, proj.rootFiles, externalFilePropertyReader, proj.options, proj.typingOptions, proj.options.compileOnSave, undefined);
|
||||
this.updateNonInferredProject(externalProject, proj.rootFiles, externalFilePropertyReader, convertCompilerOptions(proj.options), proj.typingOptions, proj.options.compileOnSave, undefined);
|
||||
return;
|
||||
}
|
||||
this.closeExternalProject(proj.projectFileName, true);
|
||||
@@ -53887,6 +53980,8 @@ var ts;
|
||||
CommandNames.SyntacticDiagnosticsSync = "syntacticDiagnosticsSync";
|
||||
CommandNames.NavBar = "navbar";
|
||||
CommandNames.NavBarFull = "navbar-full";
|
||||
CommandNames.NavTree = "navtree";
|
||||
CommandNames.NavTreeFull = "navtree-full";
|
||||
CommandNames.Navto = "navto";
|
||||
CommandNames.NavtoFull = "navto-full";
|
||||
CommandNames.Occurrences = "occurrences";
|
||||
@@ -53935,7 +54030,7 @@ var ts;
|
||||
}
|
||||
server.formatMessage = formatMessage;
|
||||
var Session = (function () {
|
||||
function Session(host, cancellationToken, useSingleInferredProject, typingsInstaller, byteLength, hrtime, logger, canUseEvents) {
|
||||
function Session(host, cancellationToken, useSingleInferredProject, typingsInstaller, byteLength, hrtime, logger, canUseEvents, eventHandler) {
|
||||
var _this = this;
|
||||
this.host = host;
|
||||
this.typingsInstaller = typingsInstaller;
|
||||
@@ -54012,23 +54107,7 @@ var ts;
|
||||
return _this.requiredResponse(_this.getRenameInfo(request.arguments));
|
||||
},
|
||||
_a[CommandNames.Open] = function (request) {
|
||||
var openArgs = request.arguments;
|
||||
var scriptKind;
|
||||
switch (openArgs.scriptKindName) {
|
||||
case "TS":
|
||||
scriptKind = 3;
|
||||
break;
|
||||
case "JS":
|
||||
scriptKind = 1;
|
||||
break;
|
||||
case "TSX":
|
||||
scriptKind = 4;
|
||||
break;
|
||||
case "JSX":
|
||||
scriptKind = 2;
|
||||
break;
|
||||
}
|
||||
_this.openClientFile(server.toNormalizedPath(openArgs.file), openArgs.fileContent, scriptKind);
|
||||
_this.openClientFile(server.toNormalizedPath(request.arguments.file), request.arguments.fileContent, server.convertScriptKindName(request.arguments.scriptKindName));
|
||||
return _this.notRequired();
|
||||
},
|
||||
_a[CommandNames.Quickinfo] = function (request) {
|
||||
@@ -54159,6 +54238,12 @@ var ts;
|
||||
_a[CommandNames.NavBarFull] = function (request) {
|
||||
return _this.requiredResponse(_this.getNavigationBarItems(request.arguments, false));
|
||||
},
|
||||
_a[CommandNames.NavTree] = function (request) {
|
||||
return _this.requiredResponse(_this.getNavigationTree(request.arguments, true));
|
||||
},
|
||||
_a[CommandNames.NavTreeFull] = function (request) {
|
||||
return _this.requiredResponse(_this.getNavigationTree(request.arguments, false));
|
||||
},
|
||||
_a[CommandNames.Occurrences] = function (request) {
|
||||
return _this.requiredResponse(_this.getOccurrences(request.arguments));
|
||||
},
|
||||
@@ -54169,7 +54254,8 @@ var ts;
|
||||
return _this.requiredResponse(_this.getDocumentHighlights(request.arguments, false));
|
||||
},
|
||||
_a[CommandNames.CompilerOptionsForInferredProjects] = function (request) {
|
||||
return _this.requiredResponse(_this.setCompilerOptionsForInferredProjects(request.arguments));
|
||||
_this.setCompilerOptionsForInferredProjects(request.arguments);
|
||||
return _this.requiredResponse(true);
|
||||
},
|
||||
_a[CommandNames.ProjectInfo] = function (request) {
|
||||
return _this.requiredResponse(_this.getProjectInfo(request.arguments));
|
||||
@@ -54180,14 +54266,14 @@ var ts;
|
||||
},
|
||||
_a
|
||||
));
|
||||
var eventHandler = canUseEvents
|
||||
? function (event) { return _this.handleEvent(event); }
|
||||
this.eventHander = canUseEvents
|
||||
? eventHandler || (function (event) { return _this.defaultEventHandler(event); })
|
||||
: undefined;
|
||||
this.projectService = new server.ProjectService(host, logger, cancellationToken, useSingleInferredProject, typingsInstaller, eventHandler);
|
||||
this.projectService = new server.ProjectService(host, logger, cancellationToken, useSingleInferredProject, typingsInstaller, this.eventHander);
|
||||
this.gcTimer = new server.GcTimer(host, 7000, logger);
|
||||
var _a;
|
||||
}
|
||||
Session.prototype.handleEvent = function (event) {
|
||||
Session.prototype.defaultEventHandler = function (event) {
|
||||
var _this = this;
|
||||
switch (event.eventName) {
|
||||
case "context":
|
||||
@@ -54653,8 +54739,11 @@ var ts;
|
||||
};
|
||||
Session.prototype.openClientFile = function (fileName, fileContent, scriptKind) {
|
||||
var _a = this.projectService.openClientFileWithNormalizedPath(fileName, fileContent, scriptKind), configFileName = _a.configFileName, configFileErrors = _a.configFileErrors;
|
||||
if (configFileErrors) {
|
||||
this.configFileDiagnosticEvent(fileName, configFileName, configFileErrors);
|
||||
if (this.eventHander) {
|
||||
this.eventHander({
|
||||
eventName: "configFileDiag",
|
||||
data: { fileName: fileName, configFileName: configFileName, diagnostics: configFileErrors || [] }
|
||||
});
|
||||
}
|
||||
};
|
||||
Session.prototype.getPosition = function (args, scriptInfo) {
|
||||
@@ -54693,7 +54782,7 @@ var ts;
|
||||
Session.prototype.getIndentation = function (args) {
|
||||
var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project;
|
||||
var position = this.getPosition(args, project.getScriptInfoForNormalizedPath(file));
|
||||
var options = args.options || this.projectService.getFormatCodeOptions(file);
|
||||
var options = args.options ? server.convertFormatOptions(args.options) : this.projectService.getFormatCodeOptions(file);
|
||||
var indentation = project.getLanguageService(false).getIndentationAtPosition(file, position, options);
|
||||
return { position: position, indentation: indentation };
|
||||
};
|
||||
@@ -54754,17 +54843,17 @@ var ts;
|
||||
};
|
||||
Session.prototype.getFormattingEditsForRangeFull = function (args) {
|
||||
var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project;
|
||||
var options = args.options || this.projectService.getFormatCodeOptions(file);
|
||||
var options = args.options ? server.convertFormatOptions(args.options) : this.projectService.getFormatCodeOptions(file);
|
||||
return project.getLanguageService(false).getFormattingEditsForRange(file, args.position, args.endPosition, options);
|
||||
};
|
||||
Session.prototype.getFormattingEditsForDocumentFull = function (args) {
|
||||
var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project;
|
||||
var options = args.options || this.projectService.getFormatCodeOptions(file);
|
||||
var options = args.options ? server.convertFormatOptions(args.options) : this.projectService.getFormatCodeOptions(file);
|
||||
return project.getLanguageService(false).getFormattingEditsForDocument(file, options);
|
||||
};
|
||||
Session.prototype.getFormattingEditsAfterKeystrokeFull = function (args) {
|
||||
var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project;
|
||||
var options = args.options || this.projectService.getFormatCodeOptions(file);
|
||||
var options = args.options ? server.convertFormatOptions(args.options) : this.projectService.getFormatCodeOptions(file);
|
||||
return project.getLanguageService(false).getFormattingEditsAfterKeystroke(file, args.position, args.key, options);
|
||||
};
|
||||
Session.prototype.getFormattingEditsAfterKeystroke = function (args) {
|
||||
@@ -54814,6 +54903,7 @@ var ts;
|
||||
});
|
||||
};
|
||||
Session.prototype.getCompletions = function (args, simplifiedResult) {
|
||||
var _this = this;
|
||||
var prefix = args.prefix || "";
|
||||
var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;
|
||||
var scriptInfo = project.getScriptInfoForNormalizedPath(file);
|
||||
@@ -54826,17 +54916,11 @@ var ts;
|
||||
return completions.entries.reduce(function (result, entry) {
|
||||
if (completions.isMemberCompletion || (entry.name.toLowerCase().indexOf(prefix.toLowerCase()) === 0)) {
|
||||
var name_44 = entry.name, kind = entry.kind, kindModifiers = entry.kindModifiers, sortText = entry.sortText, replacementSpan = entry.replacementSpan;
|
||||
var convertedSpan = undefined;
|
||||
if (replacementSpan) {
|
||||
convertedSpan = {
|
||||
start: scriptInfo.positionToLineOffset(replacementSpan.start),
|
||||
end: scriptInfo.positionToLineOffset(replacementSpan.start + replacementSpan.length)
|
||||
};
|
||||
}
|
||||
var convertedSpan = replacementSpan ? _this.decorateSpan(replacementSpan, scriptInfo) : undefined;
|
||||
result.push({ name: name_44, kind: kind, kindModifiers: kindModifiers, sortText: sortText, replacementSpan: convertedSpan });
|
||||
}
|
||||
return result;
|
||||
}, []).sort(function (a, b) { return a.name.localeCompare(b.name); });
|
||||
}, []).sort(function (a, b) { return ts.compareStrings(a.name, b.name); });
|
||||
}
|
||||
else {
|
||||
return completions;
|
||||
@@ -54936,10 +55020,11 @@ var ts;
|
||||
};
|
||||
Session.prototype.reload = function (args, reqSeq) {
|
||||
var file = server.toNormalizedPath(args.file);
|
||||
var tempFileName = args.tmpfile && server.toNormalizedPath(args.tmpfile);
|
||||
var project = this.projectService.getDefaultProjectForFile(file, true);
|
||||
if (project) {
|
||||
this.changeSeq++;
|
||||
if (project.reloadScript(file)) {
|
||||
if (project.reloadScript(file, tempFileName)) {
|
||||
this.output(undefined, CommandNames.Reload, reqSeq);
|
||||
}
|
||||
}
|
||||
@@ -54957,33 +55042,50 @@ var ts;
|
||||
var file = ts.normalizePath(fileName);
|
||||
this.projectService.closeClientFile(file);
|
||||
};
|
||||
Session.prototype.decorateNavigationBarItem = function (project, fileName, items) {
|
||||
Session.prototype.decorateNavigationBarItems = function (items, scriptInfo) {
|
||||
var _this = this;
|
||||
if (!items) {
|
||||
return undefined;
|
||||
}
|
||||
var scriptInfo = project.getScriptInfoForNormalizedPath(fileName);
|
||||
return items.map(function (item) { return ({
|
||||
return ts.map(items, function (item) { return ({
|
||||
text: item.text,
|
||||
kind: item.kind,
|
||||
kindModifiers: item.kindModifiers,
|
||||
spans: item.spans.map(function (span) { return ({
|
||||
start: scriptInfo.positionToLineOffset(span.start),
|
||||
end: scriptInfo.positionToLineOffset(ts.textSpanEnd(span))
|
||||
}); }),
|
||||
childItems: _this.decorateNavigationBarItem(project, fileName, item.childItems),
|
||||
spans: item.spans.map(function (span) { return _this.decorateSpan(span, scriptInfo); }),
|
||||
childItems: _this.decorateNavigationBarItems(item.childItems, scriptInfo),
|
||||
indent: item.indent
|
||||
}); });
|
||||
};
|
||||
Session.prototype.getNavigationBarItems = function (args, simplifiedResult) {
|
||||
var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;
|
||||
var items = project.getLanguageService().getNavigationBarItems(file);
|
||||
if (!items) {
|
||||
return undefined;
|
||||
}
|
||||
return simplifiedResult
|
||||
? this.decorateNavigationBarItem(project, file, items)
|
||||
: items;
|
||||
var items = project.getLanguageService(false).getNavigationBarItems(file);
|
||||
return !items
|
||||
? undefined
|
||||
: simplifiedResult
|
||||
? this.decorateNavigationBarItems(items, project.getScriptInfoForNormalizedPath(file))
|
||||
: items;
|
||||
};
|
||||
Session.prototype.decorateNavigationTree = function (tree, scriptInfo) {
|
||||
var _this = this;
|
||||
return {
|
||||
text: tree.text,
|
||||
kind: tree.kind,
|
||||
kindModifiers: tree.kindModifiers,
|
||||
spans: tree.spans.map(function (span) { return _this.decorateSpan(span, scriptInfo); }),
|
||||
childItems: ts.map(tree.childItems, function (item) { return _this.decorateNavigationTree(item, scriptInfo); })
|
||||
};
|
||||
};
|
||||
Session.prototype.decorateSpan = function (span, scriptInfo) {
|
||||
return {
|
||||
start: scriptInfo.positionToLineOffset(span.start),
|
||||
end: scriptInfo.positionToLineOffset(ts.textSpanEnd(span))
|
||||
};
|
||||
};
|
||||
Session.prototype.getNavigationTree = function (args, simplifiedResult) {
|
||||
var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;
|
||||
var tree = project.getLanguageService(false).getNavigationTree(file);
|
||||
return !tree
|
||||
? undefined
|
||||
: simplifiedResult
|
||||
? this.decorateNavigationTree(tree, project.getScriptInfoForNormalizedPath(file))
|
||||
: tree;
|
||||
};
|
||||
Session.prototype.getNavigateToItems = function (args, simplifiedResult) {
|
||||
var projects = this.getProjects(args);
|
||||
@@ -55051,22 +55153,16 @@ var ts;
|
||||
}
|
||||
};
|
||||
Session.prototype.getBraceMatching = function (args, simplifiedResult) {
|
||||
var _this = this;
|
||||
var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project;
|
||||
var scriptInfo = project.getScriptInfoForNormalizedPath(file);
|
||||
var position = this.getPosition(args, scriptInfo);
|
||||
var spans = project.getLanguageService(false).getBraceMatchingAtPosition(file, position);
|
||||
if (!spans) {
|
||||
return undefined;
|
||||
}
|
||||
if (simplifiedResult) {
|
||||
return spans.map(function (span) { return ({
|
||||
start: scriptInfo.positionToLineOffset(span.start),
|
||||
end: scriptInfo.positionToLineOffset(span.start + span.length)
|
||||
}); });
|
||||
}
|
||||
else {
|
||||
return spans;
|
||||
}
|
||||
return !spans
|
||||
? undefined
|
||||
: simplifiedResult
|
||||
? spans.map(function (span) { return _this.decorateSpan(span, scriptInfo); })
|
||||
: spans;
|
||||
};
|
||||
Session.prototype.getDiagnosticsForProject = function (delay, fileName) {
|
||||
var _this = this;
|
||||
@@ -56187,8 +56283,10 @@ var ts;
|
||||
}());
|
||||
var IOSession = (function (_super) {
|
||||
__extends(IOSession, _super);
|
||||
function IOSession(host, cancellationToken, installerEventPort, canUseEvents, useSingleInferredProject, globalTypingsCacheLocation, logger) {
|
||||
_super.call(this, host, cancellationToken, useSingleInferredProject, new NodeTypingsInstaller(logger, installerEventPort, globalTypingsCacheLocation, host.newLine), Buffer.byteLength, process.hrtime, logger, canUseEvents);
|
||||
function IOSession(host, cancellationToken, installerEventPort, canUseEvents, useSingleInferredProject, disableAutomaticTypingAcquisition, globalTypingsCacheLocation, logger) {
|
||||
_super.call(this, host, cancellationToken, useSingleInferredProject, disableAutomaticTypingAcquisition
|
||||
? server.nullTypingsInstaller
|
||||
: new NodeTypingsInstaller(logger, installerEventPort, globalTypingsCacheLocation, host.newLine), Buffer.byteLength, process.hrtime, logger, canUseEvents);
|
||||
}
|
||||
IOSession.prototype.exit = function () {
|
||||
this.logger.info("Exiting...");
|
||||
@@ -56377,7 +56475,8 @@ var ts;
|
||||
}
|
||||
}
|
||||
var useSingleInferredProject = sys.args.indexOf("--useSingleInferredProject") >= 0;
|
||||
var ioSession = new IOSession(sys, cancellationToken, eventPort, eventPort === undefined, useSingleInferredProject, getGlobalTypingsCacheLocation(), logger);
|
||||
var disableAutomaticTypingAcquisition = sys.args.indexOf("--disableAutomaticTypingAcquisition") >= 0;
|
||||
var ioSession = new IOSession(sys, cancellationToken, eventPort, eventPort === undefined, useSingleInferredProject, disableAutomaticTypingAcquisition, getGlobalTypingsCacheLocation(), logger);
|
||||
process.on("uncaughtException", function (err) {
|
||||
ioSession.logError(err, "unknown");
|
||||
});
|
||||
@@ -56828,6 +56927,10 @@ var ts;
|
||||
var _this = this;
|
||||
return this.forwardJSONCall("getNavigationBarItems('" + fileName + "')", function () { return _this.languageService.getNavigationBarItems(fileName); });
|
||||
};
|
||||
LanguageServiceShimObject.prototype.getNavigationTree = function (fileName) {
|
||||
var _this = this;
|
||||
return this.forwardJSONCall("getNavigationTree('" + fileName + "')", function () { return _this.languageService.getNavigationTree(fileName); });
|
||||
};
|
||||
LanguageServiceShimObject.prototype.getOutliningSpans = function (fileName) {
|
||||
var _this = this;
|
||||
return this.forwardJSONCall("getOutliningSpans('" + fileName + "')", function () { return _this.languageService.getOutliningSpans(fileName); });
|
||||
|
||||
Vendored
+887
-95
File diff suppressed because it is too large
Load Diff
+270
-170
@@ -130,6 +130,7 @@ var ts;
|
||||
var ts;
|
||||
(function (ts) {
|
||||
var createObject = Object.create;
|
||||
ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined;
|
||||
function createMap(template) {
|
||||
var map = createObject(null);
|
||||
map["__"] = undefined;
|
||||
@@ -687,7 +688,7 @@ var ts;
|
||||
if (b === undefined)
|
||||
return 1;
|
||||
if (ignoreCase) {
|
||||
if (String.prototype.localeCompare) {
|
||||
if (ts.collator && String.prototype.localeCompare) {
|
||||
var result = a.localeCompare(b, undefined, { usage: "sort", sensitivity: "accent" });
|
||||
return result < 0 ? -1 : result > 0 ? 1 : 0;
|
||||
}
|
||||
@@ -1715,6 +1716,9 @@ var ts;
|
||||
},
|
||||
watchDirectory: function (directoryName, callback, recursive) {
|
||||
var options;
|
||||
if (!directoryExists(directoryName)) {
|
||||
return;
|
||||
}
|
||||
if (isNode4OrLater() && (process.platform === "win32" || process.platform === "darwin")) {
|
||||
options = { persistent: true, recursive: !!recursive };
|
||||
}
|
||||
@@ -5187,10 +5191,12 @@ var ts;
|
||||
}
|
||||
}
|
||||
function getTypingNamesFromJson(jsonPath, filesToWatch) {
|
||||
if (host.fileExists(jsonPath)) {
|
||||
filesToWatch.push(jsonPath);
|
||||
}
|
||||
var result = ts.readConfigFile(jsonPath, function (path) { return host.readFile(path); });
|
||||
if (result.config) {
|
||||
var jsonConfig = result.config;
|
||||
filesToWatch.push(jsonPath);
|
||||
if (jsonConfig.dependencies) {
|
||||
mergeTypings(ts.getOwnKeys(jsonConfig.dependencies));
|
||||
}
|
||||
@@ -5391,43 +5397,44 @@ var ts;
|
||||
throw new Error("LanguageService is disabled");
|
||||
}
|
||||
server.nullLanguageService = {
|
||||
cleanupSemanticCache: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getSyntacticDiagnostics: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getSemanticDiagnostics: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getCompilerOptionsDiagnostics: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getSyntacticClassifications: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getEncodedSyntacticClassifications: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getSemanticClassifications: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getEncodedSemanticClassifications: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getCompletionsAtPosition: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
findReferences: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getCompletionEntryDetails: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getQuickInfoAtPosition: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
findRenameLocations: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getNameOrDottedNameSpan: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getBreakpointStatementAtPosition: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getBraceMatchingAtPosition: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getSignatureHelpItems: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getDefinitionAtPosition: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getRenameInfo: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getTypeDefinitionAtPosition: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getReferencesAtPosition: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getDocumentHighlights: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getOccurrencesAtPosition: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getNavigateToItems: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getNavigationBarItems: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getOutliningSpans: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getTodoComments: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getIndentationAtPosition: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getFormattingEditsForRange: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getFormattingEditsForDocument: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getFormattingEditsAfterKeystroke: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getDocCommentTemplateAtPosition: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
isValidBraceCompletionAtPosition: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getEmitOutput: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getProgram: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
getNonBoundSourceFile: function () { return throwLanguageServiceIsDisabledError(); },
|
||||
dispose: function () { return throwLanguageServiceIsDisabledError(); }
|
||||
cleanupSemanticCache: throwLanguageServiceIsDisabledError,
|
||||
getSyntacticDiagnostics: throwLanguageServiceIsDisabledError,
|
||||
getSemanticDiagnostics: throwLanguageServiceIsDisabledError,
|
||||
getCompilerOptionsDiagnostics: throwLanguageServiceIsDisabledError,
|
||||
getSyntacticClassifications: throwLanguageServiceIsDisabledError,
|
||||
getEncodedSyntacticClassifications: throwLanguageServiceIsDisabledError,
|
||||
getSemanticClassifications: throwLanguageServiceIsDisabledError,
|
||||
getEncodedSemanticClassifications: throwLanguageServiceIsDisabledError,
|
||||
getCompletionsAtPosition: throwLanguageServiceIsDisabledError,
|
||||
findReferences: throwLanguageServiceIsDisabledError,
|
||||
getCompletionEntryDetails: throwLanguageServiceIsDisabledError,
|
||||
getQuickInfoAtPosition: throwLanguageServiceIsDisabledError,
|
||||
findRenameLocations: throwLanguageServiceIsDisabledError,
|
||||
getNameOrDottedNameSpan: throwLanguageServiceIsDisabledError,
|
||||
getBreakpointStatementAtPosition: throwLanguageServiceIsDisabledError,
|
||||
getBraceMatchingAtPosition: throwLanguageServiceIsDisabledError,
|
||||
getSignatureHelpItems: throwLanguageServiceIsDisabledError,
|
||||
getDefinitionAtPosition: throwLanguageServiceIsDisabledError,
|
||||
getRenameInfo: throwLanguageServiceIsDisabledError,
|
||||
getTypeDefinitionAtPosition: throwLanguageServiceIsDisabledError,
|
||||
getReferencesAtPosition: throwLanguageServiceIsDisabledError,
|
||||
getDocumentHighlights: throwLanguageServiceIsDisabledError,
|
||||
getOccurrencesAtPosition: throwLanguageServiceIsDisabledError,
|
||||
getNavigateToItems: throwLanguageServiceIsDisabledError,
|
||||
getNavigationBarItems: throwLanguageServiceIsDisabledError,
|
||||
getNavigationTree: throwLanguageServiceIsDisabledError,
|
||||
getOutliningSpans: throwLanguageServiceIsDisabledError,
|
||||
getTodoComments: throwLanguageServiceIsDisabledError,
|
||||
getIndentationAtPosition: throwLanguageServiceIsDisabledError,
|
||||
getFormattingEditsForRange: throwLanguageServiceIsDisabledError,
|
||||
getFormattingEditsForDocument: throwLanguageServiceIsDisabledError,
|
||||
getFormattingEditsAfterKeystroke: throwLanguageServiceIsDisabledError,
|
||||
getDocCommentTemplateAtPosition: throwLanguageServiceIsDisabledError,
|
||||
isValidBraceCompletionAtPosition: throwLanguageServiceIsDisabledError,
|
||||
getEmitOutput: throwLanguageServiceIsDisabledError,
|
||||
getProgram: throwLanguageServiceIsDisabledError,
|
||||
getNonBoundSourceFile: throwLanguageServiceIsDisabledError,
|
||||
dispose: throwLanguageServiceIsDisabledError
|
||||
};
|
||||
server.nullLanguageServiceHost = {
|
||||
setCompilationSettings: function () { return undefined; },
|
||||
@@ -16372,14 +16379,14 @@ var ts;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function isSymbolAccessible(symbol, enclosingDeclaration, meaning) {
|
||||
function isSymbolAccessible(symbol, enclosingDeclaration, meaning, shouldComputeAliasesToMakeVisible) {
|
||||
if (symbol && enclosingDeclaration && !(symbol.flags & 262144)) {
|
||||
var initialSymbol = symbol;
|
||||
var meaningToLook = meaning;
|
||||
while (symbol) {
|
||||
var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaningToLook, false);
|
||||
if (accessibleSymbolChain) {
|
||||
var hasAccessibleDeclarations = hasVisibleDeclarations(accessibleSymbolChain[0]);
|
||||
var hasAccessibleDeclarations = hasVisibleDeclarations(accessibleSymbolChain[0], shouldComputeAliasesToMakeVisible);
|
||||
if (!hasAccessibleDeclarations) {
|
||||
return {
|
||||
accessibility: 1,
|
||||
@@ -16420,7 +16427,7 @@ var ts;
|
||||
function hasExternalModuleSymbol(declaration) {
|
||||
return ts.isAmbientModule(declaration) || (declaration.kind === 256 && ts.isExternalOrCommonJsModule(declaration));
|
||||
}
|
||||
function hasVisibleDeclarations(symbol) {
|
||||
function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) {
|
||||
var aliasesToMakeVisible;
|
||||
if (ts.forEach(symbol.declarations, function (declaration) { return !getIsDeclarationVisible(declaration); })) {
|
||||
return undefined;
|
||||
@@ -16432,14 +16439,16 @@ var ts;
|
||||
if (anyImportSyntax &&
|
||||
!(anyImportSyntax.flags & 1) &&
|
||||
isDeclarationVisible(anyImportSyntax.parent)) {
|
||||
getNodeLinks(declaration).isVisible = true;
|
||||
if (aliasesToMakeVisible) {
|
||||
if (!ts.contains(aliasesToMakeVisible, anyImportSyntax)) {
|
||||
aliasesToMakeVisible.push(anyImportSyntax);
|
||||
if (shouldComputeAliasToMakeVisible) {
|
||||
getNodeLinks(declaration).isVisible = true;
|
||||
if (aliasesToMakeVisible) {
|
||||
if (!ts.contains(aliasesToMakeVisible, anyImportSyntax)) {
|
||||
aliasesToMakeVisible.push(anyImportSyntax);
|
||||
}
|
||||
}
|
||||
else {
|
||||
aliasesToMakeVisible = [anyImportSyntax];
|
||||
}
|
||||
}
|
||||
else {
|
||||
aliasesToMakeVisible = [anyImportSyntax];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -16462,7 +16471,7 @@ var ts;
|
||||
}
|
||||
var firstIdentifier = getFirstIdentifier(entityName);
|
||||
var symbol = resolveName(enclosingDeclaration, firstIdentifier.text, meaning, undefined, undefined);
|
||||
return (symbol && hasVisibleDeclarations(symbol)) || {
|
||||
return (symbol && hasVisibleDeclarations(symbol, true)) || {
|
||||
accessibility: 1,
|
||||
errorSymbolName: ts.getTextOfNode(firstIdentifier),
|
||||
errorNode: firstIdentifier
|
||||
@@ -16679,14 +16688,10 @@ var ts;
|
||||
else if (type.flags & (32768 | 65536 | 16 | 16384)) {
|
||||
buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 793064, 0, nextFlags);
|
||||
}
|
||||
else if (!(flags & 512) && type.flags & (2097152 | 1572864) && type.aliasSymbol) {
|
||||
if (type.flags & 2097152 || !(flags & 1024)) {
|
||||
var typeArguments = type.aliasTypeArguments;
|
||||
writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, typeArguments ? typeArguments.length : 0, nextFlags);
|
||||
}
|
||||
else {
|
||||
writeUnionOrIntersectionType(type, nextFlags);
|
||||
}
|
||||
else if (!(flags & 512) && ((type.flags & 2097152 && !type.target) || type.flags & 1572864) && type.aliasSymbol &&
|
||||
isSymbolAccessible(type.aliasSymbol, enclosingDeclaration, 793064, false).accessibility === 0) {
|
||||
var typeArguments = type.aliasTypeArguments;
|
||||
writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, typeArguments ? typeArguments.length : 0, nextFlags);
|
||||
}
|
||||
else if (type.flags & 1572864) {
|
||||
writeUnionOrIntersectionType(type, nextFlags);
|
||||
@@ -30975,7 +30980,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
function trackSymbol(symbol, enclosingDeclaration, meaning) {
|
||||
handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning));
|
||||
handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning, true));
|
||||
recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForSymbol(symbol, meaning));
|
||||
}
|
||||
function reportInaccessibleThisError() {
|
||||
@@ -30992,7 +30997,7 @@ var ts;
|
||||
}
|
||||
else {
|
||||
errorNameNode = declaration.name;
|
||||
resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, 2 | 1024, writer);
|
||||
resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, 2, writer);
|
||||
errorNameNode = undefined;
|
||||
}
|
||||
}
|
||||
@@ -31004,7 +31009,7 @@ var ts;
|
||||
}
|
||||
else {
|
||||
errorNameNode = signature.name;
|
||||
resolver.writeReturnTypeOfSignatureDeclaration(signature, enclosingDeclaration, 2 | 1024, writer);
|
||||
resolver.writeReturnTypeOfSignatureDeclaration(signature, enclosingDeclaration, 2, writer);
|
||||
errorNameNode = undefined;
|
||||
}
|
||||
}
|
||||
@@ -31197,7 +31202,7 @@ var ts;
|
||||
write(tempVarName);
|
||||
write(": ");
|
||||
writer.getSymbolAccessibilityDiagnostic = getDefaultExportAccessibilityDiagnostic;
|
||||
resolver.writeTypeOfExpression(node.expression, enclosingDeclaration, 2 | 1024, writer);
|
||||
resolver.writeTypeOfExpression(node.expression, enclosingDeclaration, 2, writer);
|
||||
write(";");
|
||||
writeLine();
|
||||
write(node.isExportEquals ? "export = " : "export default ");
|
||||
@@ -31602,7 +31607,7 @@ var ts;
|
||||
}
|
||||
else {
|
||||
writer.getSymbolAccessibilityDiagnostic = getHeritageClauseVisibilityError;
|
||||
resolver.writeBaseConstructorTypeOfClass(enclosingDeclaration, enclosingDeclaration, 2 | 1024, writer);
|
||||
resolver.writeBaseConstructorTypeOfClass(enclosingDeclaration, enclosingDeclaration, 2, writer);
|
||||
}
|
||||
function getHeritageClauseVisibilityError(symbolAccessibilityResult) {
|
||||
var diagnosticMessage;
|
||||
@@ -33681,14 +33686,14 @@ var ts;
|
||||
write(" = ");
|
||||
emitObjectLiteralBody(node, firstComputedPropertyIndex);
|
||||
for (var i = firstComputedPropertyIndex, n = properties.length; i < n; i++) {
|
||||
writeComma();
|
||||
var property = properties[i];
|
||||
emitStart(property);
|
||||
if (property.kind === 149 || property.kind === 150) {
|
||||
var accessors = ts.getAllAccessorDeclarations(node.properties, property);
|
||||
if (property !== accessors.firstAccessor) {
|
||||
continue;
|
||||
}
|
||||
writeComma();
|
||||
emitStart(property);
|
||||
write("Object.defineProperty(");
|
||||
emit(tempVar);
|
||||
write(", ");
|
||||
@@ -33729,6 +33734,8 @@ var ts;
|
||||
emitEnd(property);
|
||||
}
|
||||
else {
|
||||
writeComma();
|
||||
emitStart(property);
|
||||
emitLeadingComments(property);
|
||||
emitStart(property.name);
|
||||
emit(tempVar);
|
||||
@@ -33747,8 +33754,8 @@ var ts;
|
||||
else {
|
||||
ts.Debug.fail("ObjectLiteralElement type not accounted for: " + property.kind);
|
||||
}
|
||||
emitEnd(property);
|
||||
}
|
||||
emitEnd(property);
|
||||
}
|
||||
writeComma();
|
||||
emit(tempVar);
|
||||
@@ -34192,7 +34199,11 @@ var ts;
|
||||
if (modulekind === ts.ModuleKind.System || node.kind !== 69 || ts.nodeIsSynthesized(node)) {
|
||||
return false;
|
||||
}
|
||||
return !exportEquals && exportSpecifiers && node.text in exportSpecifiers;
|
||||
if (exportEquals || !exportSpecifiers || !(node.text in exportSpecifiers)) {
|
||||
return false;
|
||||
}
|
||||
var declaration = resolver.getReferencedValueDeclaration(node);
|
||||
return declaration && ts.getEnclosingBlockScopeContainer(declaration).kind === 256;
|
||||
}
|
||||
function emitPrefixUnaryExpression(node) {
|
||||
var isPlusPlusOrMinusMinus = (node.operator === 41
|
||||
@@ -40506,7 +40517,6 @@ var ts;
|
||||
function getNavigateToItems(program, checker, cancellationToken, searchValue, maxResultCount, excludeDts) {
|
||||
var patternMatcher = ts.createPatternMatcher(searchValue);
|
||||
var rawItems = [];
|
||||
var baseSensitivity = { sensitivity: "base" };
|
||||
ts.forEach(program.getSourceFiles(), function (sourceFile) {
|
||||
cancellationToken.throwIfCancellationRequested();
|
||||
var nameToDeclarations = sourceFile.getNamedDeclarations();
|
||||
@@ -40638,8 +40648,8 @@ var ts;
|
||||
}
|
||||
function compareNavigateToItems(i1, i2) {
|
||||
return i1.matchKind - i2.matchKind ||
|
||||
i1.name.localeCompare(i2.name, undefined, baseSensitivity) ||
|
||||
i1.name.localeCompare(i2.name);
|
||||
ts.compareStringsCaseInsensitive(i1.name, i2.name) ||
|
||||
ts.compareStrings(i1.name, i2.name);
|
||||
}
|
||||
function createNavigateToItem(rawItem) {
|
||||
var declaration = rawItem.declaration;
|
||||
@@ -40671,6 +40681,13 @@ var ts;
|
||||
return result;
|
||||
}
|
||||
NavigationBar.getNavigationBarItems = getNavigationBarItems;
|
||||
function getNavigationTree(sourceFile) {
|
||||
curSourceFile = sourceFile;
|
||||
var result = convertToTree(rootNavigationBarNode(sourceFile));
|
||||
curSourceFile = undefined;
|
||||
return result;
|
||||
}
|
||||
NavigationBar.getNavigationTree = getNavigationTree;
|
||||
var curSourceFile;
|
||||
function nodeText(node) {
|
||||
return node.getText(curSourceFile);
|
||||
@@ -40920,9 +40937,8 @@ var ts;
|
||||
return name1 ? 1 : name2 ? -1 : navigationBarNodeKind(child1) - navigationBarNodeKind(child2);
|
||||
}
|
||||
}
|
||||
var collator = typeof Intl !== "undefined" && Intl && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined;
|
||||
var localeCompareIsCorrect = collator && collator.compare("a", "B") < 0;
|
||||
var localeCompareFix = localeCompareIsCorrect ? collator.compare : function (a, b) {
|
||||
var localeCompareIsCorrect = ts.collator && ts.collator.compare("a", "B") < 0;
|
||||
var localeCompareFix = localeCompareIsCorrect ? ts.collator.compare : function (a, b) {
|
||||
for (var i = 0; i < Math.min(a.length, b.length); i++) {
|
||||
var chA = a.charAt(i), chB = b.charAt(i);
|
||||
if (chA === "\"" && chB === "'") {
|
||||
@@ -40931,7 +40947,7 @@ var ts;
|
||||
if (chA === "'" && chB === "\"") {
|
||||
return -1;
|
||||
}
|
||||
var cmp = chA.toLocaleLowerCase().localeCompare(chB.toLocaleLowerCase());
|
||||
var cmp = ts.compareStrings(chA.toLocaleLowerCase(), chB.toLocaleLowerCase());
|
||||
if (cmp !== 0) {
|
||||
return cmp;
|
||||
}
|
||||
@@ -41075,6 +41091,15 @@ var ts;
|
||||
}
|
||||
}
|
||||
var emptyChildItemArray = [];
|
||||
function convertToTree(n) {
|
||||
return {
|
||||
text: getItemName(n.node),
|
||||
kind: ts.getNodeKind(n.node),
|
||||
kindModifiers: ts.getNodeModifiers(n.node),
|
||||
spans: getSpans(n),
|
||||
childItems: ts.map(n.children, convertToTree)
|
||||
};
|
||||
}
|
||||
function convertToTopLevelItem(n) {
|
||||
return {
|
||||
text: getItemName(n.node),
|
||||
@@ -41098,16 +41123,16 @@ var ts;
|
||||
grayed: false
|
||||
};
|
||||
}
|
||||
function getSpans(n) {
|
||||
var spans = [getNodeSpan(n.node)];
|
||||
if (n.additionalNodes) {
|
||||
for (var _i = 0, _a = n.additionalNodes; _i < _a.length; _i++) {
|
||||
var node = _a[_i];
|
||||
spans.push(getNodeSpan(node));
|
||||
}
|
||||
}
|
||||
function getSpans(n) {
|
||||
var spans = [getNodeSpan(n.node)];
|
||||
if (n.additionalNodes) {
|
||||
for (var _i = 0, _a = n.additionalNodes; _i < _a.length; _i++) {
|
||||
var node = _a[_i];
|
||||
spans.push(getNodeSpan(node));
|
||||
}
|
||||
return spans;
|
||||
}
|
||||
return spans;
|
||||
}
|
||||
function getModuleName(moduleDeclaration) {
|
||||
if (ts.isAmbientModule(moduleDeclaration)) {
|
||||
@@ -50365,8 +50390,10 @@ var ts;
|
||||
return ts.BreakpointResolver.spanInSourceFileAtLocation(sourceFile, position);
|
||||
}
|
||||
function getNavigationBarItems(fileName) {
|
||||
var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
|
||||
return ts.NavigationBar.getNavigationBarItems(sourceFile);
|
||||
return ts.NavigationBar.getNavigationBarItems(syntaxTreeCache.getCurrentSourceFile(fileName));
|
||||
}
|
||||
function getNavigationTree(fileName) {
|
||||
return ts.NavigationBar.getNavigationTree(syntaxTreeCache.getCurrentSourceFile(fileName));
|
||||
}
|
||||
function getSemanticClassifications(fileName, span) {
|
||||
return convertClassifications(getEncodedSemanticClassifications(fileName, span));
|
||||
@@ -51132,6 +51159,7 @@ var ts;
|
||||
getRenameInfo: getRenameInfo,
|
||||
findRenameLocations: findRenameLocations,
|
||||
getNavigationBarItems: getNavigationBarItems,
|
||||
getNavigationTree: getNavigationTree,
|
||||
getOutliningSpans: getOutliningSpans,
|
||||
getTodoComments: getTodoComments,
|
||||
getBraceMatchingAtPosition: getBraceMatchingAtPosition,
|
||||
@@ -51645,12 +51673,12 @@ var ts;
|
||||
var snap = this.snap();
|
||||
this.host.writeFile(fileName, snap.getText(0, snap.getLength()));
|
||||
};
|
||||
ScriptInfo.prototype.reloadFromFile = function () {
|
||||
ScriptInfo.prototype.reloadFromFile = function (tempFileName) {
|
||||
if (this.hasMixedContent) {
|
||||
this.reload("");
|
||||
}
|
||||
else {
|
||||
this.svc.reloadFromFile(this.fileName);
|
||||
this.svc.reloadFromFile(tempFileName || this.fileName);
|
||||
this.markContainingProjectsAsDirty();
|
||||
}
|
||||
};
|
||||
@@ -52558,11 +52586,11 @@ var ts;
|
||||
this.markAsDirty();
|
||||
}
|
||||
};
|
||||
Project.prototype.reloadScript = function (filename) {
|
||||
Project.prototype.reloadScript = function (filename, tempFileName) {
|
||||
var script = this.projectService.getScriptInfoForNormalizedPath(filename);
|
||||
if (script) {
|
||||
ts.Debug.assert(script.isAttached(this));
|
||||
script.reloadFromFile();
|
||||
script.reloadFromFile(tempFileName);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -52850,6 +52878,66 @@ var ts;
|
||||
var server;
|
||||
(function (server) {
|
||||
server.maxProgramSizeForNonTsFiles = 20 * 1024 * 1024;
|
||||
function prepareConvertersForEnumLikeCompilerOptions(commandLineOptions) {
|
||||
var map = ts.createMap();
|
||||
for (var _i = 0, commandLineOptions_1 = commandLineOptions; _i < commandLineOptions_1.length; _i++) {
|
||||
var option = commandLineOptions_1[_i];
|
||||
if (typeof option.type === "object") {
|
||||
var optionMap = option.type;
|
||||
for (var id in optionMap) {
|
||||
ts.Debug.assert(typeof optionMap[id] === "number");
|
||||
}
|
||||
map[option.name] = optionMap;
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
var compilerOptionConverters = prepareConvertersForEnumLikeCompilerOptions(ts.optionDeclarations);
|
||||
var indentStyle = ts.createMap({
|
||||
"none": ts.IndentStyle.None,
|
||||
"block": ts.IndentStyle.Block,
|
||||
"smart": ts.IndentStyle.Smart
|
||||
});
|
||||
function convertFormatOptions(protocolOptions) {
|
||||
if (typeof protocolOptions.indentStyle === "string") {
|
||||
protocolOptions.indentStyle = indentStyle[protocolOptions.indentStyle.toLowerCase()];
|
||||
ts.Debug.assert(protocolOptions.indentStyle !== undefined);
|
||||
}
|
||||
return protocolOptions;
|
||||
}
|
||||
server.convertFormatOptions = convertFormatOptions;
|
||||
function convertCompilerOptions(protocolOptions) {
|
||||
for (var id in compilerOptionConverters) {
|
||||
var propertyValue = protocolOptions[id];
|
||||
if (typeof propertyValue === "string") {
|
||||
var mappedValues = compilerOptionConverters[id];
|
||||
protocolOptions[id] = mappedValues[propertyValue.toLowerCase()];
|
||||
}
|
||||
}
|
||||
return protocolOptions;
|
||||
}
|
||||
server.convertCompilerOptions = convertCompilerOptions;
|
||||
function tryConvertScriptKindName(scriptKindName) {
|
||||
return typeof scriptKindName === "string"
|
||||
? convertScriptKindName(scriptKindName)
|
||||
: scriptKindName;
|
||||
}
|
||||
server.tryConvertScriptKindName = tryConvertScriptKindName;
|
||||
function convertScriptKindName(scriptKindName) {
|
||||
switch (scriptKindName) {
|
||||
case "JS":
|
||||
return 1;
|
||||
case "JSX":
|
||||
return 2;
|
||||
case "TS":
|
||||
return 3;
|
||||
case "TSX":
|
||||
return 4;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
server.convertScriptKindName = convertScriptKindName;
|
||||
function combineProjectOutput(projects, action, comparer, areEqual) {
|
||||
var result = projects.reduce(function (previous, current) { return ts.concatenate(previous, action(current)); }, []).sort(comparer);
|
||||
return projects.length > 1 ? ts.deduplicate(result, areEqual) : result;
|
||||
@@ -52862,7 +52950,7 @@ var ts;
|
||||
};
|
||||
var externalFilePropertyReader = {
|
||||
getFileName: function (x) { return x.fileName; },
|
||||
getScriptKind: function (x) { return x.scriptKind; },
|
||||
getScriptKind: function (x) { return tryConvertScriptKindName(x.scriptKind); },
|
||||
hasMixedContent: function (x) { return x.hasMixedContent; }
|
||||
};
|
||||
function findProjectByName(projectName, projects) {
|
||||
@@ -52947,6 +53035,9 @@ var ts;
|
||||
ProjectService.prototype.ensureInferredProjectsUpToDate_TestOnly = function () {
|
||||
this.ensureInferredProjectsUpToDate();
|
||||
};
|
||||
ProjectService.prototype.getCompilerOptionsForInferredProjects = function () {
|
||||
return this.compilerOptionsForInferredProjects;
|
||||
};
|
||||
ProjectService.prototype.updateTypingsForProject = function (response) {
|
||||
var project = this.findProject(response.projectName);
|
||||
if (!project) {
|
||||
@@ -52963,11 +53054,11 @@ var ts;
|
||||
}
|
||||
};
|
||||
ProjectService.prototype.setCompilerOptionsForInferredProjects = function (projectCompilerOptions) {
|
||||
this.compilerOptionsForInferredProjects = projectCompilerOptions;
|
||||
this.compilerOptionsForInferredProjects = convertCompilerOptions(projectCompilerOptions);
|
||||
this.compileOnSaveForInferredProjects = projectCompilerOptions.compileOnSave;
|
||||
for (var _i = 0, _a = this.inferredProjects; _i < _a.length; _i++) {
|
||||
var proj = _a[_i];
|
||||
proj.setCompilerOptions(projectCompilerOptions);
|
||||
proj.setCompilerOptions(this.compilerOptionsForInferredProjects);
|
||||
proj.compileOnSaveEnabled = projectCompilerOptions.compileOnSave;
|
||||
}
|
||||
this.updateProjectGraphs(this.inferredProjects);
|
||||
@@ -53313,7 +53404,7 @@ var ts;
|
||||
}
|
||||
ts.Debug.assert(!!parsedCommandLine.fileNames);
|
||||
if (parsedCommandLine.fileNames.length === 0) {
|
||||
errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.The_config_file_0_found_doesn_t_contain_any_source_files, configFilename));
|
||||
(errors || (errors = [])).push(ts.createCompilerDiagnostic(ts.Diagnostics.The_config_file_0_found_doesn_t_contain_any_source_files, configFilename));
|
||||
return { success: false, configFileErrors: errors };
|
||||
}
|
||||
var projectOptions = {
|
||||
@@ -53345,18 +53436,20 @@ var ts;
|
||||
return false;
|
||||
};
|
||||
ProjectService.prototype.createAndAddExternalProject = function (projectFileName, files, options, typingOptions) {
|
||||
var project = new server.ExternalProject(projectFileName, this, this.documentRegistry, options, !this.exceededTotalSizeLimitForNonTsFiles(options, files, externalFilePropertyReader), options.compileOnSave === undefined ? true : options.compileOnSave);
|
||||
var compilerOptions = convertCompilerOptions(options);
|
||||
var project = new server.ExternalProject(projectFileName, this, this.documentRegistry, compilerOptions, !this.exceededTotalSizeLimitForNonTsFiles(compilerOptions, files, externalFilePropertyReader), options.compileOnSave === undefined ? true : options.compileOnSave);
|
||||
this.addFilesToProjectAndUpdateGraph(project, files, externalFilePropertyReader, undefined, typingOptions, undefined);
|
||||
this.externalProjects.push(project);
|
||||
return project;
|
||||
};
|
||||
ProjectService.prototype.reportConfigFileDiagnostics = function (configFileName, diagnostics, triggerFile) {
|
||||
if (diagnostics && diagnostics.length > 0) {
|
||||
this.eventHandler({
|
||||
eventName: "configFileDiag",
|
||||
data: { configFileName: configFileName, diagnostics: diagnostics, triggerFile: triggerFile }
|
||||
});
|
||||
if (!this.eventHandler) {
|
||||
return;
|
||||
}
|
||||
this.eventHandler({
|
||||
eventName: "configFileDiag",
|
||||
data: { configFileName: configFileName, diagnostics: diagnostics || [], triggerFile: triggerFile }
|
||||
});
|
||||
};
|
||||
ProjectService.prototype.createAndAddConfiguredProject = function (configFileName, projectOptions, configFileErrors, clientFileName) {
|
||||
var _this = this;
|
||||
@@ -53563,7 +53656,7 @@ var ts;
|
||||
if (args.file) {
|
||||
var info = this.getScriptInfoForNormalizedPath(server.toNormalizedPath(args.file));
|
||||
if (info) {
|
||||
info.setFormatOptions(args.formatOptions);
|
||||
info.setFormatOptions(convertFormatOptions(args.formatOptions));
|
||||
this.logger.info("Host configuration update for file " + args.file);
|
||||
}
|
||||
}
|
||||
@@ -53573,7 +53666,7 @@ var ts;
|
||||
this.logger.info("Host information " + args.hostInfo);
|
||||
}
|
||||
if (args.formatOptions) {
|
||||
server.mergeMaps(this.hostConfiguration.formatCodeOptions, args.formatOptions);
|
||||
server.mergeMaps(this.hostConfiguration.formatCodeOptions, convertFormatOptions(args.formatOptions));
|
||||
this.logger.info("Format host information updated");
|
||||
}
|
||||
}
|
||||
@@ -53664,7 +53757,7 @@ var ts;
|
||||
var scriptInfo = this.getScriptInfo(file.fileName);
|
||||
ts.Debug.assert(!scriptInfo || !scriptInfo.isOpen);
|
||||
var normalizedPath = scriptInfo ? scriptInfo.fileName : server.toNormalizedPath(file.fileName);
|
||||
this.openClientFileWithNormalizedPath(normalizedPath, file.content, file.scriptKind, file.hasMixedContent);
|
||||
this.openClientFileWithNormalizedPath(normalizedPath, file.content, tryConvertScriptKindName(file.scriptKind), file.hasMixedContent);
|
||||
}
|
||||
}
|
||||
if (changedFiles) {
|
||||
@@ -53749,7 +53842,7 @@ var ts;
|
||||
var exisingConfigFiles;
|
||||
if (externalProject) {
|
||||
if (!tsConfigFiles) {
|
||||
this.updateNonInferredProject(externalProject, proj.rootFiles, externalFilePropertyReader, proj.options, proj.typingOptions, proj.options.compileOnSave, undefined);
|
||||
this.updateNonInferredProject(externalProject, proj.rootFiles, externalFilePropertyReader, convertCompilerOptions(proj.options), proj.typingOptions, proj.options.compileOnSave, undefined);
|
||||
return;
|
||||
}
|
||||
this.closeExternalProject(proj.projectFileName, true);
|
||||
@@ -53887,6 +53980,8 @@ var ts;
|
||||
CommandNames.SyntacticDiagnosticsSync = "syntacticDiagnosticsSync";
|
||||
CommandNames.NavBar = "navbar";
|
||||
CommandNames.NavBarFull = "navbar-full";
|
||||
CommandNames.NavTree = "navtree";
|
||||
CommandNames.NavTreeFull = "navtree-full";
|
||||
CommandNames.Navto = "navto";
|
||||
CommandNames.NavtoFull = "navto-full";
|
||||
CommandNames.Occurrences = "occurrences";
|
||||
@@ -53935,7 +54030,7 @@ var ts;
|
||||
}
|
||||
server.formatMessage = formatMessage;
|
||||
var Session = (function () {
|
||||
function Session(host, cancellationToken, useSingleInferredProject, typingsInstaller, byteLength, hrtime, logger, canUseEvents) {
|
||||
function Session(host, cancellationToken, useSingleInferredProject, typingsInstaller, byteLength, hrtime, logger, canUseEvents, eventHandler) {
|
||||
var _this = this;
|
||||
this.host = host;
|
||||
this.typingsInstaller = typingsInstaller;
|
||||
@@ -54012,23 +54107,7 @@ var ts;
|
||||
return _this.requiredResponse(_this.getRenameInfo(request.arguments));
|
||||
},
|
||||
_a[CommandNames.Open] = function (request) {
|
||||
var openArgs = request.arguments;
|
||||
var scriptKind;
|
||||
switch (openArgs.scriptKindName) {
|
||||
case "TS":
|
||||
scriptKind = 3;
|
||||
break;
|
||||
case "JS":
|
||||
scriptKind = 1;
|
||||
break;
|
||||
case "TSX":
|
||||
scriptKind = 4;
|
||||
break;
|
||||
case "JSX":
|
||||
scriptKind = 2;
|
||||
break;
|
||||
}
|
||||
_this.openClientFile(server.toNormalizedPath(openArgs.file), openArgs.fileContent, scriptKind);
|
||||
_this.openClientFile(server.toNormalizedPath(request.arguments.file), request.arguments.fileContent, server.convertScriptKindName(request.arguments.scriptKindName));
|
||||
return _this.notRequired();
|
||||
},
|
||||
_a[CommandNames.Quickinfo] = function (request) {
|
||||
@@ -54159,6 +54238,12 @@ var ts;
|
||||
_a[CommandNames.NavBarFull] = function (request) {
|
||||
return _this.requiredResponse(_this.getNavigationBarItems(request.arguments, false));
|
||||
},
|
||||
_a[CommandNames.NavTree] = function (request) {
|
||||
return _this.requiredResponse(_this.getNavigationTree(request.arguments, true));
|
||||
},
|
||||
_a[CommandNames.NavTreeFull] = function (request) {
|
||||
return _this.requiredResponse(_this.getNavigationTree(request.arguments, false));
|
||||
},
|
||||
_a[CommandNames.Occurrences] = function (request) {
|
||||
return _this.requiredResponse(_this.getOccurrences(request.arguments));
|
||||
},
|
||||
@@ -54169,7 +54254,8 @@ var ts;
|
||||
return _this.requiredResponse(_this.getDocumentHighlights(request.arguments, false));
|
||||
},
|
||||
_a[CommandNames.CompilerOptionsForInferredProjects] = function (request) {
|
||||
return _this.requiredResponse(_this.setCompilerOptionsForInferredProjects(request.arguments));
|
||||
_this.setCompilerOptionsForInferredProjects(request.arguments);
|
||||
return _this.requiredResponse(true);
|
||||
},
|
||||
_a[CommandNames.ProjectInfo] = function (request) {
|
||||
return _this.requiredResponse(_this.getProjectInfo(request.arguments));
|
||||
@@ -54180,14 +54266,14 @@ var ts;
|
||||
},
|
||||
_a
|
||||
));
|
||||
var eventHandler = canUseEvents
|
||||
? function (event) { return _this.handleEvent(event); }
|
||||
this.eventHander = canUseEvents
|
||||
? eventHandler || (function (event) { return _this.defaultEventHandler(event); })
|
||||
: undefined;
|
||||
this.projectService = new server.ProjectService(host, logger, cancellationToken, useSingleInferredProject, typingsInstaller, eventHandler);
|
||||
this.projectService = new server.ProjectService(host, logger, cancellationToken, useSingleInferredProject, typingsInstaller, this.eventHander);
|
||||
this.gcTimer = new server.GcTimer(host, 7000, logger);
|
||||
var _a;
|
||||
}
|
||||
Session.prototype.handleEvent = function (event) {
|
||||
Session.prototype.defaultEventHandler = function (event) {
|
||||
var _this = this;
|
||||
switch (event.eventName) {
|
||||
case "context":
|
||||
@@ -54653,8 +54739,11 @@ var ts;
|
||||
};
|
||||
Session.prototype.openClientFile = function (fileName, fileContent, scriptKind) {
|
||||
var _a = this.projectService.openClientFileWithNormalizedPath(fileName, fileContent, scriptKind), configFileName = _a.configFileName, configFileErrors = _a.configFileErrors;
|
||||
if (configFileErrors) {
|
||||
this.configFileDiagnosticEvent(fileName, configFileName, configFileErrors);
|
||||
if (this.eventHander) {
|
||||
this.eventHander({
|
||||
eventName: "configFileDiag",
|
||||
data: { fileName: fileName, configFileName: configFileName, diagnostics: configFileErrors || [] }
|
||||
});
|
||||
}
|
||||
};
|
||||
Session.prototype.getPosition = function (args, scriptInfo) {
|
||||
@@ -54693,7 +54782,7 @@ var ts;
|
||||
Session.prototype.getIndentation = function (args) {
|
||||
var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project;
|
||||
var position = this.getPosition(args, project.getScriptInfoForNormalizedPath(file));
|
||||
var options = args.options || this.projectService.getFormatCodeOptions(file);
|
||||
var options = args.options ? server.convertFormatOptions(args.options) : this.projectService.getFormatCodeOptions(file);
|
||||
var indentation = project.getLanguageService(false).getIndentationAtPosition(file, position, options);
|
||||
return { position: position, indentation: indentation };
|
||||
};
|
||||
@@ -54754,17 +54843,17 @@ var ts;
|
||||
};
|
||||
Session.prototype.getFormattingEditsForRangeFull = function (args) {
|
||||
var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project;
|
||||
var options = args.options || this.projectService.getFormatCodeOptions(file);
|
||||
var options = args.options ? server.convertFormatOptions(args.options) : this.projectService.getFormatCodeOptions(file);
|
||||
return project.getLanguageService(false).getFormattingEditsForRange(file, args.position, args.endPosition, options);
|
||||
};
|
||||
Session.prototype.getFormattingEditsForDocumentFull = function (args) {
|
||||
var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project;
|
||||
var options = args.options || this.projectService.getFormatCodeOptions(file);
|
||||
var options = args.options ? server.convertFormatOptions(args.options) : this.projectService.getFormatCodeOptions(file);
|
||||
return project.getLanguageService(false).getFormattingEditsForDocument(file, options);
|
||||
};
|
||||
Session.prototype.getFormattingEditsAfterKeystrokeFull = function (args) {
|
||||
var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project;
|
||||
var options = args.options || this.projectService.getFormatCodeOptions(file);
|
||||
var options = args.options ? server.convertFormatOptions(args.options) : this.projectService.getFormatCodeOptions(file);
|
||||
return project.getLanguageService(false).getFormattingEditsAfterKeystroke(file, args.position, args.key, options);
|
||||
};
|
||||
Session.prototype.getFormattingEditsAfterKeystroke = function (args) {
|
||||
@@ -54814,6 +54903,7 @@ var ts;
|
||||
});
|
||||
};
|
||||
Session.prototype.getCompletions = function (args, simplifiedResult) {
|
||||
var _this = this;
|
||||
var prefix = args.prefix || "";
|
||||
var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;
|
||||
var scriptInfo = project.getScriptInfoForNormalizedPath(file);
|
||||
@@ -54826,17 +54916,11 @@ var ts;
|
||||
return completions.entries.reduce(function (result, entry) {
|
||||
if (completions.isMemberCompletion || (entry.name.toLowerCase().indexOf(prefix.toLowerCase()) === 0)) {
|
||||
var name_44 = entry.name, kind = entry.kind, kindModifiers = entry.kindModifiers, sortText = entry.sortText, replacementSpan = entry.replacementSpan;
|
||||
var convertedSpan = undefined;
|
||||
if (replacementSpan) {
|
||||
convertedSpan = {
|
||||
start: scriptInfo.positionToLineOffset(replacementSpan.start),
|
||||
end: scriptInfo.positionToLineOffset(replacementSpan.start + replacementSpan.length)
|
||||
};
|
||||
}
|
||||
var convertedSpan = replacementSpan ? _this.decorateSpan(replacementSpan, scriptInfo) : undefined;
|
||||
result.push({ name: name_44, kind: kind, kindModifiers: kindModifiers, sortText: sortText, replacementSpan: convertedSpan });
|
||||
}
|
||||
return result;
|
||||
}, []).sort(function (a, b) { return a.name.localeCompare(b.name); });
|
||||
}, []).sort(function (a, b) { return ts.compareStrings(a.name, b.name); });
|
||||
}
|
||||
else {
|
||||
return completions;
|
||||
@@ -54936,10 +55020,11 @@ var ts;
|
||||
};
|
||||
Session.prototype.reload = function (args, reqSeq) {
|
||||
var file = server.toNormalizedPath(args.file);
|
||||
var tempFileName = args.tmpfile && server.toNormalizedPath(args.tmpfile);
|
||||
var project = this.projectService.getDefaultProjectForFile(file, true);
|
||||
if (project) {
|
||||
this.changeSeq++;
|
||||
if (project.reloadScript(file)) {
|
||||
if (project.reloadScript(file, tempFileName)) {
|
||||
this.output(undefined, CommandNames.Reload, reqSeq);
|
||||
}
|
||||
}
|
||||
@@ -54957,33 +55042,50 @@ var ts;
|
||||
var file = ts.normalizePath(fileName);
|
||||
this.projectService.closeClientFile(file);
|
||||
};
|
||||
Session.prototype.decorateNavigationBarItem = function (project, fileName, items) {
|
||||
Session.prototype.decorateNavigationBarItems = function (items, scriptInfo) {
|
||||
var _this = this;
|
||||
if (!items) {
|
||||
return undefined;
|
||||
}
|
||||
var scriptInfo = project.getScriptInfoForNormalizedPath(fileName);
|
||||
return items.map(function (item) { return ({
|
||||
return ts.map(items, function (item) { return ({
|
||||
text: item.text,
|
||||
kind: item.kind,
|
||||
kindModifiers: item.kindModifiers,
|
||||
spans: item.spans.map(function (span) { return ({
|
||||
start: scriptInfo.positionToLineOffset(span.start),
|
||||
end: scriptInfo.positionToLineOffset(ts.textSpanEnd(span))
|
||||
}); }),
|
||||
childItems: _this.decorateNavigationBarItem(project, fileName, item.childItems),
|
||||
spans: item.spans.map(function (span) { return _this.decorateSpan(span, scriptInfo); }),
|
||||
childItems: _this.decorateNavigationBarItems(item.childItems, scriptInfo),
|
||||
indent: item.indent
|
||||
}); });
|
||||
};
|
||||
Session.prototype.getNavigationBarItems = function (args, simplifiedResult) {
|
||||
var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;
|
||||
var items = project.getLanguageService().getNavigationBarItems(file);
|
||||
if (!items) {
|
||||
return undefined;
|
||||
}
|
||||
return simplifiedResult
|
||||
? this.decorateNavigationBarItem(project, file, items)
|
||||
: items;
|
||||
var items = project.getLanguageService(false).getNavigationBarItems(file);
|
||||
return !items
|
||||
? undefined
|
||||
: simplifiedResult
|
||||
? this.decorateNavigationBarItems(items, project.getScriptInfoForNormalizedPath(file))
|
||||
: items;
|
||||
};
|
||||
Session.prototype.decorateNavigationTree = function (tree, scriptInfo) {
|
||||
var _this = this;
|
||||
return {
|
||||
text: tree.text,
|
||||
kind: tree.kind,
|
||||
kindModifiers: tree.kindModifiers,
|
||||
spans: tree.spans.map(function (span) { return _this.decorateSpan(span, scriptInfo); }),
|
||||
childItems: ts.map(tree.childItems, function (item) { return _this.decorateNavigationTree(item, scriptInfo); })
|
||||
};
|
||||
};
|
||||
Session.prototype.decorateSpan = function (span, scriptInfo) {
|
||||
return {
|
||||
start: scriptInfo.positionToLineOffset(span.start),
|
||||
end: scriptInfo.positionToLineOffset(ts.textSpanEnd(span))
|
||||
};
|
||||
};
|
||||
Session.prototype.getNavigationTree = function (args, simplifiedResult) {
|
||||
var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;
|
||||
var tree = project.getLanguageService(false).getNavigationTree(file);
|
||||
return !tree
|
||||
? undefined
|
||||
: simplifiedResult
|
||||
? this.decorateNavigationTree(tree, project.getScriptInfoForNormalizedPath(file))
|
||||
: tree;
|
||||
};
|
||||
Session.prototype.getNavigateToItems = function (args, simplifiedResult) {
|
||||
var projects = this.getProjects(args);
|
||||
@@ -55051,22 +55153,16 @@ var ts;
|
||||
}
|
||||
};
|
||||
Session.prototype.getBraceMatching = function (args, simplifiedResult) {
|
||||
var _this = this;
|
||||
var _a = this.getFileAndProjectWithoutRefreshingInferredProjects(args), file = _a.file, project = _a.project;
|
||||
var scriptInfo = project.getScriptInfoForNormalizedPath(file);
|
||||
var position = this.getPosition(args, scriptInfo);
|
||||
var spans = project.getLanguageService(false).getBraceMatchingAtPosition(file, position);
|
||||
if (!spans) {
|
||||
return undefined;
|
||||
}
|
||||
if (simplifiedResult) {
|
||||
return spans.map(function (span) { return ({
|
||||
start: scriptInfo.positionToLineOffset(span.start),
|
||||
end: scriptInfo.positionToLineOffset(span.start + span.length)
|
||||
}); });
|
||||
}
|
||||
else {
|
||||
return spans;
|
||||
}
|
||||
return !spans
|
||||
? undefined
|
||||
: simplifiedResult
|
||||
? spans.map(function (span) { return _this.decorateSpan(span, scriptInfo); })
|
||||
: spans;
|
||||
};
|
||||
Session.prototype.getDiagnosticsForProject = function (delay, fileName) {
|
||||
var _this = this;
|
||||
@@ -56463,6 +56559,10 @@ var ts;
|
||||
var _this = this;
|
||||
return this.forwardJSONCall("getNavigationBarItems('" + fileName + "')", function () { return _this.languageService.getNavigationBarItems(fileName); });
|
||||
};
|
||||
LanguageServiceShimObject.prototype.getNavigationTree = function (fileName) {
|
||||
var _this = this;
|
||||
return this.forwardJSONCall("getNavigationTree('" + fileName + "')", function () { return _this.languageService.getNavigationTree(fileName); });
|
||||
};
|
||||
LanguageServiceShimObject.prototype.getOutliningSpans = function (fileName) {
|
||||
var _this = this;
|
||||
return this.forwardJSONCall("getOutliningSpans('" + fileName + "')", function () { return _this.languageService.getOutliningSpans(fileName); });
|
||||
|
||||
Vendored
+45
-23
@@ -1330,7 +1330,6 @@ declare namespace ts {
|
||||
UseFullyQualifiedType = 128,
|
||||
InFirstTypeArgument = 256,
|
||||
InTypeAlias = 512,
|
||||
UseTypeAliasValue = 1024,
|
||||
}
|
||||
enum SymbolFormatFlags {
|
||||
None = 0,
|
||||
@@ -1570,10 +1569,7 @@ declare namespace ts {
|
||||
Classic = 1,
|
||||
NodeJs = 2,
|
||||
}
|
||||
type RootPaths = string[];
|
||||
type PathSubstitutions = MapLike<string[]>;
|
||||
type TsConfigOnlyOptions = RootPaths | PathSubstitutions;
|
||||
type CompilerOptionsValue = string | number | boolean | (string | number)[] | TsConfigOnlyOptions;
|
||||
type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[] | MapLike<string[]>;
|
||||
interface CompilerOptions {
|
||||
allowJs?: boolean;
|
||||
allowSyntheticDefaultImports?: boolean;
|
||||
@@ -1615,13 +1611,13 @@ declare namespace ts {
|
||||
out?: string;
|
||||
outDir?: string;
|
||||
outFile?: string;
|
||||
paths?: PathSubstitutions;
|
||||
paths?: MapLike<string[]>;
|
||||
preserveConstEnums?: boolean;
|
||||
project?: string;
|
||||
reactNamespace?: string;
|
||||
removeComments?: boolean;
|
||||
rootDir?: string;
|
||||
rootDirs?: RootPaths;
|
||||
rootDirs?: string[];
|
||||
skipLibCheck?: boolean;
|
||||
skipDefaultLibCheck?: boolean;
|
||||
sourceMap?: boolean;
|
||||
@@ -2119,6 +2115,7 @@ declare namespace ts {
|
||||
getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[];
|
||||
getNavigateToItems(searchValue: string, maxResultCount?: number, excludeDts?: boolean): NavigateToItem[];
|
||||
getNavigationBarItems(fileName: string): NavigationBarItem[];
|
||||
getNavigationTree(fileName: string): NavigationTree;
|
||||
getOutliningSpans(fileName: string): OutliningSpan[];
|
||||
getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[];
|
||||
getBraceMatchingAtPosition(fileName: string, position: number): TextSpan[];
|
||||
@@ -2140,6 +2137,12 @@ declare namespace ts {
|
||||
textSpan: TextSpan;
|
||||
classificationType: string;
|
||||
}
|
||||
/**
|
||||
* Navigation bar interface designed for visual studio's dual-column layout.
|
||||
* This does not form a proper tree.
|
||||
* The navbar is returned as a list of top-level items, each of which has a list of child items.
|
||||
* Child items always have an empty array for their `childItems`.
|
||||
*/
|
||||
interface NavigationBarItem {
|
||||
text: string;
|
||||
kind: string;
|
||||
@@ -2150,6 +2153,25 @@ declare namespace ts {
|
||||
bolded: boolean;
|
||||
grayed: boolean;
|
||||
}
|
||||
/**
|
||||
* Node in a tree of nested declarations in a file.
|
||||
* The top node is always a script or module node.
|
||||
*/
|
||||
interface NavigationTree {
|
||||
/** Name of the declaration, or a short description, e.g. "<class>". */
|
||||
text: string;
|
||||
/** A ScriptElementKind */
|
||||
kind: string;
|
||||
/** ScriptElementKindModifier separated by commas, e.g. "public,abstract" */
|
||||
kindModifiers: string;
|
||||
/**
|
||||
* Spans of the nodes that generated this declaration.
|
||||
* There will be more than one if this is the result of merging.
|
||||
*/
|
||||
spans: TextSpan[];
|
||||
/** Present if non-empty */
|
||||
childItems?: NavigationTree[];
|
||||
}
|
||||
interface TodoCommentDescriptor {
|
||||
text: string;
|
||||
priority: number;
|
||||
@@ -2214,11 +2236,11 @@ declare namespace ts {
|
||||
}
|
||||
interface EditorSettings {
|
||||
baseIndentSize?: number;
|
||||
indentSize: number;
|
||||
tabSize: number;
|
||||
newLineCharacter: string;
|
||||
convertTabsToSpaces: boolean;
|
||||
indentStyle: IndentStyle;
|
||||
indentSize?: number;
|
||||
tabSize?: number;
|
||||
newLineCharacter?: string;
|
||||
convertTabsToSpaces?: boolean;
|
||||
indentStyle?: IndentStyle;
|
||||
}
|
||||
enum IndentStyle {
|
||||
None = 0,
|
||||
@@ -2239,17 +2261,17 @@ declare namespace ts {
|
||||
PlaceOpenBraceOnNewLineForControlBlocks: boolean;
|
||||
}
|
||||
interface FormatCodeSettings extends EditorSettings {
|
||||
insertSpaceAfterCommaDelimiter: boolean;
|
||||
insertSpaceAfterSemicolonInForStatements: boolean;
|
||||
insertSpaceBeforeAndAfterBinaryOperators: boolean;
|
||||
insertSpaceAfterKeywordsInControlFlowStatements: boolean;
|
||||
insertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean;
|
||||
insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean;
|
||||
insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: boolean;
|
||||
insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: boolean;
|
||||
insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces: boolean;
|
||||
placeOpenBraceOnNewLineForFunctions: boolean;
|
||||
placeOpenBraceOnNewLineForControlBlocks: boolean;
|
||||
insertSpaceAfterCommaDelimiter?: boolean;
|
||||
insertSpaceAfterSemicolonInForStatements?: boolean;
|
||||
insertSpaceBeforeAndAfterBinaryOperators?: boolean;
|
||||
insertSpaceAfterKeywordsInControlFlowStatements?: boolean;
|
||||
insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean;
|
||||
insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean;
|
||||
insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets?: boolean;
|
||||
insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?: boolean;
|
||||
insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean;
|
||||
placeOpenBraceOnNewLineForFunctions?: boolean;
|
||||
placeOpenBraceOnNewLineForControlBlocks?: boolean;
|
||||
}
|
||||
function toEditorSettings(options: EditorOptions | EditorSettings): EditorSettings;
|
||||
interface DefinitionInfo {
|
||||
|
||||
+98
-50
@@ -480,7 +480,6 @@ var ts;
|
||||
TypeFormatFlags[TypeFormatFlags["UseFullyQualifiedType"] = 128] = "UseFullyQualifiedType";
|
||||
TypeFormatFlags[TypeFormatFlags["InFirstTypeArgument"] = 256] = "InFirstTypeArgument";
|
||||
TypeFormatFlags[TypeFormatFlags["InTypeAlias"] = 512] = "InTypeAlias";
|
||||
TypeFormatFlags[TypeFormatFlags["UseTypeAliasValue"] = 1024] = "UseTypeAliasValue";
|
||||
})(ts.TypeFormatFlags || (ts.TypeFormatFlags = {}));
|
||||
var TypeFormatFlags = ts.TypeFormatFlags;
|
||||
(function (SymbolFormatFlags) {
|
||||
@@ -1024,6 +1023,8 @@ var ts;
|
||||
})(ts.Ternary || (ts.Ternary = {}));
|
||||
var Ternary = ts.Ternary;
|
||||
var createObject = Object.create;
|
||||
// More efficient to create a collator once and use its `compare` than to call `a.localeCompare(b)` many times.
|
||||
ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined;
|
||||
function createMap(template) {
|
||||
var map = createObject(null); // tslint:disable-line:no-null-keyword
|
||||
// Using 'delete' on an object causes V8 to put the object in dictionary mode.
|
||||
@@ -1692,7 +1693,8 @@ var ts;
|
||||
if (b === undefined)
|
||||
return 1 /* GreaterThan */;
|
||||
if (ignoreCase) {
|
||||
if (String.prototype.localeCompare) {
|
||||
if (ts.collator && String.prototype.localeCompare) {
|
||||
// accent means a ≠ b, a ≠ á, a = A
|
||||
var result = a.localeCompare(b, /*locales*/ undefined, { usage: "sort", sensitivity: "accent" });
|
||||
return result < 0 ? -1 /* LessThan */ : result > 0 ? 1 /* GreaterThan */ : 0 /* EqualTo */;
|
||||
}
|
||||
@@ -2867,6 +2869,9 @@ var ts;
|
||||
// Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
|
||||
// (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
|
||||
var options;
|
||||
if (!directoryExists(directoryName)) {
|
||||
return;
|
||||
}
|
||||
if (isNode4OrLater() && (process.platform === "win32" || process.platform === "darwin")) {
|
||||
options = { persistent: true, recursive: !!recursive };
|
||||
}
|
||||
@@ -18689,7 +18694,15 @@ var ts;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function isSymbolAccessible(symbol, enclosingDeclaration, meaning) {
|
||||
/**
|
||||
* Check if the given symbol in given enclosing declaration is accessible and mark all associated alias to be visible if requested
|
||||
*
|
||||
* @param symbol a Symbol to check if accessible
|
||||
* @param enclosingDeclaration a Node containing reference to the symbol
|
||||
* @param meaning a SymbolFlags to check if such meaning of the symbol is accessible
|
||||
* @param shouldComputeAliasToMakeVisible a boolean value to indicate whether to return aliases to be mark visible in case the symbol is accessible
|
||||
*/
|
||||
function isSymbolAccessible(symbol, enclosingDeclaration, meaning, shouldComputeAliasesToMakeVisible) {
|
||||
if (symbol && enclosingDeclaration && !(symbol.flags & 262144 /* TypeParameter */)) {
|
||||
var initialSymbol = symbol;
|
||||
var meaningToLook = meaning;
|
||||
@@ -18697,7 +18710,7 @@ var ts;
|
||||
// Symbol is accessible if it by itself is accessible
|
||||
var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaningToLook, /*useOnlyExternalAliasing*/ false);
|
||||
if (accessibleSymbolChain) {
|
||||
var hasAccessibleDeclarations = hasVisibleDeclarations(accessibleSymbolChain[0]);
|
||||
var hasAccessibleDeclarations = hasVisibleDeclarations(accessibleSymbolChain[0], shouldComputeAliasesToMakeVisible);
|
||||
if (!hasAccessibleDeclarations) {
|
||||
return {
|
||||
accessibility: 1 /* NotAccessible */,
|
||||
@@ -18754,7 +18767,7 @@ var ts;
|
||||
function hasExternalModuleSymbol(declaration) {
|
||||
return ts.isAmbientModule(declaration) || (declaration.kind === 256 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration));
|
||||
}
|
||||
function hasVisibleDeclarations(symbol) {
|
||||
function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) {
|
||||
var aliasesToMakeVisible;
|
||||
if (ts.forEach(symbol.declarations, function (declaration) { return !getIsDeclarationVisible(declaration); })) {
|
||||
return undefined;
|
||||
@@ -18768,14 +18781,19 @@ var ts;
|
||||
if (anyImportSyntax &&
|
||||
!(anyImportSyntax.flags & 1 /* Export */) &&
|
||||
isDeclarationVisible(anyImportSyntax.parent)) {
|
||||
getNodeLinks(declaration).isVisible = true;
|
||||
if (aliasesToMakeVisible) {
|
||||
if (!ts.contains(aliasesToMakeVisible, anyImportSyntax)) {
|
||||
aliasesToMakeVisible.push(anyImportSyntax);
|
||||
// In function "buildTypeDisplay" where we decide whether to write type-alias or serialize types,
|
||||
// we want to just check if type- alias is accessible or not but we don't care about emitting those alias at that time
|
||||
// since we will do the emitting later in trackSymbol.
|
||||
if (shouldComputeAliasToMakeVisible) {
|
||||
getNodeLinks(declaration).isVisible = true;
|
||||
if (aliasesToMakeVisible) {
|
||||
if (!ts.contains(aliasesToMakeVisible, anyImportSyntax)) {
|
||||
aliasesToMakeVisible.push(anyImportSyntax);
|
||||
}
|
||||
}
|
||||
else {
|
||||
aliasesToMakeVisible = [anyImportSyntax];
|
||||
}
|
||||
}
|
||||
else {
|
||||
aliasesToMakeVisible = [anyImportSyntax];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -18805,7 +18823,7 @@ var ts;
|
||||
var firstIdentifier = getFirstIdentifier(entityName);
|
||||
var symbol = resolveName(enclosingDeclaration, firstIdentifier.text, meaning, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined);
|
||||
// Verify if the symbol is accessible
|
||||
return (symbol && hasVisibleDeclarations(symbol)) || {
|
||||
return (symbol && hasVisibleDeclarations(symbol, /*shouldComputeAliasToMakeVisible*/ true)) || {
|
||||
accessibility: 1 /* NotAccessible */,
|
||||
errorSymbolName: ts.getTextOfNode(firstIdentifier),
|
||||
errorNode: firstIdentifier
|
||||
@@ -19052,14 +19070,16 @@ var ts;
|
||||
// The specified symbol flags need to be reinterpreted as type flags
|
||||
buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 793064 /* Type */, 0 /* None */, nextFlags);
|
||||
}
|
||||
else if (!(flags & 512 /* InTypeAlias */) && type.flags & (2097152 /* Anonymous */ | 1572864 /* UnionOrIntersection */) && type.aliasSymbol) {
|
||||
if (type.flags & 2097152 /* Anonymous */ || !(flags & 1024 /* UseTypeAliasValue */)) {
|
||||
var typeArguments = type.aliasTypeArguments;
|
||||
writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, typeArguments ? typeArguments.length : 0, nextFlags);
|
||||
}
|
||||
else {
|
||||
writeUnionOrIntersectionType(type, nextFlags);
|
||||
}
|
||||
else if (!(flags & 512 /* InTypeAlias */) && ((type.flags & 2097152 /* Anonymous */ && !type.target) || type.flags & 1572864 /* UnionOrIntersection */) && type.aliasSymbol &&
|
||||
isSymbolAccessible(type.aliasSymbol, enclosingDeclaration, 793064 /* Type */, /*shouldComputeAliasesToMakeVisible*/ false).accessibility === 0 /* Accessible */) {
|
||||
// We emit inferred type as type-alias at the current location if all the following is true
|
||||
// the input type is has alias symbol that is accessible
|
||||
// the input type is a union, intersection or anonymous type that is fully instantiated (if not we want to keep dive into)
|
||||
// e.g.: export type Bar<X, Y> = () => [X, Y];
|
||||
// export type Foo<Y> = Bar<any, Y>;
|
||||
// export const y = (x: Foo<string>) => 1 // we want to emit as ...x: () => [any, string])
|
||||
var typeArguments = type.aliasTypeArguments;
|
||||
writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, typeArguments ? typeArguments.length : 0, nextFlags);
|
||||
}
|
||||
else if (type.flags & 1572864 /* UnionOrIntersection */) {
|
||||
writeUnionOrIntersectionType(type, nextFlags);
|
||||
@@ -35905,7 +35925,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
function trackSymbol(symbol, enclosingDeclaration, meaning) {
|
||||
handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning));
|
||||
handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning, /*shouldComputeAliasesToMakeVisible*/ true));
|
||||
recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForSymbol(symbol, meaning));
|
||||
}
|
||||
function reportInaccessibleThisError() {
|
||||
@@ -35923,7 +35943,7 @@ var ts;
|
||||
}
|
||||
else {
|
||||
errorNameNode = declaration.name;
|
||||
resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, 2 /* UseTypeOfFunction */ | 1024 /* UseTypeAliasValue */, writer);
|
||||
resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, 2 /* UseTypeOfFunction */, writer);
|
||||
errorNameNode = undefined;
|
||||
}
|
||||
}
|
||||
@@ -35936,7 +35956,7 @@ var ts;
|
||||
}
|
||||
else {
|
||||
errorNameNode = signature.name;
|
||||
resolver.writeReturnTypeOfSignatureDeclaration(signature, enclosingDeclaration, 2 /* UseTypeOfFunction */ | 1024 /* UseTypeAliasValue */, writer);
|
||||
resolver.writeReturnTypeOfSignatureDeclaration(signature, enclosingDeclaration, 2 /* UseTypeOfFunction */, writer);
|
||||
errorNameNode = undefined;
|
||||
}
|
||||
}
|
||||
@@ -36138,7 +36158,7 @@ var ts;
|
||||
write(tempVarName);
|
||||
write(": ");
|
||||
writer.getSymbolAccessibilityDiagnostic = getDefaultExportAccessibilityDiagnostic;
|
||||
resolver.writeTypeOfExpression(node.expression, enclosingDeclaration, 2 /* UseTypeOfFunction */ | 1024 /* UseTypeAliasValue */, writer);
|
||||
resolver.writeTypeOfExpression(node.expression, enclosingDeclaration, 2 /* UseTypeOfFunction */, writer);
|
||||
write(";");
|
||||
writeLine();
|
||||
write(node.isExportEquals ? "export = " : "export default ");
|
||||
@@ -36559,7 +36579,7 @@ var ts;
|
||||
}
|
||||
else {
|
||||
writer.getSymbolAccessibilityDiagnostic = getHeritageClauseVisibilityError;
|
||||
resolver.writeBaseConstructorTypeOfClass(enclosingDeclaration, enclosingDeclaration, 2 /* UseTypeOfFunction */ | 1024 /* UseTypeAliasValue */, writer);
|
||||
resolver.writeBaseConstructorTypeOfClass(enclosingDeclaration, enclosingDeclaration, 2 /* UseTypeOfFunction */, writer);
|
||||
}
|
||||
function getHeritageClauseVisibilityError(symbolAccessibilityResult) {
|
||||
var diagnosticMessage;
|
||||
@@ -38898,15 +38918,15 @@ var ts;
|
||||
write(" = ");
|
||||
emitObjectLiteralBody(node, firstComputedPropertyIndex);
|
||||
for (var i = firstComputedPropertyIndex, n = properties.length; i < n; i++) {
|
||||
writeComma();
|
||||
var property = properties[i];
|
||||
emitStart(property);
|
||||
if (property.kind === 149 /* GetAccessor */ || property.kind === 150 /* SetAccessor */) {
|
||||
// TODO (drosen): Reconcile with 'emitMemberFunctions'.
|
||||
var accessors = ts.getAllAccessorDeclarations(node.properties, property);
|
||||
if (property !== accessors.firstAccessor) {
|
||||
continue;
|
||||
}
|
||||
writeComma();
|
||||
emitStart(property);
|
||||
write("Object.defineProperty(");
|
||||
emit(tempVar);
|
||||
write(", ");
|
||||
@@ -38947,6 +38967,8 @@ var ts;
|
||||
emitEnd(property);
|
||||
}
|
||||
else {
|
||||
writeComma();
|
||||
emitStart(property);
|
||||
emitLeadingComments(property);
|
||||
emitStart(property.name);
|
||||
emit(tempVar);
|
||||
@@ -38965,8 +38987,8 @@ var ts;
|
||||
else {
|
||||
ts.Debug.fail("ObjectLiteralElement type not accounted for: " + property.kind);
|
||||
}
|
||||
emitEnd(property);
|
||||
}
|
||||
emitEnd(property);
|
||||
}
|
||||
writeComma();
|
||||
emit(tempVar);
|
||||
@@ -39498,7 +39520,12 @@ var ts;
|
||||
if (modulekind === ts.ModuleKind.System || node.kind !== 69 /* Identifier */ || ts.nodeIsSynthesized(node)) {
|
||||
return false;
|
||||
}
|
||||
return !exportEquals && exportSpecifiers && node.text in exportSpecifiers;
|
||||
if (exportEquals || !exportSpecifiers || !(node.text in exportSpecifiers)) {
|
||||
return false;
|
||||
}
|
||||
// check that referenced declaration is declared on source file level
|
||||
var declaration = resolver.getReferencedValueDeclaration(node);
|
||||
return declaration && ts.getEnclosingBlockScopeContainer(declaration).kind === 256 /* SourceFile */;
|
||||
}
|
||||
function emitPrefixUnaryExpression(node) {
|
||||
var isPlusPlusOrMinusMinus = (node.operator === 41 /* PlusPlusToken */
|
||||
@@ -47554,8 +47581,6 @@ var ts;
|
||||
function getNavigateToItems(program, checker, cancellationToken, searchValue, maxResultCount, excludeDts) {
|
||||
var patternMatcher = ts.createPatternMatcher(searchValue);
|
||||
var rawItems = [];
|
||||
// This means "compare in a case insensitive manner."
|
||||
var baseSensitivity = { sensitivity: "base" };
|
||||
// Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[]
|
||||
ts.forEach(program.getSourceFiles(), function (sourceFile) {
|
||||
cancellationToken.throwIfCancellationRequested();
|
||||
@@ -47705,8 +47730,8 @@ var ts;
|
||||
// We first sort case insensitively. So "Aaa" will come before "bar".
|
||||
// Then we sort case sensitively, so "aaa" will come before "Aaa".
|
||||
return i1.matchKind - i2.matchKind ||
|
||||
i1.name.localeCompare(i2.name, undefined, baseSensitivity) ||
|
||||
i1.name.localeCompare(i2.name);
|
||||
ts.compareStringsCaseInsensitive(i1.name, i2.name) ||
|
||||
ts.compareStrings(i1.name, i2.name);
|
||||
}
|
||||
function createNavigateToItem(rawItem) {
|
||||
var declaration = rawItem.declaration;
|
||||
@@ -47741,6 +47766,13 @@ var ts;
|
||||
return result;
|
||||
}
|
||||
NavigationBar.getNavigationBarItems = getNavigationBarItems;
|
||||
function getNavigationTree(sourceFile) {
|
||||
curSourceFile = sourceFile;
|
||||
var result = convertToTree(rootNavigationBarNode(sourceFile));
|
||||
curSourceFile = undefined;
|
||||
return result;
|
||||
}
|
||||
NavigationBar.getNavigationTree = getNavigationTree;
|
||||
// Keep sourceFile handy so we don't have to search for it every time we need to call `getText`.
|
||||
var curSourceFile;
|
||||
function nodeText(node) {
|
||||
@@ -48018,11 +48050,9 @@ var ts;
|
||||
return name1 ? 1 : name2 ? -1 : navigationBarNodeKind(child1) - navigationBarNodeKind(child2);
|
||||
}
|
||||
}
|
||||
// More efficient to create a collator once and use its `compare` than to call `a.localeCompare(b)` many times.
|
||||
var collator = typeof Intl !== "undefined" && Intl && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined;
|
||||
// Intl is missing in Safari, and node 0.10 treats "a" as greater than "B".
|
||||
var localeCompareIsCorrect = collator && collator.compare("a", "B") < 0;
|
||||
var localeCompareFix = localeCompareIsCorrect ? collator.compare : function (a, b) {
|
||||
var localeCompareIsCorrect = ts.collator && ts.collator.compare("a", "B") < 0;
|
||||
var localeCompareFix = localeCompareIsCorrect ? ts.collator.compare : function (a, b) {
|
||||
// This isn't perfect, but it passes all of our tests.
|
||||
for (var i = 0; i < Math.min(a.length, b.length); i++) {
|
||||
var chA = a.charAt(i), chB = b.charAt(i);
|
||||
@@ -48032,7 +48062,7 @@ var ts;
|
||||
if (chA === "'" && chB === "\"") {
|
||||
return -1;
|
||||
}
|
||||
var cmp = chA.toLocaleLowerCase().localeCompare(chB.toLocaleLowerCase());
|
||||
var cmp = ts.compareStrings(chA.toLocaleLowerCase(), chB.toLocaleLowerCase());
|
||||
if (cmp !== 0) {
|
||||
return cmp;
|
||||
}
|
||||
@@ -48183,6 +48213,15 @@ var ts;
|
||||
}
|
||||
// NavigationBarItem requires an array, but will not mutate it, so just give it this for performance.
|
||||
var emptyChildItemArray = [];
|
||||
function convertToTree(n) {
|
||||
return {
|
||||
text: getItemName(n.node),
|
||||
kind: ts.getNodeKind(n.node),
|
||||
kindModifiers: ts.getNodeModifiers(n.node),
|
||||
spans: getSpans(n),
|
||||
childItems: ts.map(n.children, convertToTree)
|
||||
};
|
||||
}
|
||||
function convertToTopLevelItem(n) {
|
||||
return {
|
||||
text: getItemName(n.node),
|
||||
@@ -48206,16 +48245,16 @@ var ts;
|
||||
grayed: false
|
||||
};
|
||||
}
|
||||
function getSpans(n) {
|
||||
var spans = [getNodeSpan(n.node)];
|
||||
if (n.additionalNodes) {
|
||||
for (var _i = 0, _a = n.additionalNodes; _i < _a.length; _i++) {
|
||||
var node = _a[_i];
|
||||
spans.push(getNodeSpan(node));
|
||||
}
|
||||
}
|
||||
function getSpans(n) {
|
||||
var spans = [getNodeSpan(n.node)];
|
||||
if (n.additionalNodes) {
|
||||
for (var _i = 0, _a = n.additionalNodes; _i < _a.length; _i++) {
|
||||
var node = _a[_i];
|
||||
spans.push(getNodeSpan(node));
|
||||
}
|
||||
return spans;
|
||||
}
|
||||
return spans;
|
||||
}
|
||||
function getModuleName(moduleDeclaration) {
|
||||
// We want to maintain quotation marks.
|
||||
@@ -50417,10 +50456,12 @@ var ts;
|
||||
* Get the typing info from common package manager json files like package.json or bower.json
|
||||
*/
|
||||
function getTypingNamesFromJson(jsonPath, filesToWatch) {
|
||||
if (host.fileExists(jsonPath)) {
|
||||
filesToWatch.push(jsonPath);
|
||||
}
|
||||
var result = ts.readConfigFile(jsonPath, function (path) { return host.readFile(path); });
|
||||
if (result.config) {
|
||||
var jsonConfig = result.config;
|
||||
filesToWatch.push(jsonPath);
|
||||
if (jsonConfig.dependencies) {
|
||||
mergeTypings(ts.getOwnKeys(jsonConfig.dependencies));
|
||||
}
|
||||
@@ -59516,8 +59557,10 @@ var ts;
|
||||
return ts.BreakpointResolver.spanInSourceFileAtLocation(sourceFile, position);
|
||||
}
|
||||
function getNavigationBarItems(fileName) {
|
||||
var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
|
||||
return ts.NavigationBar.getNavigationBarItems(sourceFile);
|
||||
return ts.NavigationBar.getNavigationBarItems(syntaxTreeCache.getCurrentSourceFile(fileName));
|
||||
}
|
||||
function getNavigationTree(fileName) {
|
||||
return ts.NavigationBar.getNavigationTree(syntaxTreeCache.getCurrentSourceFile(fileName));
|
||||
}
|
||||
function getSemanticClassifications(fileName, span) {
|
||||
return convertClassifications(getEncodedSemanticClassifications(fileName, span));
|
||||
@@ -60461,6 +60504,7 @@ var ts;
|
||||
getRenameInfo: getRenameInfo,
|
||||
findRenameLocations: findRenameLocations,
|
||||
getNavigationBarItems: getNavigationBarItems,
|
||||
getNavigationTree: getNavigationTree,
|
||||
getOutliningSpans: getOutliningSpans,
|
||||
getTodoComments: getTodoComments,
|
||||
getBraceMatchingAtPosition: getBraceMatchingAtPosition,
|
||||
@@ -62100,6 +62144,10 @@ var ts;
|
||||
var _this = this;
|
||||
return this.forwardJSONCall("getNavigationBarItems('" + fileName + "')", function () { return _this.languageService.getNavigationBarItems(fileName); });
|
||||
};
|
||||
LanguageServiceShimObject.prototype.getNavigationTree = function (fileName) {
|
||||
var _this = this;
|
||||
return this.forwardJSONCall("getNavigationTree('" + fileName + "')", function () { return _this.languageService.getNavigationTree(fileName); });
|
||||
};
|
||||
LanguageServiceShimObject.prototype.getOutliningSpans = function (fileName) {
|
||||
var _this = this;
|
||||
return this.forwardJSONCall("getOutliningSpans('" + fileName + "')", function () { return _this.languageService.getOutliningSpans(fileName); });
|
||||
|
||||
Vendored
+45
-23
@@ -1330,7 +1330,6 @@ declare namespace ts {
|
||||
UseFullyQualifiedType = 128,
|
||||
InFirstTypeArgument = 256,
|
||||
InTypeAlias = 512,
|
||||
UseTypeAliasValue = 1024,
|
||||
}
|
||||
enum SymbolFormatFlags {
|
||||
None = 0,
|
||||
@@ -1570,10 +1569,7 @@ declare namespace ts {
|
||||
Classic = 1,
|
||||
NodeJs = 2,
|
||||
}
|
||||
type RootPaths = string[];
|
||||
type PathSubstitutions = MapLike<string[]>;
|
||||
type TsConfigOnlyOptions = RootPaths | PathSubstitutions;
|
||||
type CompilerOptionsValue = string | number | boolean | (string | number)[] | TsConfigOnlyOptions;
|
||||
type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[] | MapLike<string[]>;
|
||||
interface CompilerOptions {
|
||||
allowJs?: boolean;
|
||||
allowSyntheticDefaultImports?: boolean;
|
||||
@@ -1615,13 +1611,13 @@ declare namespace ts {
|
||||
out?: string;
|
||||
outDir?: string;
|
||||
outFile?: string;
|
||||
paths?: PathSubstitutions;
|
||||
paths?: MapLike<string[]>;
|
||||
preserveConstEnums?: boolean;
|
||||
project?: string;
|
||||
reactNamespace?: string;
|
||||
removeComments?: boolean;
|
||||
rootDir?: string;
|
||||
rootDirs?: RootPaths;
|
||||
rootDirs?: string[];
|
||||
skipLibCheck?: boolean;
|
||||
skipDefaultLibCheck?: boolean;
|
||||
sourceMap?: boolean;
|
||||
@@ -2119,6 +2115,7 @@ declare namespace ts {
|
||||
getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[];
|
||||
getNavigateToItems(searchValue: string, maxResultCount?: number, excludeDts?: boolean): NavigateToItem[];
|
||||
getNavigationBarItems(fileName: string): NavigationBarItem[];
|
||||
getNavigationTree(fileName: string): NavigationTree;
|
||||
getOutliningSpans(fileName: string): OutliningSpan[];
|
||||
getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[];
|
||||
getBraceMatchingAtPosition(fileName: string, position: number): TextSpan[];
|
||||
@@ -2140,6 +2137,12 @@ declare namespace ts {
|
||||
textSpan: TextSpan;
|
||||
classificationType: string;
|
||||
}
|
||||
/**
|
||||
* Navigation bar interface designed for visual studio's dual-column layout.
|
||||
* This does not form a proper tree.
|
||||
* The navbar is returned as a list of top-level items, each of which has a list of child items.
|
||||
* Child items always have an empty array for their `childItems`.
|
||||
*/
|
||||
interface NavigationBarItem {
|
||||
text: string;
|
||||
kind: string;
|
||||
@@ -2150,6 +2153,25 @@ declare namespace ts {
|
||||
bolded: boolean;
|
||||
grayed: boolean;
|
||||
}
|
||||
/**
|
||||
* Node in a tree of nested declarations in a file.
|
||||
* The top node is always a script or module node.
|
||||
*/
|
||||
interface NavigationTree {
|
||||
/** Name of the declaration, or a short description, e.g. "<class>". */
|
||||
text: string;
|
||||
/** A ScriptElementKind */
|
||||
kind: string;
|
||||
/** ScriptElementKindModifier separated by commas, e.g. "public,abstract" */
|
||||
kindModifiers: string;
|
||||
/**
|
||||
* Spans of the nodes that generated this declaration.
|
||||
* There will be more than one if this is the result of merging.
|
||||
*/
|
||||
spans: TextSpan[];
|
||||
/** Present if non-empty */
|
||||
childItems?: NavigationTree[];
|
||||
}
|
||||
interface TodoCommentDescriptor {
|
||||
text: string;
|
||||
priority: number;
|
||||
@@ -2214,11 +2236,11 @@ declare namespace ts {
|
||||
}
|
||||
interface EditorSettings {
|
||||
baseIndentSize?: number;
|
||||
indentSize: number;
|
||||
tabSize: number;
|
||||
newLineCharacter: string;
|
||||
convertTabsToSpaces: boolean;
|
||||
indentStyle: IndentStyle;
|
||||
indentSize?: number;
|
||||
tabSize?: number;
|
||||
newLineCharacter?: string;
|
||||
convertTabsToSpaces?: boolean;
|
||||
indentStyle?: IndentStyle;
|
||||
}
|
||||
enum IndentStyle {
|
||||
None = 0,
|
||||
@@ -2239,17 +2261,17 @@ declare namespace ts {
|
||||
PlaceOpenBraceOnNewLineForControlBlocks: boolean;
|
||||
}
|
||||
interface FormatCodeSettings extends EditorSettings {
|
||||
insertSpaceAfterCommaDelimiter: boolean;
|
||||
insertSpaceAfterSemicolonInForStatements: boolean;
|
||||
insertSpaceBeforeAndAfterBinaryOperators: boolean;
|
||||
insertSpaceAfterKeywordsInControlFlowStatements: boolean;
|
||||
insertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean;
|
||||
insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean;
|
||||
insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: boolean;
|
||||
insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: boolean;
|
||||
insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces: boolean;
|
||||
placeOpenBraceOnNewLineForFunctions: boolean;
|
||||
placeOpenBraceOnNewLineForControlBlocks: boolean;
|
||||
insertSpaceAfterCommaDelimiter?: boolean;
|
||||
insertSpaceAfterSemicolonInForStatements?: boolean;
|
||||
insertSpaceBeforeAndAfterBinaryOperators?: boolean;
|
||||
insertSpaceAfterKeywordsInControlFlowStatements?: boolean;
|
||||
insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean;
|
||||
insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean;
|
||||
insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets?: boolean;
|
||||
insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?: boolean;
|
||||
insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean;
|
||||
placeOpenBraceOnNewLineForFunctions?: boolean;
|
||||
placeOpenBraceOnNewLineForControlBlocks?: boolean;
|
||||
}
|
||||
function toEditorSettings(options: EditorOptions | EditorSettings): EditorSettings;
|
||||
interface DefinitionInfo {
|
||||
|
||||
+98
-50
@@ -480,7 +480,6 @@ var ts;
|
||||
TypeFormatFlags[TypeFormatFlags["UseFullyQualifiedType"] = 128] = "UseFullyQualifiedType";
|
||||
TypeFormatFlags[TypeFormatFlags["InFirstTypeArgument"] = 256] = "InFirstTypeArgument";
|
||||
TypeFormatFlags[TypeFormatFlags["InTypeAlias"] = 512] = "InTypeAlias";
|
||||
TypeFormatFlags[TypeFormatFlags["UseTypeAliasValue"] = 1024] = "UseTypeAliasValue";
|
||||
})(ts.TypeFormatFlags || (ts.TypeFormatFlags = {}));
|
||||
var TypeFormatFlags = ts.TypeFormatFlags;
|
||||
(function (SymbolFormatFlags) {
|
||||
@@ -1024,6 +1023,8 @@ var ts;
|
||||
})(ts.Ternary || (ts.Ternary = {}));
|
||||
var Ternary = ts.Ternary;
|
||||
var createObject = Object.create;
|
||||
// More efficient to create a collator once and use its `compare` than to call `a.localeCompare(b)` many times.
|
||||
ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined;
|
||||
function createMap(template) {
|
||||
var map = createObject(null); // tslint:disable-line:no-null-keyword
|
||||
// Using 'delete' on an object causes V8 to put the object in dictionary mode.
|
||||
@@ -1692,7 +1693,8 @@ var ts;
|
||||
if (b === undefined)
|
||||
return 1 /* GreaterThan */;
|
||||
if (ignoreCase) {
|
||||
if (String.prototype.localeCompare) {
|
||||
if (ts.collator && String.prototype.localeCompare) {
|
||||
// accent means a ≠ b, a ≠ á, a = A
|
||||
var result = a.localeCompare(b, /*locales*/ undefined, { usage: "sort", sensitivity: "accent" });
|
||||
return result < 0 ? -1 /* LessThan */ : result > 0 ? 1 /* GreaterThan */ : 0 /* EqualTo */;
|
||||
}
|
||||
@@ -2867,6 +2869,9 @@ var ts;
|
||||
// Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
|
||||
// (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
|
||||
var options;
|
||||
if (!directoryExists(directoryName)) {
|
||||
return;
|
||||
}
|
||||
if (isNode4OrLater() && (process.platform === "win32" || process.platform === "darwin")) {
|
||||
options = { persistent: true, recursive: !!recursive };
|
||||
}
|
||||
@@ -18689,7 +18694,15 @@ var ts;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function isSymbolAccessible(symbol, enclosingDeclaration, meaning) {
|
||||
/**
|
||||
* Check if the given symbol in given enclosing declaration is accessible and mark all associated alias to be visible if requested
|
||||
*
|
||||
* @param symbol a Symbol to check if accessible
|
||||
* @param enclosingDeclaration a Node containing reference to the symbol
|
||||
* @param meaning a SymbolFlags to check if such meaning of the symbol is accessible
|
||||
* @param shouldComputeAliasToMakeVisible a boolean value to indicate whether to return aliases to be mark visible in case the symbol is accessible
|
||||
*/
|
||||
function isSymbolAccessible(symbol, enclosingDeclaration, meaning, shouldComputeAliasesToMakeVisible) {
|
||||
if (symbol && enclosingDeclaration && !(symbol.flags & 262144 /* TypeParameter */)) {
|
||||
var initialSymbol = symbol;
|
||||
var meaningToLook = meaning;
|
||||
@@ -18697,7 +18710,7 @@ var ts;
|
||||
// Symbol is accessible if it by itself is accessible
|
||||
var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaningToLook, /*useOnlyExternalAliasing*/ false);
|
||||
if (accessibleSymbolChain) {
|
||||
var hasAccessibleDeclarations = hasVisibleDeclarations(accessibleSymbolChain[0]);
|
||||
var hasAccessibleDeclarations = hasVisibleDeclarations(accessibleSymbolChain[0], shouldComputeAliasesToMakeVisible);
|
||||
if (!hasAccessibleDeclarations) {
|
||||
return {
|
||||
accessibility: 1 /* NotAccessible */,
|
||||
@@ -18754,7 +18767,7 @@ var ts;
|
||||
function hasExternalModuleSymbol(declaration) {
|
||||
return ts.isAmbientModule(declaration) || (declaration.kind === 256 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration));
|
||||
}
|
||||
function hasVisibleDeclarations(symbol) {
|
||||
function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) {
|
||||
var aliasesToMakeVisible;
|
||||
if (ts.forEach(symbol.declarations, function (declaration) { return !getIsDeclarationVisible(declaration); })) {
|
||||
return undefined;
|
||||
@@ -18768,14 +18781,19 @@ var ts;
|
||||
if (anyImportSyntax &&
|
||||
!(anyImportSyntax.flags & 1 /* Export */) &&
|
||||
isDeclarationVisible(anyImportSyntax.parent)) {
|
||||
getNodeLinks(declaration).isVisible = true;
|
||||
if (aliasesToMakeVisible) {
|
||||
if (!ts.contains(aliasesToMakeVisible, anyImportSyntax)) {
|
||||
aliasesToMakeVisible.push(anyImportSyntax);
|
||||
// In function "buildTypeDisplay" where we decide whether to write type-alias or serialize types,
|
||||
// we want to just check if type- alias is accessible or not but we don't care about emitting those alias at that time
|
||||
// since we will do the emitting later in trackSymbol.
|
||||
if (shouldComputeAliasToMakeVisible) {
|
||||
getNodeLinks(declaration).isVisible = true;
|
||||
if (aliasesToMakeVisible) {
|
||||
if (!ts.contains(aliasesToMakeVisible, anyImportSyntax)) {
|
||||
aliasesToMakeVisible.push(anyImportSyntax);
|
||||
}
|
||||
}
|
||||
else {
|
||||
aliasesToMakeVisible = [anyImportSyntax];
|
||||
}
|
||||
}
|
||||
else {
|
||||
aliasesToMakeVisible = [anyImportSyntax];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -18805,7 +18823,7 @@ var ts;
|
||||
var firstIdentifier = getFirstIdentifier(entityName);
|
||||
var symbol = resolveName(enclosingDeclaration, firstIdentifier.text, meaning, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined);
|
||||
// Verify if the symbol is accessible
|
||||
return (symbol && hasVisibleDeclarations(symbol)) || {
|
||||
return (symbol && hasVisibleDeclarations(symbol, /*shouldComputeAliasToMakeVisible*/ true)) || {
|
||||
accessibility: 1 /* NotAccessible */,
|
||||
errorSymbolName: ts.getTextOfNode(firstIdentifier),
|
||||
errorNode: firstIdentifier
|
||||
@@ -19052,14 +19070,16 @@ var ts;
|
||||
// The specified symbol flags need to be reinterpreted as type flags
|
||||
buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 793064 /* Type */, 0 /* None */, nextFlags);
|
||||
}
|
||||
else if (!(flags & 512 /* InTypeAlias */) && type.flags & (2097152 /* Anonymous */ | 1572864 /* UnionOrIntersection */) && type.aliasSymbol) {
|
||||
if (type.flags & 2097152 /* Anonymous */ || !(flags & 1024 /* UseTypeAliasValue */)) {
|
||||
var typeArguments = type.aliasTypeArguments;
|
||||
writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, typeArguments ? typeArguments.length : 0, nextFlags);
|
||||
}
|
||||
else {
|
||||
writeUnionOrIntersectionType(type, nextFlags);
|
||||
}
|
||||
else if (!(flags & 512 /* InTypeAlias */) && ((type.flags & 2097152 /* Anonymous */ && !type.target) || type.flags & 1572864 /* UnionOrIntersection */) && type.aliasSymbol &&
|
||||
isSymbolAccessible(type.aliasSymbol, enclosingDeclaration, 793064 /* Type */, /*shouldComputeAliasesToMakeVisible*/ false).accessibility === 0 /* Accessible */) {
|
||||
// We emit inferred type as type-alias at the current location if all the following is true
|
||||
// the input type is has alias symbol that is accessible
|
||||
// the input type is a union, intersection or anonymous type that is fully instantiated (if not we want to keep dive into)
|
||||
// e.g.: export type Bar<X, Y> = () => [X, Y];
|
||||
// export type Foo<Y> = Bar<any, Y>;
|
||||
// export const y = (x: Foo<string>) => 1 // we want to emit as ...x: () => [any, string])
|
||||
var typeArguments = type.aliasTypeArguments;
|
||||
writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, typeArguments ? typeArguments.length : 0, nextFlags);
|
||||
}
|
||||
else if (type.flags & 1572864 /* UnionOrIntersection */) {
|
||||
writeUnionOrIntersectionType(type, nextFlags);
|
||||
@@ -35905,7 +35925,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
function trackSymbol(symbol, enclosingDeclaration, meaning) {
|
||||
handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning));
|
||||
handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning, /*shouldComputeAliasesToMakeVisible*/ true));
|
||||
recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForSymbol(symbol, meaning));
|
||||
}
|
||||
function reportInaccessibleThisError() {
|
||||
@@ -35923,7 +35943,7 @@ var ts;
|
||||
}
|
||||
else {
|
||||
errorNameNode = declaration.name;
|
||||
resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, 2 /* UseTypeOfFunction */ | 1024 /* UseTypeAliasValue */, writer);
|
||||
resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, 2 /* UseTypeOfFunction */, writer);
|
||||
errorNameNode = undefined;
|
||||
}
|
||||
}
|
||||
@@ -35936,7 +35956,7 @@ var ts;
|
||||
}
|
||||
else {
|
||||
errorNameNode = signature.name;
|
||||
resolver.writeReturnTypeOfSignatureDeclaration(signature, enclosingDeclaration, 2 /* UseTypeOfFunction */ | 1024 /* UseTypeAliasValue */, writer);
|
||||
resolver.writeReturnTypeOfSignatureDeclaration(signature, enclosingDeclaration, 2 /* UseTypeOfFunction */, writer);
|
||||
errorNameNode = undefined;
|
||||
}
|
||||
}
|
||||
@@ -36138,7 +36158,7 @@ var ts;
|
||||
write(tempVarName);
|
||||
write(": ");
|
||||
writer.getSymbolAccessibilityDiagnostic = getDefaultExportAccessibilityDiagnostic;
|
||||
resolver.writeTypeOfExpression(node.expression, enclosingDeclaration, 2 /* UseTypeOfFunction */ | 1024 /* UseTypeAliasValue */, writer);
|
||||
resolver.writeTypeOfExpression(node.expression, enclosingDeclaration, 2 /* UseTypeOfFunction */, writer);
|
||||
write(";");
|
||||
writeLine();
|
||||
write(node.isExportEquals ? "export = " : "export default ");
|
||||
@@ -36559,7 +36579,7 @@ var ts;
|
||||
}
|
||||
else {
|
||||
writer.getSymbolAccessibilityDiagnostic = getHeritageClauseVisibilityError;
|
||||
resolver.writeBaseConstructorTypeOfClass(enclosingDeclaration, enclosingDeclaration, 2 /* UseTypeOfFunction */ | 1024 /* UseTypeAliasValue */, writer);
|
||||
resolver.writeBaseConstructorTypeOfClass(enclosingDeclaration, enclosingDeclaration, 2 /* UseTypeOfFunction */, writer);
|
||||
}
|
||||
function getHeritageClauseVisibilityError(symbolAccessibilityResult) {
|
||||
var diagnosticMessage;
|
||||
@@ -38898,15 +38918,15 @@ var ts;
|
||||
write(" = ");
|
||||
emitObjectLiteralBody(node, firstComputedPropertyIndex);
|
||||
for (var i = firstComputedPropertyIndex, n = properties.length; i < n; i++) {
|
||||
writeComma();
|
||||
var property = properties[i];
|
||||
emitStart(property);
|
||||
if (property.kind === 149 /* GetAccessor */ || property.kind === 150 /* SetAccessor */) {
|
||||
// TODO (drosen): Reconcile with 'emitMemberFunctions'.
|
||||
var accessors = ts.getAllAccessorDeclarations(node.properties, property);
|
||||
if (property !== accessors.firstAccessor) {
|
||||
continue;
|
||||
}
|
||||
writeComma();
|
||||
emitStart(property);
|
||||
write("Object.defineProperty(");
|
||||
emit(tempVar);
|
||||
write(", ");
|
||||
@@ -38947,6 +38967,8 @@ var ts;
|
||||
emitEnd(property);
|
||||
}
|
||||
else {
|
||||
writeComma();
|
||||
emitStart(property);
|
||||
emitLeadingComments(property);
|
||||
emitStart(property.name);
|
||||
emit(tempVar);
|
||||
@@ -38965,8 +38987,8 @@ var ts;
|
||||
else {
|
||||
ts.Debug.fail("ObjectLiteralElement type not accounted for: " + property.kind);
|
||||
}
|
||||
emitEnd(property);
|
||||
}
|
||||
emitEnd(property);
|
||||
}
|
||||
writeComma();
|
||||
emit(tempVar);
|
||||
@@ -39498,7 +39520,12 @@ var ts;
|
||||
if (modulekind === ts.ModuleKind.System || node.kind !== 69 /* Identifier */ || ts.nodeIsSynthesized(node)) {
|
||||
return false;
|
||||
}
|
||||
return !exportEquals && exportSpecifiers && node.text in exportSpecifiers;
|
||||
if (exportEquals || !exportSpecifiers || !(node.text in exportSpecifiers)) {
|
||||
return false;
|
||||
}
|
||||
// check that referenced declaration is declared on source file level
|
||||
var declaration = resolver.getReferencedValueDeclaration(node);
|
||||
return declaration && ts.getEnclosingBlockScopeContainer(declaration).kind === 256 /* SourceFile */;
|
||||
}
|
||||
function emitPrefixUnaryExpression(node) {
|
||||
var isPlusPlusOrMinusMinus = (node.operator === 41 /* PlusPlusToken */
|
||||
@@ -47554,8 +47581,6 @@ var ts;
|
||||
function getNavigateToItems(program, checker, cancellationToken, searchValue, maxResultCount, excludeDts) {
|
||||
var patternMatcher = ts.createPatternMatcher(searchValue);
|
||||
var rawItems = [];
|
||||
// This means "compare in a case insensitive manner."
|
||||
var baseSensitivity = { sensitivity: "base" };
|
||||
// Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[]
|
||||
ts.forEach(program.getSourceFiles(), function (sourceFile) {
|
||||
cancellationToken.throwIfCancellationRequested();
|
||||
@@ -47705,8 +47730,8 @@ var ts;
|
||||
// We first sort case insensitively. So "Aaa" will come before "bar".
|
||||
// Then we sort case sensitively, so "aaa" will come before "Aaa".
|
||||
return i1.matchKind - i2.matchKind ||
|
||||
i1.name.localeCompare(i2.name, undefined, baseSensitivity) ||
|
||||
i1.name.localeCompare(i2.name);
|
||||
ts.compareStringsCaseInsensitive(i1.name, i2.name) ||
|
||||
ts.compareStrings(i1.name, i2.name);
|
||||
}
|
||||
function createNavigateToItem(rawItem) {
|
||||
var declaration = rawItem.declaration;
|
||||
@@ -47741,6 +47766,13 @@ var ts;
|
||||
return result;
|
||||
}
|
||||
NavigationBar.getNavigationBarItems = getNavigationBarItems;
|
||||
function getNavigationTree(sourceFile) {
|
||||
curSourceFile = sourceFile;
|
||||
var result = convertToTree(rootNavigationBarNode(sourceFile));
|
||||
curSourceFile = undefined;
|
||||
return result;
|
||||
}
|
||||
NavigationBar.getNavigationTree = getNavigationTree;
|
||||
// Keep sourceFile handy so we don't have to search for it every time we need to call `getText`.
|
||||
var curSourceFile;
|
||||
function nodeText(node) {
|
||||
@@ -48018,11 +48050,9 @@ var ts;
|
||||
return name1 ? 1 : name2 ? -1 : navigationBarNodeKind(child1) - navigationBarNodeKind(child2);
|
||||
}
|
||||
}
|
||||
// More efficient to create a collator once and use its `compare` than to call `a.localeCompare(b)` many times.
|
||||
var collator = typeof Intl !== "undefined" && Intl && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined;
|
||||
// Intl is missing in Safari, and node 0.10 treats "a" as greater than "B".
|
||||
var localeCompareIsCorrect = collator && collator.compare("a", "B") < 0;
|
||||
var localeCompareFix = localeCompareIsCorrect ? collator.compare : function (a, b) {
|
||||
var localeCompareIsCorrect = ts.collator && ts.collator.compare("a", "B") < 0;
|
||||
var localeCompareFix = localeCompareIsCorrect ? ts.collator.compare : function (a, b) {
|
||||
// This isn't perfect, but it passes all of our tests.
|
||||
for (var i = 0; i < Math.min(a.length, b.length); i++) {
|
||||
var chA = a.charAt(i), chB = b.charAt(i);
|
||||
@@ -48032,7 +48062,7 @@ var ts;
|
||||
if (chA === "'" && chB === "\"") {
|
||||
return -1;
|
||||
}
|
||||
var cmp = chA.toLocaleLowerCase().localeCompare(chB.toLocaleLowerCase());
|
||||
var cmp = ts.compareStrings(chA.toLocaleLowerCase(), chB.toLocaleLowerCase());
|
||||
if (cmp !== 0) {
|
||||
return cmp;
|
||||
}
|
||||
@@ -48183,6 +48213,15 @@ var ts;
|
||||
}
|
||||
// NavigationBarItem requires an array, but will not mutate it, so just give it this for performance.
|
||||
var emptyChildItemArray = [];
|
||||
function convertToTree(n) {
|
||||
return {
|
||||
text: getItemName(n.node),
|
||||
kind: ts.getNodeKind(n.node),
|
||||
kindModifiers: ts.getNodeModifiers(n.node),
|
||||
spans: getSpans(n),
|
||||
childItems: ts.map(n.children, convertToTree)
|
||||
};
|
||||
}
|
||||
function convertToTopLevelItem(n) {
|
||||
return {
|
||||
text: getItemName(n.node),
|
||||
@@ -48206,16 +48245,16 @@ var ts;
|
||||
grayed: false
|
||||
};
|
||||
}
|
||||
function getSpans(n) {
|
||||
var spans = [getNodeSpan(n.node)];
|
||||
if (n.additionalNodes) {
|
||||
for (var _i = 0, _a = n.additionalNodes; _i < _a.length; _i++) {
|
||||
var node = _a[_i];
|
||||
spans.push(getNodeSpan(node));
|
||||
}
|
||||
}
|
||||
function getSpans(n) {
|
||||
var spans = [getNodeSpan(n.node)];
|
||||
if (n.additionalNodes) {
|
||||
for (var _i = 0, _a = n.additionalNodes; _i < _a.length; _i++) {
|
||||
var node = _a[_i];
|
||||
spans.push(getNodeSpan(node));
|
||||
}
|
||||
return spans;
|
||||
}
|
||||
return spans;
|
||||
}
|
||||
function getModuleName(moduleDeclaration) {
|
||||
// We want to maintain quotation marks.
|
||||
@@ -50417,10 +50456,12 @@ var ts;
|
||||
* Get the typing info from common package manager json files like package.json or bower.json
|
||||
*/
|
||||
function getTypingNamesFromJson(jsonPath, filesToWatch) {
|
||||
if (host.fileExists(jsonPath)) {
|
||||
filesToWatch.push(jsonPath);
|
||||
}
|
||||
var result = ts.readConfigFile(jsonPath, function (path) { return host.readFile(path); });
|
||||
if (result.config) {
|
||||
var jsonConfig = result.config;
|
||||
filesToWatch.push(jsonPath);
|
||||
if (jsonConfig.dependencies) {
|
||||
mergeTypings(ts.getOwnKeys(jsonConfig.dependencies));
|
||||
}
|
||||
@@ -59516,8 +59557,10 @@ var ts;
|
||||
return ts.BreakpointResolver.spanInSourceFileAtLocation(sourceFile, position);
|
||||
}
|
||||
function getNavigationBarItems(fileName) {
|
||||
var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
|
||||
return ts.NavigationBar.getNavigationBarItems(sourceFile);
|
||||
return ts.NavigationBar.getNavigationBarItems(syntaxTreeCache.getCurrentSourceFile(fileName));
|
||||
}
|
||||
function getNavigationTree(fileName) {
|
||||
return ts.NavigationBar.getNavigationTree(syntaxTreeCache.getCurrentSourceFile(fileName));
|
||||
}
|
||||
function getSemanticClassifications(fileName, span) {
|
||||
return convertClassifications(getEncodedSemanticClassifications(fileName, span));
|
||||
@@ -60461,6 +60504,7 @@ var ts;
|
||||
getRenameInfo: getRenameInfo,
|
||||
findRenameLocations: findRenameLocations,
|
||||
getNavigationBarItems: getNavigationBarItems,
|
||||
getNavigationTree: getNavigationTree,
|
||||
getOutliningSpans: getOutliningSpans,
|
||||
getTodoComments: getTodoComments,
|
||||
getBraceMatchingAtPosition: getBraceMatchingAtPosition,
|
||||
@@ -62100,6 +62144,10 @@ var ts;
|
||||
var _this = this;
|
||||
return this.forwardJSONCall("getNavigationBarItems('" + fileName + "')", function () { return _this.languageService.getNavigationBarItems(fileName); });
|
||||
};
|
||||
LanguageServiceShimObject.prototype.getNavigationTree = function (fileName) {
|
||||
var _this = this;
|
||||
return this.forwardJSONCall("getNavigationTree('" + fileName + "')", function () { return _this.languageService.getNavigationTree(fileName); });
|
||||
};
|
||||
LanguageServiceShimObject.prototype.getOutliningSpans = function (fileName) {
|
||||
var _this = this;
|
||||
return this.forwardJSONCall("getOutliningSpans('" + fileName + "')", function () { return _this.languageService.getOutliningSpans(fileName); });
|
||||
|
||||
+72
-30
@@ -130,6 +130,7 @@ var ts;
|
||||
var ts;
|
||||
(function (ts) {
|
||||
var createObject = Object.create;
|
||||
ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined;
|
||||
function createMap(template) {
|
||||
var map = createObject(null);
|
||||
map["__"] = undefined;
|
||||
@@ -687,7 +688,7 @@ var ts;
|
||||
if (b === undefined)
|
||||
return 1;
|
||||
if (ignoreCase) {
|
||||
if (String.prototype.localeCompare) {
|
||||
if (ts.collator && String.prototype.localeCompare) {
|
||||
var result = a.localeCompare(b, undefined, { usage: "sort", sensitivity: "accent" });
|
||||
return result < 0 ? -1 : result > 0 ? 1 : 0;
|
||||
}
|
||||
@@ -1715,6 +1716,9 @@ var ts;
|
||||
},
|
||||
watchDirectory: function (directoryName, callback, recursive) {
|
||||
var options;
|
||||
if (!directoryExists(directoryName)) {
|
||||
return;
|
||||
}
|
||||
if (isNode4OrLater() && (process.platform === "win32" || process.platform === "darwin")) {
|
||||
options = { persistent: true, recursive: !!recursive };
|
||||
}
|
||||
@@ -5187,10 +5191,12 @@ var ts;
|
||||
}
|
||||
}
|
||||
function getTypingNamesFromJson(jsonPath, filesToWatch) {
|
||||
if (host.fileExists(jsonPath)) {
|
||||
filesToWatch.push(jsonPath);
|
||||
}
|
||||
var result = ts.readConfigFile(jsonPath, function (path) { return host.readFile(path); });
|
||||
if (result.config) {
|
||||
var jsonConfig = result.config;
|
||||
filesToWatch.push(jsonPath);
|
||||
if (jsonConfig.dependencies) {
|
||||
mergeTypings(ts.getOwnKeys(jsonConfig.dependencies));
|
||||
}
|
||||
@@ -5730,10 +5736,9 @@ var ts;
|
||||
typingsInstaller.NpmViewRequest = "npm view";
|
||||
typingsInstaller.NpmInstallRequest = "npm install";
|
||||
var TypingsInstaller = (function () {
|
||||
function TypingsInstaller(globalCachePath, npmPath, safeListPath, throttleLimit, log) {
|
||||
function TypingsInstaller(globalCachePath, safeListPath, throttleLimit, log) {
|
||||
if (log === void 0) { log = nullLog; }
|
||||
this.globalCachePath = globalCachePath;
|
||||
this.npmPath = npmPath;
|
||||
this.safeListPath = safeListPath;
|
||||
this.throttleLimit = throttleLimit;
|
||||
this.log = log;
|
||||
@@ -5955,12 +5960,11 @@ var ts;
|
||||
var filteredTypings = [];
|
||||
for (var _i = 0, typingsToInstall_3 = typingsToInstall; _i < typingsToInstall_3.length; _i++) {
|
||||
var typing = typingsToInstall_3[_i];
|
||||
execNpmViewTyping(this, typing);
|
||||
filterExistingTypings(this, typing);
|
||||
}
|
||||
function execNpmViewTyping(self, typing) {
|
||||
var command = self.npmPath + " view @types/" + typing + " --silent name";
|
||||
self.execAsync(typingsInstaller.NpmViewRequest, requestId, command, cachePath, function (err, stdout, stderr) {
|
||||
if (stdout) {
|
||||
function filterExistingTypings(self, typing) {
|
||||
self.execAsync(typingsInstaller.NpmViewRequest, requestId, [typing], cachePath, function (ok) {
|
||||
if (ok) {
|
||||
filteredTypings.push(typing);
|
||||
}
|
||||
execInstallCmdCount++;
|
||||
@@ -5975,9 +5979,8 @@ var ts;
|
||||
return;
|
||||
}
|
||||
var scopedTypings = filteredTypings.map(function (t) { return "@types/" + t; });
|
||||
var command = self.npmPath + " install " + scopedTypings.join(" ") + " --save-dev";
|
||||
self.execAsync(typingsInstaller.NpmInstallRequest, requestId, command, cachePath, function (err, stdout, stderr) {
|
||||
postInstallAction(stdout ? scopedTypings : []);
|
||||
self.execAsync(typingsInstaller.NpmInstallRequest, requestId, scopedTypings, cachePath, function (ok) {
|
||||
postInstallAction(ok ? scopedTypings : []);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -6004,8 +6007,10 @@ var ts;
|
||||
if (_this.log.isEnabled()) {
|
||||
_this.log.writeLine("Got FS notification for " + f + ", handler is already invoked '" + isInvoked + "'");
|
||||
}
|
||||
_this.sendResponse({ projectName: projectName, kind: "invalidate" });
|
||||
isInvoked = true;
|
||||
if (!isInvoked) {
|
||||
_this.sendResponse({ projectName: projectName, kind: "invalidate" });
|
||||
isInvoked = true;
|
||||
}
|
||||
});
|
||||
watchers.push(w);
|
||||
}
|
||||
@@ -6020,8 +6025,8 @@ var ts;
|
||||
kind: "set"
|
||||
};
|
||||
};
|
||||
TypingsInstaller.prototype.execAsync = function (requestKind, requestId, command, cwd, onRequestCompleted) {
|
||||
this.pendingRunRequests.unshift({ requestKind: requestKind, requestId: requestId, command: command, cwd: cwd, onRequestCompleted: onRequestCompleted });
|
||||
TypingsInstaller.prototype.execAsync = function (requestKind, requestId, args, cwd, onRequestCompleted) {
|
||||
this.pendingRunRequests.unshift({ requestKind: requestKind, requestId: requestId, args: args, cwd: cwd, onRequestCompleted: onRequestCompleted });
|
||||
this.executeWithThrottling();
|
||||
};
|
||||
TypingsInstaller.prototype.executeWithThrottling = function () {
|
||||
@@ -6029,9 +6034,9 @@ var ts;
|
||||
var _loop_1 = function() {
|
||||
this_1.inFlightRequestCount++;
|
||||
var request = this_1.pendingRunRequests.pop();
|
||||
this_1.runCommand(request.requestKind, request.requestId, request.command, request.cwd, function (err, stdout, stderr) {
|
||||
this_1.executeRequest(request.requestKind, request.requestId, request.args, request.cwd, function (ok) {
|
||||
_this.inFlightRequestCount--;
|
||||
request.onRequestCompleted(err, stdout, stderr);
|
||||
request.onRequestCompleted(ok);
|
||||
_this.executeWithThrottling();
|
||||
});
|
||||
};
|
||||
@@ -6077,13 +6082,14 @@ var ts;
|
||||
var NodeTypingsInstaller = (function (_super) {
|
||||
__extends(NodeTypingsInstaller, _super);
|
||||
function NodeTypingsInstaller(globalTypingsCacheLocation, throttleLimit, log) {
|
||||
_super.call(this, globalTypingsCacheLocation, getNPMLocation(process.argv[0]), ts.toPath("typingSafeList.json", __dirname, ts.createGetCanonicalFileName(ts.sys.useCaseSensitiveFileNames)), throttleLimit, log);
|
||||
_super.call(this, globalTypingsCacheLocation, ts.toPath("typingSafeList.json", __dirname, ts.createGetCanonicalFileName(ts.sys.useCaseSensitiveFileNames)), throttleLimit, log);
|
||||
this.installTypingHost = ts.sys;
|
||||
if (this.log.isEnabled()) {
|
||||
this.log.writeLine("Process id: " + process.pid);
|
||||
}
|
||||
var exec = require("child_process").exec;
|
||||
this.exec = exec;
|
||||
this.npmPath = getNPMLocation(process.argv[0]);
|
||||
this.exec = require("child_process").exec;
|
||||
this.httpGet = require("http").get;
|
||||
}
|
||||
NodeTypingsInstaller.prototype.init = function () {
|
||||
var _this = this;
|
||||
@@ -6107,18 +6113,54 @@ var ts;
|
||||
this.log.writeLine("Response has been sent.");
|
||||
}
|
||||
};
|
||||
NodeTypingsInstaller.prototype.runCommand = function (requestKind, requestId, command, cwd, onRequestCompleted) {
|
||||
NodeTypingsInstaller.prototype.executeRequest = function (requestKind, requestId, args, cwd, onRequestCompleted) {
|
||||
var _this = this;
|
||||
if (this.log.isEnabled()) {
|
||||
this.log.writeLine("#" + requestId + " running command '" + command + "'.");
|
||||
this.log.writeLine("#" + requestId + " executing " + requestKind + ", arguments'" + JSON.stringify(args) + "'.");
|
||||
}
|
||||
switch (requestKind) {
|
||||
case typingsInstaller.NpmViewRequest:
|
||||
{
|
||||
ts.Debug.assert(args.length === 1);
|
||||
var url_1 = "http://registry.npmjs.org/@types%2f" + args[0];
|
||||
var start_2 = Date.now();
|
||||
this.httpGet(url_1, function (response) {
|
||||
var ok = false;
|
||||
if (_this.log.isEnabled()) {
|
||||
_this.log.writeLine(requestKind + " #" + requestId + " request to " + url_1 + ":: status code " + response.statusCode + ", status message '" + response.statusMessage + "', took " + (Date.now() - start_2) + " ms");
|
||||
}
|
||||
switch (response.statusCode) {
|
||||
case 200:
|
||||
case 301:
|
||||
case 302:
|
||||
ok = true;
|
||||
break;
|
||||
}
|
||||
response.destroy();
|
||||
onRequestCompleted(ok);
|
||||
}).on("error", function (err) {
|
||||
if (_this.log.isEnabled()) {
|
||||
_this.log.writeLine(requestKind + " #" + requestId + " query to npm registry failed with error " + err.message + ", stack " + err.stack);
|
||||
}
|
||||
onRequestCompleted(false);
|
||||
});
|
||||
}
|
||||
break;
|
||||
case typingsInstaller.NpmInstallRequest:
|
||||
{
|
||||
var command = this.npmPath + " install " + args.join(" ") + " --save-dev";
|
||||
var start_3 = Date.now();
|
||||
this.exec(command, { cwd: cwd }, function (err, stdout, stderr) {
|
||||
if (_this.log.isEnabled()) {
|
||||
_this.log.writeLine(requestKind + " #" + requestId + " took: " + (Date.now() - start_3) + " ms" + ts.sys.newLine + "stdout: " + stdout + ts.sys.newLine + "stderr: " + stderr);
|
||||
}
|
||||
onRequestCompleted(!!stdout);
|
||||
});
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ts.Debug.assert(false, "Unknown request kind " + requestKind);
|
||||
}
|
||||
this.exec(command, { cwd: cwd }, function (err, stdout, stderr) {
|
||||
if (_this.log.isEnabled()) {
|
||||
_this.log.writeLine(requestKind + " #" + requestId + " stdout: " + stdout);
|
||||
_this.log.writeLine(requestKind + " #" + requestId + " stderr: " + stderr);
|
||||
}
|
||||
onRequestCompleted(err, stdout, stderr);
|
||||
});
|
||||
};
|
||||
return NodeTypingsInstaller;
|
||||
}(typingsInstaller.TypingsInstaller));
|
||||
|
||||
Reference in New Issue
Block a user