Chris2011 commented on issue #4064:
URL: https://github.com/apache/netbeans/issues/4064#issuecomment-1117691466
I can reproduce it, but I guess that this is the wrong context. Or the
context is missing. The problem here is, that a snippet in this way will be
part of each language that I registered, which doesn't make sense for 95%. log
-> console.log, make sense for TS and JS but not for C#, F#, erlang, etc.
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. 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.
When you have a look into a language based on textmate for vs code, you have
this piece of code to register snippets:
``` json
"snippets": [{
"language": "erlang",
"path": "./snippets/erlang.json"
}],
```
which is part of the package.json and points to a json file where we add
those snippets via json:
```json
"erlang gen_event behavior" : {
"prefix" : "erl-gen_event-behavior",
"body" : [
"-behaviour(gen_event).",
"",
"-export([init/1, handle_event/2, handle_call/2, handle_info/2,
terminate/2, code_change/3]).",
"",
"init(_Args) ->",
" {ok, []}.",
"",
"handle_event(_Event, State) ->",
" {ok, State}.",
"",
"handle_call(_Request, State) ->",
" {ok, no_reply, State}.",
"",
"handle_info(_Info, State) ->",
" {ok, State}.",
"",
"terminate(_Args, _State) ->",
" ok.",
"",
"code_change(_OldVsn, State, _Extra) ->",
" {ok, State}.",
""
],
"description" : "generate an empty gen_event"
},
```
So I also prefer this way of doing it and for this, the UI needs to have
more fields like "Snippets file: ". Just an idea. At the moment, you can create
basic syntax highlighting, folding, snippets easily with some files as you can
see in the VS Code example of erlang. What needs to be added to our textmate
implementation is exactly this option for snippets which covers your ticket.
--
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