Moving some utility functions around
This commit is contained in:
parent
e11d5e9de6
commit
8a976f1100
2 changed files with 26 additions and 26 deletions
|
@ -2063,9 +2063,6 @@ namespace ts {
|
|||
sourceMapText?: string;
|
||||
}
|
||||
|
||||
// Matches the beginning of a triple slash directive
|
||||
const tripleSlashDirectivePrefixRegex = /^\/\/\/\s*</;
|
||||
|
||||
/**
|
||||
* Matches a triple slash reference directive with an incomplete string literal for its path. Used
|
||||
* to determine if the caret is currently within the string literal and capture the literal fragment
|
||||
|
@ -2940,15 +2937,6 @@ namespace ts {
|
|||
}
|
||||
}
|
||||
|
||||
function isInReferenceComment(sourceFile: SourceFile, position: number): boolean {
|
||||
return isInCommentHelper(sourceFile, position, isReferenceComment);
|
||||
|
||||
function isReferenceComment(c: CommentRange): boolean {
|
||||
const commentText = sourceFile.text.substring(c.pos, c.end);
|
||||
return tripleSlashDirectivePrefixRegex.test(commentText);
|
||||
}
|
||||
}
|
||||
|
||||
const enum SemanticMeaning {
|
||||
None = 0x0,
|
||||
Value = 0x1,
|
||||
|
@ -6914,15 +6902,6 @@ namespace ts {
|
|||
|
||||
return result[index];
|
||||
}
|
||||
|
||||
function isInNonReferenceComment(sourceFile: SourceFile, position: number): boolean {
|
||||
return isInCommentHelper(sourceFile, position, isNonReferenceComment);
|
||||
|
||||
function isNonReferenceComment(c: CommentRange): boolean {
|
||||
const commentText = sourceFile.text.substring(c.pos, c.end);
|
||||
return !tripleSlashDirectivePrefixRegex.test(commentText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getReferencesForSuperKeyword(superKeyword: Node): ReferencedSymbol[] {
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
// These utilities are common to multiple language service features.
|
||||
/* @internal */
|
||||
namespace ts {
|
||||
// Matches the beginning of a triple slash directive
|
||||
const tripleSlashDirectivePrefixRegex = /^\/\/\/\s*</;
|
||||
|
||||
export interface ListItemInfo {
|
||||
listItemIndex: number;
|
||||
list: Node;
|
||||
|
@ -704,6 +707,29 @@ namespace ts {
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
export function hasTrailingDirectorySeparator(path: string) {
|
||||
const lastCharacter = path.charAt(path.length - 1);
|
||||
return lastCharacter === "/" || lastCharacter === "\\";
|
||||
}
|
||||
|
||||
export function isInReferenceComment(sourceFile: SourceFile, position: number): boolean {
|
||||
return isInCommentHelper(sourceFile, position, isReferenceComment);
|
||||
|
||||
function isReferenceComment(c: CommentRange): boolean {
|
||||
const commentText = sourceFile.text.substring(c.pos, c.end);
|
||||
return tripleSlashDirectivePrefixRegex.test(commentText);
|
||||
}
|
||||
}
|
||||
|
||||
export function isInNonReferenceComment(sourceFile: SourceFile, position: number): boolean {
|
||||
return isInCommentHelper(sourceFile, position, isNonReferenceComment);
|
||||
|
||||
function isNonReferenceComment(c: CommentRange): boolean {
|
||||
const commentText = sourceFile.text.substring(c.pos, c.end);
|
||||
return !tripleSlashDirectivePrefixRegex.test(commentText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Display-part writer helpers
|
||||
|
@ -925,9 +951,4 @@ namespace ts {
|
|||
}
|
||||
return ensureScriptKind(fileName, scriptKind);
|
||||
}
|
||||
|
||||
export function hasTrailingDirectorySeparator(path: string) {
|
||||
const lastCharacter = path.charAt(path.length - 1);
|
||||
return lastCharacter === "/" || lastCharacter === "\\";
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue