Skip to content

Commit b9035c0

Browse files
no more extra codelenses
1 parent 8f0db38 commit b9035c0

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

src/PowerShellEditorServices/Services/CodeLens/ReferencesCodeLensProvider.cs

+10-1
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 (scriptFile.DocumentUri.Scheme == "vscode-notebook-cell" &&
119+
uri.Path == scriptFile.DocumentUri.Path &&
120+
uri.Scheme == "file")
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

+1-2
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,7 @@ 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:") || path.StartsWith("vscode-notebook:");
220+
return DocumentUri.From(path).Scheme.ToLower() != Uri.UriSchemeFile;
222221
}
223222

224223
/// <summary>

src/PowerShellEditorServices/Services/Workspace/WorkspaceService.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +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":
198+
case "vscode-notebook-cell":
199199
break;
200200

201201
default:

0 commit comments

Comments
 (0)