提交 c13da4ce 编写于 作者: J Jason Malinowski

Avoid writing out the temporary file if it's already there

If the file is already open, then this was causing us to trigger a
reload prompt which we don't want.
上级 7a36f748
......@@ -99,7 +99,12 @@ public void NavigateToSourceGeneratedFile(Project project, ISourceGenerator gene
// The file name we generate here is chosen to match the compiler's choice, so the debugger can recognize the files should match.
// This can only be changed if the compiler changes the algorithm as well.
var temporaryFilePath = Path.Combine(projectDirectory, $"{generatorType.Module.ModuleVersionId}_{generatorType.FullName}_{generatedSourceHintName}");
File.WriteAllText(temporaryFilePath, "");
// Don't write to the file if it's already there, as that potentially triggers a file reload
if (!File.Exists(temporaryFilePath))
{
File.WriteAllText(temporaryFilePath, "");
}
var openDocumentService = _serviceProvider.GetService<SVsUIShellOpenDocument, IVsUIShellOpenDocument>();
var hr = openDocumentService.OpenDocumentViaProject(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册