-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Language TypeScript #27
Comments
I don't know much of typescript, but I don't think that it would be hard to make some basic symbols. |
Hello @mprinc , do you maybe have some examples / explanations of how such symbols should look like? Maybe i can help adding them to the regexes. Regards |
Hi @7ute and everyone else, |
Hello @danyright , i've tried to simplify/shorten your regex a bit, please try this: method: /^[ ](?:final|static|abstract|private|protected|public)[ ]([^)]+:[ ]*[^ ]+)[^\n]+{/gmi It should work in the all situations and will support unicode characters, what was not possible before. Regards |
Hey @mbuc82 , Cheers, |
Hey @danyright , could you maybe provide some sample method strings, that needs to work with this regex? In that case, i could specify it better. Thanks in advance! Regards |
Hi, `export default class myClass extends myAbstractClass {
}` As mentioned, the class declaration, the constructor, the setter and getter are recognized, but not the method. Thanks for your help. |
Hey @danyright , thank you for your feedback and that example. I'll follow up on this as soon as possible. Have a nice day! Cheers |
Hey there, D |
Correction: Please also find hereby a test file (I had to change the file's extension from .ts to .txt in order to upload it. Just change it back for your tests). Thanks for your help :-) |
Hmm getting closer, but now symbols-list can't seem to figure out the method's name anymore... Otherwise the detection is correct. |
Hey @danyright , thanks a lot for your testfile, it was of great help so far. I just played around a bit, to just detect the methods. If i understand your pattern correctly, all methods (with and without prefixed private, public etc.) should be matched, but you want to avoid getters and setters (since i guess, you have single patterns for them) because of the negative lookahead. Please try this one:
From your file, it matches the constructor and all methods, but without getters and setters (and without commented out methods) correctly. I like to use space-matches like [ ]* because they also captures tabulators and other types of whitespace (not just spaces). Please let me know, if it works for you. Cheers |
Hi Marco, We're getting closer, but with your suggestion, method/function calls are recognized as methods (for instance this.MyMethod3(); ) - see corrected version of my example file. D |
Hello @danyright , sorry for my delayed response, i was off for 2 weeks. I've tweaked the regex a bit again and now the method recognition seems to work good on my side, even with function / method calls in the code:
Please take a look and let me know, how it works for you. link to regex101: https://regex101.com/r/s8FaOT/1 Best regards |
Hey Marco, Thanks for your help, |
Hey Marco, Regards |
hello, any news about this? |
What about typescript?
Or how difficult is to describe it by ourselves?
The text was updated successfully, but these errors were encountered: