generate namespace for new file
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using SharpIDE.Application.Features.SolutionDiscovery;
|
||||
using SharpIDE.Application.Features.SolutionDiscovery.VsPersistence;
|
||||
|
||||
namespace SharpIDE.Application.Features.FileWatching;
|
||||
|
||||
@@ -25,10 +26,11 @@ public class IdeFileOperationsService(SharpIdeSolutionModificationService sharpI
|
||||
// await _sharpIdeSolutionModificationService.RemoveFile(file);
|
||||
// }
|
||||
|
||||
public async Task CreateCsFile(SharpIdeFolder parentFolder, string newFileName, string @namespace)
|
||||
public async Task CreateCsFile(SharpIdeFolder parentFolder, string newFileName)
|
||||
{
|
||||
var newFilePath = Path.Combine(parentFolder.Path, newFileName);
|
||||
var className = Path.GetFileNameWithoutExtension(newFileName);
|
||||
var @namespace = NewFileTemplates.ComputeNamespace(parentFolder);
|
||||
var fileText = NewFileTemplates.CsharpClass(className, @namespace);
|
||||
await File.WriteAllTextAsync(newFilePath, fileText);
|
||||
await _sharpIdeSolutionModificationService.CreateFile(parentFolder, newFileName, fileText);
|
||||
|
||||
Reference in New Issue
Block a user