本文整理汇总了C#中IVsTextView类的典型用法代码示例。如果您正苦于以下问题:C# IVsTextView类的具体用法?C# IVsTextView怎么用?C# IVsTextView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IVsTextView类属于命名空间,在下文中一共展示了IVsTextView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TextViewCommandFilter
/// <summary>
/// Initializes a new instance of the <see cref="TextViewCommandFilter"/> class
/// for the specified text view.
/// </summary>
/// <param name="textViewAdapter">The text view this command filter should attach to.</param>
protected TextViewCommandFilter(IVsTextView textViewAdapter)
{
if (textViewAdapter == null)
throw new ArgumentNullException("textViewAdapter");
_textViewAdapter = textViewAdapter;
}
示例2: ArgumentNullException
int IVsCodeWindowManager.OnNewView(IVsTextView pView)
{
if (pView == null)
throw new ArgumentNullException("pView");
return OnNewView(pView);
}
示例3: SurroundWith
public SurroundWith(IVsTextView adapter, IWpfTextView textView, ICompletionBroker broker)
: base(adapter, textView, GuidList.guidFormattingCmdSet, PkgCmdIDList.SurroundWith)
{
_broker = broker;
_view = textView;
_buffer = textView.TextBuffer;
}
示例4: CommandFilter
internal CommandFilter(IVsTextView textViewAdapter, IWpfTextView textView)
{
recorder = new Recorder();
listening = false;
this.textView = textView;
textViewAdapter.AddCommandFilter(this, out nextFilter);
// trying to get document path from TextBuffer
ITextBuffer buffer = this.textView.TextBuffer;
ITextDocument document;
var result = buffer.Properties.TryGetProperty<ITextDocument>(
typeof(ITextDocument), out document);
if (result)
{
string documentFullPath = document.FilePath;
recordFullPath = documentFullPath + ".rec";
}
else
{
// TODO: save to some folder
recordFullPath = "document.rec";
}
// subscribe to RecorderControl event
RecorderControl.RecordStateChanged += new EventHandler<RecordStateChangedArgs>(OnRecordStateChanged);
}
示例5: RemoveWhitespaceOnSave
public RemoveWhitespaceOnSave(IVsTextView textViewAdapter, IWpfTextView view, DTE2 dte, ITextDocument document)
{
textViewAdapter.AddCommandFilter(this, out _nextCommandTarget);
_view = view;
_dte = dte;
_document = document;
}
示例6: VsTextViewCreated
public void VsTextViewCreated(IVsTextView textViewAdapter)
{
var textView = EditorAdaptersFactoryService.GetWpfTextView(textViewAdapter);
textView.Closed += TextviewClosed;
// Both "Web Compiler" and "Bundler & Minifier" extensions add this property on their
// generated output files. Generated output should be ignored from linting
bool generated;
if (textView.Properties.TryGetProperty("generated", out generated) && generated)
return;
if (TextDocumentFactoryService.TryGetTextDocument(textView.TextDataModel.DocumentBuffer, out _document))
{
Task.Run(async () =>
{
if (!LinterService.IsFileSupported(_document.FilePath))
return;
_document.FileActionOccurred += DocumentSaved;
textView.Properties.AddProperty("lint_filename", _document.FilePath);
// Don't run linter again if error list already contains errors for the file.
if (!TableDataSource.Instance.HasErrors(_document.FilePath))
{
await LinterService.LintAsync(false, _document.FilePath);
}
});
}
}
示例7: FindConfigLine
private static bool FindConfigLine(IVsTextView configTextView, out int configLineIndex, out string configLineText)
{
configLineText = null;
for (configLineIndex = 0;
String.IsNullOrWhiteSpace(configLineText);
configLineIndex++)
{
int hr = configTextView.GetTextStream(
configLineIndex,
0,
configLineIndex + 1,
0,
out configLineText);
if (hr != VSConstants.S_OK || configLineText == null)
{
break;
}
if (IsConfigLine(configLineText))
{
return true;
}
}
configLineIndex = -1;
configLineText = null;
return false;
}
示例8: 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;
}
}
示例9:
void IVsTextViewCreationListener.VsTextViewCreated(IVsTextView vsView)
{
var view = _adaptersFactory.GetWpfTextView(vsView);
if (view == null)
{
return;
}
var opt = _vim.GetBuffer(view);
if (!opt.IsSome())
{
return;
}
var buffer = opt.Value;
var broker = _displayWindowBrokerFactoryServcie.CreateDisplayWindowBroker(view);
var result = VsCommandTarget.Create(buffer, vsView, _adapter, broker, _externalEditorManager);
if (result.IsSuccess)
{
_filterMap.Add(buffer, result.Value);
}
// Try and install the IVsFilterKeys adapter. This cannot be done synchronously here
// because Venus projects are not fully initialized at this state. Merely querying
// for properties cause them to corrupt internal state and prevents rendering of the
// view. Occurs for aspx and .js pages
Action install = () => VsFilterKeysAdapter.TryInstallFilterKeysAdapter(_adapter, _editorOptionsFactoryService, buffer);
Dispatcher.CurrentDispatcher.BeginInvoke(install, null);
}
示例10: VsTextViewCreated
public void VsTextViewCreated(IVsTextView textViewAdapter)
{
var textView = EditorAdaptersFactoryService.GetWpfTextView(textViewAdapter);
textView.Options.SetOptionValue(DefaultOptions.IndentSizeOptionId, 2);
textView.Options.SetOptionValue(DefaultOptions.ConvertTabsToSpacesOptionId, true);
}
示例11: VsTextViewCreated
public void VsTextViewCreated(IVsTextView textViewAdapter)
{
var textView = EditorAdaptersFactoryService.GetWpfTextView(textViewAdapter);
var completionModelManager = CompletionModelManagerProvider.GetCompletionModel(textView);
textView.Properties.GetOrCreateSingletonProperty(() => new CompletionCommandHandlerTriggers(textViewAdapter, textView, completionModelManager));
textView.Properties.GetOrCreateSingletonProperty(() => new CompletionCommandHandler(textViewAdapter, textView, completionModelManager));
}
示例12: VsTextViewCreated
public void VsTextViewCreated(IVsTextView textViewAdapter)
{
IWpfTextView textView = editorFactory.GetWpfTextView(textViewAdapter);
if (textView != null)
AddCommandFilter(textViewAdapter, new MultiPointEditCommandFilter(textView));
}
示例13: VsTextViewCreated
public void VsTextViewCreated(IVsTextView textViewAdapter)
{
var commandFilter = new EditorCommandFilter(serviceProvider: this.serviceProvider);
IOleCommandTarget nextTarget;
ErrorHandler.ThrowOnFailure(textViewAdapter.AddCommandFilter(commandFilter, out nextTarget));
commandFilter.NextCommandTarget = nextTarget;
}
示例14: VsCommandFilter
void IVsTextViewCreationListener.VsTextViewCreated(IVsTextView vsView)
{
var view = _adaptersFactory.GetWpfTextView(vsView);
if (view == null)
{
return;
}
var opt = _vim.GetBuffer(view);
if (!opt.IsSome())
{
return;
}
var buffer = opt.Value;
var filter = new VsCommandFilter(buffer, vsView, _serviceProvider);
_filterMap.Add(buffer, filter);
// Try and install the IVsFilterKeys adapter. This cannot be done synchronously here
// because Venus projects are not fully initialized at this state. Merely querying
// for properties cause them to corrupt internal state and prevents rendering of the
// view. Occurs for aspx and .js pages
Action install = () =>
{
VsFilterKeysAdapter.TryInstallFilterKeysAdapter(_adapter, _editorOptionsFactoryService, buffer);
};
Dispatcher.CurrentDispatcher.BeginInvoke(install, null);
}
示例15: VsTextViewCreated
public void VsTextViewCreated(IVsTextView textViewAdapter)
{
var textView = EditorAdaptersFactoryService.GetWpfTextView(textViewAdapter);
textView.Properties.GetOrCreateSingletonProperty(() => new GoToDefinitionCommandTarget(textViewAdapter, textView, GoToDefinitionProviderService, ServiceProvider));
textView.Properties.GetOrCreateSingletonProperty(() => new OpenIncludeFileCommandTarget(textViewAdapter, textView, ServiceProvider, SourceTextFactory));
}