-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Jsx completion feature and tests
- Loading branch information
1 parent
cdd9314
commit 318b59f
Showing
10 changed files
with
368 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
tests/cases/fourslash/jsxAttributeSnippetCompletionAuto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
// @Filename: foo.tsx | ||
//// declare namespace JSX { | ||
//// interface Element { } | ||
//// interface IntrinsicElements { | ||
//// foo: { | ||
//// prop_a: boolean; | ||
//// prop_b: string; | ||
//// prop_c: any; | ||
//// prop_d: { p1: string; } | ||
//// prop_e: string | undefined; | ||
//// prop_f: boolean | undefined; | ||
//// prop_g: { p1: string; } | undefined; | ||
//// prop_h?: string; | ||
//// prop_i?: boolean; | ||
//// prop_j?: { p1: string; }; | ||
//// } | ||
//// } | ||
//// } | ||
//// | ||
//// <foo [|prop_/**/|] /> | ||
|
||
verify.completions({ | ||
marker: "", | ||
exact: [ | ||
{ | ||
name: "prop_a", | ||
isSnippet: undefined, | ||
}, | ||
{ | ||
name: "prop_b", | ||
insertText: "prop_b=\"$1\"", | ||
replacementSpan: test.ranges()[0], | ||
isSnippet: true, | ||
}, | ||
{ | ||
name: "prop_c", | ||
insertText: "prop_c={$1}", | ||
replacementSpan: test.ranges()[0], | ||
isSnippet: true, | ||
}, | ||
{ | ||
name: "prop_d", | ||
insertText: "prop_d={$1}", | ||
replacementSpan: test.ranges()[0], | ||
isSnippet: true, | ||
}, | ||
{ | ||
name: "prop_e", | ||
insertText: "prop_e=\"$1\"", | ||
replacementSpan: test.ranges()[0], | ||
isSnippet: true, | ||
}, | ||
{ | ||
name: "prop_f", | ||
isSnippet: undefined, | ||
}, | ||
{ | ||
name: "prop_g", | ||
insertText: "prop_g={$1}", | ||
replacementSpan: test.ranges()[0], | ||
isSnippet: true, | ||
}, | ||
{ | ||
name: "prop_h", | ||
insertText: "prop_h=\"$1\"", | ||
replacementSpan: test.ranges()[0], | ||
isSnippet: true, | ||
sortText: completion.SortText.OptionalMember, | ||
}, | ||
{ | ||
name: "prop_i", | ||
isSnippet: undefined, | ||
sortText: completion.SortText.OptionalMember, | ||
}, | ||
{ | ||
name: "prop_j", | ||
insertText: "prop_j={$1}", | ||
replacementSpan: test.ranges()[0], | ||
isSnippet: true, | ||
sortText: completion.SortText.OptionalMember, | ||
} | ||
], | ||
preferences: { | ||
jsxSnippetCompletion: "auto" | ||
} | ||
}); |
94 changes: 94 additions & 0 deletions
94
tests/cases/fourslash/jsxAttributeSnippetCompletionBraces.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
// @Filename: foo.tsx | ||
//// declare namespace JSX { | ||
//// interface Element { } | ||
//// interface IntrinsicElements { | ||
//// foo: { | ||
//// prop_a: boolean; | ||
//// prop_b: string; | ||
//// prop_c: any; | ||
//// prop_d: { p1: string; } | ||
//// prop_e: string | undefined; | ||
//// prop_f: boolean | undefined; | ||
//// prop_g: { p1: string; } | undefined; | ||
//// prop_h?: string; | ||
//// prop_i?: boolean; | ||
//// prop_j?: { p1: string; }; | ||
//// } | ||
//// } | ||
//// } | ||
//// | ||
//// <foo [|prop_/**/|] /> | ||
|
||
verify.completions({ | ||
marker: "", | ||
exact: [ | ||
{ | ||
name: "prop_a", | ||
insertText: "prop_a={$1}", | ||
replacementSpan: test.ranges()[0], | ||
isSnippet: true, | ||
}, | ||
{ | ||
name: "prop_b", | ||
insertText: "prop_b={$1}", | ||
replacementSpan: test.ranges()[0], | ||
isSnippet: true, | ||
}, | ||
{ | ||
name: "prop_c", | ||
insertText: "prop_c={$1}", | ||
replacementSpan: test.ranges()[0], | ||
isSnippet: true, | ||
}, | ||
{ | ||
name: "prop_d", | ||
insertText: "prop_d={$1}", | ||
replacementSpan: test.ranges()[0], | ||
isSnippet: true, | ||
}, | ||
{ | ||
name: "prop_e", | ||
insertText: "prop_e={$1}", | ||
replacementSpan: test.ranges()[0], | ||
isSnippet: true, | ||
}, | ||
{ | ||
name: "prop_f", | ||
insertText: "prop_f={$1}", | ||
replacementSpan: test.ranges()[0], | ||
isSnippet: true, | ||
}, | ||
{ | ||
name: "prop_g", | ||
insertText: "prop_g={$1}", | ||
replacementSpan: test.ranges()[0], | ||
isSnippet: true, | ||
}, | ||
{ | ||
name: "prop_h", | ||
insertText: "prop_h={$1}", | ||
replacementSpan: test.ranges()[0], | ||
isSnippet: true, | ||
sortText: completion.SortText.OptionalMember, | ||
}, | ||
{ | ||
name: "prop_i", | ||
insertText: "prop_i={$1}", | ||
replacementSpan: test.ranges()[0], | ||
isSnippet: true, | ||
sortText: completion.SortText.OptionalMember, | ||
}, | ||
{ | ||
name: "prop_j", | ||
insertText: "prop_j={$1}", | ||
replacementSpan: test.ranges()[0], | ||
isSnippet: true, | ||
sortText: completion.SortText.OptionalMember, | ||
} | ||
], | ||
preferences: { | ||
jsxSnippetCompletion: "braces" | ||
} | ||
}); |
74 changes: 74 additions & 0 deletions
74
tests/cases/fourslash/jsxAttributeSnippetCompletionDefault.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
// @Filename: foo.tsx | ||
//// declare namespace JSX { | ||
//// interface Element { } | ||
//// interface IntrinsicElements { | ||
//// foo: { | ||
//// prop_a: boolean; | ||
//// prop_b: string; | ||
//// prop_c: any; | ||
//// prop_d: { p1: string; } | ||
//// prop_e: string | undefined; | ||
//// prop_f: boolean | undefined; | ||
//// prop_g: { p1: string; } | undefined; | ||
//// prop_h?: string; | ||
//// prop_i?: boolean; | ||
//// prop_j?: { p1: string; }; | ||
//// } | ||
//// } | ||
//// } | ||
//// | ||
//// <foo [|prop_/**/|] /> | ||
|
||
verify.completions({ | ||
marker: "", | ||
exact: [ | ||
{ | ||
name: "prop_a", | ||
isSnippet: undefined, | ||
}, | ||
{ | ||
name: "prop_b", | ||
isSnippet: undefined, | ||
}, | ||
{ | ||
name: "prop_c", | ||
isSnippet: undefined, | ||
}, | ||
{ | ||
name: "prop_d", | ||
isSnippet: undefined, | ||
}, | ||
{ | ||
name: "prop_e", | ||
isSnippet: undefined, | ||
}, | ||
{ | ||
name: "prop_f", | ||
isSnippet: undefined, | ||
}, | ||
{ | ||
name: "prop_g", | ||
isSnippet: undefined, | ||
}, | ||
{ | ||
name: "prop_h", | ||
isSnippet: undefined, | ||
sortText: completion.SortText.OptionalMember, | ||
}, | ||
{ | ||
name: "prop_i", | ||
isSnippet: undefined, | ||
sortText: completion.SortText.OptionalMember, | ||
}, | ||
{ | ||
name: "prop_j", | ||
isSnippet: undefined, | ||
sortText: completion.SortText.OptionalMember, | ||
} | ||
], | ||
preferences: { | ||
jsxSnippetCompletion: undefined | ||
} | ||
}); |
Oops, something went wrong.