negora commented on issue #4064:
URL: https://github.com/apache/netbeans/issues/4064#issuecomment-1119379655

   > So if you have a look at the select box and choose "php" below the list of 
snippets there are 3 register cards: expanded text, description and context, 
which is missing for textmate language.
   
   Surprisingly I had never realized about the *Context* tab.
   
   > So either we need to add each language, that I have created via textmate 
grammar into the drop down list to set the context automatically or we need to 
add the context and have a list there for each language that I have registered.
   
   I believe that the first option would be more correct.
   
   However, I think that snippets should already work in their current form. We 
(users) can already introduce prefixes in our abbreviations to overcome this 
limitation. So, for example, `ts_while` would generate a `while` loop for 
TypeScript, `kt_while` would be generate one for Kotlin, and so on. If we don't 
want to press the `[Shift]` key to type the underscore, we can use any other 
delimiter or none at all.
   
   With all this I'm not saying that the IDE doesn't need snippets/templates 
separated by language (I think the opposite). I'm just saying that, first, 
templates should work with TextMate grammars in general. But I don't know why 
they don't.
   
   > And to your comment for LSP, I don't see that in LSP. Sure that would be 
also cool, but with a simple config file like for NetBeans core langauges it is 
XML and like VS Code does, is json, that could be enough to work. We just need 
to implement this. :)
   
   The LSP specification seems to support snippets already, as I said. They've 
at least one advantage over snippets in the client-side: the server knows 
better about the context (i.e. variable types) and can be more precise when 
providing choices to fill the placeholders. For example, think on the `whileit` 
template for Java code, in NetBeans IDE. The editor only offers those 
variables, in the current scope, that inherit from `java.util.Iterator`.
   
   But LSP also has its disadvantages. The most important is that each LSP 
server that you want to use needs to support this feature (which is optional). 
If it doesn't support it, you're *left in mud*.
   
   So, after thinking much on this, I believe that client-side support is a 
must. After all, if a specific LSP server ever supports this feature, maybe 
NetBeans can delegate to it (as long as the templates are minimally compatible).
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

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

Reply via email to