Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In the current situation, a generic service (in Editors/S ) cannot be safely registered - the committer risks that he will extend a contract (positions defined) from module Foo to all other modules.


The service could eventually register with position=0 (but warning must not have been printed for such situation), but that would also mean it would take precedence over all items in more specific MIME types - typically positioned using positive integers (see docs). Could potentially break existing 3rd party modules.

Overall state

As it turns out, the most obtrusive change is the introduction of LSP CompletionProvider in the Editors/ (MIME type ""). Incidentally this is the service (CompletionProvider) that most languages see that 'natural declaration order' is sufficient. See, for example:
- Latte - https://github.com/apache/netbeans/blob/master/php/php.latte/src/org/netbeans/modules/php/latte/resources/layer.xml#L41
- Smarty - https://github.com/apache/netbeans/blob/master/php/php.smarty/src/org/netbeans/modules/php/smarty/resources/layer.xml#L63
- (Twig, ..)
- JSP - https://github.com/apache/netbeans/blob/master/enterprise/web.core.syntax/src/org/netbeans/modules/web/core/syntax/resources/layer.xml#L138
- HTML - https://github.com/apache/netbeans/blob/master/ide/html.editor/src/org/netbeans/modules/html/editor/resources/layer.xml#L149

...

The MIME annotation processor would then by default generate nothing (again). LSP or other generic registrations cam use either "floatvalue=0.0", or floatvalue="-whatever.0", depending on whether order is or is not important. They could eventually use just intvalue="0", but that would also mean they would take precedence over more specific MIME registrations. Given how (implementation-wise) the MIME MultiFileSystem is composed:

  • position float="0.0" will favour the more specific declarations over the less specific ones, provided none of them has position defined;
  • declarations with positions defined will sort according to those positions, AFTER all intvalue="0" (compatibility) and BEFORE floatvalue="0.0" (new feature);

If the API extends to 

Code Block
languagejava
List<FileObject> FileUtil.getOrder(Collection<FileObject> items, @Nullable Number defaultOrder, boolean printWarning);

MIME lookup could order all undefined registrations into the same (last rack), retaining most-specific to least-specific order between them, and allow all explicit (positive integers and floats) positions to take precedence. 

Benefits of this complicated setup are:

...