typescript 4.9.0-dev.20221006 → 4.9.0-dev.20221011

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/protocol.d.ts CHANGED
@@ -860,12 +860,14 @@ declare namespace ts.server.protocol {
860
860
  command: CommandTypes.References;
861
861
  }
862
862
  interface ReferencesResponseItem extends FileSpanWithContext {
863
- /** Text of line containing the reference. Including this
864
- * with the response avoids latency of editor loading files
865
- * to show text of reference line (the server already has
866
- * loaded the referencing files).
863
+ /**
864
+ * Text of line containing the reference. Including this
865
+ * with the response avoids latency of editor loading files
866
+ * to show text of reference line (the server already has loaded the referencing files).
867
+ *
868
+ * If {@link UserPreferences.disableLineTextInReferences} is enabled, the property won't be filled
867
869
  */
868
- lineText: string;
870
+ lineText?: string;
869
871
  /**
870
872
  * True if reference is a write location, false otherwise.
871
873
  */
@@ -2711,6 +2713,10 @@ declare namespace ts.server.protocol {
2711
2713
  readonly includeInlayFunctionLikeReturnTypeHints?: boolean;
2712
2714
  readonly includeInlayEnumMemberValueHints?: boolean;
2713
2715
  readonly autoImportFileExcludePatterns?: string[];
2716
+ /**
2717
+ * Indicates whether {@link ReferencesResponseItem.lineText} is supported.
2718
+ */
2719
+ readonly disableLineTextInReferences?: boolean;
2714
2720
  }
2715
2721
  interface CompilerOptions {
2716
2722
  allowJs?: boolean;
package/lib/tsc.js CHANGED
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
69
69
  var ts;
70
70
  (function (ts) {
71
71
  ts.versionMajorMinor = "4.9";
72
- ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221006");
72
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221011");
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  var globals = typeof globalThis !== "undefined" ? globalThis :
@@ -49626,7 +49626,17 @@ var ts;
49626
49626
  return !!(ts.getObjectFlags(type) & 32 && getMappedTypeModifiers(type) & 4);
49627
49627
  }
49628
49628
  function isGenericMappedType(type) {
49629
- return !!(ts.getObjectFlags(type) & 32) && isGenericIndexType(getConstraintTypeFromMappedType(type));
49629
+ if (ts.getObjectFlags(type) & 32) {
49630
+ var constraint = getConstraintTypeFromMappedType(type);
49631
+ if (isGenericIndexType(constraint)) {
49632
+ return true;
49633
+ }
49634
+ var nameType = getNameTypeFromMappedType(type);
49635
+ if (nameType && isGenericIndexType(instantiateType(nameType, makeUnaryTypeMapper(getTypeParameterFromMappedType(type), constraint)))) {
49636
+ return true;
49637
+ }
49638
+ }
49639
+ return false;
49630
49640
  }
49631
49641
  function resolveStructuredTypeMembers(type) {
49632
49642
  if (!type.members) {
@@ -52559,8 +52569,13 @@ var ts;
52559
52569
  return getStringLiteralType(text);
52560
52570
  }
52561
52571
  newTexts.push(text);
52562
- if (ts.every(newTexts, function (t) { return t === ""; }) && ts.every(newTypes, function (t) { return !!(t.flags & 4); })) {
52563
- return stringType;
52572
+ if (ts.every(newTexts, function (t) { return t === ""; })) {
52573
+ if (ts.every(newTypes, function (t) { return !!(t.flags & 4); })) {
52574
+ return stringType;
52575
+ }
52576
+ if (newTypes.length === 1 && isPatternLiteralType(newTypes[0])) {
52577
+ return newTypes[0];
52578
+ }
52564
52579
  }
52565
52580
  var id = "".concat(getTypeListId(newTypes), "|").concat(ts.map(newTexts, function (t) { return t.length; }).join(","), "|").concat(newTexts.join(""));
52566
52581
  var type = templateLiteralTypes.get(id);
@@ -52619,11 +52634,12 @@ var ts;
52619
52634
  }
52620
52635
  function getStringMappingType(symbol, type) {
52621
52636
  return type.flags & (1048576 | 131072) ? mapType(type, function (t) { return getStringMappingType(symbol, t); }) :
52622
- type.flags & 268435456 && symbol === type.symbol ? type :
52623
- isGenericIndexType(type) || isPatternLiteralPlaceholderType(type) ? getStringMappingTypeForGenericType(symbol, isPatternLiteralPlaceholderType(type) && !(type.flags & 268435456) ? getTemplateLiteralType(["", ""], [type]) : type) :
52624
- type.flags & 128 ? getStringLiteralType(applyStringMapping(symbol, type.value)) :
52625
- type.flags & 134217728 ? getTemplateLiteralType.apply(void 0, applyTemplateStringMapping(symbol, type.texts, type.types)) :
52626
- type;
52637
+ type.flags & 128 ? getStringLiteralType(applyStringMapping(symbol, type.value)) :
52638
+ type.flags & 134217728 ? getTemplateLiteralType.apply(void 0, applyTemplateStringMapping(symbol, type.texts, type.types)) :
52639
+ type.flags & 268435456 && symbol === type.symbol ? type :
52640
+ type.flags & (1 | 4 || type.flags & 268435456) || isGenericIndexType(type) ? getStringMappingTypeForGenericType(symbol, type) :
52641
+ isPatternLiteralPlaceholderType(type) ? getStringMappingTypeForGenericType(symbol, getTemplateLiteralType(["", ""], [type])) :
52642
+ type;
52627
52643
  }
52628
52644
  function applyStringMapping(symbol, str) {
52629
52645
  switch (intrinsicTypeKinds.get(symbol.escapedName)) {
@@ -52887,10 +52903,11 @@ var ts;
52887
52903
  accessNode;
52888
52904
  }
52889
52905
  function isPatternLiteralPlaceholderType(type) {
52890
- return !!(type.flags & (1 | 4 | 8 | 64)) || !!(type.flags & 268435456 && isPatternLiteralPlaceholderType(type.type));
52906
+ return !!(type.flags & (1 | 4 | 8 | 64)) || isPatternLiteralType(type);
52891
52907
  }
52892
52908
  function isPatternLiteralType(type) {
52893
- return !!(type.flags & 134217728) && ts.every(type.types, isPatternLiteralPlaceholderType);
52909
+ return !!(type.flags & 134217728) && ts.every(type.types, isPatternLiteralPlaceholderType) ||
52910
+ !!(type.flags & 268435456) && isPatternLiteralPlaceholderType(type.type);
52894
52911
  }
52895
52912
  function isGenericType(type) {
52896
52913
  return !!getGenericObjectFlags(type);
@@ -58240,7 +58257,7 @@ var ts;
58240
58257
  && (!roundTripOnly || s === ts.pseudoBigIntToString({ negative: negative, base10Value: ts.parsePseudoBigInt(scanner.getTokenValue()) }));
58241
58258
  }
58242
58259
  function isMemberOfStringMapping(source, target) {
58243
- if (target.flags & (4 | 3)) {
58260
+ if (target.flags & (4 | 1)) {
58244
58261
  return true;
58245
58262
  }
58246
58263
  if (target.flags & 134217728) {
package/lib/tsserver.js CHANGED
@@ -109,7 +109,7 @@ var ts;
109
109
  // The following is baselined as a literal template type without intervention
110
110
  /** The version of the TypeScript compiler release */
111
111
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
112
- ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221006");
112
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221011");
113
113
  /* @internal */
114
114
  var Comparison;
115
115
  (function (Comparison) {
@@ -59873,7 +59873,20 @@ var ts;
59873
59873
  return !!(ts.getObjectFlags(type) & 32 /* ObjectFlags.Mapped */ && getMappedTypeModifiers(type) & 4 /* MappedTypeModifiers.IncludeOptional */);
59874
59874
  }
59875
59875
  function isGenericMappedType(type) {
59876
- return !!(ts.getObjectFlags(type) & 32 /* ObjectFlags.Mapped */) && isGenericIndexType(getConstraintTypeFromMappedType(type));
59876
+ if (ts.getObjectFlags(type) & 32 /* ObjectFlags.Mapped */) {
59877
+ var constraint = getConstraintTypeFromMappedType(type);
59878
+ if (isGenericIndexType(constraint)) {
59879
+ return true;
59880
+ }
59881
+ // A mapped type is generic if the 'as' clause references generic types other than the iteration type.
59882
+ // To determine this, we substitute the constraint type (that we now know isn't generic) for the iteration
59883
+ // type and check whether the resulting type is generic.
59884
+ var nameType = getNameTypeFromMappedType(type);
59885
+ if (nameType && isGenericIndexType(instantiateType(nameType, makeUnaryTypeMapper(getTypeParameterFromMappedType(type), constraint)))) {
59886
+ return true;
59887
+ }
59888
+ }
59889
+ return false;
59877
59890
  }
59878
59891
  function resolveStructuredTypeMembers(type) {
59879
59892
  if (!type.members) {
@@ -63193,8 +63206,14 @@ var ts;
63193
63206
  return getStringLiteralType(text);
63194
63207
  }
63195
63208
  newTexts.push(text);
63196
- if (ts.every(newTexts, function (t) { return t === ""; }) && ts.every(newTypes, function (t) { return !!(t.flags & 4 /* TypeFlags.String */); })) {
63197
- return stringType;
63209
+ if (ts.every(newTexts, function (t) { return t === ""; })) {
63210
+ if (ts.every(newTypes, function (t) { return !!(t.flags & 4 /* TypeFlags.String */); })) {
63211
+ return stringType;
63212
+ }
63213
+ // Normalize `${Mapping<xxx>}` into Mapping<xxx>
63214
+ if (newTypes.length === 1 && isPatternLiteralType(newTypes[0])) {
63215
+ return newTypes[0];
63216
+ }
63198
63217
  }
63199
63218
  var id = "".concat(getTypeListId(newTypes), "|").concat(ts.map(newTexts, function (t) { return t.length; }).join(","), "|").concat(newTexts.join(""));
63200
63219
  var type = templateLiteralTypes.get(id);
@@ -63253,12 +63272,14 @@ var ts;
63253
63272
  }
63254
63273
  function getStringMappingType(symbol, type) {
63255
63274
  return type.flags & (1048576 /* TypeFlags.Union */ | 131072 /* TypeFlags.Never */) ? mapType(type, function (t) { return getStringMappingType(symbol, t); }) :
63256
- // Mapping<Mapping<T>> === Mapping<T>
63257
- type.flags & 268435456 /* TypeFlags.StringMapping */ && symbol === type.symbol ? type :
63258
- isGenericIndexType(type) || isPatternLiteralPlaceholderType(type) ? getStringMappingTypeForGenericType(symbol, isPatternLiteralPlaceholderType(type) && !(type.flags & 268435456 /* TypeFlags.StringMapping */) ? getTemplateLiteralType(["", ""], [type]) : type) :
63259
- type.flags & 128 /* TypeFlags.StringLiteral */ ? getStringLiteralType(applyStringMapping(symbol, type.value)) :
63260
- type.flags & 134217728 /* TypeFlags.TemplateLiteral */ ? getTemplateLiteralType.apply(void 0, applyTemplateStringMapping(symbol, type.texts, type.types)) :
63261
- type;
63275
+ type.flags & 128 /* TypeFlags.StringLiteral */ ? getStringLiteralType(applyStringMapping(symbol, type.value)) :
63276
+ type.flags & 134217728 /* TypeFlags.TemplateLiteral */ ? getTemplateLiteralType.apply(void 0, applyTemplateStringMapping(symbol, type.texts, type.types)) :
63277
+ // Mapping<Mapping<T>> === Mapping<T>
63278
+ type.flags & 268435456 /* TypeFlags.StringMapping */ && symbol === type.symbol ? type :
63279
+ type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */ || type.flags & 268435456 /* TypeFlags.StringMapping */) || isGenericIndexType(type) ? getStringMappingTypeForGenericType(symbol, type) :
63280
+ // This handles Mapping<`${number}`> and Mapping<`${bigint}`>
63281
+ isPatternLiteralPlaceholderType(type) ? getStringMappingTypeForGenericType(symbol, getTemplateLiteralType(["", ""], [type])) :
63282
+ type;
63262
63283
  }
63263
63284
  function applyStringMapping(symbol, str) {
63264
63285
  switch (intrinsicTypeKinds.get(symbol.escapedName)) {
@@ -63537,10 +63558,11 @@ var ts;
63537
63558
  accessNode;
63538
63559
  }
63539
63560
  function isPatternLiteralPlaceholderType(type) {
63540
- return !!(type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */ | 8 /* TypeFlags.Number */ | 64 /* TypeFlags.BigInt */)) || !!(type.flags & 268435456 /* TypeFlags.StringMapping */ && isPatternLiteralPlaceholderType(type.type));
63561
+ return !!(type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */ | 8 /* TypeFlags.Number */ | 64 /* TypeFlags.BigInt */)) || isPatternLiteralType(type);
63541
63562
  }
63542
63563
  function isPatternLiteralType(type) {
63543
- return !!(type.flags & 134217728 /* TypeFlags.TemplateLiteral */) && ts.every(type.types, isPatternLiteralPlaceholderType);
63564
+ return !!(type.flags & 134217728 /* TypeFlags.TemplateLiteral */) && ts.every(type.types, isPatternLiteralPlaceholderType) ||
63565
+ !!(type.flags & 268435456 /* TypeFlags.StringMapping */) && isPatternLiteralPlaceholderType(type.type);
63544
63566
  }
63545
63567
  function isGenericType(type) {
63546
63568
  return !!getGenericObjectFlags(type);
@@ -69727,7 +69749,7 @@ var ts;
69727
69749
  && (!roundTripOnly || s === ts.pseudoBigIntToString({ negative: negative, base10Value: ts.parsePseudoBigInt(scanner.getTokenValue()) }));
69728
69750
  }
69729
69751
  function isMemberOfStringMapping(source, target) {
69730
- if (target.flags & (4 /* TypeFlags.String */ | 3 /* TypeFlags.AnyOrUnknown */)) {
69752
+ if (target.flags & (4 /* TypeFlags.String */ | 1 /* TypeFlags.Any */)) {
69731
69753
  return true;
69732
69754
  }
69733
69755
  if (target.flags & 134217728 /* TypeFlags.TemplateLiteral */) {
@@ -146214,8 +146236,8 @@ var ts;
146214
146236
  }
146215
146237
  if (ts.scanner.getToken() === 15 /* SyntaxKind.TemplateHead */) {
146216
146238
  var stack = [ts.scanner.getToken()];
146217
- var token = ts.scanner.scan();
146218
146239
  loop: while (ts.length(stack)) {
146240
+ var token = ts.scanner.scan();
146219
146241
  switch (token) {
146220
146242
  case 1 /* SyntaxKind.EndOfFileToken */:
146221
146243
  break loop;
@@ -146243,7 +146265,6 @@ var ts;
146243
146265
  }
146244
146266
  break;
146245
146267
  }
146246
- token = ts.scanner.scan();
146247
146268
  }
146248
146269
  nextToken();
146249
146270
  }
@@ -163732,7 +163753,6 @@ var ts;
163732
163753
  var start = cursorRequest ? getExtractableParent(startToken) : ts.getParentNodeInSpan(startToken, sourceFile, adjustedSpan);
163733
163754
  // Do the same for the ending position
163734
163755
  var end = cursorRequest ? start : ts.getParentNodeInSpan(endToken, sourceFile, adjustedSpan);
163735
- var declarations = [];
163736
163756
  // We'll modify these flags as we walk the tree to collect data
163737
163757
  // about what things need to be done as part of the extraction.
163738
163758
  var rangeFacts = RangeFacts.None;
@@ -163775,7 +163795,7 @@ var ts;
163775
163795
  // the expression.
163776
163796
  return { errors: [ts.createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractRange)] };
163777
163797
  }
163778
- return { targetRange: { range: statements, facts: rangeFacts, declarations: declarations, thisNode: thisNode } };
163798
+ return { targetRange: { range: statements, facts: rangeFacts, thisNode: thisNode } };
163779
163799
  }
163780
163800
  if (ts.isReturnStatement(start) && !start.expression) {
163781
163801
  // Makes no sense to extract an expression-less return statement.
@@ -163787,7 +163807,7 @@ var ts;
163787
163807
  if (errors) {
163788
163808
  return { errors: errors };
163789
163809
  }
163790
- return { targetRange: { range: getStatementOrExpressionRange(node), facts: rangeFacts, declarations: declarations, thisNode: thisNode } }; // TODO: GH#18217
163810
+ return { targetRange: { range: getStatementOrExpressionRange(node), facts: rangeFacts, thisNode: thisNode } }; // TODO: GH#18217
163791
163811
  /**
163792
163812
  * Attempt to refine the extraction node (generally, by shrinking it) to produce better results.
163793
163813
  * @param node The unrefined extraction node.
@@ -163799,10 +163819,10 @@ var ts;
163799
163819
  }
163800
163820
  }
163801
163821
  else if (ts.isVariableStatement(node) || ts.isVariableDeclarationList(node)) {
163802
- var declarations_6 = ts.isVariableStatement(node) ? node.declarationList.declarations : node.declarations;
163822
+ var declarations = ts.isVariableStatement(node) ? node.declarationList.declarations : node.declarations;
163803
163823
  var numInitializers = 0;
163804
163824
  var lastInitializer = void 0;
163805
- for (var _i = 0, declarations_5 = declarations_6; _i < declarations_5.length; _i++) {
163825
+ for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) {
163806
163826
  var declaration = declarations_5[_i];
163807
163827
  if (declaration.initializer) {
163808
163828
  numInitializers++;
@@ -163902,7 +163922,6 @@ var ts;
163902
163922
  (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractExportedEntity));
163903
163923
  return true;
163904
163924
  }
163905
- declarations.push(node.symbol);
163906
163925
  }
163907
163926
  // Some things can't be extracted in certain situations
163908
163927
  switch (node.kind) {
@@ -167948,8 +167967,8 @@ var ts;
167948
167967
  tags = __spreadArray(__spreadArray([], inheritedTags, true), tags, true);
167949
167968
  }
167950
167969
  };
167951
- for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) {
167952
- var declaration = declarations_7[_i];
167970
+ for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) {
167971
+ var declaration = declarations_6[_i];
167953
167972
  _loop_20(declaration);
167954
167973
  }
167955
167974
  }
@@ -167975,8 +167994,8 @@ var ts;
167975
167994
  if (inheritedDocs)
167976
167995
  doc = doc.length === 0 ? inheritedDocs.slice() : inheritedDocs.concat(ts.lineBreakPart(), doc);
167977
167996
  };
167978
- for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) {
167979
- var declaration = declarations_8[_i];
167997
+ for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) {
167998
+ var declaration = declarations_7[_i];
167980
167999
  _loop_21(declaration);
167981
168000
  }
167982
168001
  }
@@ -173044,6 +173063,7 @@ var ts;
173044
173063
  this.watchOptions = watchOptions;
173045
173064
  this.rootFiles = [];
173046
173065
  this.rootFilesMap = new ts.Map();
173066
+ /*@internal*/
173047
173067
  this.plugins = [];
173048
173068
  /*@internal*/
173049
173069
  /**
@@ -173572,6 +173592,7 @@ var ts;
173572
173592
  this.directoryStructureHost = undefined;
173573
173593
  this.exportMapCache = undefined;
173574
173594
  this.projectErrors = undefined;
173595
+ this.plugins.length = 0;
173575
173596
  // Clean up file watchers waiting for missing files
173576
173597
  if (this.missingFilesMap) {
173577
173598
  ts.clearMap(this.missingFilesMap, ts.closeFileWatcher);
@@ -174245,6 +174266,14 @@ var ts;
174245
174266
  Project.prototype.isSourceOfProjectReferenceRedirect = function (fileName) {
174246
174267
  return !!this.program && this.program.isSourceOfProjectReferenceRedirect(fileName);
174247
174268
  };
174269
+ /*@internal*/
174270
+ Project.prototype.getGlobalPluginSearchPaths = function () {
174271
+ // Search any globally-specified probe paths, then our peer node_modules
174272
+ return __spreadArray(__spreadArray([], this.projectService.pluginProbeLocations, true), [
174273
+ // ../../.. to walk from X/node_modules/typescript/lib/tsserver.js to X/node_modules/
174274
+ ts.combinePaths(this.projectService.getExecutingFilePath(), "../../.."),
174275
+ ], false);
174276
+ };
174248
174277
  Project.prototype.enableGlobalPlugins = function (options, pluginConfigOverrides) {
174249
174278
  if (!this.projectService.globalPlugins.length)
174250
174279
  return;
@@ -174253,11 +174282,8 @@ var ts;
174253
174282
  this.projectService.logger.info("Plugins were requested but not running in environment that supports 'require'. Nothing will be loaded");
174254
174283
  return;
174255
174284
  }
174256
- // Search any globally-specified probe paths, then our peer node_modules
174257
- var searchPaths = __spreadArray(__spreadArray([], this.projectService.pluginProbeLocations, true), [
174258
- // ../../.. to walk from X/node_modules/typescript/lib/tsserver.js to X/node_modules/
174259
- ts.combinePaths(this.projectService.getExecutingFilePath(), "../../.."),
174260
- ], false);
174285
+ // Enable global plugins with synthetic configuration entries
174286
+ var searchPaths = this.getGlobalPluginSearchPaths();
174261
174287
  var _loop_1 = function (globalPluginName) {
174262
174288
  // Skip empty names from odd commandline parses
174263
174289
  if (!globalPluginName)
@@ -174270,7 +174296,6 @@ var ts;
174270
174296
  this_1.enablePlugin({ name: globalPluginName, global: true }, searchPaths, pluginConfigOverrides);
174271
174297
  };
174272
174298
  var this_1 = this;
174273
- // Enable global plugins with synthetic configuration entries
174274
174299
  for (var _i = 0, _a = this.projectService.globalPlugins; _i < _a.length; _i++) {
174275
174300
  var globalPluginName = _a[_i];
174276
174301
  _loop_1(globalPluginName);
@@ -175005,6 +175030,7 @@ var ts;
175005
175030
  /*@internal*/
175006
175031
  ConfiguredProject.prototype.enablePluginsWithOptions = function (options, pluginConfigOverrides) {
175007
175032
  var _a;
175033
+ this.plugins.length = 0;
175008
175034
  if (!((_a = options.plugins) === null || _a === void 0 ? void 0 : _a.length) && !this.projectService.globalPlugins.length)
175009
175035
  return;
175010
175036
  var host = this.projectService.host;
@@ -175012,9 +175038,7 @@ var ts;
175012
175038
  this.projectService.logger.info("Plugins were requested but not running in environment that supports 'require'. Nothing will be loaded");
175013
175039
  return;
175014
175040
  }
175015
- // Search our peer node_modules, then any globally-specified probe paths
175016
- // ../../.. to walk from X/node_modules/typescript/lib/tsserver.js to X/node_modules/
175017
- var searchPaths = __spreadArray([ts.combinePaths(this.projectService.getExecutingFilePath(), "../../..")], this.projectService.pluginProbeLocations, true);
175041
+ var searchPaths = this.getGlobalPluginSearchPaths();
175018
175042
  if (this.projectService.allowLocalPluginLoads) {
175019
175043
  var local = ts.getDirectoryPath(this.canonicalConfigFilePath);
175020
175044
  this.projectService.logger.info("Local plugin loading enabled; adding ".concat(local, " to search paths"));
@@ -180725,6 +180749,7 @@ var ts;
180725
180749
  var references = getReferencesWorker(projects, this.getDefaultProject(args), { fileName: args.file, pos: position }, this.logger);
180726
180750
  if (!simplifiedResult)
180727
180751
  return references;
180752
+ var preferences = this.getPreferences(file);
180728
180753
  var defaultProject = this.getDefaultProject(args);
180729
180754
  var scriptInfo = defaultProject.getScriptInfoForNormalizedPath(file);
180730
180755
  var nameInfo = defaultProject.getLanguageService().getQuickInfoAtPosition(file, position);
@@ -180733,7 +180758,7 @@ var ts;
180733
180758
  var symbolStartOffset = nameSpan ? scriptInfo.positionToLineOffset(nameSpan.start).offset : 0;
180734
180759
  var symbolName = nameSpan ? scriptInfo.getSnapshot().getText(nameSpan.start, ts.textSpanEnd(nameSpan)) : "";
180735
180760
  var refs = ts.flatMap(references, function (referencedSymbol) {
180736
- return referencedSymbol.references.map(function (entry) { return referenceEntryToReferencesResponseItem(_this.projectService, entry); });
180761
+ return referencedSymbol.references.map(function (entry) { return referenceEntryToReferencesResponseItem(_this.projectService, entry, preferences); });
180737
180762
  });
180738
180763
  return { refs: refs, symbolName: symbolName, symbolStartOffset: symbolStartOffset, symbolDisplayString: symbolDisplayString };
180739
180764
  };
@@ -180741,6 +180766,7 @@ var ts;
180741
180766
  var _this = this;
180742
180767
  var projects = this.getProjects(args);
180743
180768
  var fileName = args.file;
180769
+ var preferences = this.getPreferences(server.toNormalizedPath(fileName));
180744
180770
  var references = [];
180745
180771
  var seen = createDocumentSpanSet();
180746
180772
  forEachProjectInProjects(projects, /*path*/ undefined, function (project) {
@@ -180759,7 +180785,7 @@ var ts;
180759
180785
  });
180760
180786
  if (!simplifiedResult)
180761
180787
  return references;
180762
- var refs = references.map(function (entry) { return referenceEntryToReferencesResponseItem(_this.projectService, entry); });
180788
+ var refs = references.map(function (entry) { return referenceEntryToReferencesResponseItem(_this.projectService, entry, preferences); });
180763
180789
  return {
180764
180790
  refs: refs,
180765
180791
  symbolName: "\"".concat(args.file, "\"")
@@ -181823,14 +181849,18 @@ var ts;
181823
181849
  }
181824
181850
  return text;
181825
181851
  }
181826
- function referenceEntryToReferencesResponseItem(projectService, _a) {
181852
+ function referenceEntryToReferencesResponseItem(projectService, _a, _b) {
181827
181853
  var fileName = _a.fileName, textSpan = _a.textSpan, contextSpan = _a.contextSpan, isWriteAccess = _a.isWriteAccess, isDefinition = _a.isDefinition;
181854
+ var disableLineTextInReferences = _b.disableLineTextInReferences;
181828
181855
  var scriptInfo = ts.Debug.checkDefined(projectService.getScriptInfo(fileName));
181829
181856
  var span = toProtocolTextSpanWithContext(textSpan, contextSpan, scriptInfo);
181830
- var lineSpan = scriptInfo.lineToTextSpan(span.start.line - 1);
181831
- var lineText = scriptInfo.getSnapshot().getText(lineSpan.start, ts.textSpanEnd(lineSpan)).replace(/\r|\n/g, "");
181857
+ var lineText = disableLineTextInReferences ? undefined : getLineText(scriptInfo, span);
181832
181858
  return __assign(__assign({ file: fileName }, span), { lineText: lineText, isWriteAccess: isWriteAccess, isDefinition: isDefinition });
181833
181859
  }
181860
+ function getLineText(scriptInfo, span) {
181861
+ var lineSpan = scriptInfo.lineToTextSpan(span.start.line - 1);
181862
+ return scriptInfo.getSnapshot().getText(lineSpan.start, ts.textSpanEnd(lineSpan)).replace(/\r|\n/g, "");
181863
+ }
181834
181864
  function isCompletionEntryData(data) {
181835
181865
  return data === undefined || data && typeof data === "object"
181836
181866
  && typeof data.exportName === "string"
@@ -185870,6 +185900,9 @@ var ts;
185870
185900
  process.on("message", function (e) {
185871
185901
  _this.onMessage(e);
185872
185902
  });
185903
+ process.on("disconnect", function () {
185904
+ _this.exit();
185905
+ });
185873
185906
  };
185874
185907
  return IpcIOSession;
185875
185908
  }(IOSession));
@@ -7982,12 +7982,14 @@ declare namespace ts.server.protocol {
7982
7982
  command: CommandTypes.References;
7983
7983
  }
7984
7984
  interface ReferencesResponseItem extends FileSpanWithContext {
7985
- /** Text of line containing the reference. Including this
7986
- * with the response avoids latency of editor loading files
7987
- * to show text of reference line (the server already has
7988
- * loaded the referencing files).
7985
+ /**
7986
+ * Text of line containing the reference. Including this
7987
+ * with the response avoids latency of editor loading files
7988
+ * to show text of reference line (the server already has loaded the referencing files).
7989
+ *
7990
+ * If {@link UserPreferences.disableLineTextInReferences} is enabled, the property won't be filled
7989
7991
  */
7990
- lineText: string;
7992
+ lineText?: string;
7991
7993
  /**
7992
7994
  * True if reference is a write location, false otherwise.
7993
7995
  */
@@ -9833,6 +9835,10 @@ declare namespace ts.server.protocol {
9833
9835
  readonly includeInlayFunctionLikeReturnTypeHints?: boolean;
9834
9836
  readonly includeInlayEnumMemberValueHints?: boolean;
9835
9837
  readonly autoImportFileExcludePatterns?: string[];
9838
+ /**
9839
+ * Indicates whether {@link ReferencesResponseItem.lineText} is supported.
9840
+ */
9841
+ readonly disableLineTextInReferences?: boolean;
9836
9842
  }
9837
9843
  interface CompilerOptions {
9838
9844
  allowJs?: boolean;
@@ -10084,7 +10090,6 @@ declare namespace ts.server {
10084
10090
  private externalFiles;
10085
10091
  private missingFilesMap;
10086
10092
  private generatedFilesMap;
10087
- private plugins;
10088
10093
  protected languageService: LanguageService;
10089
10094
  languageServiceEnabled: boolean;
10090
10095
  readonly trace?: (s: string) => void;