Skip to content

Commit 4c028fd

Browse files
committed
CR fixes
1 parent 6174f4c commit 4c028fd

7 files changed

+17
-14
lines changed

src/compiler/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8757,7 +8757,7 @@ namespace ts {
87578757
readonly includeCompletionsWithInsertText?: boolean;
87588758
readonly includeCompletionsWithClassMemberSnippets?: boolean;
87598759
readonly includeCompletionsWithObjectLiteralMethodSnippets?: boolean;
8760-
readonly includeCompletionsWithLabelDetails?: boolean;
8760+
readonly useLabelDetailsInCompletionEntries?: boolean;
87618761
readonly allowIncompleteCompletions?: boolean;
87628762
readonly importModuleSpecifierPreference?: "shortest" | "project-relative" | "relative" | "non-relative";
87638763
/** Determines whether we import `foo/index.ts` as "foo", "foo/index", or "foo/index.js" */

src/server/protocol.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -3434,8 +3434,9 @@ namespace ts.server.protocol {
34343434
readonly includeCompletionsWithObjectLiteralMethodSnippets?: boolean;
34353435
/**
34363436
* Indicates whether {@link CompletionEntry.labelDetails completion entry label details} are supported.
3437+
* If not, contents of `labelDetails` may be included in the {@link CompletionEntry.name} property.
34373438
*/
3438-
readonly includeCompletionsWithLabelDetails?: boolean;
3439+
readonly useLabelDetailsInCompletionEntries?: boolean;
34393440
readonly allowIncompleteCompletions?: boolean;
34403441
readonly importModuleSpecifierPreference?: "shortest" | "project-relative" | "relative" | "non-relative";
34413442
/** Determines whether we import `foo/index.ts` as "foo", "foo/index", or "foo/index.js" */

src/services/completions.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,7 @@ namespace ts.Completions {
780780
return undefined;
781781
}
782782
({ insertText, isSnippet, importAdder, labelDetails } = entry);
783-
if (!preferences.includeCompletionsWithLabelDetails) {
783+
if (!preferences.useLabelDetailsInCompletionEntries) {
784784
name = name + labelDetails.detail;
785785
labelDetails = undefined;
786786
}
@@ -1113,8 +1113,10 @@ namespace ts.Completions {
11131113
target: options.target,
11141114
omitTrailingSemicolon: true,
11151115
});
1116+
// The `labelDetails.detail` will be displayed right beside the method name,
1117+
// so we drop the name (and modifiers) from the signature.
11161118
const methodSignature = factory.createMethodSignature(
1117-
method.modifiers,
1119+
/*modifiers*/ undefined,
11181120
/*name*/ "",
11191121
method.questionToken,
11201122
method.typeParameters,

tests/cases/fourslash/completionsObjectLiteralMethod1.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ verify.completions({
3838
includeCompletionsWithInsertText: true,
3939
includeCompletionsWithSnippetText: false,
4040
includeCompletionsWithObjectLiteralMethodSnippets: true,
41-
includeCompletionsWithLabelDetails: true,
41+
useLabelDetailsInCompletionEntries: true,
4242
},
4343
includes: [
4444
{
@@ -64,7 +64,7 @@ verify.completions({
6464
includeCompletionsWithInsertText: true,
6565
includeCompletionsWithSnippetText: false,
6666
includeCompletionsWithObjectLiteralMethodSnippets: true,
67-
includeCompletionsWithLabelDetails: true,
67+
useLabelDetailsInCompletionEntries: true,
6868
},
6969
includes: [
7070
{
@@ -121,7 +121,7 @@ verify.completions({
121121
includeCompletionsWithInsertText: true,
122122
includeCompletionsWithSnippetText: false,
123123
includeCompletionsWithObjectLiteralMethodSnippets: true,
124-
includeCompletionsWithLabelDetails: true,
124+
useLabelDetailsInCompletionEntries: true,
125125
},
126126
includes: [
127127
{
@@ -147,7 +147,7 @@ verify.completions({
147147
includeCompletionsWithInsertText: true,
148148
includeCompletionsWithSnippetText: true,
149149
includeCompletionsWithObjectLiteralMethodSnippets: true,
150-
includeCompletionsWithLabelDetails: true,
150+
useLabelDetailsInCompletionEntries: true,
151151
},
152152
includes: [
153153
{
@@ -174,7 +174,7 @@ verify.completions({
174174
includeCompletionsWithInsertText: true,
175175
includeCompletionsWithSnippetText: true,
176176
includeCompletionsWithObjectLiteralMethodSnippets: true,
177-
includeCompletionsWithLabelDetails: false,
177+
useLabelDetailsInCompletionEntries: false,
178178
},
179179
includes: [
180180
{

tests/cases/fourslash/completionsObjectLiteralMethod2.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ verify.completions({
2424
includeCompletionsWithInsertText: true,
2525
includeCompletionsWithSnippetText: false,
2626
includeCompletionsWithObjectLiteralMethodSnippets: true,
27-
includeCompletionsWithLabelDetails: true,
27+
useLabelDetailsInCompletionEntries: true,
2828
},
2929
includes: [
3030
{
@@ -51,7 +51,7 @@ verify.applyCodeActionFromCompletion("a", {
5151
includeCompletionsWithInsertText: true,
5252
includeCompletionsWithSnippetText: false,
5353
includeCompletionsWithObjectLiteralMethodSnippets: true,
54-
includeCompletionsWithLabelDetails: true,
54+
useLabelDetailsInCompletionEntries: true,
5555
},
5656
name: "foo",
5757
source: completion.CompletionSource.ObjectLiteralMethodSnippet,

tests/cases/fourslash/completionsObjectLiteralMethod3.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ verify.completions({
3939
includeCompletionsWithInsertText: true,
4040
includeCompletionsWithSnippetText: false,
4141
includeCompletionsWithObjectLiteralMethodSnippets: true,
42-
includeCompletionsWithLabelDetails: true,
42+
useLabelDetailsInCompletionEntries: true,
4343
},
4444
includes: [
4545
{
@@ -97,7 +97,7 @@ verify.completions({
9797
includeCompletionsWithInsertText: true,
9898
includeCompletionsWithSnippetText: false,
9999
includeCompletionsWithObjectLiteralMethodSnippets: true,
100-
includeCompletionsWithLabelDetails: true,
100+
useLabelDetailsInCompletionEntries: true,
101101
},
102102
includes: [
103103
{

tests/cases/fourslash/fourslash.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ declare namespace FourSlashInterface {
648648
readonly includeCompletionsWithInsertText?: boolean;
649649
readonly includeCompletionsWithClassMemberSnippets?: boolean;
650650
readonly includeCompletionsWithObjectLiteralMethodSnippets?: boolean;
651-
readonly includeCompletionsWithLabelDetails?: boolean;
651+
readonly useLabelDetailsInCompletionEntries?: boolean;
652652
readonly allowIncompleteCompletions?: boolean;
653653
/** @deprecated use `includeCompletionsWithInsertText` */
654654
readonly includeInsertTextCompletions?: boolean;

0 commit comments

Comments
 (0)