public BottomMargin(IWpfTextView textView, IClassifierAggregatorService classifier, ITextDocumentFactoryService documentService)
        {
            _textView = textView;
            _classifier = classifier.GetClassifier(textView.TextBuffer);
            _foregroundBrush = new SolidColorBrush((Color)FindResource(VsColors.CaptionTextKey));
            _backgroundBrush = new SolidColorBrush((Color)FindResource(VsColors.ScrollBarBackgroundKey));

            this.Background = _backgroundBrush;
            this.ClipToBounds = true;

            _lblEncoding = new TextControl("Encoding");
            this.Children.Add(_lblEncoding);

            _lblContentType = new TextControl("Content type");
            this.Children.Add(_lblContentType);

            _lblClassification = new TextControl("Classification");
            this.Children.Add(_lblClassification);

            _lblSelection = new TextControl("Selection");
            this.Children.Add(_lblSelection);

            UpdateClassificationLabel();
            UpdateContentTypeLabel();
            UpdateContentSelectionLabel();

            if (documentService.TryGetTextDocument(textView.TextDataModel.DocumentBuffer, out _doc))
            {
                _doc.FileActionOccurred += FileChangedOnDisk;
                UpdateEncodingLabel(_doc);
            }

            textView.Caret.PositionChanged += CaretPositionChanged;
        }
 public BackgroundParser(ITextBuffer textBuffer, ITextDocumentFactoryService textDocumentFactoryService, IOutputWindowService outputWindowService)
     : this(textBuffer, TaskScheduler.Default, textDocumentFactoryService, outputWindowService, PredefinedOutputWindowPanes.TvlDiagnostics)
 {
     Contract.Requires(textBuffer != null);
     Contract.Requires(textDocumentFactoryService != null);
     Contract.Requires(outputWindowService != null);
 }
        internal 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 repositoryDirectory = _commands.GetGitRepository(_textDocument.FilePath);
                    if (repositoryDirectory != null)
                    {
                        _watcher = new FileSystemWatcher(repositoryDirectory);
                        _watcher.Changed += HandleFileSystemChanged;
                        _watcher.Created += HandleFileSystemChanged;
                        _watcher.Deleted += HandleFileSystemChanged;
                        _watcher.Renamed += HandleFileSystemChanged;
                        _watcher.EnableRaisingEvents = true;
                    }
                }
            }
        }
        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.º 5
0
		public InstantVisualStudio (IWpfTextView view, ITextDocumentFactoryService textDocumentFactoryService)
		{
			this.view = view;
			this.layer = view.GetAdornmentLayer("Instant.VisualStudio");

			//Listen to any event that changes the layout (text changes, scrolling, etc)
			this.view.LayoutChanged += OnLayoutChanged;

			this.dispatcher = Dispatcher.CurrentDispatcher;

			this.evaluator.EvaluationCompleted += OnEvaluationCompleted;
			this.evaluator.Start();

			this.dte.Events.BuildEvents.OnBuildProjConfigDone += OnBuildProjeConfigDone;
			this.dte.Events.BuildEvents.OnBuildDone += OnBuildDone;
			this.dte.Events.BuildEvents.OnBuildBegin += OnBuildBegin;

			this.statusbar = (IVsStatusbar)this.serviceProvider.GetService (typeof (IVsStatusbar));

			ITextDocument textDocument;
			if (!textDocumentFactoryService.TryGetTextDocument (view.TextBuffer, out textDocument))
				throw new InvalidOperationException();

			this.document = this.dte.Documents.OfType<EnvDTE.Document>().FirstOrDefault (d => d.FullName == textDocument.FilePath);

			InstantTagToggleAction.Toggled += OnInstantToggled;
		}
Exemplo n.º 6
0
        public BottomMargin(IWpfTextView textView, IClassifierAggregatorService classifier, ITextDocumentFactoryService documentService)
        {
            _textView = textView;
            _classifier = classifier.GetClassifier(textView.TextBuffer);

            SetResourceReference(BackgroundProperty, EnvironmentColors.ScrollBarBackgroundBrushKey);

            ClipToBounds = true;

            _lblEncoding = new TextControl("Encoding");
            Children.Add(_lblEncoding);

            _lblContentType = new TextControl("Content type");
            Children.Add(_lblContentType);

            _lblClassification = new TextControl("Classification");
            Children.Add(_lblClassification);

            _lblSelection = new TextControl("Selection");
            Children.Add(_lblSelection);

            UpdateClassificationLabel();
            UpdateContentTypeLabel();
            UpdateContentSelectionLabel();

            if (documentService.TryGetTextDocument(textView.TextDataModel.DocumentBuffer, out _doc))
            {
                _doc.FileActionOccurred += FileChangedOnDisk;
                UpdateEncodingLabel(_doc);
            }

            textView.Caret.PositionChanged += CaretPositionChanged;
        }
        public GoToDefinitionFilterProvider(
            [Import(typeof(SVsServiceProvider))] System.IServiceProvider serviceProvider,
            IVsEditorAdaptersFactoryService editorFactory,
            IEditorOptionsFactoryService editorOptionsFactory,
            ITextDocumentFactoryService textDocumentFactoryService,
            [Import(typeof(DotNetReferenceSourceProvider))] ReferenceSourceProvider referenceSourceProvider,
            VSLanguageService fsharpVsLanguageService,
            ProjectFactory projectFactory)
        {
            _serviceProvider = serviceProvider;
            _editorFactory = editorFactory;
            _editorOptionsFactory = editorOptionsFactory;
            _textDocumentFactoryService = textDocumentFactoryService;
            _referenceSourceProvider = referenceSourceProvider;
            _fsharpVsLanguageService = fsharpVsLanguageService;
            _projectFactory = projectFactory;

            var dte = serviceProvider.GetService(typeof(SDTE)) as DTE;
            var events = dte.Events as Events2;
            if (events != null)
            {
                _solutionEvents = events.SolutionEvents;
                _solutionEvents.AfterClosing += Cleanup;
            }
        }
        public DiffMarginViewModel(DiffMargin margin, IWpfTextView textView, ITextDocumentFactoryService textDocumentFactoryService, IGitCommands gitCommands)
        {
            if (margin == null)
                throw new ArgumentNullException("margin");
            if (textView == null)
                throw new ArgumentNullException("textView");
            if (textDocumentFactoryService == null)
                throw new ArgumentNullException("textDocumentFactoryService");
            if (gitCommands == null)
                throw new ArgumentNullException("gitCommands");

            _margin = margin;
            _textView = textView;
            _gitCommands = gitCommands;
            _diffViewModels = new ObservableCollection<DiffViewModel>();
            _previousChangeCommand = new RelayCommand<DiffViewModel>(PreviousChange, PreviousChangeCanExecute);
            _nextChangeCommand = new RelayCommand<DiffViewModel>(NextChange, NextChangeCanExecute);

            _textView.LayoutChanged += OnLayoutChanged;
            _textView.ViewportHeightChanged += OnViewportHeightChanged;

            _parser = new DiffUpdateBackgroundParser(textView.TextBuffer, TaskScheduler.Default, textDocumentFactoryService, gitCommands);
            _parser.ParseComplete += HandleParseComplete;
            _parser.RequestParse(false);
        }
Exemplo n.º 9
0
        public AntlrBackgroundParser(ITextBuffer textBuffer, TaskScheduler taskScheduler, ITextDocumentFactoryService textDocumentFactoryService, IOutputWindowService outputWindowService)
            : base(textBuffer, taskScheduler, textDocumentFactoryService, outputWindowService)
        {
            Contract.Requires(textBuffer != null);
            Contract.Requires(taskScheduler != null);
            Contract.Requires(textDocumentFactoryService != null);
            Contract.Requires(outputWindowService != null);

            if (!_initialized)
            {
                try
                {
                    // have to create an instance of the tool to make sure the error manager gets initialized
                    new AntlrTool();
                }
                catch (Exception e)
                {
                    if (ErrorHandler.IsCriticalException(e))
                        throw;
                }


                _initialized = true;
            }
        }
Exemplo n.º 10
0
 protected VimHost(
     ITextDocumentFactoryService textDocumentFactoryService,
     IEditorOperationsFactoryService editorOperationsFactoryService)
 {
     _textDocumentFactoryService = textDocumentFactoryService;
     _editorOperationsFactoryService = editorOperationsFactoryService;
 }
Exemplo n.º 11
0
 public CompletionSource(CompletionSourceProvider provider, ITextBuffer buffer, ITextDocumentFactoryService textDocumentFactory, DartAnalysisServiceFactory analysisServiceFactory)
 {
     this.provider = provider;
     this.buffer = buffer;
     this.textDocumentFactory = textDocumentFactory;
     this.analysisServiceFactory = analysisServiceFactory;
 }
Exemplo n.º 12
0
        internal VsVimHost(
            IVsAdapter adapter,
            ITextBufferFactoryService textBufferFactoryService,
            ITextEditorFactoryService textEditorFactoryService,
            ITextDocumentFactoryService textDocumentFactoryService,
            ITextBufferUndoManagerProvider undoManagerProvider,
            IVsEditorAdaptersFactoryService editorAdaptersFactoryService,
            IEditorOperationsFactoryService editorOperationsFactoryService,
            IWordUtilFactory wordUtilFactory,
            ITextManager textManager,
            ISharedServiceFactory sharedServiceFactory,
            SVsServiceProvider serviceProvider)
            : base(textBufferFactoryService, textEditorFactoryService, textDocumentFactoryService, editorOperationsFactoryService)
        {
            _vsAdapter = adapter;
            _editorAdaptersFactoryService = editorAdaptersFactoryService;
            _wordUtilFactory = wordUtilFactory;
            _dte = (_DTE)serviceProvider.GetService(typeof(_DTE));
            _vsExtensibility = (IVsExtensibility)serviceProvider.GetService(typeof(IVsExtensibility));
            _textManager = textManager;
            _sharedService = sharedServiceFactory.Create();
            _vsMonitorSelection = serviceProvider.GetService<SVsShellMonitorSelection, IVsMonitorSelection>();

            uint cookie;
            _vsMonitorSelection.AdviseSelectionEvents(this, out cookie);
        }
Exemplo n.º 13
0
        internal VsVimHost(
            IVsAdapter adapter,
            ITextBufferFactoryService textBufferFactoryService,
            ITextEditorFactoryService textEditorFactoryService,
            ITextDocumentFactoryService textDocumentFactoryService,
            ITextBufferUndoManagerProvider undoManagerProvider,
            IVsEditorAdaptersFactoryService editorAdaptersFactoryService,
            IEditorOperationsFactoryService editorOperationsFactoryService,
            ISmartIndentationService smartIndentationService,
            ITextManager textManager,
            ISharedServiceFactory sharedServiceFactory,
            IVimApplicationSettings vimApplicationSettings,
            SVsServiceProvider serviceProvider)
            : base(textBufferFactoryService, textEditorFactoryService, textDocumentFactoryService, editorOperationsFactoryService)
        {
            _vsAdapter = adapter;
            _editorAdaptersFactoryService = editorAdaptersFactoryService;
            _dte = (_DTE)serviceProvider.GetService(typeof(_DTE));
            _vsExtensibility = (IVsExtensibility)serviceProvider.GetService(typeof(IVsExtensibility));
            _textManager = textManager;
            _sharedService = sharedServiceFactory.Create();
            _vsMonitorSelection = serviceProvider.GetService<SVsShellMonitorSelection, IVsMonitorSelection>();
            _fontProperties = new TextEditorFontProperties(serviceProvider);
            _vimApplicationSettings = vimApplicationSettings;
            _smartIndentationService = smartIndentationService;

            uint cookie;
            _vsMonitorSelection.AdviseSelectionEvents(this, out cookie);
        }
Exemplo n.º 14
0
 internal TextManager(
     IVsAdapter adapter,
     ITextDocumentFactoryService textDocumentFactoryService,
     ITextBufferFactoryService textBufferFactoryService,
     ISharedServiceFactory sharedServiceFactory,
     SVsServiceProvider serviceProvider) : this(adapter, textDocumentFactoryService, textBufferFactoryService, sharedServiceFactory.Create(), serviceProvider)
 {
 }
Exemplo n.º 15
0
 internal VimHostImpl(
     ITextBufferFactoryService textBufferFactoryService,
     ITextEditorFactoryService textEditorFactoryService,
     ITextDocumentFactoryService textDocumentFactoryService,
     IEditorOperationsFactoryService editorOperationsFactoryService) :
     base(textBufferFactoryService, textEditorFactoryService, textDocumentFactoryService, editorOperationsFactoryService)
 {
 }
 private PhpOutliningBackgroundParser(ITextBuffer textBuffer, TaskScheduler taskScheduler, IOutputWindowService outputWindowService, ITextDocumentFactoryService textDocumentFactoryService)
     : base(textBuffer, taskScheduler, textDocumentFactoryService, outputWindowService)
 {
     Contract.Requires(textBuffer != null);
     Contract.Requires(taskScheduler != null);
     Contract.Requires(outputWindowService != null);
     Contract.Requires(textDocumentFactoryService != null);
 }
        internal static PhpOutliningBackgroundParser CreateParser(ITextBuffer textBuffer, TaskScheduler taskScheduler, IOutputWindowService outputWindowService, ITextDocumentFactoryService textDocumentFactoryService)
        {
            Contract.Requires<ArgumentNullException>(textBuffer != null, "textBuffer");
            Contract.Requires<ArgumentNullException>(taskScheduler != null, "taskScheduler");
            Contract.Requires<ArgumentNullException>(outputWindowService != null, "outputWindowService");
            Contract.Requires<ArgumentNullException>(textDocumentFactoryService != null, "textDocumentFactoryService");

            return new PhpOutliningBackgroundParser(textBuffer, taskScheduler, outputWindowService, textDocumentFactoryService);
        }
Exemplo n.º 18
0
 protected VimHostTest()
 {
     _textDocumentFactoryService = CompositionContainer.GetExportedValue<ITextDocumentFactoryService>();
     _vimHost = new VimHostImpl(
         TextBufferFactoryService,
         TextEditorFactoryService,
         _textDocumentFactoryService,
         EditorOperationsFactoryService);
 }
        public MarkdownBackgroundParser(ITextBuffer textBuffer, TaskScheduler taskScheduler, ITextDocumentFactoryService textDocumentFactoryService)
            : base(textBuffer, taskScheduler, textDocumentFactoryService)
        {
            ReparseDelay = TimeSpan.FromMilliseconds(300);

            ITextDocument document;
            if (textDocumentFactoryService.TryGetTextDocument(textBuffer, out document))
                this.LoadRuleset(document);
        }
 public PreviewWindowBackgroundParser(ITextBuffer textBuffer, TaskScheduler taskScheduler, ITextDocumentFactoryService textDocumentFactoryService)
     : base(textBuffer, taskScheduler, textDocumentFactoryService)
 {
     ReparseDelay = TimeSpan.FromMilliseconds(1000);
     if (!textDocumentFactoryService.TryGetTextDocument(textBuffer, out document))
     {
         document = null;
     }
     markdownTransform.DocumentToTransformPath = document == null ? null : document.FilePath;
 }
Exemplo n.º 21
0
 public SyntaxErrorManager(BackgroundParser backgroundParser, ITextView textView, IOptionsService optionsService, IServiceProvider serviceProvider, ITextDocumentFactoryService textDocumentFactoryService)
     : base(textView, optionsService, serviceProvider, textDocumentFactoryService)
 {
     backgroundParser.SubscribeToThrottledSyntaxTreeAvailable(BackgroundParserSubscriptionDelay.OnIdle,
         async x => await ExceptionHelper.TryCatchCancellation(() =>
         {
             RefreshErrors(x.Snapshot, x.CancellationToken);
             return Task.FromResult(0);
         }));
 }
 public PackageInitializerViewHandler(
   [Import(typeof(SVsServiceProvider))]IServiceProvider serviceProvider,
   IVsEditorAdaptersFactoryService adaptersFactoryService,
   IFileRegistrationRequestService fileRegistrationRequestService,
   ITextDocumentFactoryService textDocumentFactoryService) {
   _serviceProvider = serviceProvider;
   _adaptersFactoryService = adaptersFactoryService;
   _fileRegistrationRequestService = fileRegistrationRequestService;
   _textDocumentFactoryService = textDocumentFactoryService;
 }
Exemplo n.º 23
0
 internal TextManager(
     IVsAdapter adapter,
     ITextDocumentFactoryService textDocumentFactoryService,
     SVsServiceProvider serviceProvider)
 {
     _vsAdapter = adapter;
     _serviceProvider = serviceProvider;
     _textManager = _serviceProvider.GetService<SVsTextManager, IVsTextManager>();
     _textDocumentFactoryService = textDocumentFactoryService;
     _table = new RunningDocumentTable(_serviceProvider);
 }
        public PreviewWindowBackgroundParser(ITextBuffer textBuffer, TaskScheduler taskScheduler, ITextDocumentFactoryService textDocumentFactoryService)
            : base(textBuffer, taskScheduler, textDocumentFactoryService)
        {
            ReparseDelay = TimeSpan.FromMilliseconds(1000);

            ITextDocument markdownDocument;
            if (textDocumentFactoryService.TryGetTextDocument(textBuffer, out markdownDocument))
            {
                markdownDocumentPath = markdownDocument.FilePath;
            }
        }
Exemplo n.º 25
0
        public DartCodeWindowManager(ITextDocumentFactoryService textDocumentFactory, IVsEditorAdaptersFactoryService editorAdapterFactory, IVsCodeWindow codeWindow, DartAnalysisServiceFactory analysisServiceFactory)
        {
            this.barManager = ((IVsDropdownBarManager)codeWindow);
            this.analysisServiceFactory = analysisServiceFactory;

            // Figure out the filename (seriously; this is the best way?!).
            IVsTextView textView;
            codeWindow.GetPrimaryView(out textView);
            wpfTextView = editorAdapterFactory.GetWpfTextView(textView);
            textDocumentFactory.TryGetTextDocument(wpfTextView.TextBuffer, out this.textDocument);
        }
Exemplo n.º 26
0
 public Services(
     IEditorOptionsFactoryService editorOptionsFactory, 
     IEditorOperationsFactoryService editorOperatiosnFactoryService,
     ITextBufferUndoManagerProvider textBufferUndoManagerProvider,
     ITextDocumentFactoryService textDocumentFactoryService)
 {
     _editorOptionsFactory = editorOptionsFactory;
     _editorOperationsFactoryService = editorOperatiosnFactoryService;
     _textBufferUndoManagerProvider = textBufferUndoManagerProvider;
     _textDocumentFactoryService = textDocumentFactoryService;
 }
Exemplo n.º 27
0
 public TextDocumentTable(
   [Import(typeof(SVsServiceProvider))]IServiceProvider serviceProvider,
   ITextDocumentFactoryService textDocumentFactoryService,
   IVsEditorAdaptersFactoryService vsEditorAdaptersFactoryService) {
   _serviceProvider = serviceProvider;
   _textDocumentFactoryService = textDocumentFactoryService;
   _vsEditorAdaptersFactoryService = vsEditorAdaptersFactoryService;
   textDocumentFactoryService.TextDocumentCreated += TextDocumentFactoryServiceOnTextDocumentCreated;
   textDocumentFactoryService.TextDocumentDisposed += TextDocumentFactoryServiceOnTextDocumentDisposed;
   _firstRun = new Lazy<bool>(FetchRunningDocumentTable);
 }
 public QuickInfoMarginProvider(
     [Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider,
     ITextDocumentFactoryService textDocumentFactoryService,
     ProjectFactory projectFactory,
     VSLanguageService vsLanguageService)
 {
     _serviceProvider = serviceProvider;
     _textDocumentFactoryService = textDocumentFactoryService;
     _projectFactory = projectFactory;
     _vsLanguageService = vsLanguageService;
 }
 public CodeFormattingHookHelper(
     IVsEditorAdaptersFactoryService adaptersFactory, 
     IEditorOptionsFactoryService editorOptionsFactory,
     IEditorOperationsFactoryService editorOperationsFactoryService,
     ITextBufferUndoManagerProvider textBufferUndoManagerProvider,
     ITextDocumentFactoryService textDocumentFactoryService)
 {
     _adaptersFactory = adaptersFactory;
     _editorOptionsFactory = editorOptionsFactory;
     _editorOperationsFactorySerivce = editorOperationsFactoryService;
     _textBufferUndoManagerProvider = textBufferUndoManagerProvider;
     _textDocumentFactoryService = textDocumentFactoryService;
 }
 public RenameCommandFilterProvider(
     [Import(typeof(SVsServiceProvider))] System.IServiceProvider serviceProvider,
     ITextDocumentFactoryService textDocumentFactoryService,
     IVsEditorAdaptersFactoryService editorFactory,
     ProjectFactory projectFactory,
     VSLanguageService fsharpVsLanguageService)
 {
     _serviceProvider = serviceProvider;
     _textDocumentFactoryService = textDocumentFactoryService;
     _editorFactory = editorFactory;
     _projectFactory = projectFactory;
     _fsharpVsLanguageService = fsharpVsLanguageService;
 }
        public VisualStudioSymbolNavigationService(
            SVsServiceProvider serviceProvider,
            VisualStudio14StructureTaggerProvider outliningTaggerProvider)
            : base(outliningTaggerProvider.ThreadingContext)
        {
            _serviceProvider         = serviceProvider;
            _outliningTaggerProvider = outliningTaggerProvider;

            var componentModel = _serviceProvider.GetService <SComponentModel, IComponentModel>();

            _editorAdaptersFactory       = componentModel.GetService <IVsEditorAdaptersFactoryService>();
            _textEditorFactoryService    = componentModel.GetService <ITextEditorFactoryService>();
            _textDocumentFactoryService  = componentModel.GetService <ITextDocumentFactoryService>();
            _metadataAsSourceFileService = componentModel.GetService <IMetadataAsSourceFileService>();
        }
Exemplo n.º 32
0
        public CommentsAdornment(IWpfTextView view, ITextDocumentFactoryService textDocumentFactory)
        {
            _textDocumentFactory = textDocumentFactory;
            _view  = view;
            _layer = view.GetAdornmentLayer("CommentImageAdornmentLayer");
            Images = new ConcurrentDictionary <int, CommentImage>();
            _view.LayoutChanged += OnLayoutChanged;

            _contentTypeName = view.TextBuffer.ContentType.TypeName;
            _view.TextBuffer.ContentTypeChanged += OnContentTypeChanged;

            _errorTags = new List <ITagSpan <ErrorTag> >();

            _timer.Elapsed += _timer_Elapsed;
        }
Exemplo n.º 33
0
 public UnionPatternMatchCaseGeneratorSmartTaggerProvider(
     [Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider,
     ITextDocumentFactoryService textDocumentFactoryService,
     ITextUndoHistoryRegistry undoHistoryRegistry,
     ProjectFactory projectFactory,
     VSLanguageService fsharpVsLanguageService,
     IVSOpenDocumentsTracker openDocumentsTracker)
 {
     _serviceProvider            = serviceProvider;
     _textDocumentFactoryService = textDocumentFactoryService;
     _undoHistoryRegistry        = undoHistoryRegistry;
     _projectFactory             = projectFactory;
     _fsharpVsLanguageService    = fsharpVsLanguageService;
     _openDocumentsTracker       = openDocumentsTracker;
 }
Exemplo n.º 34
0
        public PrintfSpecifiersUsageTaggerProvider(
            [Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider,
            ITextDocumentFactoryService textDocumentFactoryService,
            ProjectFactory projectFactory,
            VSLanguageService fsharpVsLanguageService,
            PrintfColorManager printfColorManager)
        {
            _serviceProvider            = serviceProvider;
            _textDocumentFactoryService = textDocumentFactoryService;
            _projectFactory             = projectFactory;
            _fsharpVsLanguageService    = fsharpVsLanguageService;
            _printfColorManager         = printfColorManager;

            VSColorTheme.ThemeChanged += UpdateTheme;
        }
Exemplo n.º 35
0
 internal TextManager(
     IVsAdapter adapter,
     ITextDocumentFactoryService textDocumentFactoryService,
     ITextBufferFactoryService textBufferFactoryService,
     ISharedService sharedService,
     SVsServiceProvider serviceProvider)
 {
     _vsAdapter                  = adapter;
     _serviceProvider            = serviceProvider;
     _textManager                = _serviceProvider.GetService <SVsTextManager, IVsTextManager>();
     _textDocumentFactoryService = textDocumentFactoryService;
     _textBufferFactoryService   = textBufferFactoryService;
     _runningDocumentTable       = _serviceProvider.GetService <SVsRunningDocumentTable, IVsRunningDocumentTable>();
     _sharedService              = sharedService;
 }
 public XmlDocCommandFilterProvider(
     [Import(typeof(SVsServiceProvider))] System.IServiceProvider serviceProvider,
     ITextDocumentFactoryService textDocumentFactoryService,
     IVsEditorAdaptersFactoryService editorFactory,
     ProjectFactory projectFactory,
     VSLanguageService fsharpVsLanguageService,
     IVSOpenDocumentsTracker openDocumentTracker)
 {
     _serviceProvider            = serviceProvider;
     _textDocumentFactoryService = textDocumentFactoryService;
     _editorFactory           = editorFactory;
     _projectFactory          = projectFactory;
     _fsharpVsLanguageService = fsharpVsLanguageService;
     _openDocumentTracker     = openDocumentTracker;
 }
 public CodeFormattingHookHelper(
     IVsEditorAdaptersFactoryService adaptersFactory,
     IEditorOptionsFactoryService editorOptionsFactory,
     IEditorOperationsFactoryService editorOperationsFactoryService,
     ITextBufferUndoManagerProvider textBufferUndoManagerProvider,
     ITextDocumentFactoryService textDocumentFactoryService,
     [Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider)
 {
     _adaptersFactory                = adaptersFactory;
     _editorOptionsFactory           = editorOptionsFactory;
     _editorOperationsFactoryService = editorOperationsFactoryService;
     _textBufferUndoManagerProvider  = textBufferUndoManagerProvider;
     _textDocumentFactoryService     = textDocumentFactoryService;
     _serviceProvider                = serviceProvider;
 }
Exemplo n.º 38
0
        public QuickInfoSource(
            ITextBuffer textBuffer,
            IReadOnlyDictionary <string, QuickInfoState> quickInfoOptions,
            ITextDocumentFactoryService documentFactoryService)
        {
            _textBuffer             = textBuffer;
            _documentFactoryService = documentFactoryService;
            _language = _textBuffer.GetLanguage();
            _state    = !(_language is null) && quickInfoOptions.TryGetValue(_language, out var state)
                ? state
                : GeneralChangingService.Instance.GetDefaultQuickInfoState();

            _documentFactoryService.TextDocumentDisposed   += OnTextDocumentDisposed;
            GeneralChangingService.Instance.GeneralChanged += OnGeneralChanged;
        }
 public FindReferencesFilterProvider(
     [Import(typeof(SVsServiceProvider))] System.IServiceProvider serviceProvider,
     ITextDocumentFactoryService textDocumentFactoryService,
     IVsEditorAdaptersFactoryService editorFactory,
     FileSystem fileSystem,
     ProjectFactory projectFactory,
     VSLanguageService fsharpVsLanguageService)
 {
     _serviceProvider            = serviceProvider;
     _textDocumentFactoryService = textDocumentFactoryService;
     _editorFactory           = editorFactory;
     _fileSystem              = fileSystem;
     _projectFactory          = projectFactory;
     _fsharpVsLanguageService = fsharpVsLanguageService;
 }
Exemplo n.º 40
0
        public EditorBuffer(ITextBuffer textBuffer, ITextDocumentFactoryService textDocumentFactoryService = null)
        {
            Check.ArgumentNull(nameof(textBuffer), textBuffer);

            _textBuffer = textBuffer;
            _textBuffer.ChangedHighPriority += OnTextBufferChangedHighPriority;
            _textBuffer.Changed             += OnTextBufferChanged;
            _textBuffer.Properties[Key]      = this;

            _textDocumentFactoryService = textDocumentFactoryService;
            if (_textDocumentFactoryService != null)
            {
                _textDocumentFactoryService.TextDocumentDisposed += OnTextDocumentDisposed;
            }
        }
        public CommentsAdornment(IWpfTextView view, ITextDocumentFactoryService textDocumentFactory, SVsServiceProvider serviceProvider)
        {
            m_TextDocumentFactory = textDocumentFactory;
            m_View = view;
            _layer = view.GetAdornmentLayer("CommentImageAdornmentLayer");
            Images = new ConcurrentDictionary <int, CommentImage>();
            m_View.LayoutChanged += OnLayoutChanged;

            _contentTypeName = view.TextBuffer.ContentType.TypeName;
            m_View.TextBuffer.ContentTypeChanged += OnContentTypeChanged;

            _errorTags        = new List <ITagSpan <ErrorTag> >();
            _variableExpander = new VariableExpander(m_View, serviceProvider);

            m_Timer.Elapsed += _timer_Elapsed;
        }
        /// <summary>
        /// Don't get a textDocument if our secret LSP file is trying to be opened
        /// </summary>
        /// <param name="textDocumentFactoryService"></param>
        /// <param name="textBuffer"></param>
        /// <param name="textDocument"></param>
        /// <returns></returns>
        public static bool TryGetTextDocument(this ITextDocumentFactoryService textDocumentFactoryService, ITextBuffer textBuffer, out IVirtualTextDocument textDocument)
        {
            textDocument = null;
            if (!textDocumentFactoryService.TryGetTextDocument(textBuffer, out ITextDocument td))
            {
                return(false);
            }

            textDocument = VirtualTextDocument.FromTextDocument(td);
            if (textDocument == null)
            {
                return(false);
            }

            return(!td.FilePath.EndsWithIgnoreCase(Core.Constants.CodeStreamCodeStream));
        }
Exemplo n.º 43
0
        private bool TryGetTextDocument(ITextBuffer buffer, out ITextDocument textDocument)
        {
            if (this._textDocumentFactoryService == null)
            {
                this._textDocumentFactoryService = (ServiceProvider.GlobalProvider.GetService(typeof(SComponentModel)) as IComponentModel)?.GetService <ITextDocumentFactoryService>();
            }
            ITextDocument document = null;

            if (this._textDocumentFactoryService != null && this._textDocumentFactoryService.TryGetTextDocument(buffer, out document))
            {
                textDocument = document;
                return(true);
            }
            textDocument = null;
            return(false);
        }
Exemplo n.º 44
0
        /// <summary>
        /// Don't get a textDocument if our secret LSP file is trying to be opened
        /// </summary>
        /// <param name="textDocumentFactoryService"></param>
        /// <param name="textBuffer"></param>
        /// <param name="textDocument"></param>
        /// <returns></returns>
        public static bool TryGetTextDocument(this ITextDocumentFactoryService textDocumentFactoryService, ITextBuffer textBuffer, out ITextDocument textDocument)
        {
            textDocument = null;
            if (!textDocumentFactoryService.TryGetTextDocument(textBuffer, out ITextDocument td))
            {
                return(false);
            }

            textDocument = td;
            if (textDocument == null)
            {
                return(false);
            }
            //	if (textDocument.FilePath.EqualsIgnoreCase("temp.txt")) return false;
            return(!textDocument.FilePath.EndsWithIgnoreCase(Core.Constants.CodeStreamCodeStream));
        }
Exemplo n.º 45
0
        private void EnableTokenizationOfNewClojureBuffers()
        {
            var componentModel = (IComponentModel)GetService(typeof(SComponentModel));
            TokenizedBufferBuilder      tokenizedBufferBuilder = new TokenizedBufferBuilder(new Tokenizer());
            ITextDocumentFactoryService documentFactoryService = componentModel.GetService <ITextDocumentFactoryService>();

            documentFactoryService.TextDocumentDisposed +=
                (o, e) => tokenizedBufferBuilder.RemoveTokenizedBuffer(e.TextDocument.TextBuffer);

            documentFactoryService.TextDocumentCreated +=
                (o, e) => { if (e.TextDocument.FilePath.EndsWith(".clj"))
                            {
                                tokenizedBufferBuilder.CreateTokenizedBuffer(e.TextDocument.TextBuffer);
                            }
            };
        }
Exemplo n.º 46
0
 internal VimAppHost(
     ITextBufferFactoryService textBufferFactoryService,
     ITextEditorFactoryService textEditorFactoryService,
     ITextDocumentFactoryService textDocumentFactoryService,
     IEditorOperationsFactoryService editorOperationsFactoryService,
     IContentTypeRegistryService contentTypeRegistryService,
     IFileSystem fileSystem,
     IDirectoryUtil directoryUtil) : base(
         textBufferFactoryService,
         textEditorFactoryService,
         textDocumentFactoryService,
         editorOperationsFactoryService)
 {
     _contentTypeRegistryService = contentTypeRegistryService;
     _fileSystem    = fileSystem;
     _directoryUtil = directoryUtil;
 }
Exemplo n.º 47
0
 internal VsVimHost(
     IVsAdapter adapter,
     ITextBufferUndoManagerProvider undoManagerProvider,
     IVsEditorAdaptersFactoryService editorAdaptersFactoryService,
     ITextManager textManager,
     ITextDocumentFactoryService textDocumentFactoryService,
     IEditorOperationsFactoryService editorOperationsFactoryService,
     IWordUtilFactory wordUtilFactory,
     SVsServiceProvider serviceProvider)
     : base(textDocumentFactoryService, editorOperationsFactoryService)
 {
     _adapter = adapter;
     _editorAdaptersFactoryService = editorAdaptersFactoryService;
     _wordUtilFactory = wordUtilFactory;
     _dte             = (_DTE)serviceProvider.GetService(typeof(_DTE));
     _textManager     = textManager;
 }
Exemplo n.º 48
0
 internal EditorFactory(
     SVsServiceProvider vsServiceProvider,
     IVsEditorAdaptersFactoryService vsEditorAdaptersAdapterFactory,
     ITextBufferFactoryService textBufferFactoryService,
     ITextDocumentFactoryService textDocumentFactoryService,
     ITextEditorFactoryService textEditorFactoryService,
     [EditorUtilsImport] IProtectedOperations protectedOperations)
 {
     _vsEditorFactory   = new VsEditorFactory();
     _vsServiceProvider = vsServiceProvider;
     _vsEditorAdaptersFactoryService = vsEditorAdaptersAdapterFactory;
     _textBufferFactoryService       = textBufferFactoryService;
     _textDocumentFactoryService     = textDocumentFactoryService;
     _textEditorFactoryService       = textEditorFactoryService;
     _oleServiceProvider             = _vsServiceProvider.GetService <IOleServiceProvider, IOleServiceProvider>();
     _protectedOperations            = protectedOperations;
 }
Exemplo n.º 49
0
        internal static bool IsXSharpDocument(this ITextDocumentFactoryService factory, ITextBuffer buffer)
        {
            string path = "";

            if (buffer.Properties.ContainsProperty(typeof(XFile)))
            {
                return(buffer.GetFile() != null);
            }
            // When not found then locate the file in the XSolution by its name
            if (factory != null)
            {
                ITextDocument doc = null;
                if (factory.TryGetTextDocument(buffer, out doc))
                {
                    path = doc.FilePath;
                }
            }
            // Find and attach the X# document when we have it, or a null to indicate that we have searched
            // and not found it
            var file = XSolution.FindFile(path);

            if (file == null)
            {
                var type = XFileTypeHelpers.GetFileType(path);
                switch (type)
                {
                case XFileType.SourceCode:
                case XFileType.Header:
                    file = XSolution.AddOrphan(path);
                    break;

                default:
                    if (type.IsVOBinary())
                    {
                        file = XSolution.AddOrphan(path);
                    }
                    break;
                }
            }
            if (file != null)
            {
                file.Interactive = true;
                buffer.Properties.AddProperty(typeof(XFile), file);
            }
            return(file != null);
        }
        public DefaultVisualStudioDocumentTrackerFactoryFactory(
            ForegroundDispatcher foregroundDispatcher,
            ITextDocumentFactoryService textDocumentFactory)
        {
            if (foregroundDispatcher == null)
            {
                throw new ArgumentNullException(nameof(foregroundDispatcher));
            }

            if (textDocumentFactory == null)
            {
                throw new ArgumentNullException(nameof(textDocumentFactory));
            }

            _foregroundDispatcher = foregroundDispatcher;
            _textDocumentFactory  = textDocumentFactory;
        }
Exemplo n.º 51
0
        public DefaultTextBufferProjectService(
            RunningDocumentTable documentTable,
            ITextDocumentFactoryService documentFactory)
        {
            if (documentTable == null)
            {
                throw new ArgumentNullException(nameof(documentTable));
            }

            if (documentFactory == null)
            {
                throw new ArgumentNullException(nameof(documentFactory));
            }

            _documentFactory = documentFactory;
            _documentTable   = documentTable;
        }
        public DefaultTextBufferProjectService(
            ITextDocumentFactoryService documentFactory,
            ErrorReporter errorReporter)
        {
            if (documentFactory == null)
            {
                throw new ArgumentNullException(nameof(documentFactory));
            }

            if (errorReporter == null)
            {
                throw new ArgumentNullException(nameof(errorReporter));
            }

            _documentFactory = documentFactory;
            _errorReporter   = errorReporter;
        }
Exemplo n.º 53
0
 public OutliningTaggerProvider(
     [Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider,
     ITextDocumentFactoryService textDocumentFactoryService,
     ITextEditorFactoryService textEditorFactoryService,
     IProjectionBufferFactoryService projectionBufferFactoryService,
     IOutliningManagerService outliningManagerService,
     ProjectFactory projectFactory,
     VSLanguageService vsLanguageService)
 {
     _serviceProvider = serviceProvider;
     _textDocumentFactoryService = textDocumentFactoryService;
     _textEditorFactoryService = textEditorFactoryService;
     _projectionBufferFactoryService = projectionBufferFactoryService;
     _outliningManagerService = outliningManagerService;
     _projectFactory = projectFactory;
     _vsLanguageService = vsLanguageService;
 }
Exemplo n.º 54
0
        public Document(ITextDocumentFactoryService textDocumentFactory, ITextDocument textDocument, ILexer lexer, IParser parser, OnDestroyAction onDestroy)
        {
            _textDocumentFactory = textDocumentFactory;
            _textDocument        = textDocument;
            _textBuffer          = textDocument.TextBuffer;
            Lexer          = lexer;
            Parser         = parser;
            _destroyAction = onDestroy;
            _cts           = new CancellationTokenSource();

            _tokenizer       = new DocumentTokenizer(_textDocument.TextBuffer, Lexer, _cts.Token);
            DocumentAnalysis = new DocumentAnalysis(this, DocumentTokenizer, Parser);
            Disposed         = false;

            _textDocumentFactory.TextDocumentDisposed += OnTextDocumentDisposed;
            _textBuffer.Changed += BufferChanged;
        }
        public DefaultTextBufferProjectService(
            ITextDocumentFactoryService documentFactory,
            AggregateProjectCapabilityResolver projectCapabilityResolver)
        {
            if (documentFactory is null)
            {
                throw new ArgumentNullException(nameof(documentFactory));
            }

            if (projectCapabilityResolver is null)
            {
                throw new ArgumentNullException(nameof(projectCapabilityResolver));
            }

            _documentFactory           = documentFactory;
            _projectCapabilityResolver = projectCapabilityResolver;
        }
Exemplo n.º 56
0
        public RazorContentTypeChangeListener(
            ITextDocumentFactoryService textDocumentFactory,
            LSPDocumentManager lspDocumentManager,
            LSPEditorFeatureDetector lspEditorFeatureDetector,
            SVsServiceProvider serviceProvider,
            IEditorOptionsFactoryService editorOptionsFactory)
        {
            if (textDocumentFactory is null)
            {
                throw new ArgumentNullException(nameof(textDocumentFactory));
            }

            if (lspDocumentManager is null)
            {
                throw new ArgumentNullException(nameof(lspDocumentManager));
            }

            if (lspEditorFeatureDetector is null)
            {
                throw new ArgumentNullException(nameof(lspEditorFeatureDetector));
            }

            if (serviceProvider is null)
            {
                throw new ArgumentNullException(nameof(serviceProvider));
            }

            if (editorOptionsFactory is null)
            {
                throw new ArgumentNullException(nameof(editorOptionsFactory));
            }

            _lspDocumentManager = lspDocumentManager as TrackingLSPDocumentManager;

            if (_lspDocumentManager is null)
            {
#pragma warning disable CA2208 // Instantiate argument exceptions correctly
                throw new ArgumentException("The LSP document manager should be of type " + typeof(TrackingLSPDocumentManager).FullName, nameof(_lspDocumentManager));
#pragma warning restore CA2208 // Instantiate argument exceptions correctly
            }

            _textDocumentFactory      = textDocumentFactory;
            _lspEditorFeatureDetector = lspEditorFeatureDetector;
            _serviceProvider          = serviceProvider;
            _editorOptionsFactory     = editorOptionsFactory;
        }
        public DefaultTextBufferProjectService(
            [Import(typeof(SVsServiceProvider))] IServiceProvider services,
            ITextDocumentFactoryService documentFactory)
        {
            if (services == null)
            {
                throw new ArgumentNullException(nameof(services));
            }

            if (documentFactory == null)
            {
                throw new ArgumentNullException(nameof(documentFactory));
            }

            _documentFactory = documentFactory;
            _documentTable   = new RunningDocumentTable(services);
        }
Exemplo n.º 58
0
        internal VsVimHost(
            IVsAdapter adapter,
            ITextBufferFactoryService textBufferFactoryService,
            ITextEditorFactoryService textEditorFactoryService,
            ITextDocumentFactoryService textDocumentFactoryService,
            ITextBufferUndoManagerProvider undoManagerProvider,
            IVsEditorAdaptersFactoryService editorAdaptersFactoryService,
            IEditorOperationsFactoryService editorOperationsFactoryService,
            ISmartIndentationService smartIndentationService,
            ITextManager textManager,
            ISharedServiceFactory sharedServiceFactory,
            IVimApplicationSettings vimApplicationSettings,
            IExtensionAdapterBroker extensionAdapterBroker,
            IProtectedOperations protectedOperations,
            IMarkDisplayUtil markDisplayUtil,
            IControlCharUtil controlCharUtil,
            ICommandDispatcher commandDispatcher,
            SVsServiceProvider serviceProvider,
            IClipboardDevice clipboardDevice)
            : base(textBufferFactoryService, textEditorFactoryService, textDocumentFactoryService, editorOperationsFactoryService)
        {
            _vsAdapter = adapter;
            _editorAdaptersFactoryService = editorAdaptersFactoryService;
            _dte                     = (_DTE)serviceProvider.GetService(typeof(_DTE));
            _vsExtensibility         = (IVsExtensibility)serviceProvider.GetService(typeof(IVsExtensibility));
            _textManager             = textManager;
            _sharedService           = sharedServiceFactory.Create();
            _vsMonitorSelection      = serviceProvider.GetService <SVsShellMonitorSelection, IVsMonitorSelection>();
            _vimApplicationSettings  = vimApplicationSettings;
            _smartIndentationService = smartIndentationService;
            _extensionAdapterBroker  = extensionAdapterBroker;
            _runningDocumentTable    = serviceProvider.GetService <SVsRunningDocumentTable, IVsRunningDocumentTable>();
            _vsShell                 = (IVsShell)serviceProvider.GetService(typeof(SVsShell));
            _protectedOperations     = protectedOperations;
            _commandDispatcher       = commandDispatcher;
            _clipboardDevice         = clipboardDevice;

            _vsMonitorSelection.AdviseSelectionEvents(this, out uint selectionCookie);
            _runningDocumentTable.AdviseRunningDocTableEvents(this, out uint runningDocumentTableCookie);

            InitOutputPane();

            _settingsSync = new SettingsSync(vimApplicationSettings, markDisplayUtil, controlCharUtil, _clipboardDevice);
            _settingsSync.SyncFromApplicationSettings();
        }
Exemplo n.º 59
0
        public static LabelGraph GetOrCreate_Label_Graph(
            ITextBuffer buffer,
            IBufferTagAggregatorFactoryService aggregatorFactory,
            ITextDocumentFactoryService docFactory,
            IContentTypeRegistryService contentService)
        {
            Contract.Requires(buffer != null);


            LabelGraph sc1()
            {
                IContentType contentType = contentService.GetContentType(AsmDudePackage.AsmDudeContentType);

                return(new LabelGraph(buffer, aggregatorFactory, AsmDudeTools.Instance.Error_List_Provider, docFactory, contentType));
            }

            return(buffer.Properties.GetOrCreateSingletonProperty(sc1));
        }
        public UnusedSymbolClassifierProvider(
            [Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider,
            ClassificationColorManager classificationColorManager,
            IClassificationTypeRegistryService classificationRegistry,
            ITextDocumentFactoryService textDocumentFactoryService,
            VSLanguageService fsharpVsLanguageService,
            ProjectFactory projectFactory)
        {
            _serviceProvider            = serviceProvider;
            _classificationColorManager = classificationColorManager;
            _classificationRegistry     = classificationRegistry;
            _textDocumentFactoryService = textDocumentFactoryService;
            _fsharpVsLanguageService    = fsharpVsLanguageService;
            _projectFactory             = projectFactory;

            // Receive notification for Visual Studio theme change
            VSColorTheme.ThemeChanged += UpdateTheme;
        }