提交 cdc32b73 编写于 作者: D David Barbet

Address more feedback.

上级 ebe0a9ff
......@@ -8,7 +8,7 @@ namespace Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem
/// Defines the methods that get called by the <see cref="RunningDocumentTableEventTracker"/>
/// for getting notified about running document table events.
/// </summary>
interface IRunningDocumentTableEventListener
internal interface IRunningDocumentTableEventListener
{
void OnCloseDocument(uint docCookie, string moniker);
......
......@@ -85,7 +85,6 @@ void IRunningDocumentTableEventListener.OnCloseDocument(uint docCookie, string m
void IRunningDocumentTableEventListener.OnRefreshDocumentContext(uint docCookie, string moniker)
{
// This event is not relevant to the misc workspace.
return;
}
void IRunningDocumentTableEventListener.OnReloadDocumentData(uint docCookie, string moniker)
......@@ -102,7 +101,6 @@ void IRunningDocumentTableEventListener.OnReloadDocumentData(uint docCookie, str
void IRunningDocumentTableEventListener.OnBeforeOpenDocument(uint docCookie, string moniker, ITextBuffer textBuffer)
{
// This event is not relevant to the misc workspace.
return;
}
void IRunningDocumentTableEventListener.OnInitializedDocument(uint docCookie, string moniker, ITextBuffer textBuffer)
......
......@@ -21,21 +21,21 @@ internal sealed class RunningDocumentTableEventTracker : IVsRunningDocTableEvent
private readonly ForegroundThreadAffinitizedObject _foregroundAffinitization;
private readonly IVsEditorAdaptersFactoryService _editorAdaptersFactoryService;
private readonly IVsRunningDocumentTable4 _runningDocumentTable;
private readonly IRunningDocumentTableEventListener _runningDocumentTableEventListener;
private readonly IRunningDocumentTableEventListener _listener;
private uint _runningDocumentTableEventsCookie;
public RunningDocumentTableEventTracker(IThreadingContext threadingContext, IVsEditorAdaptersFactoryService editorAdaptersFactoryService, IVsRunningDocumentTable4 runningDocumentTable,
IRunningDocumentTableEventListener runningDocumentTableEventListener)
IRunningDocumentTableEventListener listener)
{
Contract.ThrowIfNull(threadingContext);
Contract.ThrowIfNull(editorAdaptersFactoryService);
Contract.ThrowIfNull(runningDocumentTable);
Contract.ThrowIfNull(runningDocumentTableEventListener);
Contract.ThrowIfNull(listener);
_foregroundAffinitization = new ForegroundThreadAffinitizedObject(threadingContext, assertIsForeground: true);
_runningDocumentTable = runningDocumentTable;
_editorAdaptersFactoryService = editorAdaptersFactoryService;
_runningDocumentTableEventListener = runningDocumentTableEventListener;
_listener = listener;
((IVsRunningDocumentTable)_runningDocumentTable).AdviseRunningDocTableEvents(this, out _runningDocumentTableEventsCookie);
}
......@@ -51,7 +51,7 @@ public int OnBeforeLastDocumentUnlock(uint docCookie, uint dwRDTLockType, uint d
{
if (CheckPreconditions(docCookie))
{
_runningDocumentTableEventListener.OnCloseDocument(docCookie, _runningDocumentTable.GetDocumentMoniker(docCookie));
_listener.OnCloseDocument(docCookie, _runningDocumentTable.GetDocumentMoniker(docCookie));
}
}
......@@ -75,7 +75,7 @@ public int OnAfterAttributeChangeEx(uint docCookie, uint grfAttribs, IVsHierarch
{
if (CheckPreconditions(docCookie))
{
_runningDocumentTableEventListener.OnRenameDocument(docCookie, pszMkDocumentNew, pszMkDocumentOld);
_listener.OnRenameDocument(docCookie, pszMkDocumentNew, pszMkDocumentOld);
}
}
......@@ -83,7 +83,7 @@ public int OnAfterAttributeChangeEx(uint docCookie, uint grfAttribs, IVsHierarch
{
if (TryGetBuffer(docCookie, out var buffer))
{
_runningDocumentTableEventListener.OnInitializedDocument(docCookie, _runningDocumentTable.GetDocumentMoniker(docCookie), buffer);
_listener.OnInitializedDocument(docCookie, _runningDocumentTable.GetDocumentMoniker(docCookie), buffer);
}
}
......@@ -94,13 +94,13 @@ public int OnAfterAttributeChangeEx(uint docCookie, uint grfAttribs, IVsHierarch
{
if (CheckPreconditions(docCookie))
{
_runningDocumentTableEventListener.OnReloadDocumentData(docCookie, _runningDocumentTable.GetDocumentMoniker(docCookie));
_listener.OnReloadDocumentData(docCookie, _runningDocumentTable.GetDocumentMoniker(docCookie));
}
}
if ((grfAttribs & (uint)__VSRDTATTRIB.RDTA_Hierarchy) != 0)
{
_runningDocumentTableEventListener.OnRefreshDocumentContext(docCookie, _runningDocumentTable.GetDocumentMoniker(docCookie));
_listener.OnRefreshDocumentContext(docCookie, _runningDocumentTable.GetDocumentMoniker(docCookie));
}
return VSConstants.S_OK;
......@@ -112,7 +112,7 @@ public int OnBeforeDocumentWindowShow(uint docCookie, int fFirstShow, IVsWindowF
{
if (TryGetBuffer(docCookie, out var buffer))
{
_runningDocumentTableEventListener.OnBeforeOpenDocument(docCookie, _runningDocumentTable.GetDocumentMoniker(docCookie), buffer);
_listener.OnBeforeOpenDocument(docCookie, _runningDocumentTable.GetDocumentMoniker(docCookie), buffer);
}
}
......
......@@ -101,7 +101,6 @@ void IRunningDocumentTableEventListener.OnRefreshDocumentContext(uint docCookie,
void IRunningDocumentTableEventListener.OnReloadDocumentData(uint docCookie, string moniker)
{
// This event is not relevant to the VS workspace open file tracker.
return;
}
void IRunningDocumentTableEventListener.OnBeforeOpenDocument(uint docCookie, string moniker, ITextBuffer textBuffer)
......@@ -113,7 +112,6 @@ void IRunningDocumentTableEventListener.OnInitializedDocument(uint docCookie, st
void IRunningDocumentTableEventListener.OnRenameDocument(uint docCookie, string newMoniker, string oldMoniker)
{
// This event is not relevant to the VS workspace open file tracker.
return;
}
public async static Task<OpenFileTracker> CreateAsync(VisualStudioWorkspaceImpl workspace, IAsyncServiceProvider asyncServiceProvider)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册