From 34c7692a4b428a9542ded2a6e9f701408586a151 Mon Sep 17 00:00:00 2001 From: Rob Holt Date: Thu, 1 Aug 2019 10:54:52 -0700 Subject: [PATCH 1/2] Fix git uri problem --- .../Workspace/Workspace.cs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/PowerShellEditorServices/Workspace/Workspace.cs b/src/PowerShellEditorServices/Workspace/Workspace.cs index 34cb0d641..57b024f05 100644 --- a/src/PowerShellEditorServices/Workspace/Workspace.cs +++ b/src/PowerShellEditorServices/Workspace/Workspace.cs @@ -13,6 +13,7 @@ using System.Runtime.InteropServices; using Microsoft.Extensions.FileSystemGlobbing; using Microsoft.Extensions.FileSystemGlobbing.Abstractions; +using System.Collections.Concurrent; namespace Microsoft.PowerShell.EditorServices { @@ -49,6 +50,13 @@ public class Workspace "**/*" }; + private static readonly string[] s_supportedUriSchemes = new[] + { + "file", + "untitled", + "inmemory" + }; + private ILogger logger; private Version powerShellVersion; private Dictionary workspaceFiles = new Dictionary(); @@ -174,6 +182,20 @@ public ScriptFile GetFile(string filePath) /// The out parameter that will contain the ScriptFile object. public bool TryGetFile(string filePath, out ScriptFile scriptFile) { + try + { + if (filePath.Contains(":/") // Quick heuristic to determine if we might have a URI + && !s_supportedUriSchemes.Contains(new Uri(filePath).Scheme)) + { + scriptFile = null; + return false; + } + } + catch + { + // If something goes wrong trying to check for URIs, just proceed to normal logic + } + try { scriptFile = GetFile(filePath); From a90e8e242f53a9b82349029283cce342c1404fa4 Mon Sep 17 00:00:00 2001 From: Rob Holt Date: Thu, 1 Aug 2019 10:56:47 -0700 Subject: [PATCH 2/2] Remove unused imports --- src/PowerShellEditorServices/Workspace/Workspace.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/PowerShellEditorServices/Workspace/Workspace.cs b/src/PowerShellEditorServices/Workspace/Workspace.cs index 57b024f05..e063877be 100644 --- a/src/PowerShellEditorServices/Workspace/Workspace.cs +++ b/src/PowerShellEditorServices/Workspace/Workspace.cs @@ -12,8 +12,6 @@ using System.Text; using System.Runtime.InteropServices; using Microsoft.Extensions.FileSystemGlobbing; -using Microsoft.Extensions.FileSystemGlobbing.Abstractions; -using System.Collections.Concurrent; namespace Microsoft.PowerShell.EditorServices {