| 113 | } |
| 114 | |
| 115 | func (c *tomlToolConfig) Unset(scope Scope, keyPath string) (bool, string, error) { |
| 116 | parts, err := Parse(keyPath) |
| 117 | if err != nil { |
| 118 | return false, "", err |
| 119 | } |
| 120 | path := c.PathFor(scope) |
| 121 | if path == "" { |
| 122 | return false, "", fmt.Errorf("editorconfig: %s scope %s unsupported", c.spec.name, scope) |
| 123 | } |
| 124 | data, _, err := loadTOML(path) |
| 125 | if err != nil { |
| 126 | return false, "", err |
| 127 | } |
| 128 | found := Unset(data, parts) |
| 129 | if !found { |
| 130 | return false, path, nil |
| 131 | } |
| 132 | if err := writeTOML(path, data); err != nil { |
| 133 | return false, "", err |
| 134 | } |
| 135 | return true, path, nil |
| 136 | } |
| 137 | |
| 138 | func writeTOML(path string, data map[string]any) error { |
| 139 | if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil { |