Feature/delete peek scripts (#174)

* Delete temp script folder

* Delete folder and refactor code

* Add unit tests

* create folder per workspace

* Refactor and move creation to FileUtils

* Separate multiple assignment
This commit is contained in:
Sharon Ravindran
2016-12-15 13:34:33 -08:00
committed by GitHub
parent 9c6162282a
commit 5d2bf7fbe4
5 changed files with 118 additions and 5 deletions

View File

@@ -21,6 +21,7 @@ using Microsoft.SqlTools.ServiceLayer.Hosting.Protocol;
using Microsoft.SqlTools.ServiceLayer.LanguageServices.Completion;
using Microsoft.SqlTools.ServiceLayer.LanguageServices.Contracts;
using Microsoft.SqlTools.ServiceLayer.SqlContext;
using Microsoft.SqlTools.ServiceLayer.QueryExecution;
using Microsoft.SqlTools.ServiceLayer.Utility;
using Microsoft.SqlTools.ServiceLayer.Workspace;
using Microsoft.SqlTools.ServiceLayer.Workspace.Contracts;
@@ -216,6 +217,7 @@ namespace Microsoft.SqlTools.ServiceLayer.LanguageServices
serviceHost.RegisterShutdownTask(async (shutdownParams, shutdownRequestContext) =>
{
Logger.Write(LogLevel.Verbose, "Shutting down language service");
DeletePeekDefinitionScripts();
await Task.FromResult(0);
});
@@ -1232,5 +1234,14 @@ namespace Microsoft.SqlTools.ServiceLayer.LanguageServices
return false;
}
}
internal void DeletePeekDefinitionScripts()
{
// Delete temp folder created to store peek definition scripts
if (FileUtils.SafeDirectoryExists(FileUtils.PeekDefinitionTempFolder))
{
FileUtils.SafeDirectoryDelete(FileUtils.PeekDefinitionTempFolder, true);
}
}
}
}