本文整理汇总了C#中ITextBuffer类的典型用法代码示例。如果您正苦于以下问题:C# ITextBuffer类的具体用法?C# ITextBuffer怎么用?C# ITextBuffer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ITextBuffer类属于命名空间,在下文中一共展示了ITextBuffer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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;
}
示例3: TryCreateCompletionSource
public ICompletionSource TryCreateCompletionSource(ITextBuffer textBuffer)
{
if (!IntegrationOptionsProvider.GetOptions().EnableIntelliSense)
return null;
return new GherkinStepCompletionSource(textBuffer, GherkinLanguageServiceFactory.GetLanguageService(textBuffer));
}
示例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;
}
示例5: GetPreprocessorAdapter
public static PreprocessorAdapter GetPreprocessorAdapter(ITextBuffer buffer)
{
lock (sync)
{
return GetClangAdapterForBuffer(buffer).GetPreprocessor();
}
}
示例6: VendorClassifier
internal VendorClassifier(IClassificationTypeRegistryService registry, ITextBuffer buffer)
{
_registry = registry;
_buffer = buffer;
_decClassification = _registry.GetClassificationType(ClassificationTypes._declaration);
_valClassification = _registry.GetClassificationType(ClassificationTypes._value);
}
示例7: PyClassifier
internal PyClassifier(ITextBuffer textBuffer, IClassificationTypeRegistryService classificationRegistryService)
{
this.textBuffer = textBuffer;
this.classificationRegistryService = classificationRegistryService;
this.textBuffer.ReadOnlyRegionsChanged += new EventHandler<SnapshotSpanEventArgs>(textBuffer_ReadOnlyRegionsChanged);
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
}
}
示例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;
}
示例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);
}
}
示例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;
}