提交 9dab11bc 编写于 作者: C Cyrus Najmabadi

Only mark buffers readonly if they're part of a project that supports Enc.

上级 74fcc40e
......@@ -10,6 +10,7 @@
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.TextManager.Interop;
using Roslyn.Utilities;
using Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem;
namespace Microsoft.CodeAnalysis.Editor.Implementation.EditAndContinue
{
......@@ -80,9 +81,16 @@ public void Dispose()
private void SetReadOnly(Document document)
{
SessionReadOnlyReason sessionReason;
ProjectReadOnlyReason projectReason;
SetReadOnly(document.Id, _encService.IsProjectReadOnly(document.Project.Name, out sessionReason, out projectReason));
// Only set documents read-only if they're part of a project that supports Enc.
var workspace = document.Project.Solution.Workspace as VisualStudioWorkspaceImpl;
var project = workspace?.ProjectTracker?.GetProject(document.Project.Id) as AbstractEncProject;
if (project != null)
{
SessionReadOnlyReason sessionReason;
ProjectReadOnlyReason projectReason;
SetReadOnly(document.Id, _encService.IsProjectReadOnly(document.Project.Name, out sessionReason, out projectReason));
}
}
private void SetReadOnly(DocumentId documentId, bool value)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册