Open
Description
π Search Terms
regular expressions, unicode character class, unicode property, hints, autocomplete
β Viability Checklist
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
- This isn't a request to add a new utility type: https://github.com/microsoft/TypeScript/wiki/No-New-Utility-Types
- This feature would agree with the rest of our Design Goals: https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals
β Suggestion
Since TS now validates regular expressions including unicode properties and even provides spelling suggestions, why not autocomplete them?
π Motivating Example
In this example TS 5.5 understands that the first regex is incorrect:
const re1 = /\p{Emoj}/u // Error: Unknown Unicode property name or value. Did you mean "Emoji"?
const re2 = /\p{Emoji}/u // Ok
π» Use Cases
It would be convenient if TS suggested available unicode properties when suggestions are triggered inside \p{}
/\P{}
sequences.