Skip to content

Commit be84d4d

Browse files
Needed changes for Notebook UI Support (#1321)
* more vscode-notebook * no more extra codelenses * rob's feedback
1 parent e5e11bf commit be84d4d

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

src/PowerShellEditorServices/Services/CodeLens/ReferencesCodeLensProvider.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,18 @@ public CodeLens ResolveCodeLens(CodeLens codeLens, ScriptFile scriptFile)
113113
continue;
114114
}
115115

116+
DocumentUri uri = DocumentUri.From(foundReference.FilePath);
117+
// For any vscode-notebook-cell, we need to ignore the backing file on disk.
118+
if (uri.Scheme == "file" &&
119+
scriptFile.DocumentUri.Scheme == "vscode-notebook-cell" &&
120+
uri.Path == scriptFile.DocumentUri.Path)
121+
{
122+
continue;
123+
}
124+
116125
acc.Add(new Location
117126
{
118-
Uri = DocumentUri.From(foundReference.FilePath),
127+
Uri = uri,
119128
Range = foundReference.ScriptRegion.ToRange()
120129
});
121130
}

src/PowerShellEditorServices/Services/TextDocument/ScriptFile.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,10 @@ internal static List<string> GetLinesInternal(string text)
217217
internal static bool IsUntitledPath(string path)
218218
{
219219
Validate.IsNotNull(nameof(path), path);
220-
221-
return path.ToLower().StartsWith("untitled:");
220+
return string.Equals(
221+
DocumentUri.From(path).Scheme,
222+
Uri.UriSchemeFile,
223+
StringComparison.OrdinalIgnoreCase);
222224
}
223225

224226
/// <summary>

src/PowerShellEditorServices/Services/Workspace/WorkspaceService.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ public bool TryGetFile(DocumentUri documentUri, out ScriptFile scriptFile)
195195
// List supported schemes here
196196
case "file":
197197
case "untitled":
198+
case "vscode-notebook-cell":
198199
break;
199200

200201
default:

0 commit comments

Comments
 (0)