Skip to content

Commit 076db46

Browse files
TypeScript BotDanielRosenwasser
TypeScript Bot
andauthored
Cherry-pick PR #40072 into release-4.0 (#40076)
Component commits: 1582b76 Revert "Add '(approximate)' to the beginning of quick info requests in PartialSemantic mode (#40061)" This reverts commit 2426eb4. Co-authored-by: Daniel Rosenwasser <[email protected]>
1 parent c9c6cd2 commit 076db46

File tree

2 files changed

+2
-27
lines changed

2 files changed

+2
-27
lines changed

src/services/services.ts

+2-11
Original file line numberDiff line numberDiff line change
@@ -1587,9 +1587,7 @@ namespace ts {
15871587
kind: ScriptElementKind.unknown,
15881588
kindModifiers: ScriptElementKindModifier.none,
15891589
textSpan: createTextSpanFromNode(nodeForQuickInfo, sourceFile),
1590-
displayParts: prefixWithApproximation(
1591-
typeChecker.runWithCancellationToken(cancellationToken, typeChecker => typeToDisplayParts(typeChecker, type, getContainerNode(nodeForQuickInfo)))
1592-
),
1590+
displayParts: typeChecker.runWithCancellationToken(cancellationToken, typeChecker => typeToDisplayParts(typeChecker, type, getContainerNode(nodeForQuickInfo))),
15931591
documentation: type.symbol ? type.symbol.getDocumentationComment(typeChecker) : undefined,
15941592
tags: type.symbol ? type.symbol.getJsDocTags() : undefined
15951593
};
@@ -1602,7 +1600,7 @@ namespace ts {
16021600
kind: symbolKind,
16031601
kindModifiers: SymbolDisplay.getSymbolModifiers(symbol),
16041602
textSpan: createTextSpanFromNode(nodeForQuickInfo, sourceFile),
1605-
displayParts: prefixWithApproximation(displayParts),
1603+
displayParts,
16061604
documentation,
16071605
tags,
16081606
};
@@ -1632,13 +1630,6 @@ namespace ts {
16321630
}
16331631
}
16341632

1635-
function prefixWithApproximation(displayParts: SymbolDisplayPart[]): SymbolDisplayPart[] {
1636-
if (languageServiceMode === LanguageServiceMode.Semantic) {
1637-
return displayParts;
1638-
}
1639-
return [textPart("(approximation)"), spacePart(), ...displayParts];
1640-
}
1641-
16421633
/// Goto definition
16431634
function getDefinitionAtPosition(fileName: string, position: number): readonly DefinitionInfo[] | undefined {
16441635
synchronizeHostData();

src/testRunner/unittests/tsserver/partialSemanticServer.ts

-16
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,6 @@ import { something } from "something";
3030
return { host, session, file1, file2, file3, something, configFile };
3131
}
3232

33-
it("adds '(approximation)' to the description of quick info", () => {
34-
const file: File = {
35-
path: `${tscWatch.projectRoot}/foo.ts`,
36-
content: "export const foo = 100;"
37-
};
38-
const host = createServerHost([file]);
39-
const session = createSession(host, { serverMode: LanguageServiceMode.PartialSemantic, useSingleInferredProject: true });
40-
openFilesForSession([file], session);
41-
const response = session.executeCommandSeq<protocol.QuickInfoRequest>({
42-
command: protocol.CommandTypes.Quickinfo,
43-
arguments: protocolFileLocationFromSubstring(file, "foo"),
44-
}).response as protocol.QuickInfoResponseBody;
45-
46-
assert(stringContainsAt(response.displayString, "(approximation)", 0));
47-
});
48-
4933
it("open files are added to inferred project even if config file is present and semantic operations succeed", () => {
5034
const { host, session, file1, file2 } = setup();
5135
const service = session.getProjectService();

0 commit comments

Comments
 (0)