@@ -222,20 +222,20 @@ internal class CCTokensService(private val project: Project) {
222222 return null
223223 }
224224
225- private fun buildTypes (jsonObject : JSONObject , commonScopes : List < CommitScopeModel >): Map <String , CommitTypeModel > =
225+ private fun buildTypes (jsonObject : JSONObject , commonScopes : Map < String , CommitScopeModel >): Map <String , CommitTypeModel > =
226226 jsonObject.keySet().associateWith {
227227 val descriptor = jsonObject.getJSONObject(it)
228228 val description = descriptor.optString(" description" , " " )
229229 val scopes = buildScopes(descriptor.optJSONObject(" scopes" ) ? : JSONObject ())
230230 CommitTypeModel (
231231 name = it,
232232 description = description,
233- scopes = scopes + commonScopes ,
233+ scopes = commonScopes + scopes ,
234234 )
235235 }
236236
237- private fun buildScopes (jsonObject : JSONObject ): List < CommitScopeModel > =
238- jsonObject.keySet().map {
237+ private fun buildScopes (jsonObject : JSONObject ): Map < String , CommitScopeModel > =
238+ jsonObject.keySet().associateWithTo( LinkedHashMap ()) {
239239 val descriptor = jsonObject.getJSONObject(it)
240240 val description = descriptor.optString(" description" , " " )
241241 CommitScopeModel (
@@ -256,8 +256,8 @@ internal class CCTokensService(private val project: Project) {
256256 )
257257 }
258258
259- private fun buildFooterValues (jsonObject : JSONObject ): List < CommitFooterValueModel > =
260- jsonObject.keySet().map {
259+ private fun buildFooterValues (jsonObject : JSONObject ): Map < String , CommitFooterValueModel > =
260+ jsonObject.keySet().associateWithTo( LinkedHashMap ()) {
261261 val descriptor = jsonObject.getJSONObject(it)
262262 val description = descriptor.optString(" description" , " " )
263263 CommitFooterValueModel (
@@ -278,7 +278,7 @@ internal class CCTokensService(private val project: Project) {
278278 map[name] = CommitFooterTypeModel (
279279 name = name,
280280 description = description,
281- values = emptyList (),
281+ values = emptyMap (),
282282 )
283283 }
284284
@@ -293,7 +293,7 @@ internal class CCTokensService(private val project: Project) {
293293 class CommitTypeModel (
294294 val name : String ,
295295 val description : String ,
296- val scopes : List < CommitScopeModel >,
296+ val scopes : Map < String , CommitScopeModel >,
297297 )
298298
299299 class CommitScopeModel (
@@ -304,7 +304,7 @@ internal class CCTokensService(private val project: Project) {
304304 class CommitFooterTypeModel (
305305 val name : String ,
306306 val description : String ,
307- val values : List < CommitFooterValueModel >,
307+ val values : Map < String , CommitFooterValueModel >,
308308 )
309309
310310 class CommitFooterValueModel (
0 commit comments