本文整理汇总了C#中IVsTextView类的典型用法代码示例。如果您正苦于以下问题:C# IVsTextView类的具体用法?C# IVsTextView怎么用?C# IVsTextView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IVsTextView类属于命名空间,在下文中一共展示了IVsTextView类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:modulexcite,项目名称:SHFB-1,代码行数:12,代码来源:TextViewCommandFilter.cs
示例2: ArgumentNullException
int IVsCodeWindowManager.OnNewView(IVsTextView pView)
{
if (pView == null)
throw new ArgumentNullException("pView");
return OnNewView(pView);
}
开发者ID:Kav2018,项目名称:JavaForVS,代码行数:7,代码来源:CodeWindowManager.cs
示例3: SurroundWith
public SurroundWith(IVsTextView adapter, IWpfTextView textView, ICompletionBroker broker)
: base(adapter, textView, GuidList.guidFormattingCmdSet, PkgCmdIDList.SurroundWith)
{
_broker = broker;
_view = textView;
_buffer = textView.TextBuffer;
}
开发者ID:joeriks,项目名称:WebEssentials2013,代码行数:7,代码来源:SurroundWithTarget.cs
示例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);
}
开发者ID:dmitry-zakablukov,项目名称:WorkRecorderVSIX,代码行数:29,代码来源:CommandFilter.cs
示例5: RemoveWhitespaceOnSave
public RemoveWhitespaceOnSave(IVsTextView textViewAdapter, IWpfTextView view, DTE2 dte, ITextDocument document)
{
textViewAdapter.AddCommandFilter(this, out _nextCommandTarget);
_view = view;
_dte = dte;
_document = document;
}
开发者ID:laurentkempe,项目名称:TrailingWhitespace,代码行数:7,代码来源:RemoveWhitespaceOnSave.cs
示例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);
}
});
}
}
开发者ID:pgatilov,项目名称:WebAnalyzer,代码行数:29,代码来源:SourceFileCreationListener.cs
示例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;
}
开发者ID:nstanard,项目名称:WebPackTaskRunner,代码行数:30,代码来源:TaskRunnerFileBindingsHelper.cs
示例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;
}
}
开发者ID:vestild,项目名称:nemerle,代码行数:28,代码来源:NemerleTextViewCreationListener.cs
示例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);
}
开发者ID:bentayloruk,项目名称:VsVim,代码行数:30,代码来源:HostFactory.cs
示例10: VsTextViewCreated
public void VsTextViewCreated(IVsTextView textViewAdapter)
{
var textView = EditorAdaptersFactoryService.GetWpfTextView(textViewAdapter);
textView.Options.SetOptionValue(DefaultOptions.IndentSizeOptionId, 2);
textView.Options.SetOptionValue(DefaultOptions.ConvertTabsToSpacesOptionId, true);
}
开发者ID:xoofx,项目名称:MarkdownEditor,代码行数:7,代码来源:EditorOptions.cs
示例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));
}
开发者ID:tgjones,项目名称:HlslTools,代码行数:7,代码来源:CompletionCommandHandlerProvider.cs
示例12: VsTextViewCreated
public void VsTextViewCreated(IVsTextView textViewAdapter)
{
IWpfTextView textView = editorFactory.GetWpfTextView(textViewAdapter);
if (textView != null)
AddCommandFilter(textViewAdapter, new MultiPointEditCommandFilter(textView));
}
开发者ID:Cronwell,项目名称:MultiEdit,代码行数:7,代码来源:MultiPointEditFilterProvider.cs
示例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;
}
开发者ID:jango2015,项目名称:VS-Macros,代码行数:7,代码来源:TextViewCreationListener.cs
示例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);
}
开发者ID:praveennet,项目名称:VsVim,代码行数:29,代码来源:HostFactory.cs
示例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));
}
开发者ID:Samana,项目名称:HlslTools,代码行数:7,代码来源:GoToDefinitionTextViewCreationListener.cs
示例16: Attach
public void Attach(IVsTextView textViewAdapter)
{
// Try loading only once since this is a heavy operation.
if (_loaded)
return;
_loaded = true;
var shell = _serviceProvider.GetService(typeof(SVsShell)) as IVsShell;
if (shell == null)
return;
IVsPackage package = null;
var packageToBeLoadedGuid = new Guid(GuidList.GuidVsChromiumPkgString);
shell.LoadPackage(ref packageToBeLoadedGuid, out package);
// Ensure document is seen as loaded - This is necessary for the first
// opened editor because the document is open before the package has a
// chance to listen to TextDocumentFactoryService events.
var textView = _adaptersFactoryService.GetWpfTextView(textViewAdapter);
if (textView != null) {
foreach (var buffer in textView.BufferGraph.GetTextBuffers(x => true)) {
ITextDocument textDocument;
if (_textDocumentFactoryService.TryGetTextDocument(buffer, out textDocument)) {
_textDocumentService.OnDocumentOpen(textDocument);
}
}
}
}
开发者ID:nick-chromium,项目名称:vs-chromium,代码行数:28,代码来源:PackageInitializerViewHandler.cs
示例17: VsTextViewCreated
/// <summary>
/// Creates a plugin instance when a new text editor is opened
/// </summary>
public void VsTextViewCreated(IVsTextView adapter)
{
IWpfTextView view = adapterFactory.GetWpfTextView(adapter);
if (view == null)
return;
ITextDocument document;
if (!docFactory.TryGetTextDocument(view.TextDataModel.DocumentBuffer, out document))
return;
IObjectWithSite iows = adapter as IObjectWithSite;
if (iows == null)
return;
System.IntPtr p;
iows.GetSite(typeof(IServiceProvider).GUID, out p);
if (p == System.IntPtr.Zero)
return;
IServiceProvider isp = Marshal.GetObjectForIUnknown(p) as IServiceProvider;
if (isp == null)
return;
ServiceProvider sp = new ServiceProvider(isp);
DTE dte = sp.GetService(typeof(DTE)) as DTE;
sp.Dispose();
new Plugin(view, document, dte);
}
开发者ID:xuhdev,项目名称:editorconfig-visualstudio,代码行数:32,代码来源:PluginFactory.cs
示例18: VsTextViewCreated
public async void VsTextViewCreated(IVsTextView textViewAdapter)
{
IWpfTextView view = AdaptersFactory.GetWpfTextView(textViewAdapter);
Debug.Assert(view != null);
int tries = 0;
// Ugly ugly hack
// Keep trying to register our filter until after the JSLS CommandFilter
// is added so we can catch completion before JSLS swallows all of them.
// To confirm this, click Debug, New Breakpoint, Break at Function, type
// Microsoft.VisualStudio.JSLS.TextView.TextView.CreateCommandFilter,
// then make sure that our last filter is added after that runs.
JsCommandFilter filter = new JsCommandFilter(view, CompletionBroker, _standardClassifications);
while (true)
{
IOleCommandTarget next;
textViewAdapter.AddCommandFilter(filter, out next);
filter.Next = next;
if (IsJSLSInstalled(next) || ++tries > 10)
return;
await Task.Delay(500);
textViewAdapter.RemoveCommandFilter(filter); // Remove the too-early filter and try again.
}
}
开发者ID:Russe11,项目名称:WebEssentials2013,代码行数:26,代码来源:JavaScriptCompletionController.cs
示例19: Register
public static void Register(IVsTextView interopTextView, IWpfTextView textView, Services services)
{
var dispatcher = new StandardCommandDispatcher();
dispatcher._textView = textView;
dispatcher._services = services;
interopTextView.AddCommandFilter(dispatcher, out dispatcher._commandChain);
}
开发者ID:jaredpar,项目名称:fantomas,代码行数:7,代码来源:StandardCommandDispatcher.cs
示例20: VsTextViewCreated
public void VsTextViewCreated(IVsTextView textViewAdapter)
{
var textView = EditorAdaptersFactoryService.GetWpfTextView(textViewAdapter);
textView.Properties.GetOrCreateSingletonProperty(() => new MinifySelection(textViewAdapter, textView));
textView.Properties.GetOrCreateSingletonProperty(() => new JavaScriptFindReferences(textViewAdapter, textView, Navigator));
textView.Properties.GetOrCreateSingletonProperty(() => new ExtractToFile(textViewAdapter, textView));
textView.Properties.GetOrCreateSingletonProperty(() => new NodeModuleGoToDefinition(textViewAdapter, textView));
textView.Properties.GetOrCreateSingletonProperty(() => new ReferenceTagGoToDefinition(textViewAdapter, textView));
textView.Properties.GetOrCreateSingletonProperty(() => new CommentCompletionCommandTarget(textViewAdapter, textView, AggregatorService));
textView.Properties.GetOrCreateSingletonProperty(() => new CommentIndentationCommandTarget(textViewAdapter, textView, AggregatorService, CompletionBroker));
ITextDocument document;
if (TextDocumentFactoryService.TryGetTextDocument(textView.TextDataModel.DocumentBuffer, out document))
{
if (ProjectHelpers.GetProjectItem(document.FilePath) == null)
return;
var jsHintLintInvoker = new LintFileInvoker(f => new JavaScriptLintReporter(new JsHintCompiler(), f), document);
textView.Closed += (s, e) => jsHintLintInvoker.Dispose();
textView.TextBuffer.Properties.GetOrCreateSingletonProperty(() => jsHintLintInvoker);
var jsCodeStyleLintInvoker = new LintFileInvoker(f => new JavaScriptLintReporter(new JsCodeStyleCompiler(), f), document);
textView.Closed += (s, e) => jsCodeStyleLintInvoker.Dispose();
textView.TextBuffer.Properties.GetOrCreateSingletonProperty(() => jsCodeStyleLintInvoker);
}
}
开发者ID:GProulx,项目名称:WebEssentials2013,代码行数:29,代码来源:JavaScriptCreationListener.cs
注:本文中的IVsTextView类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论