Refactor VSCode configuration to use lowercase 'unityMCP' and improve argument checking

main
xsodus 2025-05-12 09:24:10 +07:00
parent 619172ad99
commit b4910be508
1 changed files with 3 additions and 2 deletions

View File

@ -168,7 +168,7 @@ namespace UnityMcpBridge.Editor.Windows
{ {
servers = new servers = new
{ {
UnityMCP = new unityMCP = new
{ {
command = "uv", command = "uv",
args = new[] { "--directory", pythonDir, "run", "server.py" } args = new[] { "--directory", pythonDir, "run", "server.py" }
@ -180,6 +180,7 @@ namespace UnityMcpBridge.Editor.Windows
JsonSerializerSettings jsonSettings = new() { Formatting = Formatting.Indented }; JsonSerializerSettings jsonSettings = new() { Formatting = Formatting.Indented };
string manualConfigJson = JsonConvert.SerializeObject(vscodeConfig, jsonSettings); string manualConfigJson = JsonConvert.SerializeObject(vscodeConfig, jsonSettings);
// Use the VSCodeManualSetupWindow directly since we're in the same namespace
VSCodeManualSetupWindow.ShowWindow(configPath, manualConfigJson); VSCodeManualSetupWindow.ShowWindow(configPath, manualConfigJson);
} }
} }
@ -653,7 +654,7 @@ namespace UnityMcpBridge.Editor.Windows
var args = config.mcp.servers.unityMCP.args.ToObject<string[]>(); var args = config.mcp.servers.unityMCP.args.ToObject<string[]>();
if (pythonDir != null && if (pythonDir != null &&
Array.Exists(args, arg => arg.Contains(pythonDir, StringComparison.Ordinal))) Array.Exists(args, new Predicate<string>(arg => arg.Contains(pythonDir, StringComparison.Ordinal))))
{ {
mcpClient.SetStatus(McpStatus.Configured); mcpClient.SetStatus(McpStatus.Configured);
} }