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

@@ -48,6 +48,23 @@ namespace Microsoft.SqlTools.ServiceLayer.Workspace
#region Public Methods
/// <summary>
/// Checks if a given URI is contained in a workspace
/// </summary>
/// <param name="filePath"></param>
/// <returns>Flag indicating if the file is tracked in workspace</returns>
public bool ContainsFile(string filePath)
{
Validate.IsNotNullOrWhitespaceString("filePath", filePath);
// Resolve the full file path
string resolvedFilePath = this.ResolveFilePath(filePath);
string keyName = resolvedFilePath.ToLower();
ScriptFile scriptFile = null;
return this.workspaceFiles.TryGetValue(keyName, out scriptFile);
}
/// <summary>
/// Gets an open file in the workspace. If the file isn't open but
/// exists on the filesystem, load and return it. Virtual method to
@@ -124,9 +141,10 @@ namespace Microsoft.SqlTools.ServiceLayer.Workspace
// with 'inmemory'. Untitled files which have been marked of
// type SqlTools have a path starting with 'untitled'.
return
filePath.StartsWith("inmemory") ||
filePath.StartsWith("tsqloutput") ||
filePath.StartsWith("untitled");
filePath.StartsWith("inmemory:") ||
filePath.StartsWith("tsqloutput:") ||
filePath.StartsWith("git:") ||
filePath.StartsWith("untitled:");
}
/// <summary>