Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

Commit

Permalink
Added workspace file generation
Browse files Browse the repository at this point in the history
  • Loading branch information
cdmazom committed May 6, 2022
1 parent ce951f4 commit 0365c6b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ enum ScriptingLanguage
}
}";

const string k_WorkspaceJson = @"{
""folders"": [
{
""path"": "".""
}
]
}";

/// <summary>
/// Map source extensions to ScriptingLanguages
/// </summary>
Expand Down Expand Up @@ -348,6 +356,7 @@ public void GenerateAndWriteSolutionAndProjects()
}

WriteVSCodeSettingsFiles();
WriteWorkspaceFile();
}

List<ResponseFileData> ParseResponseFileData(Assembly assembly)
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Packages/com.unity.ide.vscode/Editor/VSCodeScriptEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down

0 comments on commit 0365c6b

Please sign in to comment.