当前位置: 首页>>代码示例>>C#>>正文


C# ITextBuffer类代码示例

本文整理汇总了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);
        }
开发者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


注:本文中的ITextBuffer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。