/// <inheritdoc />
        public ICompletionSource TryCreateCompletionSource(ITextBuffer textBuffer)
        {
            if(!MefProviderOptions.EnableExtendedXmlCommentsCompletion)
                return null;

            return new CSharpDocumentationCompletionSource(textBuffer, this);
        }
 public SurroundWith(IVsTextView adapter, IWpfTextView textView, ICompletionBroker broker)
     : base(adapter, textView, GuidList.guidFormattingCmdSet, PkgCmdIDList.SurroundWith)
 {
     _broker = broker;
     _view = textView;
     _buffer = textView.TextBuffer;
 }
Exemplo n.º 3
0
 public static ITaggerEventSource OnOptionChanged(
     ITextBuffer subjectBuffer,
     IOption option,
     TaggerDelay delay)
 {
     return new OptionChangedEventSource(subjectBuffer, option, delay);
 }
        public IQuickInfoSource TryCreateQuickInfoSource(ITextBuffer textBuffer)
        {
            var generalOptions = Setting.getGeneralOptions(_serviceProvider);
            if (generalOptions == null || !generalOptions.LinterEnabled) return null;

            return new LintQuickInfoSource(textBuffer, _viewTagAggregatorFactoryService);
        }
        public ICompletionSource TryCreateCompletionSource(ITextBuffer textBuffer)
        {
            if (!IntegrationOptionsProvider.GetOptions().EnableIntelliSense)
                return null;

            return new GherkinStepCompletionSource(textBuffer, GherkinLanguageServiceFactory.GetLanguageService(textBuffer));
        }
 public void Create(params string[] lines)
 {
     _textBuffer = EditorUtil.CreateTextBuffer(lines);
     _factory = new MockRepository(MockBehavior.Strict);
     _adapterRaw = new ResharperExternalEditAdapter();
     _adapter = _adapterRaw;
 }
 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;
 }
Exemplo n.º 8
0
 public static IEnumerable<Diagnostic> GetDiagnostics(ITextBuffer buffer)
 {
     lock (sync)
     {
         return GetClangAdapterForBuffer(buffer).GetDiagnostics();
     }
 }
Exemplo n.º 9
0
 public static PreprocessorAdapter GetPreprocessorAdapter(ITextBuffer buffer)
 {
     lock (sync)
     {
         return GetClangAdapterForBuffer(buffer).GetPreprocessor();
     }
 }
        public ISuggestedActionsSource CreateSuggestedActionsSource(ITextView textView, ITextBuffer textBuffer)
        {
            Contract.ThrowIfNull(textView);
            Contract.ThrowIfNull(textBuffer);

            return new Source(this, textView, textBuffer);
        }
Exemplo n.º 11
0
		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;
		}
        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);
        }
 internal VendorClassifier(IClassificationTypeRegistryService registry, ITextBuffer buffer)
 {
     _registry = registry;
     _buffer = buffer;
     _decClassification = _registry.GetClassificationType(ClassificationTypes._declaration);
     _valClassification = _registry.GetClassificationType(ClassificationTypes._value);
 }
Exemplo n.º 14
0
 /// <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;
 }
Exemplo n.º 15
0
 public AvaloniaDesignerPane(IVsCodeWindow vsCodeWindow, IVsTextLines textBuffer, string fileName, IAvaloniaDesignerSettings designerSettings)
 {
     _vsCodeWindow = vsCodeWindow;
     _textBuffer = textBuffer.GetTextBuffer();
     _fileName = fileName;
     _designerSettings = designerSettings;
 }
        public ScriptCompletionReplacementSource(ITextBuffer textBuffer)
        {
            _textBuffer = textBuffer;

            if (textBuffer.ContentType.TypeName.Equals("HTML", StringComparison.OrdinalIgnoreCase))
                _lbm = VsServiceManager.GetLanguageBlockManager(textBuffer);
        }
Exemplo n.º 17
0
        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;
        }
        /// <summary>
        /// Attempts to run code cleanup on the specified document.
        /// </summary>
        /// <param name="document">The document for cleanup.</param>
        /// <param name="textBuffer">The text buffer for the document.</param>
        internal void Cleanup(Document document, ITextBuffer textBuffer)
        {
            if (!_codeCleanupAvailabilityLogic.ShouldCleanup(document, true)) return;

            // Make sure the document to be cleaned up is active, required for some commands like format document.
            document.Activate();

            if (_package.IDE.ActiveDocument != document)
            {
                OutputWindowHelper.WriteLine(document.Name + " did not complete activation before cleaning started.");
            }

            _undoTransactionHelper.Run(
                delegate
                {
                    _package.IDE.StatusBar.Text = String.Format("EditorConfig is cleaning '{0}'...", document.Name);

                    // Perform the set of configured cleanups based on the language.
                    RunCodeCleanupGeneric(document, textBuffer);

                    _package.IDE.StatusBar.Text = String.Format("EditorConfig cleaned '{0}'.", document.Name);
                },
                delegate(Exception ex)
                {
                    OutputWindowHelper.WriteLine(String.Format("EditorConfig stopped cleaning '{0}': {1}", document.Name, ex));
                    _package.IDE.StatusBar.Text = String.Format("EditorConfig stopped cleaning '{0}'.  See output window for more details.", document.Name);
                });
        }
Exemplo n.º 19
0
 public RCompletionContext(ICompletionSession session, ITextBuffer textBuffer, AstRoot ast, int position)
 {
     Session = session;
     TextBuffer = textBuffer;
     Position = position;
     AstRoot = ast;
 }
Exemplo n.º 20
0
        public IClassifier GetClassifier(ITextBuffer buffer)
        {
            GherkinFileEditorParser parser = GetParser(buffer);

            return buffer.Properties.GetOrCreateSingletonProperty(() =>
                new GherkinFileClassifier(parser));
        }
Exemplo n.º 21
0
    public QuickInfoSource(ITextBuffer textBuffer, ITextViewTracker textViewTracker) {
      Contract.Requires(textBuffer != null);
      Contract.Requires(textViewTracker != null);

      _textBuffer = textBuffer;
      _textViewTracker = (TextViewTracker)textViewTracker;
    }
            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);
                }
            }
        internal PyClassifier(ITextBuffer textBuffer, IClassificationTypeRegistryService classificationRegistryService)
        {
            this.textBuffer = textBuffer;
            this.classificationRegistryService = classificationRegistryService;

            this.textBuffer.ReadOnlyRegionsChanged += new EventHandler<SnapshotSpanEventArgs>(textBuffer_ReadOnlyRegionsChanged);
        }
Exemplo n.º 24
0
        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;
        }
Exemplo n.º 25
0
        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;
        }
Exemplo n.º 26
0
        /// <summary>
        /// Create a Visual Studio simulation with the specified set of lines
        /// </summary>
        private void CreateCore(bool simulateResharper, bool usePeekRole, params string[] lines)
        {
            if (usePeekRole)
            {
                _textBuffer = CreateTextBuffer(lines);
                _textView = TextEditorFactoryService.CreateTextView(
                    _textBuffer,
                    TextEditorFactoryService.CreateTextViewRoleSet(PredefinedTextViewRoles.Document, PredefinedTextViewRoles.Editable, Constants.TextViewRoleEmbeddedPeekTextView));
            }
            else
            {
                _textView = CreateTextView(lines);
                _textBuffer = _textView.TextBuffer;
            }
            _vimBuffer = Vim.CreateVimBuffer(_textView);
            _bufferCoordinator = new VimBufferCoordinator(_vimBuffer);
            _vsSimulation = new VsSimulation(
                _bufferCoordinator,
                simulateResharper: simulateResharper,
                simulateStandardKeyMappings: false,
                editorOperationsFactoryService: EditorOperationsFactoryService,
                keyUtil: KeyUtil);

            VimHost.TryCustomProcessFunc = (textView, insertCommand) =>
                {
                    if (textView == _textView)
                    {
                        return _vsSimulation.VsCommandTarget.TryCustomProcess(insertCommand);
                    }

                    return false;
                };
        }
Exemplo n.º 27
0
        // 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;
        }
Exemplo n.º 28
0
        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);
            }
        }
        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;
                    }
                }
            }
        }
Exemplo n.º 30
0
 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);
 }
Exemplo n.º 31
0
 internal ExceptionCompletionAnalysis(IServiceProvider serviceProvider, ICompletionSession session, ITextView view, ITrackingSpan span, ITextBuffer textBuffer, CompletionOptions options)
     : base(serviceProvider, session, view, span, textBuffer, options)
 {
 }
Exemplo n.º 32
0
        internal static void CaptureExistingClassificationSpans(
            IViewClassifierAggregatorService classifierAggregator, ITextView textView, ITextBuffer textBuffer)
        {
            // No need to do this more than once.
            if (textBuffer.Properties.ContainsProperty(s_classificationsKey))
            {
                return;
            }

            // Capture the existing set of classifications and attach them to the buffer as a
            // property.
            var classifier = classifierAggregator.GetClassifier(textView);

            try
            {
                var classifications = classifier.GetClassificationSpans(textBuffer.CurrentSnapshot.GetSpan());
                textBuffer.Properties.AddProperty(s_classificationsKey, classifications);
            }
            finally
            {
                var disposable = classifier as IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
        }
Exemplo n.º 33
0
 public IClassifier GetClassifier(ITextBuffer textBuffer)
 {
     return(new InertClassifier(textBuffer));
 }
Exemplo n.º 34
0
 public TestCompletionSource(TestCompletionSourceProvider sourceProvider, ITextBuffer textBuffer)
 {
     m_sourceProvider            = sourceProvider;
     m_textBuffer                = textBuffer;
     fileSpecificTooltipProvider = new FileSpecificTooltipProvider();
 }
Exemplo n.º 35
0
 public ITrackingPoint GetTriggerPoint(ITextBuffer textBuffer)
 => throw new NotImplementedException();
 /// <summary>
 /// Gets the interactive window associated with the text buffer if the text
 /// buffer is being hosted in the interactive window.
 ///
 /// Returns null if the text buffer is not hosted in the interactive window.
 /// </summary>
 public static IInteractiveWindow GetInteractiveWindow(this ITextBuffer buffer)
 {
     return(InteractiveWindow.FromBuffer(buffer));
 }
Exemplo n.º 37
0
#pragma warning restore 649

        #region IClassifierProvider

        /// <summary>
        /// Gets a classifier for the given text buffer.
        /// </summary>
        /// <param name="buffer">The <see cref="ITextBuffer"/> to classify.</param>
        /// <returns>A classifier for the text buffer, or null if the provider cannot do so in its current state.</returns>
        public IClassifier GetClassifier(ITextBuffer buffer)
        {
            return(buffer.Properties.GetOrCreateSingletonProperty <EditorClassifier1>(creator: () => new EditorClassifier1(this.classificationRegistry)));
        }
Exemplo n.º 38
0
 public bool IsCurrent(ITextBuffer textBuffer)
 {
     return(IsCurrent(textBuffer.CurrentSnapshot));
 }
Exemplo n.º 39
0
 public GeneratorResults GenerateCode(ITextBuffer input)
 {
     return(GenerateCode(input, null, null, null, null));
 }
Exemplo n.º 40
0
 public ITagger <T> CreateTagger <T>(ITextBuffer buffer) where T : ITag
 {
     return(new DafnyTokenTagger(buffer) as ITagger <T>);
 }
Exemplo n.º 41
0
 public ParserResults ParseTemplate(ITextBuffer input)
 {
     return(ParseTemplate(input, null));
 }
Exemplo n.º 42
0
 public GeneratorResults GenerateCode(ITextBuffer input, CancellationToken?cancelToken)
 {
     return(GenerateCode(input, null, null, null, cancelToken));
 }
Exemplo n.º 43
0
 public GeneratorResults GenerateCode(ITextBuffer input, string className, string rootNamespace, string sourceFileName)
 {
     return(GenerateCode(input, className, rootNamespace, sourceFileName, null));
 }
Exemplo n.º 44
0
 public ParserResults ParseTemplate(ITextBuffer input, CancellationToken?cancelToken)
 {
     return(ParseTemplateCore(new TextBufferReader(input), cancelToken));
 }
Exemplo n.º 45
0
 private void RemoveRHistory(ITextBuffer textBuffer)
 {
     _histories.Remove(textBuffer);
 }
Exemplo n.º 46
0
 public GeneratorResults GenerateCode(ITextBuffer input, string className, string rootNamespace, string sourceFileName, CancellationToken?cancelToken)
 {
     return(GenerateCodeCore(new TextBufferReader(input), className, rootNamespace, sourceFileName, cancelToken));
 }
Exemplo n.º 47
0
 public IQuickInfoSource TryCreateQuickInfoSource(ITextBuffer textBuffer)
 {
     return(new QuickInfoSource(ClassificationFormatMapService, ClassificationService, DispatcherGlyphService));
 }
Exemplo n.º 48
0
 private void Create(params string[] lines)
 {
     _textBuffer = CreateTextBuffer(lines);
 }
Exemplo n.º 49
0
 private Document DocumentFromTextBuffer(ITextBuffer textBuffer)
 {
     return(IdeApp.Workbench.Documents.FirstOrDefault(doc => doc.TextBuffer == textBuffer));
 }
Exemplo n.º 50
0
        public IRHistory GetAssociatedRHistory(ITextBuffer textBuffer)
        {
            IRHistory history;

            return(_histories.TryGetValue(textBuffer, out history) ? history : null);
        }
Exemplo n.º 51
0
        public bool IsDirty(ITextBuffer textBuffer)
        {
            var doc = DocumentFromTextBuffer(textBuffer);

            return(doc.IsDirty);
        }
Exemplo n.º 52
0
 /// <inheritdoc />
 public bool IsEnabled(ITextBuffer buffer)
 {
     // Getting the configuration determines if spell checking is enabled for this file
     return(buffer != null && spellingService != null && spellingService.GetConfiguration(buffer) != null);
 }
Exemplo n.º 53
0
 protected virtual void Create(params string[] lines)
 {
     _vimBuffer  = CreateVimBuffer(lines);
     _textView   = _vimBuffer.TextView;
     _textBuffer = _textView.TextBuffer;
 }
Exemplo n.º 54
0
        public bool IsReadOnly(ITextBuffer textBuffer)
        {
            var doc = DocumentFromTextBuffer(textBuffer);

            return(doc.IsViewOnly);
        }
 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;
 }
 public DiagnosticsChangedEventSource(ITextBuffer subjectBuffer, IDiagnosticService service, TaggerDelay delay)
     : base(delay)
 {
     _subjectBuffer = subjectBuffer;
     _service = service;
 }
Exemplo n.º 57
0
        public ITagger <T> CreateTagger <T>(ITextBuffer buffer) where T : ITag
        {
            ITagAggregator <RustTokenTag> rustTagAgg = aggregatorFactory.CreateTagAggregator <RustTokenTag>(buffer);

            return(new VisualRustClassifier(buffer, rustTagAgg, ClassificationTypeRegistry) as ITagger <T>);
        }
        public ISuggestedActionsSource CreateSuggestedActionsSource(ITextView textView, ITextBuffer textBuffer)
        {
            if (this.TextDocumentFactoryService.TryGetTextDocument(textView.TextBuffer, out var document))
            {
                return(textView.Properties.GetOrCreateSingletonProperty(() =>
                                                                        new SuggestedActionsSource(this.ViewTagAggregatorFactoryService, this.SuggestedActionCategoryRegistry, textView, textBuffer, document.FilePath)));
            }

            return(null);
        }
 internal CompletionSource(ITextBuffer textBuffer, object completionDataKey)
 {
     _completionDataKey = completionDataKey;
     _textBuffer        = textBuffer;
 }
Exemplo n.º 60
0
 internal HaskellTokenTagger(ITextBuffer buffer)
 {
     this.buffer = buffer;
 }