Re: Implement additional Hints for existing Language
Alex Muthmann <[email protected]>
| Newsgroups | gmane.comp.java.netbeans.modules.openide.devel |
|---|---|
| Message-ID | <[email protected]> |
I'm sorry to repeat myself but my problem is not, that I'm unable to implement and register a hint but that it does seem to be impossible, to add hints to an existing Language. If I would like to implement a new language with a new mimetype etc, I would not have to ask those questions. All I need is an advice, how multiple Languages can be registered on the same mimetype OR if there is another way to add hints. Am 2016-10-09 12:24, schrieb geertjan wielenga: > Now that you have a HintsProvider, you need to implement Rules (pic-1) > and register them in the layer (pic-2). > > Gj > > On 9-10-2016 12:18, Alex Muthmann wrote: >> Please have a look at the github links I provided, you'll see, that I >> already have both Language and HintsProvider implemented. >> >> Also both classes you mention do NOT cover my use case as they are >> mere Hints used in JsHintsProvider, which is used in JsLanguage >> (registered on text/javascript). So this does not add a new HTML hint >> in a module but implements a completely new Language :( >> >> Am 2016-10-09 12:10, schrieb geertjan wielenga: >>> Look at org.netbeans.modules.javascript2.editor.hints.JsAstRule or >>> JsConventionHint. Also you have to implement HintsProvider. >>> >>> Gj >>> >>> On 9-10-2016 11:50, Alex Muthmann wrote: >>>> yes, exactly, that would be awesome! >>>> >>>> Am 2016-10-09 11:42, schrieb geertjan wielenga: >>>>> So, to be clear, if I show an example of how to create a new plugin >>>>> that adds a new HTML hint in NetBeans IDE, that's what you're >>>>> looking >>>>> for? >>>>> >>>>> Gj >>>>> >>>>> On 9-10-2016 11:39, Alex Muthmann wrote: >>>>>> Yes, this is what I (of course) did first, I also had a deeper >>>>>> look into the Netbeans sources but there was no implementation >>>>>> covering my requirement (extend an existing language). It looks >>>>>> easy to implement a new one, but if you need to use an already >>>>>> registered mimeType it gets fuzzy :( >>>>>> >>>>>> Am 2016-10-09 01:13, schrieb geertjan wielenga: >>>>>>> I'll try to take a look but if I were you I'd go to Google and >>>>>>> search >>>>>>> for 'getHintsProvider' to see how others have implemented that -- >>>>>>> I >>>>>>> can see many implementations when I do that. >>>>>>> >>>>>>> Gj >>>>>>> >>>>>>> On 8-10-2016 20:57, Alex Muthmann wrote: >>>>>>>> Hi, >>>>>>>> >>>>>>>> thanks for your reply. >>>>>>>> >>>>>>>> You can find the code here: >>>>>>>> https://github.com/wcm-io/wcm-io-tooling/tree/netbeans-sightly-hints >>>>>>>> SightlyLanguage.java: >>>>>>>> https://github.com/wcm-io/wcm-io-tooling/blob/netbeans-sightly-hints/netbeans/sightly/src/main/java/io/wcm/tooling/netbeans/sightly/editor/SightlyLanguage.java >>>>>>>> SightylHintsProvider: >>>>>>>> https://github.com/wcm-io/wcm-io-tooling/blob/netbeans-sightly-hints/netbeans/sightly/src/main/java/io/wcm/tooling/netbeans/sightly/editor/hints/SightlyHintsProvider.java >>>>>>>> >>>>>>>> I added some exceptions, so I would expect to see those as soon, >>>>>>>> as the language is called successfully. >>>>>>>> >>>>>>>> >>>>>>>> Am 2016-10-08 12:21, schrieb geertjan wielenga: >>>>>>>>> On 7-10-2016 0:26, Alex Muthmann wrote: >>>>>>>>>> Hi there, >>>>>>>>>> >>>>>>>>>> there has already be a discussion with Geertjan and Petr >>>>>>>>>> regarding the options to implement additional Hints for an >>>>>>>>>> existing language. I need to add additional Hints for HTML >>>>>>>>>> files and the consensus was, that I should use the CSL API to >>>>>>>>>> implement a Language and add a HintProvider. >>>>>>>>>> >>>>>>>>>> I did some basic tests >>>>>>>>> >>>>>>>>> Put your code on GitHub and send a link to it here so we can >>>>>>>>> all see >>>>>>>>> the code rather than text. >>>>>>>>> >>>>>>>>> Gj >>>>>>>>> >>>>>>>>>> but ran into the following situation: >>>>>>>>>> As soon as I register a new Language XYZ which uses the >>>>>>>>>> mimeType text/html, the build-in HTML Language does not work >>>>>>>>>> anymore (no hints, no code-completion etc). I'd expect that >>>>>>>>>> all languages registered on a mimeType are used and not only >>>>>>>>>> one of those. >>>>>>>>>> >>>>>>>>>> I was not able to find this use-case in the netbeans >>>>>>>>>> source-code and I'm currently lost :( >>>>>>>>>> Could somebody probably provide an example of a working >>>>>>>>>> extension of an existing language or an alternative to the >>>>>>>>>> implementation of a complete new language? >>>>>>>>>> >>>>>>>>>> Thank you very much, >>>>>>>>>> Alex Muthmann