剛剛給ccls加了textDocument/{formatting,onTypeFormatting,rangeFormatting}
,並不複雜,調用clangFormat即可。ccls/clangd announce:
{
"documentFormattingProvider":true,
"documentRangeFormattingProvider":true,
"documentOnTypeFormattingProvider":{"firstTriggerCharacter":"}","moreTriggerCharacter":[]}
}
鍵入}
,找到最近的{
,把其中內容format。感興趣可以看看你們用的language server是否支援,,以及去實現這個功能吧!