mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-18 17:27:54 -05:00
Enable infrastructure to test the symbol display parts returned by quickInfo
This commit is contained in:
@@ -765,7 +765,7 @@ module FourSlash {
|
||||
return "\nActual " + name + ":\n\t" + actualValue + "\nExpected value:\n\t" + expectedValue;
|
||||
}
|
||||
|
||||
public verifyQuickInfo(negative: boolean, expectedText?: string, expectedDocumentation?: string) {
|
||||
public quickInfoIs(negative: boolean, expectedText?: string, expectedDocumentation?: string) {
|
||||
[expectedText, expectedDocumentation].forEach(str => {
|
||||
if (str) {
|
||||
this.scenarioActions.push('<ShowQuickInfo />');
|
||||
@@ -794,6 +794,21 @@ module FourSlash {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public verifyQuickInfo(kind: string, kindModifiers: string, textSpan: { start: number; length: number; },
|
||||
displayParts: { text: string; kind: string; }[],
|
||||
documentation: { text: string; kind: string; }[]) {
|
||||
this.scenarioActions.push('<ShowQuickInfo />');
|
||||
this.scenarioActions.push('<Verify return values of quickInfo="' + JSON.stringify(displayParts) + '"/>');
|
||||
|
||||
var actualQuickInfo = this.languageService.getQuickInfoAtPosition(this.activeFile.fileName, this.currentCaretPosition);
|
||||
assert.equal(actualQuickInfo.kind, kind, this.messageAtLastKnownMarker("QuickInfo kind"));
|
||||
assert.equal(actualQuickInfo.kindModifiers, kindModifiers, this.messageAtLastKnownMarker("QuickInfo kindModifiers"));
|
||||
assert.equal(JSON.stringify(actualQuickInfo.textSpan), JSON.stringify(textSpan), this.messageAtLastKnownMarker("QuickInfo textSpan"));
|
||||
assert.equal(JSON.stringify(actualQuickInfo.displayParts), JSON.stringify(displayParts), this.messageAtLastKnownMarker("QuickInfo displayParts"));
|
||||
assert.equal(JSON.stringify(actualQuickInfo.documentation), JSON.stringify(documentation), this.messageAtLastKnownMarker("QuickInfo documentation"));
|
||||
}
|
||||
|
||||
public verifyRenameLocations(findInStrings: boolean, findInComments: boolean) {
|
||||
var renameInfo = this.languageService.getRenameInfo(this.activeFile.fileName, this.currentCaretPosition);
|
||||
if (renameInfo.canRename) {
|
||||
|
||||
@@ -1317,7 +1317,10 @@ module ts {
|
||||
|
||||
function writeIndent() {
|
||||
if (lineStart) {
|
||||
displayParts.push(displayPart(getIndentString(indent), SymbolDisplayPartKind.space));
|
||||
var indentString = getIndentString(indent);
|
||||
if (indentString) {
|
||||
displayParts.push(displayPart(indentString, SymbolDisplayPartKind.space));
|
||||
}
|
||||
lineStart = false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user