本文整理汇总了C#中IVsTextView.GetFilePath方法的典型用法代码示例。如果您正苦于以下问题:C# IVsTextView.GetFilePath方法的具体用法?C# IVsTextView.GetFilePath怎么用?C# IVsTextView.GetFilePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVsTextView
的用法示例。
在下文中一共展示了IVsTextView.GetFilePath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VsTextViewCreated
public void VsTextViewCreated(IVsTextView textViewAdapter)
{
var view = textViewAdapter.ToITextView();
var filePath = textViewAdapter.GetFilePath();
var project = ProjectInfo.FindProject(filePath);
if (project == null)
return;
var engine = project.Engine;
if (engine.IsExtensionRegistered(Path.GetExtension(filePath))
|| engine.HasSourceChangedSubscribers(Location.GetFileIndex(filePath)))
{
//Trace.WriteLine("Opened: " + filePath);
IVsTextLines vsTextLines = textViewAdapter.GetBuffer();
var langSrv = NemerlePackage.GetGlobalService(typeof(NemerleLanguageService)) as NemerleLanguageService;
if (langSrv == null)
return;
var source = (NemerleSource)langSrv.GetOrCreateSource(vsTextLines);
source.AddRef();
project.AddEditableSource(source);
if (!Utils.IsNemerleFileExtension(filePath))
view.TextBuffer.Changed += TextBuffer_Changed;
view.Closed += view_Closed;
}
}
示例2: VsTextViewCreated
public void VsTextViewCreated(IVsTextView textViewAdapter)
{
var view = textViewAdapter.ToITextView();
var filePath = textViewAdapter.GetFilePath();
var project = GetProjectInfo(filePath);
if (project == null)
return;
//Trace.WriteLine("Opened: " + filePath);
IVsTextLines vsTextLines = textViewAdapter.GetBuffer();
var langSrv = NemerlePackage.GetGlobalService(typeof(NemerleLanguageService)) as NemerleLanguageService;
if (langSrv == null)
return;
var source = (NemerleSource)langSrv.GetOrCreateSource(vsTextLines);
project.AddEditableSource(source);
view.TextBuffer.Changed += TextBuffer_Changed;
view.Closed += view_Closed;
}