-
Notifications
You must be signed in to change notification settings - Fork 12.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide Spelling Suggestions for Named Capture Group References in Re…
…gular Expressions (#58613)
- Loading branch information
1 parent
dc1ffb1
commit f5238c3
Showing
6 changed files
with
42 additions
and
0 deletions.
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
12 changes: 12 additions & 0 deletions
12
tests/baselines/reference/regularExpressionGroupNameSuggestions.errors.txt
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,12 @@ | ||
regularExpressionGroupNameSuggestions.ts(1,18): error TS1503: Named capturing groups are only available when targeting 'ES2018' or later. | ||
regularExpressionGroupNameSuggestions.ts(1,27): error TS1532: There is no capturing group named 'Foo' in this regular expression. | ||
|
||
|
||
==== regularExpressionGroupNameSuggestions.ts (2 errors) ==== | ||
const regex = /(?<foo>)\k<Foo>/; | ||
~~~~~ | ||
!!! error TS1503: Named capturing groups are only available when targeting 'ES2018' or later. | ||
~~~ | ||
!!! error TS1532: There is no capturing group named 'Foo' in this regular expression. | ||
!!! related TS1369: Did you mean 'foo'? | ||
|
8 changes: 8 additions & 0 deletions
8
tests/baselines/reference/regularExpressionGroupNameSuggestions.js
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,8 @@ | ||
//// [tests/cases/compiler/regularExpressionGroupNameSuggestions.ts] //// | ||
|
||
//// [regularExpressionGroupNameSuggestions.ts] | ||
const regex = /(?<foo>)\k<Foo>/; | ||
|
||
|
||
//// [regularExpressionGroupNameSuggestions.js] | ||
var regex = /(?<foo>)\k<Foo>/; |
6 changes: 6 additions & 0 deletions
6
tests/baselines/reference/regularExpressionGroupNameSuggestions.symbols
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,6 @@ | ||
//// [tests/cases/compiler/regularExpressionGroupNameSuggestions.ts] //// | ||
|
||
=== regularExpressionGroupNameSuggestions.ts === | ||
const regex = /(?<foo>)\k<Foo>/; | ||
>regex : Symbol(regex, Decl(regularExpressionGroupNameSuggestions.ts, 0, 5)) | ||
|
9 changes: 9 additions & 0 deletions
9
tests/baselines/reference/regularExpressionGroupNameSuggestions.types
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,9 @@ | ||
//// [tests/cases/compiler/regularExpressionGroupNameSuggestions.ts] //// | ||
|
||
=== regularExpressionGroupNameSuggestions.ts === | ||
const regex = /(?<foo>)\k<Foo>/; | ||
>regex : RegExp | ||
> : ^^^^^^ | ||
>/(?<foo>)\k<Foo>/ : RegExp | ||
> : ^^^^^^ | ||
|
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 @@ | ||
const regex = /(?<foo>)\k<Foo>/; |