Fix Intellisense not working for saved files (#867)

* Fix tools service to store the corrected file path

* Use ClientFilePath for key

* Further fixes

* Undo spacing changes

* Fix tests

* Trigger CI rebuild
This commit is contained in:
Charles Gagnon
2019-09-19 11:28:40 -07:00
committed by GitHub
parent 9d140b53f3
commit de1bab9f1e
13 changed files with 168 additions and 116 deletions

View File

@@ -138,16 +138,23 @@ namespace Microsoft.SqlTools.ServiceLayer.Utility
}
}
internal static ResolvedFile TryGetFullPath(string filePath)
/// <summary>
/// Attempts to resolve the given filePath to an absolute path to a file on disk,
/// defaulting to the original filePath if that fails.
/// </summary>
/// <param name="filePath">The file path to resolve</param>
/// <param name="clientUri">The full file path URI used by the client</param>
/// <returns></returns>
internal static ResolvedFile TryGetFullPath(string filePath, string clientUri)
{
try
{
return new ResolvedFile(Path.GetFullPath(filePath), true);
return new ResolvedFile(Path.GetFullPath(filePath), clientUri, true);
}
catch(NotSupportedException)
{
// This is not a standard path.
return new ResolvedFile(filePath, false);
return new ResolvedFile(filePath, clientUri, false);
}
}
}

View File

@@ -19,20 +19,24 @@ namespace Microsoft.SqlTools.ServiceLayer.Utility
/// </summary>
internal class ResolvedFile
{
public ResolvedFile(string filePath, bool canReadFromDisk)
public ResolvedFile(string filePath, string clientUri, bool canReadFromDisk)
{
FilePath = filePath;
ClientUri = clientUri;
CanReadFromDisk = canReadFromDisk;
}
public string FilePath { get; private set; }
public string ClientUri { get; private set; }
public bool CanReadFromDisk { get; private set; }
public string LowercaseFilePath
public string LowercaseClientUri
{
get
{
return FilePath?.ToLower();
return ClientUri?.ToLower();
}
}
}