diff --git a/Packages/com.unity.ide.vscode/Editor/ProjectGeneration/ProjectGeneration.cs b/Packages/com.unity.ide.vscode/Editor/ProjectGeneration/ProjectGeneration.cs index 9c81099..855f9cc 100644 --- a/Packages/com.unity.ide.vscode/Editor/ProjectGeneration/ProjectGeneration.cs +++ b/Packages/com.unity.ide.vscode/Editor/ProjectGeneration/ProjectGeneration.cs @@ -92,6 +92,14 @@ enum ScriptingLanguage } }"; + const string k_WorkspaceJson = @"{ + ""folders"": [ + { + ""path"": ""."" + } + ] +}"; + /// /// Map source extensions to ScriptingLanguages /// @@ -348,6 +356,7 @@ public void GenerateAndWriteSolutionAndProjects() } WriteVSCodeSettingsFiles(); + WriteWorkspaceFile(); } List ParseResponseFileData(Assembly assembly) @@ -804,6 +813,14 @@ void WriteVSCodeSettingsFiles() if (!m_FileIOProvider.Exists(vsCodeSettingsJson)) m_FileIOProvider.WriteAllText(vsCodeSettingsJson, k_SettingsJson); } + + void WriteWorkspaceFile() + { + var workspaceFile = Path.Combine(ProjectDirectory, $"{m_ProjectName}.code-workspace"); + + if (!m_FileIOProvider.Exists(workspaceFile)) + m_FileIOProvider.WriteAllText(workspaceFile, k_WorkspaceJson); + } } public static class SolutionGuidGenerator diff --git a/Packages/com.unity.ide.vscode/Editor/VSCodeScriptEditor.cs b/Packages/com.unity.ide.vscode/Editor/VSCodeScriptEditor.cs index bbf9329..5903bf4 100644 --- a/Packages/com.unity.ide.vscode/Editor/VSCodeScriptEditor.cs +++ b/Packages/com.unity.ide.vscode/Editor/VSCodeScriptEditor.cs @@ -25,7 +25,7 @@ public class VSCodeScriptEditor : IExternalCodeEditor static string DefaultApp => EditorPrefs.GetString("kScriptsDefaultApp"); - static string DefaultArgument { get; } = "\"$(ProjectPath)\" -g \"$(File)\":$(Line):$(Column)"; + static string DefaultArgument { get; } = "\"$(ProjectPath)/$(ProjectName).code-workspace\" -g \"$(File)\":$(Line):$(Column)"; string Arguments {