mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-21 09:35:39 -05:00
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:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user