Skip to content

Commit 710e7d9

Browse files
authored
Remove non-ascii characters from internal code comments (#53608)
1 parent b29ed18 commit 710e7d9

File tree

9 files changed

+26
-26
lines changed

9 files changed

+26
-26
lines changed

src/compiler/scanner.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2802,7 +2802,7 @@ const codePointAt: (s: string, i: number) => number = (String.prototype as any).
28022802
}
28032803
// Get the first code unit
28042804
const first = str.charCodeAt(i);
2805-
// check if its the start of a surrogate pair
2805+
// check if it's the start of a surrogate pair
28062806
if (first >= 0xD800 && first <= 0xDBFF && size > i + 1) { // high surrogate and there is a next code unit
28072807
const second = str.charCodeAt(i + 1);
28082808
if (second >= 0xDC00 && second <= 0xDFFF) { // low surrogate

src/services/codefixes/addMissingAwait.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ function getDeclarationSiteFix(context: CodeFixContext | CodeFixAllContext, expr
129129
}
130130
});
131131
// No fix-all because it will already be included once with the use site fix,
132-
// and for simplicity the fix-all doesnt let the user choose between use-site and declaration-site fixes.
132+
// and for simplicity the fix-all doesn't let the user choose between use-site and declaration-site fixes.
133133
return createCodeFixActionWithoutFixAll(
134134
"addMissingAwaitToInitializer",
135135
initializerChanges,
@@ -257,7 +257,7 @@ function symbolReferenceIsAlsoMissingAwait(reference: Identifier, diagnostics: r
257257
(diagnostic.start + diagnostic.length!) === errorNode.getEnd());
258258

259259
return diagnostic && contains(errorCodes, diagnostic.code) ||
260-
// A Promise is usually not correct in a binary expression (its not valid
260+
// A Promise is usually not correct in a binary expression (it's not valid
261261
// in an arithmetic expression and an equality comparison seems unusual),
262262
// but if the other side of the binary expression has an error, the side
263263
// is typed `any` which will squash the error that would identify this

src/services/exportInfoMap.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ export function createCacheableExportInfoMap(host: CacheableExportInfoMapHost):
255255
typeAcquisitionEnabled && consumesNodeCoreModules(oldSourceFile) !== consumesNodeCoreModules(newSourceFile) ||
256256
// Module agumentation and ambient module changes can add or remove exports available to be auto-imported.
257257
// Changes elsewhere in the file can change the *type* of an export in a module augmentation,
258-
// but type info is gathered in getCompletionEntryDetails, which doesnt use the cache.
258+
// but type info is gathered in getCompletionEntryDetails, which doesn't use the cache.
259259
!arrayIsEqualTo(oldSourceFile.moduleAugmentations, newSourceFile.moduleAugmentations) ||
260260
!ambientModuleDeclarationsAreEqual(oldSourceFile, newSourceFile)
261261
) {

src/services/findAllReferences.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,7 +1203,7 @@ export namespace Core {
12031203
return undefined;
12041204
}
12051205
// Likewise, when we *are* looking for a special keyword, make sure we
1206-
// *dont* include readonly member modifiers.
1206+
// *don't* include readonly member modifiers.
12071207
return getAllReferencesForKeyword(
12081208
sourceFiles,
12091209
node.kind,
@@ -1444,7 +1444,7 @@ export namespace Core {
14441444
});
14451445
}
14461446

1447-
// Source file ID symbol ID Whether the symbol has been searched for in the source file.
1447+
// Source file ID -> symbol ID -> Whether the symbol has been searched for in the source file.
14481448
private readonly sourceFileToSeenSymbols: Set<number>[] = [];
14491449
/** Returns `true` the first time we search for a symbol in a file and `false` afterwards. */
14501450
markSearchedSymbols(sourceFile: SourceFile, symbols: readonly Symbol[]): boolean {

src/services/formatting/rules.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -904,7 +904,7 @@ function isSemicolonDeletionContext(context: FormattingContext): boolean {
904904
if (context.contextNode.kind === SyntaxKind.InterfaceDeclaration ||
905905
context.contextNode.kind === SyntaxKind.TypeAliasDeclaration
906906
) {
907-
// Cant remove semicolon after `foo`; it would parse as a method declaration:
907+
// Can't remove semicolon after `foo`; it would parse as a method declaration:
908908
//
909909
// interface I {
910910
// foo;

src/services/organizeImports.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,17 +263,17 @@ function removeUnusedImports(oldImports: readonly ImportDeclaration[], sourceFil
263263
if (name || namedBindings) {
264264
usedImports.push(updateImportDeclarationAndClause(importDecl, name, namedBindings));
265265
}
266-
// If a module is imported to be augmented, its used
266+
// If a module is imported to be augmented, it's used
267267
else if (hasModuleDeclarationMatchingSpecifier(sourceFile, moduleSpecifier)) {
268-
// If were in a declaration file, its safe to remove the import clause from it
268+
// If we're in a declaration file, it's safe to remove the import clause from it
269269
if (sourceFile.isDeclarationFile) {
270270
usedImports.push(factory.createImportDeclaration(
271271
importDecl.modifiers,
272272
/*importClause*/ undefined,
273273
moduleSpecifier,
274274
/*assertClause*/ undefined));
275275
}
276-
// If were not in a declaration file, we cant remove the import clause even though
276+
// If we're not in a declaration file, we can't remove the import clause even though
277277
// the imported symbols are unused, because removing them makes it look like the import
278278
// declaration has side effects, which will cause it to be preserved in the JS emit.
279279
else {

src/services/signatureHelp.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ function createJSSignatureHelpItems(argumentInfo: ArgumentListInfo, program: Pro
227227

228228
function containsPrecedingToken(startingToken: Node, sourceFile: SourceFile, container: Node) {
229229
const pos = startingToken.getFullStart();
230-
// Theres a possibility that `startingToken.parent` contains only `startingToken` and
230+
// There's a possibility that `startingToken.parent` contains only `startingToken` and
231231
// missing nodes, none of which are valid to be returned by `findPrecedingToken`. In that
232232
// case, the preceding token we want is actually higher up the tree—almost definitely the
233233
// next parent, but theoretically the situation with missing nodes might be happening on

src/services/smartSelection.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export function getSmartSelectionRange(pos: number, sourceFile: SourceFile): Sel
8181
// 1. Blocks are effectively redundant with SyntaxLists.
8282
// 2. TemplateSpans, along with the SyntaxLists containing them, are a somewhat unintuitive grouping
8383
// of things that should be considered independently.
84-
// 3. A VariableStatements children are just a VaraiableDeclarationList and a semicolon.
84+
// 3. A VariableStatement's children are just a VaraiableDeclarationList and a semicolon.
8585
// 4. A lone VariableDeclaration in a VaraibleDeclaration feels redundant with the VariableStatement.
8686
// Dive in without pushing a selection range.
8787
if (isBlock(node)
@@ -135,8 +135,8 @@ export function getSmartSelectionRange(pos: number, sourceFile: SourceFile): Sel
135135
break;
136136
}
137137

138-
// If we made it to the end of the for loop, were done.
139-
// In practice, Ive only seen this happen at the very end
138+
// If we made it to the end of the for loop, we're done.
139+
// In practice, I've only seen this happen at the very end
140140
// of a SourceFile.
141141
if (i === children.length - 1) {
142142
break outer;
@@ -153,7 +153,7 @@ export function getSmartSelectionRange(pos: number, sourceFile: SourceFile): Sel
153153
if (!selectionRange || (
154154
// Skip ranges that are identical to the parent
155155
!textSpansEqual(textSpan, selectionRange.textSpan) &&
156-
// Skip ranges that dont contain the original position
156+
// Skip ranges that don't contain the original position
157157
textSpanIntersectsWithPosition(textSpan, pos)
158158
)) {
159159
selectionRange = { textSpan, ...selectionRange && { parent: selectionRange } };
@@ -182,8 +182,8 @@ export function getSmartSelectionRange(pos: number, sourceFile: SourceFile): Sel
182182
* @param node The candidate node to snap to.
183183
*/
184184
function positionShouldSnapToNode(sourceFile: SourceFile, pos: number, node: Node) {
185-
// Cant use 'ts.positionBelongsToNode()' here because it cleverly accounts
186-
// for missing nodes, which cant really be considered when deciding what
185+
// Can't use 'ts.positionBelongsToNode()' here because it cleverly accounts
186+
// for missing nodes, which can't really be considered when deciding what
187187
// to select.
188188
Debug.assert(node.pos <= pos);
189189
if (pos < node.end) {
@@ -203,7 +203,7 @@ const isImport = or(isImportDeclaration, isImportEqualsDeclaration);
203203
* transforming them into an artificial tree according to their intuitive
204204
* grouping where no grouping actually exists in the parse tree. For example,
205205
* top-level imports are grouped into their own SyntaxList so they can be
206-
* selected all together, even though in the AST theyre just siblings of each
206+
* selected all together, even though in the AST they're just siblings of each
207207
* other as well as of other top-level statements and declarations.
208208
*/
209209
function getSelectionChildren(node: Node): readonly Node[] {
@@ -213,13 +213,13 @@ function getSelectionChildren(node: Node): readonly Node[] {
213213
}
214214

215215
// Mapped types _look_ like ObjectTypes with a single member,
216-
// but in fact dont contain a SyntaxList or a node containing
217-
// the key/value pair like ObjectTypes do, but it seems intuitive
216+
// but in fact don't contain a SyntaxList or a node containing
217+
// the "key/value" pair like ObjectTypes do, but it seems intuitive
218218
// that the selection would snap to those points. The philosophy
219219
// of choosing a selection range is not so much about what the
220220
// syntax currently _is_ as what the syntax might easily become
221221
// if the user is making a selection; e.g., we synthesize a selection
222-
// around the key/value pair not because theres a node there, but
222+
// around the "key/value" pair not because there's a node there, but
223223
// because it allows the mapped type to become an object type with a
224224
// few keystrokes.
225225
if (isMappedTypeNode(node)) {

src/services/utilities.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3457,7 +3457,7 @@ function nodeIsASICandidate(node: Node, sourceFile: SourceFileLike): boolean {
34573457
return false;
34583458
}
34593459

3460-
// See comment in parsers `parseDoStatement`
3460+
// See comment in parser's `parseDoStatement`
34613461
if (node.kind === SyntaxKind.DoStatement) {
34623462
return true;
34633463
}
@@ -3524,7 +3524,7 @@ export function probablyUsesSemicolons(sourceFile: SourceFile): boolean {
35243524
});
35253525

35263526
// One statement missing a semicolon isn't sufficient evidence to say the user
3527-
// doesnt want semicolons, because they may not even be done writing that statement.
3527+
// doesn't want semicolons, because they may not even be done writing that statement.
35283528
if (withSemicolon === 0 && withoutSemicolon <= 1) {
35293529
return true;
35303530
}
@@ -3677,7 +3677,7 @@ export interface PackageJsonImportFilter {
36773677
/**
36783678
* Use for a specific module specifier that has already been resolved.
36793679
* Use `allowsImportingAmbientModule` or `allowsImportingSourceFile` to resolve
3680-
* the best module specifier for a given module _and_ determine if its importable.
3680+
* the best module specifier for a given module _and_ determine if it's importable.
36813681
*/
36823682
allowsImportingSpecifier: (moduleSpecifier: string) => boolean;
36833683
}
@@ -3779,7 +3779,7 @@ export function createPackageJsonImportFilter(fromFile: SourceFile, preferences:
37793779
}
37803780

37813781
function isAllowedCoreNodeModulesImport(moduleSpecifier: string) {
3782-
// If were in JavaScript, it can be difficult to tell whether the user wants to import
3782+
// If we're in JavaScript, it can be difficult to tell whether the user wants to import
37833783
// from Node core modules or not. We can start by seeing if the user is actually using
37843784
// any node core modules, as opposed to simply having @types/node accidentally as a
37853785
// dependency of a dependency.
@@ -3809,7 +3809,7 @@ export function createPackageJsonImportFilter(fromFile: SourceFile, preferences:
38093809
if (!specifier) {
38103810
return undefined;
38113811
}
3812-
// Paths here are not node_modules, so we dont care about them;
3812+
// Paths here are not node_modules, so we don't care about them;
38133813
// returning anything will trigger a lookup in package.json.
38143814
if (!pathIsRelative(specifier) && !isRootedDiskPath(specifier)) {
38153815
return getNodeModuleRootSpecifier(specifier);

0 commit comments

Comments
 (0)