| 98 | } |
| 99 | |
| 100 | func (c *jsonToolConfig) Set(scope Scope, keyPath string, value any) (string, error) { |
| 101 | parts, err := Parse(keyPath) |
| 102 | if err != nil { |
| 103 | return "", err |
| 104 | } |
| 105 | path := c.PathFor(scope) |
| 106 | if path == "" { |
| 107 | return "", fmt.Errorf("editorconfig: %s scope %s unsupported", c.spec.name, scope) |
| 108 | } |
| 109 | data, _, err := loadJSON(path) |
| 110 | if err != nil { |
| 111 | return "", err |
| 112 | } |
| 113 | Set(data, parts, value) |
| 114 | if err := writeJSON(path, data); err != nil { |
| 115 | return "", err |
| 116 | } |
| 117 | return path, nil |
| 118 | } |
| 119 | |
| 120 | func (c *jsonToolConfig) Unset(scope Scope, keyPath string) (bool, string, error) { |
| 121 | parts, err := Parse(keyPath) |