mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Renamed span to textSpan to better follow other language service APIs
This commit is contained in:
@@ -779,10 +779,10 @@ namespace FourSlash {
|
||||
if (ranges && ranges.length > rangeIndex) {
|
||||
const range = ranges[rangeIndex];
|
||||
|
||||
const start = completions.span.start;
|
||||
const end = start + completions.span.length;
|
||||
const start = completions.textSpan.start;
|
||||
const end = start + completions.textSpan.length;
|
||||
if (range.start !== start || range.end !== end) {
|
||||
this.raiseError(`Expected completion span for '${symbol}', ${stringify(completions.span)}, to cover range ${stringify(range)}`);
|
||||
this.raiseError(`Expected completion span for '${symbol}', ${stringify(completions.textSpan)}, to cover range ${stringify(range)}`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -236,7 +236,7 @@ namespace ts.server {
|
||||
const endPosition = this.lineOffsetToPosition(fileName, response.span.end);
|
||||
|
||||
return {
|
||||
span: ts.createTextSpanFromBounds(startPosition, endPosition),
|
||||
textSpan: ts.createTextSpanFromBounds(startPosition, endPosition),
|
||||
entries: response.body
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1482,7 +1482,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
export interface ImportCompletionInfo {
|
||||
span: TextSpan;
|
||||
textSpan: TextSpan;
|
||||
entries: ImportCompletionEntry[];
|
||||
}
|
||||
|
||||
@@ -4513,7 +4513,7 @@ namespace ts {
|
||||
// Get all known external module names or complete a path to a module
|
||||
return {
|
||||
entries: getStringLiteralCompletionEntriesFromModuleNames(<StringLiteral>node),
|
||||
span: getDirectoryFragmentTextSpan((<StringLiteral>node).text, node.getStart() + 1)
|
||||
textSpan: getDirectoryFragmentTextSpan((<StringLiteral>node).text, node.getStart() + 1)
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -4793,18 +4793,18 @@ namespace ts {
|
||||
const scriptPath = getDirectoryPath(sourceFile.path);
|
||||
if (kind === "path") {
|
||||
// Give completions for a relative path
|
||||
const span: TextSpan = getDirectoryFragmentTextSpan(toComplete, range.pos + prefix.length);
|
||||
const textSpan: TextSpan = getDirectoryFragmentTextSpan(toComplete, range.pos + prefix.length);
|
||||
return {
|
||||
entries: getCompletionEntriesForDirectoryFragment(toComplete, scriptPath, getSupportedExtensions(program.getCompilerOptions()), /*includeExtensions*/true, sourceFile.path),
|
||||
span
|
||||
textSpan
|
||||
};
|
||||
}
|
||||
else {
|
||||
// Give completions based on the typings available
|
||||
const span: TextSpan = { start: range.pos + prefix.length, length: match[0].length - prefix.length };
|
||||
const textSpan: TextSpan = { start: range.pos + prefix.length, length: match[0].length - prefix.length };
|
||||
return {
|
||||
entries: getCompletionEntriesFromTypings(host, program.getCompilerOptions(), scriptPath),
|
||||
span
|
||||
textSpan
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user