Skip to content

Commit cdf3b72

Browse files
authored
Remove RedHat YAML extension and yaml.* settings from VSCode configuration (#7066)
1 parent 056a62b commit cdf3b72

4 files changed

Lines changed: 31 additions & 86 deletions

File tree

.vscode/extensions.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"recommendations": [
33
"astro-build.astro-vscode",
4-
"davidanson.vscode-markdownlint",
5-
"redhat.vscode-yaml"
4+
"davidanson.vscode-markdownlint"
65
]
76
}

.vscode/settings.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
{
22
"github.copilot.enable": {
33
"markdown": true
4-
},
5-
"yaml.completion": true,
6-
"yaml.hover": true,
7-
"yaml.schemas": {
8-
"./.github/aw/schemas/agentic-workflow.json": ".github/workflows/*.md"
9-
},
10-
"yaml.validate": true
4+
}
115
}

pkg/cli/init.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ func InitRepository(verbose bool, mcp bool, campaign bool, tokens bool, engine s
128128
}
129129
}
130130

131-
// Configure VSCode settings for YAML schema validation
132-
initLog.Print("Configuring VSCode YAML schema validation")
131+
// Configure VSCode settings
132+
initLog.Print("Configuring VSCode settings")
133133

134134
// Write workflow schema to .github/aw/
135135
if err := ensureWorkflowSchema(verbose); err != nil {
@@ -178,8 +178,6 @@ func InitRepository(verbose bool, mcp bool, campaign bool, tokens bool, engine s
178178
fmt.Fprintln(os.Stderr, "")
179179
fmt.Fprintln(os.Stderr, console.FormatSuccessMessage("Repository initialized for agentic workflows!"))
180180
fmt.Fprintln(os.Stderr, "")
181-
fmt.Fprintln(os.Stderr, console.FormatInfoMessage("VSCode YAML schema validation configured"))
182-
fmt.Fprintln(os.Stderr, "")
183181
if mcp {
184182
fmt.Fprintln(os.Stderr, console.FormatInfoMessage("GitHub Copilot Agent MCP integration configured"))
185183
fmt.Fprintln(os.Stderr, "")

pkg/cli/vscode_config.go

Lines changed: 27 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func ensureWorkflowSchema(verbose bool) error {
9898
return nil
9999
}
100100

101-
// ensureVSCodeSettings creates or updates .vscode/settings.json with YAML schema configuration
101+
// ensureVSCodeSettings creates or updates .vscode/settings.json
102102
func ensureVSCodeSettings(verbose bool) error {
103103
vscodeConfigLog.Print("Creating or updating .vscode/settings.json")
104104

@@ -111,52 +111,22 @@ func ensureVSCodeSettings(verbose bool) error {
111111

112112
settingsPath := filepath.Join(vscodeDir, "settings.json")
113113

114-
// Read existing settings if they exist
115-
var settings VSCodeSettings
116-
if data, err := os.ReadFile(settingsPath); err == nil {
117-
vscodeConfigLog.Printf("Reading existing settings from: %s", settingsPath)
118-
if err := json.Unmarshal(data, &settings); err != nil {
119-
return fmt.Errorf("failed to parse existing settings.json: %w", err)
114+
// Check if settings.json already exists
115+
if _, err := os.Stat(settingsPath); err == nil {
116+
vscodeConfigLog.Print("Settings file already exists, skipping creation")
117+
if verbose {
118+
fmt.Fprintf(os.Stderr, "Settings file already exists at %s\n", settingsPath)
120119
}
121-
} else {
122-
vscodeConfigLog.Print("No existing settings found, creating new one")
123-
settings.Other = make(map[string]any)
120+
return nil
124121
}
125122

126-
// Initialize yaml.schemas if it doesn't exist
127-
if settings.YAMLSchemas == nil {
128-
settings.YAMLSchemas = make(map[string]any)
129-
}
130-
131-
// Add schema mapping for workflow files
132-
schemaPath := "./.github/aw/schemas/agentic-workflow.json"
133-
workflowPattern := ".github/workflows/*.md"
134-
135-
// Check if already configured
136-
if existingPattern, exists := settings.YAMLSchemas[schemaPath]; exists {
137-
if existingPattern == workflowPattern {
138-
vscodeConfigLog.Print("Schema mapping already configured, skipping update")
139-
if verbose {
140-
fmt.Fprintf(os.Stderr, "YAML schema mapping already configured in %s\n", settingsPath)
141-
}
142-
return nil
143-
}
144-
}
145-
146-
settings.YAMLSchemas[schemaPath] = workflowPattern
147-
148-
// Ensure yaml validation settings are enabled
149-
if settings.Other == nil {
150-
settings.Other = make(map[string]any)
151-
}
152-
if _, exists := settings.Other["yaml.validate"]; !exists {
153-
settings.Other["yaml.validate"] = true
154-
}
155-
if _, exists := settings.Other["yaml.hover"]; !exists {
156-
settings.Other["yaml.hover"] = true
157-
}
158-
if _, exists := settings.Other["yaml.completion"]; !exists {
159-
settings.Other["yaml.completion"] = true
123+
// Create minimal settings file with just Copilot settings
124+
settings := VSCodeSettings{
125+
Other: map[string]any{
126+
"github.copilot.enable": map[string]bool{
127+
"markdown": true,
128+
},
129+
},
160130
}
161131

162132
// Write settings file with proper indentation
@@ -173,7 +143,7 @@ func ensureVSCodeSettings(verbose bool) error {
173143
return nil
174144
}
175145

176-
// ensureVSCodeExtensions creates or updates .vscode/extensions.json with RedHat YAML extension
146+
// ensureVSCodeExtensions creates or updates .vscode/extensions.json
177147
func ensureVSCodeExtensions(verbose bool) error {
178148
vscodeConfigLog.Print("Creating or updating .vscode/extensions.json")
179149

@@ -185,39 +155,23 @@ func ensureVSCodeExtensions(verbose bool) error {
185155

186156
extensionsPath := filepath.Join(vscodeDir, "extensions.json")
187157

188-
// Read existing extensions if they exist
189-
var extensions VSCodeExtensions
190-
if data, err := os.ReadFile(extensionsPath); err == nil {
191-
vscodeConfigLog.Printf("Reading existing extensions from: %s", extensionsPath)
192-
if err := json.Unmarshal(data, &extensions); err != nil {
193-
return fmt.Errorf("failed to parse existing extensions.json: %w", err)
194-
}
195-
} else {
196-
vscodeConfigLog.Print("No existing extensions file found, creating new one")
197-
extensions.Recommendations = []string{}
198-
}
199-
200-
// Check if RedHat YAML extension is already in recommendations
201-
redhatYAMLExt := "redhat.vscode-yaml"
202-
hasYAMLExt := false
203-
for _, ext := range extensions.Recommendations {
204-
if ext == redhatYAMLExt {
205-
hasYAMLExt = true
206-
break
207-
}
208-
}
209-
210-
if hasYAMLExt {
211-
vscodeConfigLog.Print("RedHat YAML extension already in recommendations, skipping update")
158+
// Check if extensions.json already exists
159+
if _, err := os.Stat(extensionsPath); err == nil {
160+
vscodeConfigLog.Print("Extensions file already exists, skipping creation")
212161
if verbose {
213-
fmt.Fprintf(os.Stderr, "RedHat YAML extension already in %s\n", extensionsPath)
162+
fmt.Fprintf(os.Stderr, "Extensions file already exists at %s\n", extensionsPath)
214163
}
215164
return nil
216165
}
217166

218-
// Add RedHat YAML extension to recommendations
219-
extensions.Recommendations = append(extensions.Recommendations, redhatYAMLExt)
220-
vscodeConfigLog.Printf("Added %s to recommendations", redhatYAMLExt)
167+
// Create minimal extensions file with common recommendations
168+
extensions := VSCodeExtensions{
169+
Recommendations: []string{
170+
"astro-build.astro-vscode",
171+
"davidanson.vscode-markdownlint",
172+
},
173+
}
174+
vscodeConfigLog.Print("Creating new extensions file with basic recommendations")
221175

222176
// Write extensions file with proper indentation
223177
data, err := json.MarshalIndent(extensions, "", " ")

0 commit comments

Comments
 (0)