本文整理汇总了C#中ITextBuffer类的典型用法代码示例。如果您正苦于以下问题:C# ITextBuffer类的具体用法?C# ITextBuffer怎么用?C# ITextBuffer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ITextBuffer类属于命名空间,在下文中一共展示了ITextBuffer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: TryCreateQuickInfoSource
public IQuickInfoSource TryCreateQuickInfoSource(ITextBuffer textBuffer)
{
var generalOptions = Setting.getGeneralOptions(_serviceProvider);
if (generalOptions == null || !generalOptions.LinterEnabled) return null;
return new LintQuickInfoSource(textBuffer, _viewTagAggregatorFactoryService);
}
开发者ID:ReedCopsey,项目名称:VisualFSharpPowerTools,代码行数:7,代码来源:LintQuickInfoProvider.cs
示例2: AbstractSnippetFunctionGenerateSwitchCases
public AbstractSnippetFunctionGenerateSwitchCases(AbstractSnippetExpansionClient snippetExpansionClient, ITextView textView, ITextBuffer subjectBuffer, string caseGenerationLocationField, string switchExpressionField)
: base(snippetExpansionClient, textView, subjectBuffer)
{
this.CaseGenerationLocationField = caseGenerationLocationField;
this.SwitchExpressionField = (switchExpressionField.Length >= 2 && switchExpressionField[0] == '$' && switchExpressionField[switchExpressionField.Length - 1] == '$')
? switchExpressionField.Substring(1, switchExpressionField.Length - 2) : switchExpressionField;
}
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:7,代码来源:AbstractSnippetFunctionGenerateSwitchCases.cs
示例3: TryCreateCompletionSource
public ICompletionSource TryCreateCompletionSource(ITextBuffer textBuffer)
{
if (!IntegrationOptionsProvider.GetOptions().EnableIntelliSense)
return null;
return new GherkinStepCompletionSource(textBuffer, GherkinLanguageServiceFactory.GetLanguageService(textBuffer));
}
开发者ID:roffster,项目名称:SpecFlow,代码行数:7,代码来源:GherkinStepCompletionSource.cs
示例4: GetResolveResult
public static ResolveResult GetResolveResult (Document doc, ITextBuffer editor)
{
ITextEditorResolver textEditorResolver = doc.GetContent<ITextEditorResolver> ();
if (textEditorResolver != null)
return textEditorResolver.GetLanguageItem (editor.CursorPosition);
/* Fallback (currently not needed)
// Look for an identifier at the cursor position
IParser parser = ProjectDomService.GetParserByFileName (editor.Name);
if (parser == null)
return;
ExpressionResult id = new ExpressionResult (editor.SelectedText);
if (String.IsNullOrEmpty (id.Expression)) {
IExpressionFinder finder = parser.CreateExpressionFinder (ctx);
if (finder == null)
return;
id = finder.FindFullExpression (editor.Text, editor.CursorPosition);
if (id == null)
return;
}
IResolver resolver = parser.CreateResolver (ctx, doc, editor.Name);
if (resolver == null)
return;
return resolver.Resolve (id, new DomLocation (line, column));
**/
return null;
}
开发者ID:stewartwhaley,项目名称:monodevelop,代码行数:26,代码来源:RefactoryCommands.cs
示例5: GetPreprocessorAdapter
public static PreprocessorAdapter GetPreprocessorAdapter(ITextBuffer buffer)
{
lock (sync)
{
return GetClangAdapterForBuffer(buffer).GetPreprocessor();
}
}
开发者ID:jizillon,项目名称:naggy,代码行数:7,代码来源:ClangServices.cs
示例6: VendorClassifier
internal VendorClassifier(IClassificationTypeRegistryService registry, ITextBuffer buffer)
{
_registry = registry;
_buffer = buffer;
_decClassification = _registry.GetClassificationType(ClassificationTypes._declaration);
_valClassification = _registry.GetClassificationType(ClassificationTypes._value);
}
开发者ID:LogoPhonix,项目名称:WebEssentials2012,代码行数:7,代码来源:VendorClassifier.cs
示例7: PyClassifier
internal PyClassifier(ITextBuffer textBuffer, IClassificationTypeRegistryService classificationRegistryService)
{
this.textBuffer = textBuffer;
this.classificationRegistryService = classificationRegistryService;
this.textBuffer.ReadOnlyRegionsChanged += new EventHandler<SnapshotSpanEventArgs>(textBuffer_ReadOnlyRegionsChanged);
}
开发者ID:kageyamaginn,项目名称:VSSDK-Extensibility-Samples,代码行数:7,代码来源:PyClassifier.cs
示例8: NavigationBarController
public NavigationBarController(
INavigationBarPresenter presenter,
ITextBuffer subjectBuffer,
IWaitIndicator waitIndicator,
IAsynchronousOperationListener asyncListener)
{
_presenter = presenter;
_subjectBuffer = subjectBuffer;
_waitIndicator = waitIndicator;
_asyncListener = asyncListener;
_workspaceRegistration = Workspace.GetWorkspaceRegistration(subjectBuffer.AsTextContainer());
_workspaceRegistration.WorkspaceChanged += OnWorkspaceRegistrationChanged;
presenter.CaretMoved += OnCaretMoved;
presenter.ViewFocused += OnViewFocused;
presenter.DropDownFocused += OnDropDownFocused;
presenter.ItemSelected += OnItemSelected;
subjectBuffer.PostChanged += OnSubjectBufferPostChanged;
// Initialize the tasks to be an empty model so we never have to deal with a null case.
_modelTask = Task.FromResult(
new NavigationBarModel(
SpecializedCollections.EmptyList<NavigationBarItem>(),
default(VersionStamp),
null));
_selectedItemInfoTask = Task.FromResult(new NavigationBarSelectedTypeAndMember(null, null));
if (_workspaceRegistration.Workspace != null)
{
ConnectToWorkspace(_workspaceRegistration.Workspace);
}
}
开发者ID:Rickinio,项目名称:roslyn,代码行数:35,代码来源:NavigationBarController.cs
示例9: FileChange
public FileChange(TextDocument left,
TextDocument right,
IComponentModel componentModel,
AbstractChange parent,
PreviewEngine engine,
IVsImageService2 imageService) : base(engine)
{
Contract.ThrowIfFalse(left != null || right != null);
this.Id = left != null ? left.Id : right.Id;
_left = left;
_right = right;
_imageService = imageService;
_componentModel = componentModel;
var bufferFactory = componentModel.GetService<ITextBufferFactoryService>();
var bufferText = left != null ?
left.GetTextAsync(CancellationToken.None).WaitAndGetResult(CancellationToken.None) :
right.GetTextAsync(CancellationToken.None).WaitAndGetResult(CancellationToken.None);
_buffer = bufferFactory.CreateTextBuffer(bufferText.ToString(), bufferFactory.InertContentType);
_encoding = bufferText.Encoding;
this.Children = ComputeChildren(left, right, CancellationToken.None);
this.parent = parent;
}
开发者ID:RoryVL,项目名称:roslyn,代码行数:25,代码来源:FileChange.cs
示例10: TextChange
public TextChange(int oldPosition, int oldLength, ITextBuffer oldBuffer, int newPosition, int newLength, ITextBuffer newBuffer)
: this()
{
if (oldPosition < 0)
{
throw new ArgumentOutOfRangeException("oldPosition", String.Format(CultureInfo.CurrentCulture, CommonResources.Argument_Must_Be_GreaterThanOrEqualTo, "0"));
}
if (newPosition < 0)
{
throw new ArgumentOutOfRangeException("newPosition", String.Format(CultureInfo.CurrentCulture, CommonResources.Argument_Must_Be_GreaterThanOrEqualTo, "0"));
}
if (oldLength < 0)
{
throw new ArgumentOutOfRangeException("oldLength", String.Format(CultureInfo.CurrentCulture, CommonResources.Argument_Must_Be_GreaterThanOrEqualTo, "0"));
}
if (newLength < 0)
{
throw new ArgumentOutOfRangeException("newLength", String.Format(CultureInfo.CurrentCulture, CommonResources.Argument_Must_Be_GreaterThanOrEqualTo, "0"));
}
if (oldBuffer == null)
{
throw new ArgumentNullException("oldBuffer");
}
if (newBuffer == null)
{
throw new ArgumentNullException("newBuffer");
}
OldPosition = oldPosition;
NewPosition = newPosition;
OldLength = oldLength;
NewLength = newLength;
NewBuffer = newBuffer;
OldBuffer = oldBuffer;
}
开发者ID:modulexcite,项目名称:Transformalize,代码行数:35,代码来源:TextChange.cs
示例11: EnableFullIntelliSense
// Statement completion
public bool EnableFullIntelliSense(ITextBuffer buffer, SnapshotPoint point)
{
var tokens = GetSemanticModel(buffer);
var type = tokens.GetContextSpan(point).Type;
return type == ContextType.CodeBlock || type == ContextType.Lambda;
}
开发者ID:Kymeric,项目名称:Typewriter,代码行数:8,代码来源:Editor.cs
示例12: DiffUpdateBackgroundParser
public DiffUpdateBackgroundParser(ITextBuffer textBuffer, ITextBuffer documentBuffer, TaskScheduler taskScheduler, ITextDocumentFactoryService textDocumentFactoryService, IGitCommands commands)
: base(textBuffer, taskScheduler, textDocumentFactoryService)
{
_documentBuffer = documentBuffer;
_commands = commands;
ReparseDelay = TimeSpan.FromMilliseconds(500);
if (TextDocumentFactoryService.TryGetTextDocument(_documentBuffer, out _textDocument))
{
if (_commands.IsGitRepository(_textDocument.FilePath))
{
_textDocument.FileActionOccurred += OnFileActionOccurred;
var solutionDirectory = _commands.GetGitRepository(_textDocument.FilePath);
if (!string.IsNullOrWhiteSpace(solutionDirectory))
{
var gitDirectory = Path.Combine(solutionDirectory, ".git");
_watcher = new FileSystemWatcher(gitDirectory);
_watcher.Changed += HandleFileSystemChanged;
_watcher.Created += HandleFileSystemChanged;
_watcher.Deleted += HandleFileSystemChanged;
_watcher.Renamed += HandleFileSystemChanged;
_watcher.EnableRaisingEvents = true;
}
}
}
}
开发者ID:275208498,项目名称:GitDiffMargin,代码行数:28,代码来源:DiffUpdateBackgroundParser.cs
示例13: TryGetController
public bool TryGetController(ITextView textView, ITextBuffer subjectBuffer, out Controller controller)
{
AssertIsForeground();
// check whether this feature is on.
if (!subjectBuffer.GetOption(InternalFeatureOnOffOptions.CompletionSet))
{
controller = null;
return false;
}
// If we don't have a presenter, then there's no point in us even being involved. Just
// defer to the next handler in the chain.
// Also, if there's an inline rename session then we do not want completion.
if (_completionPresenter == null || _inlineRenameService.ActiveSession != null)
{
controller = null;
return false;
}
var autobraceCompletionCharSet = GetAllAutoBraceCompletionChars(subjectBuffer.ContentType);
controller = Controller.GetInstance(
textView, subjectBuffer,
_editorOperationsFactoryService, _undoHistoryRegistry, _completionPresenter,
new AggregateAsynchronousOperationListener(_asyncListeners, FeatureAttribute.CompletionSet),
_allCompletionProviders, autobraceCompletionCharSet);
return true;
}
开发者ID:GeertVL,项目名称:roslyn,代码行数:30,代码来源:AsyncCompletionService.cs
示例14: TagComputer
public TagComputer(
ITextBuffer subjectBuffer,
IForegroundNotificationService notificationService,
IAsynchronousOperationListener asyncListener,
ClassificationTypeMap typeMap,
SyntacticClassificationTaggerProvider taggerProvider)
{
_subjectBuffer = subjectBuffer;
_notificationService = notificationService;
_listener = asyncListener;
_typeMap = typeMap;
_taggerProvider = taggerProvider;
_workQueue = new AsynchronousSerialWorkQueue(asyncListener);
_reportChangeCancellationSource = new CancellationTokenSource();
_lastLineCache = new LastLineCache();
_workspaceRegistration = Workspace.GetWorkspaceRegistration(subjectBuffer.AsTextContainer());
_workspaceRegistration.WorkspaceChanged += OnWorkspaceRegistrationChanged;
if (_workspaceRegistration.Workspace != null)
{
ConnectToWorkspace(_workspaceRegistration.Workspace);
}
}
开发者ID:rgani,项目名称:roslyn,代码行数:26,代码来源:SyntacticClassificationTaggerProvider.TagComputer.cs
示例15: ImportSmartTagAction
/// <summary>
/// Creates a new smart tag action for a "from fob import oar" smart tag.
/// </summary>
public ImportSmartTagAction(string fromName, string name, ITextBuffer buffer, ITextView view, IServiceProvider serviceProvider)
: base(serviceProvider, RefactoringIconKind.AddUsing) {
FromName = fromName;
Name = name;
_buffer = buffer;
_view = view;
}
开发者ID:wenh123,项目名称:PTVS,代码行数:10,代码来源:ImportSmartTagAction.cs
示例16: Create
public void Create(params string[] lines)
{
_textView = CreateTextView(lines);
_textView.Caret.MoveTo(new SnapshotPoint(_textView.TextSnapshot, 0));
_textBuffer = _textView.TextBuffer;
_factory = new MockRepository(MockBehavior.Strict);
_editOpts = _factory.Create<IEditorOperations>();
_vimHost = _factory.Create<IVimHost>();
_vimHost.Setup(x => x.IsDirty(It.IsAny<ITextBuffer>())).Returns(false);
_operations = _factory.Create<ICommonOperations>();
_operations.SetupGet(x => x.EditorOperations).Returns(_editOpts.Object);
_statusUtil = _factory.Create<IStatusUtil>();
_fileSystem = _factory.Create<IFileSystem>(MockBehavior.Strict);
_foldManager = _factory.Create<IFoldManager>(MockBehavior.Strict);
_vimData = new VimData();
_vim = MockObjectFactory.CreateVim(RegisterMap, host: _vimHost.Object, vimData: _vimData, factory: _factory);
var localSettings = new LocalSettings(Vim.GlobalSettings);
var vimTextBuffer = MockObjectFactory.CreateVimTextBuffer(
_textBuffer,
vim: _vim.Object,
localSettings: localSettings,
factory: _factory);
var vimBufferData = CreateVimBufferData(
vimTextBuffer.Object,
_textView,
statusUtil: _statusUtil.Object);
var vimBuffer = CreateVimBuffer(vimBufferData);
_interpreter = new Interpreter.VimInterpreter(
vimBuffer,
_operations.Object,
_foldManager.Object,
_fileSystem.Object,
_factory.Create<IBufferTrackingService>().Object);
}
开发者ID:wmchristie,项目名称:VsVim,代码行数:34,代码来源:CommandProcessorLegacyTest.cs
示例17: GetSmartTagActions
public override IEnumerable<ISmartTagAction> GetSmartTagActions(JSONMember item, ITextBuffer buffer)
{
string directory = Path.GetDirectoryName(buffer.GetFileName());
if (item.Value != null && item.Value.Text.Trim('"').Length > 0)
yield return new UpdatePackageAction(item.UnquotedNameText, directory);
}
开发者ID:XmlmXmlmX,项目名称:JSON-Intellisense,代码行数:7,代码来源:BowerUpdatePackage.cs
示例18: GetClassifier
public IClassifier GetClassifier(ITextBuffer buffer)
{
GherkinFileEditorParser parser = GetParser(buffer);
return buffer.Properties.GetOrCreateSingletonProperty(() =>
new GherkinFileClassifier(parser));
}
开发者ID:bondsbw,项目名称:SpecFlow,代码行数:7,代码来源:GherkinFileClassifier.cs
示例19: CreateSuggestedActionsSource
public ISuggestedActionsSource CreateSuggestedActionsSource(ITextView textView, ITextBuffer textBuffer)
{
Contract.ThrowIfNull(textView);
Contract.ThrowIfNull(textBuffer);
return new Source(this, textView, textBuffer);
}
开发者ID:JackWangCUMT,项目名称:roslyn,代码行数:7,代码来源:SuggestedActionsSourceProvider.cs
示例20: QuickInfoSource
public QuickInfoSource(ITextBuffer textBuffer, ITextViewTracker textViewTracker) {
Contract.Requires(textBuffer != null);
Contract.Requires(textViewTracker != null);
_textBuffer = textBuffer;
_textViewTracker = (TextViewTracker)textViewTracker;
}
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:7,代码来源:QuickInfo.cs
注:本文中的ITextBuffer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论