remove unused code
This commit is contained in:
@@ -1,16 +1,12 @@
|
|||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using SharpIDE.Application.Features.Analysis;
|
|
||||||
using SharpIDE.Application.Features.Events;
|
|
||||||
using SharpIDE.Application.Features.SolutionDiscovery;
|
using SharpIDE.Application.Features.SolutionDiscovery;
|
||||||
|
|
||||||
namespace SharpIDE.Application.Features.FilePersistence;
|
namespace SharpIDE.Application.Features.FilePersistence;
|
||||||
#pragma warning disable VSTHRD011
|
#pragma warning disable VSTHRD011
|
||||||
|
|
||||||
/// Holds the in memory copies of files, and manages saving/loading them to/from disk.
|
/// Holds the in memory copies of files, and manages saving/loading them to/from disk.
|
||||||
public class IdeOpenTabsFileManager(RoslynAnalysis roslynAnalysis)
|
public class IdeOpenTabsFileManager
|
||||||
{
|
{
|
||||||
private readonly RoslynAnalysis _roslynAnalysis = roslynAnalysis;
|
|
||||||
|
|
||||||
private ConcurrentDictionary<SharpIdeFile, Lazy<Task<string>>> _openFiles = new();
|
private ConcurrentDictionary<SharpIdeFile, Lazy<Task<string>>> _openFiles = new();
|
||||||
|
|
||||||
/// Implicitly 'opens' a file if not already open, and returns the text.
|
/// Implicitly 'opens' a file if not already open, and returns the text.
|
||||||
@@ -35,26 +31,6 @@ public class IdeOpenTabsFileManager(RoslynAnalysis roslynAnalysis)
|
|||||||
_openFiles[file] = newLazyTask;
|
_openFiles[file] = newLazyTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task ReloadFileFromDisk(SharpIdeFile file)
|
|
||||||
{
|
|
||||||
if (!_openFiles.ContainsKey(file)) throw new InvalidOperationException("File is not open in memory.");
|
|
||||||
|
|
||||||
var newTextTaskLazy = new Lazy<Task<string>>(() => File.ReadAllTextAsync(file.Path));
|
|
||||||
_openFiles[file] = newTextTaskLazy;
|
|
||||||
var textTask = newTextTaskLazy.Value;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<bool> ReloadFileFromDiskIfOpenInEditor(SharpIdeFile file)
|
|
||||||
{
|
|
||||||
if (!_openFiles.ContainsKey(file)) return false;
|
|
||||||
|
|
||||||
var newTextTaskLazy = new Lazy<Task<string>>(() => File.ReadAllTextAsync(file.Path));
|
|
||||||
_openFiles[file] = newTextTaskLazy;
|
|
||||||
//var textTask = newTextTaskLazy.Value;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task SaveFileAsync(SharpIdeFile file)
|
public async Task SaveFileAsync(SharpIdeFile file)
|
||||||
{
|
{
|
||||||
if (!_openFiles.ContainsKey(file)) throw new InvalidOperationException("File is not open in memory.");
|
if (!_openFiles.ContainsKey(file)) throw new InvalidOperationException("File is not open in memory.");
|
||||||
|
|||||||
Reference in New Issue
Block a user