facebookarchive/atom-ide-ui

Allow code format providers to return null to 'fall through'

Offen

#26 geöffnet am 13.09.2017

 (1 Kommentar) (0 Reaktionen) (0 zugewiesene Personen)JavaScript (110 Forks)batch import
code formatenhancementhelp wanted

Repository-Metriken

Stars
 (937 Sterne)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

Code format providers are currently forced to return something: https://github.com/facebook-atom/atom-ide-ui/blob/master/modules/atom-ide-ui/pkg/atom-ide-code-format/lib/types.js

However, this makes it difficult to have multiple formatting providers for the same document, since we only use the one with the highest priority.

Instead, we should use ProviderRegistry.getAllProvidersForEditor (e.g. on https://github.com/facebook-atom/atom-ide-ui/blob/master/modules/atom-ide-ui/pkg/atom-ide-code-format/lib/CodeFormatManager.js#L257) and take the first one with a non-nullable result.

cc @damieng

Contributor Guide