Handle open\close document events with git URI prefix (#254)

This commit is contained in:
Karl Burtram
2017-02-23 18:10:57 -08:00
committed by GitHub
parent 0af7bef66d
commit 206cde9a3e
3 changed files with 88 additions and 3 deletions

View File

@@ -244,6 +244,11 @@ namespace Microsoft.SqlTools.ServiceLayer.Workspace
{
Logger.Write(LogLevel.Verbose, "HandleDidOpenTextDocumentNotification");
if (IsScmEvent(openParams.TextDocument.Uri))
{
return;
}
// read the SQL file contents into the ScriptFile
ScriptFile openedFile = Workspace.GetFileBuffer(openParams.TextDocument.Uri, openParams.TextDocument.Text);
@@ -260,6 +265,11 @@ namespace Microsoft.SqlTools.ServiceLayer.Workspace
{
Logger.Write(LogLevel.Verbose, "HandleDidCloseTextDocumentNotification");
if (IsScmEvent(closeParams.TextDocument.Uri))
{
return;
}
// Skip closing this file if the file doesn't exist
var closedFile = Workspace.GetFile(closeParams.TextDocument.Uri);
if (closedFile == null)
@@ -311,6 +321,12 @@ namespace Microsoft.SqlTools.ServiceLayer.Workspace
EndOffset = changeRange.End.Character + 1
};
}
internal static bool IsScmEvent(string filePath)
{
// if the URI is prefixed with git: then we want to skip processing that file
return filePath.StartsWith("git:");
}
#endregion
}