Skip to content

Commit ce692b2

Browse files
committed
Address Codacy issues
1 parent af3629b commit ce692b2

File tree

2 files changed

+1
-38
lines changed

2 files changed

+1
-38
lines changed

src/PowerShellEditorServices/Workspace/ScriptFile.cs

-37
Original file line numberDiff line numberDiff line change
@@ -576,43 +576,6 @@ public BufferRange GetRangeBetweenOffsets(int startOffset, int endOffset)
576576

577577
#region Private Methods
578578

579-
private static string GetPathAsClientPath(string path)
580-
{
581-
const string fileUriPrefix = "file:///";
582-
583-
if (path.StartsWith("untitled:", StringComparison.Ordinal))
584-
{
585-
return path;
586-
}
587-
588-
if (path.StartsWith("file:///", StringComparison.Ordinal))
589-
{
590-
return path;
591-
}
592-
593-
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
594-
{
595-
return new Uri(path).AbsoluteUri;
596-
}
597-
598-
// VSCode file URIs on Windows need the drive letter lowercase, and the colon
599-
// URI encoded. System.Uri won't do that, so we manually create the URI.
600-
var newUri = System.Web.HttpUtility.UrlPathEncode(path);
601-
int colonIndex = path.IndexOf(":");
602-
for (var i = colonIndex - 1; i >= 0; i--)
603-
{
604-
newUri.Remove(i, 1);
605-
newUri.Insert(i, char.ToLowerInvariant(path[i]).ToString());
606-
}
607-
608-
return newUri
609-
.Remove(colonIndex, 1)
610-
.Insert(colonIndex, "%3A")
611-
.Replace("\\", "/")
612-
.Insert(0, fileUriPrefix)
613-
.ToString();
614-
}
615-
616579
private void SetFileContents(string fileContents)
617580
{
618581
// Split the file contents into lines and trim

src/PowerShellEditorServices/Workspace/Workspace.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ internal static string ConvertPathToDocumentUri(string path)
658658
// VSCode file URIs on Windows need the drive letter lowercase, and the colon
659659
// URI encoded. System.Uri won't do that, so we manually create the URI.
660660
var newUri = System.Web.HttpUtility.UrlPathEncode(path);
661-
int colonIndex = path.IndexOf(":");
661+
int colonIndex = path.IndexOf(":", StringComparison.Ordinal);
662662
for (var i = colonIndex - 1; i >= 0; i--)
663663
{
664664
newUri.Remove(i, 1);

0 commit comments

Comments
 (0)