CSL languages embedded in XML documents do not have editor support (e.g. code completion, syntax highlighting). Please add the necessary CSL files to the XML mime lookup.
I was able to enable code completion, occurrences marking, and hyperlinks in a CSL language embedded in XML by adding the following to the layer.xml :
<attr name="instanceOf" stringvalue="org.netbeans.modules.parsing.spi.ParserFactory"/>
<attr name="instanceCreate" methodvalue="org.netbeans.modules.csl.core.GsfParserFactory.create"/>
<attr name="instanceClass" stringvalue="org.netbeans.modules.csl.editor.semantic.HighlightsLayerFactoryImpl"/>
<attr name="instanceOf" stringvalue="org.netbeans.spi.editor.highlighting.HighlightsLayerFactory"/>
<attr name="instanceClass" stringvalue="org.netbeans.modules.csl.editor.hyperlink.GsfHyperlinkProvider"/>
<attr name="instanceOf" stringvalue="org.netbeans.lib.editor.hyperlink.spi.HyperlinkProviderExt"/>
<attr name="instanceClass" stringvalue="org.netbeans.modules.csl.editor.completion.GsfCompletionProvider"/>
Created attachment 111260 [details]
Sample project that attempts to embed CSS in XML
Added sample project that demonstrates embedding CSL language (CSS, in this case) in XML
The parsing.api correctly creates the embeddings in both Document and Source. Unfortunately the XML support does not provide CSL entry points so the support for embedded CSL base languages is not executed.
The layer patch provided by Daniel enables some CSL services in the XML support and makes the CSS to work.
Svato, before enabling the CSL in the XML please check a performance impact.
Switched to P2, in accordance with BugPriorityGuidelines (http://wiki.netbeans.org/BugPriorityGuidelines).
It does not work, since whole XML was not adapted to CSL at all (a small code reuse of isolated commenting feature makes XML editor dependent on CSL, but in fact CSL features are not used).
I would strongly recommend to postpone this feature to 7.2. Some additional work on CSL is also planned, so XML could align with that within 7.2 release.
(In reply to comment #4)
> It does not work, since whole XML was not adapted to CSL at all (a small code
> reuse of isolated commenting feature makes XML editor dependent on CSL, but in
> fact CSL features are not used).
> I would strongly recommend to postpone this feature to 7.2. Some additional
> work on CSL is also planned, so XML could align with that within 7.2 release.
That sounds reasonable. Is the plan to migrate XML to use CSL and the parsing API? Would you mind if I helped out with this feature for 7.2?
Nothing is stoned until the release cycle starts; but the plan is to modularize CSL somewhat to allow its use piece by piece - see http://wiki.netbeans.org/CslModularization (just notes, in progress). If you feel like you could invest time into analysis, it would be great to have a list of XML features which COULD be replaced by CSL, or necessary adjustments (additions), which could enable the reuse.
The less redundant code we have in XML the better.
(In reply to comment #6)
Sounds good. I'll write down what I've noticed so far, and have a look through some of the XML modules that I haven't used yet.