Re: Implement additional Hints for existing Language

Svata Dedic <[email protected]>
Newsgroups gmane.comp.java.netbeans.modules.openide.devel
Message-ID <[email protected]>
Dne 9.10.2016 v 14:37 Alex Muthmann napsal(a):
> This would be a cool solution if I want to have a new MimeType. But as
> the file-extension is given, I can't simply replace text/html with e.g.
> text/sly and then use this mimeType.

In fact, you eventually could. We have an "underdocumented" way to make
"derivative" languages, which is used e.g. by XML or more recently
Javascript (i.e. Grunt support uses text/x-grunt+javascript). I suspect
the support is not complete, but it's something which can be changed /
fixed.

If you make the IDE to recognize your HTML files as text/x-sightly+html,
you could register your Language Sightly language (based on HTML) and
eventually get a combination of tools for text/html AND
text/x-sightly+html (which takes precedence).

MIMELookup should support the "inheritance" so whatever service is
registered for text/x-sightly+html will override services for HTML or
will be processed first.

BUT the CSL Language support currently stops at the first Language
definition, so again registering a Language would probably mask out HTML
core features. You can however register actions, toolbar items ... this way.

> 
> I'll try to explain the use case once again:
> If I open a HTML File in Netbeans, I want the Editor to:
> * display the Hints provided by HtmlLanguage
> * additional Hints provided by my plugin
> 
I wonder whether simple registration of your rules would be sufficient -
register in mf-layer's folder
"csl-hints/text/html/error|hints|suggestions|selection/<category>
Since the rule management is in CSL API module, it should pick up also
your rules for text/html MIME type.
Look into HTML editor module on how html rules are implemented (what
interfaces you need to implement + examples).

-Svata
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.