mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-16 01:25:41 -05:00
Handle open\close document events with git URI prefix (#254)
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user