facebookarchive/atom-ide-ui

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

開放

#26 建立於 2017年9月13日

 (1 則留言) (0 個反應) (0 位負責人)JavaScript (110 個分叉)batch import
code formatenhancementhelp wanted

倉庫指標

星標
 (937 顆星)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

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

貢獻者指南