You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2022/01/26 10:52:13 UTC

[GitHub] [netbeans] PashaTurok opened a new issue #3509: Add comments and getters/setters support for TypeScript classes

PashaTurok opened a new issue #3509:
URL: https://github.com/apache/netbeans/issues/3509


   ### Description
   
   I don't know if there is any meaning in opening feature request as my request about markdown files support was just closed, but I will try.
   
   Starting from ES 6 JavaScript supports classes and with TypeScript we can do the following:
   
   ```
   class Person {
       private _name: String = null;
       ...
   } 
   ```   
   As a very basic support I suggest to add comments and getter/setter generation:
   
   1. Comments
   
   class Person {
       /** Press enter. Nothing, so you have to type all "*" yourself that is very boring.
       private _name: String = null;
     } 
   
   2. Getters and setters generation according to ES6.
   
   class Person {
       /** Press enter. Nothing, so you have to type all "*" yourself that is very boring.
       private _name: String = null;
       
       //getter
       public get name(): string {
           return this._name;
       }
       //setter
       public set name(name: string) {
           this.name = name;
       }
     } 
   
   
   ### Use case/motivation
   
   _No response_
   
   ### Related issues
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow the Apache Software Foundation's [Code of Conduct](https://www.apache.org/foundation/policies/conduct.html)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] Chris2011 commented on issue #3509: Add comments and getters/setters support for TypeScript classes

Posted by GitBox <gi...@apache.org>.
Chris2011 commented on issue #3509:
URL: https://github.com/apache/netbeans/issues/3509#issuecomment-1023417592


   Hey @PashaTurok I think you mixed two different things here. One is comment support while hitting enter to add a new '*' and also the other thing to add at the end of the comment. And adding code generators for getter/setter in TypeScript.
   
   So next time, please create one ticket for each feature. Code generator for getter and setter has nothing todo with the comments that you requested.
   
   Anyway, I had a look into the code generation stuff and found this tutorial: https://netbeans.apache.org/tutorials/nbm-code-generator.html The problem with this tutorial is, that is is very coupled to the JavaSource class which can handle all the stuff inside a Java file to identify what is a member, what is a class, what is an interface etc. Such feature, afaik is not available for JavaScript nor TypeScript. TypeScript was the first language which was implemented with the textmate lexer and I dunno whether we already have a class where we can figure out what is a variable, class, (A parser) etc. I think also this comes from the Language Server of TypeScript, if we can get the info from the server, that could be easier to handle. There is a PHP implementation somehow but someone created an ASTNode and all other stuff directly for PHP. I jumped into this too to check what they did for PHP and maybe we can use it but I dunno. There is a global parser but the rest needs to be handled
  differently. I can have a look when NetBeans starts to build again.
   
   As an alternative, we can use a 3rd-party-lib called tree-sitter and the java impl by JetBrains: https://github.com/JetBrains/jsitter. To parse a language, which is supported by this parser: http://tree-sitter.github.io/tree-sitter/. So differnet approach as ANTLR or JavaCC because you don't need to create a lexer before, I mean someone already did this but we don't need to do this by our own. So it creates a concrete syntax tree for this language. That means for all the supported languages of this parser we can try to use this and make this by our own.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists