/// <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; }
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; }
public static IEnumerable<Diagnostic> GetDiagnostics(ITextBuffer buffer) { lock (sync) { return GetClangAdapterForBuffer(buffer).GetDiagnostics(); } }
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); }
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); }
/// <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; }
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); }
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); }); }
public RCompletionContext(ICompletionSession session, ITextBuffer textBuffer, AstRoot ast, int position) { Session = session; TextBuffer = textBuffer; Position = position; AstRoot = ast; }
public IClassifier GetClassifier(ITextBuffer buffer) { GherkinFileEditorParser parser = GetParser(buffer); return buffer.Properties.GetOrCreateSingletonProperty(() => new GherkinFileClassifier(parser)); }
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); }
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; }
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; }
/// <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; }; }
// 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; }
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; } } } }
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); }
internal ExceptionCompletionAnalysis(IServiceProvider serviceProvider, ICompletionSession session, ITextView view, ITrackingSpan span, ITextBuffer textBuffer, CompletionOptions options) : base(serviceProvider, session, view, span, textBuffer, options) { }
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(); } } }
public IClassifier GetClassifier(ITextBuffer textBuffer) { return(new InertClassifier(textBuffer)); }
public TestCompletionSource(TestCompletionSourceProvider sourceProvider, ITextBuffer textBuffer) { m_sourceProvider = sourceProvider; m_textBuffer = textBuffer; fileSpecificTooltipProvider = new FileSpecificTooltipProvider(); }
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)); }
#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))); }
public bool IsCurrent(ITextBuffer textBuffer) { return(IsCurrent(textBuffer.CurrentSnapshot)); }
public GeneratorResults GenerateCode(ITextBuffer input) { return(GenerateCode(input, null, null, null, null)); }
public ITagger <T> CreateTagger <T>(ITextBuffer buffer) where T : ITag { return(new DafnyTokenTagger(buffer) as ITagger <T>); }
public ParserResults ParseTemplate(ITextBuffer input) { return(ParseTemplate(input, null)); }
public GeneratorResults GenerateCode(ITextBuffer input, CancellationToken?cancelToken) { return(GenerateCode(input, null, null, null, cancelToken)); }
public GeneratorResults GenerateCode(ITextBuffer input, string className, string rootNamespace, string sourceFileName) { return(GenerateCode(input, className, rootNamespace, sourceFileName, null)); }
public ParserResults ParseTemplate(ITextBuffer input, CancellationToken?cancelToken) { return(ParseTemplateCore(new TextBufferReader(input), cancelToken)); }
private void RemoveRHistory(ITextBuffer textBuffer) { _histories.Remove(textBuffer); }
public GeneratorResults GenerateCode(ITextBuffer input, string className, string rootNamespace, string sourceFileName, CancellationToken?cancelToken) { return(GenerateCodeCore(new TextBufferReader(input), className, rootNamespace, sourceFileName, cancelToken)); }
public IQuickInfoSource TryCreateQuickInfoSource(ITextBuffer textBuffer) { return(new QuickInfoSource(ClassificationFormatMapService, ClassificationService, DispatcherGlyphService)); }
private void Create(params string[] lines) { _textBuffer = CreateTextBuffer(lines); }
private Document DocumentFromTextBuffer(ITextBuffer textBuffer) { return(IdeApp.Workbench.Documents.FirstOrDefault(doc => doc.TextBuffer == textBuffer)); }
public IRHistory GetAssociatedRHistory(ITextBuffer textBuffer) { IRHistory history; return(_histories.TryGetValue(textBuffer, out history) ? history : null); }
public bool IsDirty(ITextBuffer textBuffer) { var doc = DocumentFromTextBuffer(textBuffer); return(doc.IsDirty); }
/// <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); }
protected virtual void Create(params string[] lines) { _vimBuffer = CreateVimBuffer(lines); _textView = _vimBuffer.TextView; _textBuffer = _textView.TextBuffer; }
public bool IsReadOnly(ITextBuffer textBuffer) { var doc = DocumentFromTextBuffer(textBuffer); return(doc.IsViewOnly); }
public DiagnosticsChangedEventSource(ITextBuffer subjectBuffer, IDiagnosticService service, TaggerDelay delay) : base(delay) { _subjectBuffer = subjectBuffer; _service = service; }
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; }
internal HaskellTokenTagger(ITextBuffer buffer) { this.buffer = buffer; }