Closed jonyeezs closed 7 years ago
Haven't had a chance to test this out yet, but thanks for this! I'll try it out soon.
Tips: (and working with TypeScriptReact :D ) functions: (private|protected|public)? (static)? \s+ REPLACE \s ( interfaces: interface\s+REPLACE\s{
@avernus88 is that specific to TypeScriptReact?
It works with both: 'TypeScript': regExp: ///
class\s+REPLACE(\s+extends\s+[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*|)\s+{
# or
|
# matches 'function REPLACE('
function \s+ REPLACE \s* \(
# or
|
# matches 'REPLACE = function (' or 'REPLACE: function ('
REPLACE \s* (=|:) \s* function \s* \(
|
# function:
(private|protected|public)? (static)? \s+ REPLACE \s* \(
# interface:
|
interface\s+REPLACE\s*{
///
isTabBased: false
'TypeScriptReact':
regExp: ///
# class
class\s+REPLACE(\s+extends\s+[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*|)\s+{
# or
|
# matches 'function REPLACE('
function \s+ REPLACE \s* \(
# or
|
# matches 'REPLACE = function (' or 'REPLACE: function ('
REPLACE \s* (=|:) \s* function \s* \(
|
# function:
(private|protected|public)? (static)? \s+ REPLACE \s* \(
# interface:
|
interface\s+REPLACE\s*{
///
isTabBased: false
This is amazing guys. Works flawlessly. Thanks so much. Going to release it shortly.
TS uses classes as JS uses function as constructor.
Here is the propose regex:
class\s+REPLACE(\s+extends\s+[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*|)\s+{
This should cater for scenarios:
class Replace {}
class Replace extends Base {
export class Replace {}
export class Replace extends Base {}