6666//! directory: canonical
6767//! file: canonical
6868//! output: canonical
69+ //! entry:
70+ //! command_as_array: true
71+ //! keep_output_field: true
6972//! ```
7073//!
7174//! ```yaml
@@ -334,6 +337,8 @@ mod types {
334337 pub struct Format {
335338 #[ serde( default ) ]
336339 pub paths : PathFormat ,
340+ #[ serde( default ) ]
341+ pub entry : EntryFormat ,
337342 }
338343
339344 /// Format configuration of paths in the JSON compilation database.
@@ -358,6 +363,24 @@ mod types {
358363 Relative ,
359364 }
360365
366+ /// Configuration for formatting output entries.
367+ #[ derive( Clone , Debug , PartialEq , Deserialize , Serialize ) ]
368+ pub struct EntryFormat {
369+ #[ serde( default = "default_enabled" ) ]
370+ pub command_field_as_array : bool ,
371+ #[ serde( default = "default_enabled" ) ]
372+ pub keep_output_field : bool ,
373+ }
374+
375+ impl Default for EntryFormat {
376+ fn default ( ) -> Self {
377+ Self {
378+ command_field_as_array : true ,
379+ keep_output_field : true ,
380+ }
381+ }
382+ }
383+
361384 pub ( super ) const SUPPORTED_SCHEMA_VERSION : & str = "4.0" ;
362385 const PRELOAD_LIBRARY_PATH : & str = env ! ( "PRELOAD_LIBRARY_PATH" ) ;
363386 const WRAPPER_EXECUTABLE_PATH : & str = env ! ( "WRAPPER_EXECUTABLE_PATH" ) ;
@@ -382,14 +405,14 @@ mod types {
382405 }
383406
384407 // Custom deserialization function to validate the schema version
385- fn validate_schema_version < ' de , D > ( deserializer : D ) -> std :: result :: Result < String , D :: Error >
408+ fn validate_schema_version < ' de , D > ( deserializer : D ) -> Result < String , D :: Error >
386409 where
387410 D : serde:: Deserializer < ' de > ,
388411 {
389412 let schema: String = Deserialize :: deserialize ( deserializer) ?;
390413 if schema != SUPPORTED_SCHEMA_VERSION {
391414 use serde:: de:: Error ;
392- Err ( D :: Error :: custom ( format ! (
415+ Err ( Error :: custom ( format ! (
393416 "Unsupported schema version: {}. Expected: {}" ,
394417 schema, SUPPORTED_SCHEMA_VERSION
395418 ) ) )
@@ -624,6 +647,10 @@ pub mod loader {
624647 file : PathResolver :: Canonical ,
625648 output : PathResolver :: Canonical ,
626649 } ,
650+ entry : EntryFormat {
651+ command_field_as_array : true ,
652+ keep_output_field : true ,
653+ } ,
627654 } ,
628655 } ,
629656 schema : String :: from ( "4.0" ) ,
@@ -678,6 +705,10 @@ pub mod loader {
678705 file : PathResolver :: Canonical ,
679706 output : PathResolver :: Canonical ,
680707 } ,
708+ entry : EntryFormat {
709+ command_field_as_array : true ,
710+ keep_output_field : true ,
711+ } ,
681712 } ,
682713 } ,
683714 schema : String :: from ( "4.0" ) ,
@@ -737,6 +768,9 @@ pub mod loader {
737768 directory: relative
738769 file: relative
739770 output: relative
771+ entry:
772+ command_field_as_array: false
773+ keep_output_field: false
740774 "# ;
741775
742776 let result = Loader :: from_reader ( content) . unwrap ( ) ;
@@ -781,6 +815,10 @@ pub mod loader {
781815 file : PathResolver :: Relative ,
782816 output : PathResolver :: Relative ,
783817 } ,
818+ entry : EntryFormat {
819+ command_field_as_array : false ,
820+ keep_output_field : false ,
821+ } ,
784822 } ,
785823 } ,
786824 schema : String :: from ( "4.0" ) ,
0 commit comments