From 020f6404879fc0c6b41ed000a77269794b365b13 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 17 Jul 2026 20:38:49 +0000 Subject: [PATCH 1/3] Initial plan From 1f2ae2a5db429ea1cff74096f5c18c9a3e9c41d3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 17 Jul 2026 20:56:30 +0000 Subject: [PATCH 2/3] Respect editor tab/space settings in parsed formatting prefs Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com> --- internal/ls/lsutil/userpreferences.go | 18 +++++++++++++- internal/ls/lsutil/userpreferences_test.go | 28 ++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/internal/ls/lsutil/userpreferences.go b/internal/ls/lsutil/userpreferences.go index 8fc5146d634..b44b9b65287 100644 --- a/internal/ls/lsutil/userpreferences.go +++ b/internal/ls/lsutil/userpreferences.go @@ -886,7 +886,23 @@ func ParseUserPreferences(items map[string]any) UserPreferences { // editor < javascript < typescript < js/ts if editorItem, ok := items["editor"]; ok && editorItem != nil { if editorSettings, ok := editorItem.(map[string]any); ok { - prefs = prefs.withConfig(map[string]any{"unstable": editorSettings}) + unstableEditorSettings := make(map[string]any, len(editorSettings)+2) + for key, value := range editorSettings { + unstableEditorSettings[key] = value + } + // VS Code editor settings use "insertSpaces" and "tabSize"; map them to + // tsserver raw formatting setting names consumed by "unstable". + if tabSize, ok := unstableEditorSettings["tabSize"]; ok { + if _, hasIndentSize := unstableEditorSettings["indentSize"]; !hasIndentSize { + unstableEditorSettings["indentSize"] = tabSize + } + } + if insertSpaces, ok := unstableEditorSettings["insertSpaces"]; ok { + if _, hasConvertTabs := unstableEditorSettings["convertTabsToSpaces"]; !hasConvertTabs { + unstableEditorSettings["convertTabsToSpaces"] = insertSpaces + } + } + prefs = prefs.withConfig(map[string]any{"unstable": unstableEditorSettings}) } } // Apply javascript, then typescript, then js/ts (highest precedence). diff --git a/internal/ls/lsutil/userpreferences_test.go b/internal/ls/lsutil/userpreferences_test.go index 153f737b345..bb597be2bf7 100644 --- a/internal/ls/lsutil/userpreferences_test.go +++ b/internal/ls/lsutil/userpreferences_test.go @@ -511,6 +511,34 @@ func TestUserPreferencesParseServerFeaturePreferences(t *testing.T) { }) } +func TestUserPreferencesParseEditorFormattingSettings(t *testing.T) { + t.Parallel() + + t.Run("editor insertSpaces and tabSize apply to format settings", func(t *testing.T) { + t.Parallel() + prefs := ParseUserPreferences(map[string]any{ + "editor": map[string]any{ + "tabSize": 2, + "insertSpaces": false, + }, + }) + assert.Equal(t, prefs.FormatCodeSettings.TabSize, 2) + assert.Equal(t, prefs.FormatCodeSettings.IndentSize, 2) + assert.Equal(t, prefs.FormatCodeSettings.ConvertTabsToSpaces, core.TSFalse) + }) + + t.Run("editor raw formatting setting wins over insertSpaces alias", func(t *testing.T) { + t.Parallel() + prefs := ParseUserPreferences(map[string]any{ + "editor": map[string]any{ + "insertSpaces": false, + "convertTabsToSpaces": true, + }, + }) + assert.Equal(t, prefs.FormatCodeSettings.ConvertTabsToSpaces, core.TSTrue) + }) +} + func TestUserPreferencesParseJSDocCompletionPreferences(t *testing.T) { t.Parallel() From ca1d0de879151d3a0746844a3d94a8eeb482c631 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 17 Jul 2026 21:06:46 +0000 Subject: [PATCH 3/3] Address lint by using maps.Copy in editor settings mapping Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com> --- internal/ls/lsutil/userpreferences.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/internal/ls/lsutil/userpreferences.go b/internal/ls/lsutil/userpreferences.go index b44b9b65287..9ce32c8dcdf 100644 --- a/internal/ls/lsutil/userpreferences.go +++ b/internal/ls/lsutil/userpreferences.go @@ -1,6 +1,7 @@ package lsutil import ( + "maps" "reflect" "slices" "strings" @@ -887,9 +888,7 @@ func ParseUserPreferences(items map[string]any) UserPreferences { if editorItem, ok := items["editor"]; ok && editorItem != nil { if editorSettings, ok := editorItem.(map[string]any); ok { unstableEditorSettings := make(map[string]any, len(editorSettings)+2) - for key, value := range editorSettings { - unstableEditorSettings[key] = value - } + maps.Copy(unstableEditorSettings, editorSettings) // VS Code editor settings use "insertSpaces" and "tabSize"; map them to // tsserver raw formatting setting names consumed by "unstable". if tabSize, ok := unstableEditorSettings["tabSize"]; ok {