File size: 1,087 Bytes
3a14a3a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

import json
import os

file_path = 'package.json'

with open(file_path, 'r', encoding='utf-8') as f:
    data = json.load(f)

# Navigate to configurationDefaults
config_defaults = data.get('contributes', {}).get('configurationDefaults', {})

# Check if [mql5] exists
if '[mql5]' in config_defaults:
    mql5_config = config_defaults['[mql5]']
    if 'editor.tokenColorCustomizations' in mql5_config:
        # Move editor.tokenColorCustomizations to root of configurationDefaults
        config_defaults['editor.tokenColorCustomizations'] = mql5_config['editor.tokenColorCustomizations']
        # Remove [mql5]
        del config_defaults['[mql5]']
        print("Successfully moved editor.tokenColorCustomizations and removed [mql5] block.")
    else:
        print("[mql5] found but editor.tokenColorCustomizations not found inside it.")
else:
    print("[mql5] block not found in configurationDefaults. Already fixed?")

# Write back
with open(file_path, 'w', encoding='utf-8') as f:
    json.dump(data, f, indent=4)
    print("package.json updated.")