コード例 #1
0
ファイル: CompletionSource.cs プロジェクト: rsmolnikov/spark
 public CompletionSource(ITextBuffer textBuffer, ITextStructureNavigator textNavigator, IProjectExplorer projectExplorer)
 {
     _textBuffer = textBuffer;
     _textNavigator = textNavigator;
     _projectExplorer = projectExplorer;
     _viewExplorer = ViewExplorer.CreateFromActiveDocument(_projectExplorer);
 }
コード例 #2
0
ファイル: MotionUtilTest.cs プロジェクト: bentayloruk/VsVim
 private void Create(ITextView textView)
 {
     _textView = textView;
     _textBuffer = textView.TextBuffer;
     _buffer = _textView.TextBuffer;
     _snapshot = _buffer.CurrentSnapshot;
     _buffer.Changed += delegate { _snapshot = _buffer.CurrentSnapshot; };
     _globalSettings = new Vim.GlobalSettings();
     _localSettings = new LocalSettings(_globalSettings, _textView);
     _markMap = new MarkMap(new TrackingLineColumnService());
     _vimData = new VimData();
     _search = VimUtil.CreateSearchService(_globalSettings);
     _jumpList = VimUtil.CreateJumpList();
     _statusUtil = new Mock<IStatusUtil>(MockBehavior.Strict);
     _navigator = VimUtil.CreateTextStructureNavigator(_textView.TextBuffer);
     _motionUtil = new MotionUtil(
         _textView,
         _markMap,
         _localSettings,
         _search,
         _navigator,
         _jumpList,
         _statusUtil.Object,
         _vimData);
 }
コード例 #3
0
ファイル: MotionUtilTest.cs プロジェクト: franch/VsVim
 private void Create(ITextView textView, IEditorOptions editorOptions = null)
 {
     _textView = textView;
     _textBuffer = textView.TextBuffer;
     _snapshot = _textBuffer.CurrentSnapshot;
     _textBuffer.Changed += delegate { _snapshot = _textBuffer.CurrentSnapshot; };
     _globalSettings = new Vim.GlobalSettings();
     _localSettings = new LocalSettings(_globalSettings, FSharpOption.CreateForReference(editorOptions), FSharpOption.CreateForReference(textView));
     _markMap = new MarkMap(new TrackingLineColumnService());
     _vimData = new VimData();
     _search = VimUtil.CreateSearchService(_globalSettings);
     _jumpList = VimUtil.CreateJumpList();
     _statusUtil = new Mock<IStatusUtil>(MockBehavior.Strict);
     _navigator = VimUtil.CreateTextStructureNavigator(_textView, WordKind.NormalWord);
     _motionUtil = new MotionUtil(
         _textView,
         _markMap,
         _localSettings,
         _search,
         _navigator,
         _jumpList,
         _statusUtil.Object,
         VimUtil.GetWordUtil(textView),
         _vimData);
 }
コード例 #4
0
        public CommandFilter(IVsTextView textViewAdapter, IWpfTextView textView, ITextStructureNavigator textNavigator, ICompletionBroker completionBroker)
        {
            textViewAdapter.AddCommandFilter(this, out _nextCommand);

            _textView         = textView;
            _textNavigator    = textNavigator;
            _completionBroker = completionBroker;
        }
コード例 #5
0
 public NavigableSymbolSource(IServiceProvider serviceProvider, ITextBuffer buffer, IClassifier classifier, ITextStructureNavigator textNavigator)
 {
     _serviceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider));
     _buffer          = buffer ?? throw new ArgumentNullException(nameof(buffer));
     _classifier      = classifier ?? throw new ArgumentNullException(nameof(classifier));
     _textNavigator   = textNavigator ?? throw new ArgumentNullException(nameof(textNavigator));
     _entryService    = serviceProvider.GetEntryService();
 }
コード例 #6
0
        public PhpTextStructureNavigator(ITextBuffer textBuffer, ITextStructureNavigator delegateNavigator)
        {
            Contract.Requires <ArgumentNullException>(textBuffer != null, "textBuffer");
            Contract.Requires <ArgumentNullException>(delegateNavigator != null, "delegateNavigator");

            _textBuffer        = textBuffer;
            _delegateNavigator = delegateNavigator;
        }
コード例 #7
0
        public SubwordNavigationCommandFilter(IWpfTextView textView, IEditorOperations operations, ITextStructureNavigator navigator)
        {
            this.textView   = textView;
            this.operations = operations;
            this.navigator  = navigator;

            RegisterCommands();
        }
コード例 #8
0
 public EmojiCompletionSource(ITextStructureNavigator textStructureNavigator)
 {
     _textStructureNavigator = textStructureNavigator;
     // Build a collection of Emojis to handle
     _emojis = GlyphfriendPackage.Emojis
               .Select(e => EmojiCompletion(e.Key, e.Value))
               .ToList();
 }
コード例 #9
0
        public SparkSignatureHelpCommand(IVsTextView textViewAdapter, IWpfTextView textView, ITextStructureNavigator navigator, ISignatureHelpBroker broker)
        {
            _textView = textView;
            _navigator = navigator;
            _broker = broker;

            ChainTheNextCommand(textViewAdapter);
        }
コード例 #10
0
        private ITrackingSpan FindTokenSpanAtPosition(SnapshotPoint point)
        {
            SnapshotPoint           currentPoint = point - 1;
            ITextStructureNavigator navigator    = m_sourceProvider.NavigatorService.GetTextStructureNavigator(m_textBuffer);
            TextExtent extent = navigator.GetExtentOfWord(currentPoint);

            return(currentPoint.Snapshot.CreateTrackingSpan(extent.Span, SpanTrackingMode.EdgeInclusive));
        }
 public CSharpDocumentationCompletionSource(ITextView textView, IClassifierAggregatorService classifier, ITextStructureNavigatorSelectorService navigator, IEditorOperationsFactoryService operationsFactory)
 {
     _textView          = textView;
     _textBuffer        = textView.TextBuffer;
     _classifier        = classifier.GetClassifier(_textBuffer);
     _navigator         = navigator.GetTextStructureNavigator(_textBuffer);
     _operationsFactory = operationsFactory;
 }
コード例 #12
0
ファイル: GLSLCompletionSource.cs プロジェクト: Xannden/VGLSL
        private ITrackingSpan FindTokenSpanAtPosition(ICompletionSession session)
        {
            SnapshotPoint           currentPoint = session.TextView.Caret.Position.BufferPosition - 1;
            ITextStructureNavigator navigator    = this.provider.NavigatorService.GetTextStructureNavigator(this.textBuffer);
            TextExtent extent = navigator.GetExtentOfWord(currentPoint);

            return(currentPoint.Snapshot.CreateTrackingSpan(extent.Span, SpanTrackingMode.EdgeInclusive));
        }
コード例 #13
0
        private ITrackingSpan FindTokenSpanAtPosition(ITrackingPoint point, ICompletionSession session)
        {
            SnapshotPoint           currentPoint = (session.TextView.Caret.Position.BufferPosition) - 1;
            ITextStructureNavigator navigator    = _navigation.GetTextStructureNavigator(_buffer);
            TextExtent extent = navigator.GetExtentOfWord(currentPoint);

            return(currentPoint.Snapshot.CreateTrackingSpan(extent.Span, SpanTrackingMode.EdgeInclusive));
        }
コード例 #14
0
        ITagger <T> IViewTaggerProvider.CreateTagger <T>(ITextView textView, ITextBuffer buffer)
        {
            ISQLanguageService      service = SQVSUtils.GetService <ISQLanguageService>();
            ITextStructureNavigator textStructureNavigator =
                TextStructureNavigatorSelector.GetTextStructureNavigator(buffer);

            return(buffer.Properties.GetOrCreateSingletonProperty(delegate() { return new SQErrorTagger(textView, buffer, textStructureNavigator, service as SQLanguageServiceEX); }) as ITagger <T>);
        }
コード例 #15
0
        private TextExtent FindExtentAtPoint(SnapshotPoint?subjectTriggerPoint)
        {
            ITextStructureNavigator navigator =
                provider.NavigatorService.GetTextStructureNavigator(textBuffer);
            TextExtent extent = navigator.GetExtentOfWord(subjectTriggerPoint.Value);

            return(extent);
        }
コード例 #16
0
 public AntlrIntellisenseCommandFilter(IVsTextView textViewAdapter, AntlrIntellisenseController controller)
     : base(textViewAdapter, controller)
 {
     var textView = Controller.Provider.EditorAdaptersFactoryService.GetWpfTextView(textViewAdapter);
     var textBuffer = textView.TextBuffer;
     _classifier = Controller.Provider.ClassifierAggregatorService.GetClassifier(textView.TextBuffer);
     _textStructureNavigator = Controller.Provider.TextStructureNavigatorSelectorService.GetTextStructureNavigator(textBuffer);
 }
コード例 #17
0
        public AntlrTextStructureNavigator(ITextBuffer textBuffer, ITextStructureNavigator delegateNavigator)
        {
            Contract.Requires<ArgumentNullException>(textBuffer != null, "textBuffer");
            Contract.Requires<ArgumentNullException>(delegateNavigator != null, "delegateNavigator");

            _textBuffer = textBuffer;
            _delegateNavigator = delegateNavigator;
        }
コード例 #18
0
 public PlainTextCompletionSource(
     ITextBuffer buffer,
     ITextStructureNavigator structureNavigator)
 {
     this.theBuffer = buffer;
     this.navigator = structureNavigator;
     glyphIcon      = new BitmapImage(new Uri("pack://application:,,,/Winterdom.Viasfora;component/Resources/PlainTextCompletion.ico"));
 }
コード例 #19
0
        private ITrackingSpan FindTokenSpanAtPosition(ITrackingPoint point, ICompletionSession completionSession)
        {
            SnapshotPoint           ssPoint   = (completionSession.TextView.Caret.Position.BufferPosition) - 1;
            ITextStructureNavigator navigator = sourceProvider.TextNavigatorService.GetTextStructureNavigator(this.textBuffer);
            TextExtent textExtent             = navigator.GetExtentOfWord(ssPoint);

            return(ssPoint.Snapshot.CreateTrackingSpan(textExtent.Span, SpanTrackingMode.EdgeInclusive));
        }
コード例 #20
0
 public SQErrorTagger(ITextView view, ITextBuffer sourceBuffer, ITextStructureNavigator textStructureNavigator, SQLanguageServiceEX service)
 {
     _buffer                     = sourceBuffer;
     _languangeService           = service;
     filepath                    = SQLanguageServiceEX.GetFileName(_buffer);
     _buffer.Changed            -= _buffer_Changed;
     _buffer.ChangedLowPriority += _buffer_Changed;
 }
コード例 #21
0
        internal SignatureHelpCommandHandler(IVsTextView textViewAdapter, ITextView textView, ITextStructureNavigator nav, ISignatureHelpBroker broker)
        {
            _textView  = textView;
            _broker    = broker;
            _navigator = nav;

            // Add to the filter chain
            textViewAdapter.AddCommandFilter(this, out _nextCommandHandler);
        }
コード例 #22
0
 public CmdCompletionSource(ITextBuffer buffer, IClassifierAggregatorService classifier, IGlyphService glyphService, ITextStructureNavigator textStructureNavigator)
 {
     _buffer                 = buffer;
     _classifier             = classifier.GetClassifier(buffer);
     _keywordGlyph           = glyphService.GetGlyph(StandardGlyphGroup.GlyphGroupVariable, StandardGlyphItem.GlyphItemPublic);
     _environmentGlyph       = glyphService.GetGlyph(StandardGlyphGroup.GlyphAssembly, StandardGlyphItem.GlyphItemPublic);
     _labelGlyph             = glyphService.GetGlyph(StandardGlyphGroup.GlyphArrow, StandardGlyphItem.GlyphItemPublic);
     _textStructureNavigator = textStructureNavigator;
 }
コード例 #23
0
        private ITrackingSpan CreateTrackingSpanForSnippet(ICompletionSession session)
        {
            ITrackingPoint          point        = session.GetTriggerPoint(textBuffer);
            SnapshotPoint           currentPoint = (session.TextView.Caret.Position.BufferPosition) - 1;
            ITextStructureNavigator navigator    = textStructureNavigatorSelectorService.GetTextStructureNavigator(textBuffer);
            TextExtent extent = navigator.GetExtentOfWord(currentPoint);

            return(currentPoint.Snapshot.CreateTrackingSpan(extent.Span, SpanTrackingMode.EdgeInclusive));
        }
コード例 #24
0
        protected override ITagger <T> GetTagger <T>(ITextView textView, ITextBuffer buffer)
        {
            ITextStructureNavigator textStructureNavigator =
                TextStructureNavigatorSelector.GetTextStructureNavigator(buffer);
            var tagger =
                new HighlightWordTagger(textView, buffer, TextSearchService, textStructureNavigator) as ITagger <T>;

            return(tagger);
        }
コード例 #25
0
 public GoToDefMouseHandler(IWpfTextView view, IOleCommandTarget commandTarget, IClassifier aggregator,
                            ITextStructureNavigator navigator, CtrlKeyState state)
 {
     _view          = view;
     _commandTarget = commandTarget;
     _aggregator    = aggregator;
     _navigator     = navigator;
     _state         = state;
 }
コード例 #26
0
        public Antlr4IntellisenseCommandFilter(IVsTextView textViewAdapter, Antlr4IntellisenseController controller)
            : base(textViewAdapter, controller)
        {
            var textView   = Controller.Provider.EditorAdaptersFactoryService.GetWpfTextView(textViewAdapter);
            var textBuffer = textView.TextBuffer;

            _classifier             = Controller.Provider.ClassifierAggregatorService.GetClassifier(textView.TextBuffer);
            _textStructureNavigator = Controller.Provider.TextStructureNavigatorSelectorService.GetTextStructureNavigator(textBuffer);
        }
コード例 #27
0
 public CmdCompletionSource(ITextBuffer buffer, IClassifierAggregatorService classifier, IGlyphService glyphService, ITextStructureNavigator textStructureNavigator)
 {
     _buffer = buffer;
     _classifier = classifier.GetClassifier(buffer);
     _keywordGlyph = glyphService.GetGlyph(StandardGlyphGroup.GlyphGroupVariable, StandardGlyphItem.GlyphItemPublic);
     _environmentGlyph = glyphService.GetGlyph(StandardGlyphGroup.GlyphAssembly, StandardGlyphItem.GlyphItemPublic);
     _labelGlyph = glyphService.GetGlyph(StandardGlyphGroup.GlyphArrow, StandardGlyphItem.GlyphItemPublic);
     _textStructureNavigator = textStructureNavigator;
 }
        public ImagePreviewToolTipMouseProcessor(IWpfTextView view, ITextStructureNavigator navigator,
                                                 IToolTipProviderFactory toolTipProviderFactory, ITextDocument textDocument)
        {
            this.spanSearcher    = new StringSpanSearcher(view, navigator);
            this.toolTipProvider = toolTipProviderFactory.GetToolTipProvider(view);
            this.textDocument    = textDocument;

            this.shownSpan = null;
        }
コード例 #29
0
        internal StaDynSignatureHelpCommandHandler(IVsTextView textViewAdapter, ITextView textView, ITextStructureNavigator nav, ISignatureHelpBroker broker)
        {
            this.m_textView  = textView;
            this.m_broker    = broker;
            this.m_navigator = nav;

            //add this to the filter chain
            textViewAdapter.AddCommandFilter(this, out m_nextCommandHandler);
        }
コード例 #30
0
 public EmojiCompletionSource(ITextBuffer buffer,ITextStructureNavigator textStructureNavigator)
 {
     _buffer = buffer;
     _textStructureNavigator = textStructureNavigator;
     // Build a collection of Emojis to handle 
     _emojis = GlyphfriendPackage.Emojis
                                 .Select(e => EmojiCompletion(e.Key, e.Value))
                                 .ToList();
 }
コード例 #31
0
        private ITrackingSpan FindTokenSpanAtPosition(ITrackingPoint point, ICompletionSession session)
        {
            SnapshotPoint           currentPoint = (session.TextView.Caret.Position.BufferPosition) - 1;
            ITextStructureNavigator navigator    = m_sourceProvider.NavigatorService.GetTextStructureNavigator(m_textBuffer);
            TextExtent extent = navigator.GetExtentOfWord(currentPoint);
            string     w1     = currentPoint.Snapshot.GetText(extent.Span);

            return(currentPoint.Snapshot.CreateTrackingSpan(extent.Span, SpanTrackingMode.EdgeInclusive));
        }
コード例 #32
0
 // Token: 0x06000012 RID: 18 RVA: 0x000022D4 File Offset: 0x000004D4
 public StickyHighlightWordTagger(ITextView view, ITextBuffer sourceBuffer, ITextSearchService textSearchService, ITextStructureNavigator textStructureNavigator)
 {
     this.View                   = view;
     this.SourceBuffer           = sourceBuffer;
     this.TextSearchService      = textSearchService;
     this.TextStructureNavigator = textStructureNavigator;
     this.View.LayoutChanged    += this.ViewLayoutChanged;
     this.WordSpanMap            = new Dictionary <string, NormalizedSnapshotSpanCollection>();
     HighlightedWordCollection.Instance.Changed += this.HighlightWordAdded;
 }
コード例 #33
0
        public AlloyTextStructureNavigator(ITextBuffer textBuffer, ITextStructureNavigator delegateTextStructureNavigator)
        {
            if (textBuffer == null)
                throw new ArgumentNullException("textBuffer");
            if (delegateTextStructureNavigator == null)
                throw new ArgumentNullException("delegateTextStructureNavigator");

            this._textBuffer = textBuffer;
            this._delegateTextStructureNavigator = delegateTextStructureNavigator;
        }
コード例 #34
0
        public CompletionSessionManager(ICompletionBroker broker, IWpfTextView textView, ITextStructureNavigator textNavigator)
        {
            if (broker == null) throw new ArgumentNullException("broker", "Completion Broker is null.");
            if (textView == null) throw new ArgumentNullException("textView", "Text View is null.");
            if (textNavigator == null) throw new ArgumentNullException("textNavigator", "Text Navigator is null.");

            _completionBroker = broker;
            _textView = textView;
            _textNavigator = textNavigator;
        }
コード例 #35
0
 public PlainTextCompletionSource(
     ITextBuffer buffer,
     ITextStructureNavigator structureNavigator,
     IVsfSettings settings)
 {
     this.theBuffer = buffer;
       this.navigator = structureNavigator;
       this.settings = settings;
       glyphIcon = new BitmapImage(new Uri("pack://application:,,,/Winterdom.Viasfora;component/Resources/PlainTextCompletion.ico"));
 }
コード例 #36
0
        internal EpochCompletionCommandHandler(IVsTextView textViewAdapter, ITextView textView, EpochCompletionHandlerProvider provider, ISignatureHelpBroker broker, ITextStructureNavigator nav)
        {
            this.m_textView  = textView;
            this.m_provider  = provider;
            this.m_navigator = nav;
            this.m_broker    = broker;

            //add the command to the command chain
            textViewAdapter.AddCommandFilter(this, out m_nextCommandHandler);
        }
コード例 #37
0
            public ITagger <T> CreateTagger <T>(ITextView textView, ITextBuffer buffer) where T : ITag
            {
                //provide highlighting only on the top buffer
                //if (textView.TextBuffer != buffer)
                //return null;
                ITextStructureNavigator textStructureNavigator =
                    TextStructureNavigatorSelector.GetTextStructureNavigator(buffer);

                return(new HighlightWordTagger(textView, buffer, TextSearchService, textStructureNavigator) as ITagger <T>);
            }
コード例 #38
0
        // Token: 0x0600001E RID: 30 RVA: 0x00002850 File Offset: 0x00000A50
        public ITagger <T> CreateTagger <T>(ITextView textView, ITextBuffer buffer) where T : ITag
        {
            if (textView.TextBuffer != buffer)
            {
                return(null);
            }
            ITextStructureNavigator textStructureNavigator = this.TextStructureNavigatorSelector.GetTextStructureNavigator(buffer);

            return(new StickyHighlightWordTagger(textView, buffer, this.TextSearchService, textStructureNavigator) as ITagger <T>);
        }
コード例 #39
0
        internal static CommandUtil CreateCommandUtil(
            ITextView textView,
            ICommonOperations operations                     = null,
            IMotionUtil motionUtil                           = null,
            IStatusUtil statusUtil                           = null,
            IRegisterMap registerMap                         = null,
            IMarkMap markMap                                 = null,
            IVimData vimData                                 = null,
            IVimLocalSettings localSettings                  = null,
            IUndoRedoOperations undoRedOperations            = null,
            ISmartIndentationService smartIndentationService = null,
            IFoldManager foldManager                         = null,
            IVimHost vimHost                                 = null,
            IMacroRecorder recorder                          = null,
            ISearchService searchService                     = null,
            ITextStructureNavigator wordNavigator            = null,
            IJumpList jumpList                               = null)
        {
            statusUtil              = statusUtil ?? new StatusUtil();
            undoRedOperations       = undoRedOperations ?? VimUtil.CreateUndoRedoOperations(statusUtil);
            localSettings           = localSettings ?? new LocalSettings(new GlobalSettings());
            registerMap             = registerMap ?? CreateRegisterMap(MockObjectFactory.CreateClipboardDevice().Object);
            markMap                 = markMap ?? new MarkMap(new TrackingLineColumnService());
            vimData                 = vimData ?? new VimData();
            motionUtil              = motionUtil ?? CreateTextViewMotionUtil(textView, markMap: markMap, vimData: vimData, settings: localSettings);
            operations              = operations ?? CreateCommonOperations(textView, localSettings, vimData: vimData, statusUtil: statusUtil);
            smartIndentationService = smartIndentationService ?? CreateSmartIndentationService();
            foldManager             = foldManager ?? CreateFoldManager(textView.TextBuffer);
            searchService           = searchService ?? CreateSearchService(localSettings.GlobalSettings);
            wordNavigator           = wordNavigator ?? CreateTextStructureNavigator(textView.TextBuffer, WordKind.NormalWord);
            jumpList                = jumpList ?? CreateJumpList();
            vimHost                 = vimHost ?? new MockVimHost();
            var vim = MockObjectFactory.CreateVim(
                registerMap: registerMap,
                map: markMap,
                host: vimHost,
                vimData: vimData,
                recorder: recorder,
                searchService: searchService);
            var buffer = MockObjectFactory.CreateVimBuffer(
                textView: textView,
                settings: localSettings,
                motionUtil: motionUtil,
                vim: vim.Object,
                wordNavigator: wordNavigator,
                jumpList: jumpList);

            return(new CommandUtil(
                       buffer.Object,
                       operations,
                       statusUtil,
                       undoRedOperations,
                       smartIndentationService,
                       foldManager));
        }
コード例 #40
0
        public ITagger <T> CreateTagger <T>(ITextView textView, ITextBuffer buffer) where T : ITag
        {
            if (textView.TextBuffer != buffer)
            {
                return(null);
            }

            ITextStructureNavigator textStructureNavigator = TextStructureNavigatorSelector.GetTextStructureNavigator(buffer);

            return(buffer.Properties.GetOrCreateSingletonProperty(() => new CssHighlightWordTagger(textView, buffer, TextSearchService, textStructureNavigator)) as ITagger <T>);
        }
コード例 #41
0
ファイル: CodeView.cs プロジェクト: madsnyholm/CodeEditor
 public CodeView(CodeEditorWindow owner, ITextView textView)
 {
     m_Owner = owner;
     _textView = textView;
     _document = _textView.Document;
     var textFont = _textView.Appearance.Text.font;
     _font = textFont ? textFont : GUI.skin.font;
     _navigator = new DefaultTextStructureNavigator();
     Caret.Moved += EnsureCursorIsVisible;
     _textView.DoubleClicked = DoubleClickedDocument;
 }
コード例 #42
0
        public ITextStructureNavigator CreateTextStructureNavigator(ITextBuffer textBuffer)
        {
            if (textBuffer == null)
            {
                throw new ArgumentNullException("textBuffer");
            }

            ITextStructureNavigator delegateTextStructureNavigator = TextStructureNavigatorSelectorService.CreateTextStructureNavigator(textBuffer, AnyContentType);

            return(new AlloyTextStructureNavigator(textBuffer, delegateTextStructureNavigator));
        }
コード例 #43
0
ファイル: TextSearchService.cs プロジェクト: 0xd4d/dnSpy
		bool IsWholeWord(ITextStructureNavigator textStructureNavigator, ITextSnapshot snapshot, FindResult result) {
			Debug.Assert(textStructureNavigator != null);
			if (textStructureNavigator == null)
				return false;
			if (result.Length == 0)
				return false;
			var start = textStructureNavigator.GetExtentOfWord(new SnapshotPoint(snapshot, result.Position));
			if (start.Span.Start.Position != result.Position)
				return false;
			var end = textStructureNavigator.GetExtentOfWord(new SnapshotPoint(snapshot, result.Position + result.Length - 1));
			return end.Span.End.Position == result.Position + result.Length;
		}
コード例 #44
0
ファイル: SearchServiceTest.cs プロジェクト: franch/VsVim
        public void Create(params string[] lines)
        {
            _textBuffer = EditorUtil.CreateTextBuffer(lines);
            _navigator = VimUtil.CreateTextStructureNavigator(_textBuffer, WordKind.NormalWord);
            _globalSettings = new Vim.GlobalSettings();
            _globalSettings.Magic = true;
            _globalSettings.IgnoreCase = true;
            _globalSettings.SmartCase = false;

            _textSearch = EditorUtil.FactoryService.TextSearchService;
            _searchRaw = new SearchService(_textSearch, _globalSettings);
            _search = _searchRaw;
        }
		public CodeView(EditorWindow owner, ITextView textView)
		{
			m_Owner = owner;
			_textView = textView;
			_document = _textView.Document;
			var textFont = _textView.Appearance.Text.font;
			_font = textFont ? textFont : GUI.skin.font;
			_navigator = new DefaultTextStructureNavigator();
			_completion = new CodeViewCompletion(this, _textView);

			Caret.Moved += OnCaretMoved;
			_textView.Clicked = OnTextViewClicked;
		}
コード例 #46
0
        public virtual void Create(ITextSearchService textSearchService, params string[] lines)
        {
            _textBuffer = CreateTextBuffer(lines);
            _wordNavigator = WordUtil.CreateTextStructureNavigator(WordKind.NormalWord, _textBuffer.ContentType);
            _globalSettings = Vim.GlobalSettings;
            _globalSettings.Magic = true;
            _globalSettings.IgnoreCase = true;
            _globalSettings.SmartCase = false;

            _textSearch = textSearchService;
            _searchRaw = new SearchService(_textSearch, _globalSettings);
            _search = _searchRaw;
        }
コード例 #47
0
 public PlainTextCompletionSource(
     ITextBuffer buffer,
     ITextStructureNavigator structureNavigator,
     IVsfSettings settings)
 {
     this.theBuffer = buffer;
       this.navigator = structureNavigator;
       this.settings = settings;
       String assemblyName = this.GetType().Assembly.GetName().Name;
       glyphIcon = new BitmapImage(new Uri(String.Format(
     "pack://application:,,,/{0};component/Resources/PlainTextCompletion.ico",
     assemblyName)));
 }
コード例 #48
0
ファイル: SearchServiceTest.cs プロジェクト: wmchristie/VsVim
        public void Create(params string[] lines)
        {
            _textBuffer = CreateTextBuffer(lines);
            _wordNavigator = WordUtilFactory.GetWordUtil(_textBuffer).CreateTextStructureNavigator(WordKind.NormalWord);
            _globalSettings = Vim.GlobalSettings;
            _globalSettings.Magic = true;
            _globalSettings.IgnoreCase = true;
            _globalSettings.SmartCase = false;

            _textSearch = TextSearchService;
            _searchRaw = new SearchService(_textSearch, _globalSettings);
            _search = _searchRaw;
        }
            internal TextStructureNavigator(
                ITextBuffer subjectBuffer,
                ITextStructureNavigator naturalLanguageNavigator,
                AbstractTextStructureNavigatorProvider provider,
                IWaitIndicator waitIndicator)
            {
                Contract.ThrowIfNull(subjectBuffer);
                Contract.ThrowIfNull(naturalLanguageNavigator);
                Contract.ThrowIfNull(provider);

                _subjectBuffer = subjectBuffer;
                _naturalLanguageNavigator = naturalLanguageNavigator;
                _provider = provider;
                _waitIndicator = waitIndicator;
            }
コード例 #50
0
ファイル: VimUtil.cs プロジェクト: rride/VsVim
 internal static ICommonOperations CreateCommonOperations(
     ITextView textView,
     IVimLocalSettings localSettings,
     IOutliningManager outlining = null,
     IStatusUtil statusUtil = null,
     ISearchService searchService = null,
     IUndoRedoOperations undoRedoOperations = null,
     IVimData vimData = null,
     IVimHost vimHost = null,
     ITextStructureNavigator navigator = null,
     IClipboardDevice clipboardDevice = null,
     IFoldManager foldManager = null)
 {
     var editorOperations = EditorUtil.GetOperations(textView);
     var editorOptions = EditorUtil.FactoryService.EditorOptionsFactory.GetOptions(textView);
     var jumpList = new JumpList(new TrackingLineColumnService());
     var keyMap = new KeyMap();
     foldManager = foldManager ?? new FoldManager(textView.TextBuffer);
     statusUtil = statusUtil ?? new StatusUtil();
     searchService = searchService ?? CreateSearchService(localSettings.GlobalSettings);
     undoRedoOperations = undoRedoOperations ??
                          new UndoRedoOperations(statusUtil, FSharpOption<ITextUndoHistory>.None);
     vimData = vimData ?? new VimData();
     vimHost = vimHost ?? new MockVimHost();
     navigator = navigator ?? CreateTextStructureNavigator(textView.TextBuffer);
     clipboardDevice = clipboardDevice ?? new MockClipboardDevice();
     var operationsData = new OperationsData(
         editorOperations,
         editorOptions,
         foldManager,
         jumpList,
         keyMap,
         localSettings,
         outlining != null ? FSharpOption.Create(outlining) : FSharpOption<IOutliningManager>.None,
         CreateRegisterMap(clipboardDevice),
         searchService,
         EditorUtil.FactoryService.SmartIndentationService,
         statusUtil,
         textView,
         undoRedoOperations,
         vimData,
         vimHost,
         navigator);
     return new CommonOperations(operationsData);
 }
コード例 #51
0
ファイル: MockObjectFactory.cs プロジェクト: sehe/VsVim
 public static Mock<IVimBuffer> CreateVimBuffer(
     ITextView textView,
     string name = null,
     IVim vim = null,
     IJumpList jumpList = null,
     IVimLocalSettings localSettings = null,
     IIncrementalSearch incrementalSearch = null,
     IMotionUtil motionUtil = null,
     ITextStructureNavigator wordNavigator = null,
     MockRepository factory = null)
 {
     factory = factory ?? new MockRepository(MockBehavior.Strict);
     name = name ?? "test";
     vim = vim ?? CreateVim().Object;
     jumpList = jumpList ?? (factory.Create<IJumpList>().Object);
     motionUtil = motionUtil ?? factory.Create<IMotionUtil>().Object;
     wordNavigator = wordNavigator ?? factory.Create<ITextStructureNavigator>().Object;
     localSettings = localSettings ?? new LocalSettings(vim.GlobalSettings);
     var vimTextBuffer = CreateVimTextBuffer(
         textView.TextBuffer,
         localSettings: localSettings,
         vim: vim,
         factory: factory);
     var mock = factory.Create<IVimBuffer>();
     mock.SetupGet(x => x.TextView).Returns(textView);
     mock.SetupGet(x => x.MotionUtil).Returns(motionUtil);
     mock.SetupGet(x => x.TextBuffer).Returns(() => textView.TextBuffer);
     mock.SetupGet(x => x.TextSnapshot).Returns(() => textView.TextSnapshot);
     mock.SetupGet(x => x.Name).Returns(name);
     mock.SetupGet(x => x.LocalSettings).Returns(localSettings);
     mock.SetupGet(x => x.GlobalSettings).Returns(localSettings.GlobalSettings);
     mock.SetupGet(x => x.MarkMap).Returns(vim.MarkMap);
     mock.SetupGet(x => x.RegisterMap).Returns(vim.RegisterMap);
     mock.SetupGet(x => x.JumpList).Returns(jumpList);
     mock.SetupGet(x => x.Vim).Returns(vim);
     mock.SetupGet(x => x.VimData).Returns(vim.VimData);
     mock.SetupGet(x => x.IncrementalSearch).Returns(incrementalSearch);
     mock.SetupGet(x => x.WordNavigator).Returns(wordNavigator);
     mock.SetupGet(x => x.VimTextBuffer).Returns(vimTextBuffer.Object);
     return mock;
 }
 public GoToDefMouseHandler(IWpfTextView view, IOleCommandTarget commandTarget, IClassifier aggregator,
                            ITextStructureNavigator navigator, CtrlKeyState state)
 {
     _view = view;
     _commandTarget = commandTarget;
     _aggregator = aggregator;
     _navigator = navigator;
     _state = state;
 }
コード例 #53
0
        private void Create(
            IEditorOperations editorOpts = null,
            ITextStructureNavigator baseNav = null,
            params string[] lines)
        {
            _host = new Mock<IVimHost>(MockBehavior.Strict);
            if (editorOpts == null)
            {
                var tuple = EditorUtil.CreateViewAndOperations(lines);
                _view = tuple.Item1;
                editorOpts = tuple.Item2;
            }
            else
            {
                _view = EditorUtil.CreateView(lines);
            }

            baseNav = baseNav ?? (new Mock<ITextStructureNavigator>(MockBehavior.Strict)).Object;
            var nav = TssUtil.CreateTextStructureNavigator(WordKind.NormalWord, baseNav);
            _globalSettings = MockObjectFactory.CreateGlobalSettings(ignoreCase: true);
            _settings = MockObjectFactory.CreateLocalSettings(_globalSettings.Object);
            _jumpList = new Mock<IJumpList>(MockBehavior.Strict);
            _searchService = new SearchService(EditorUtil.FactoryService.textSearchService, _globalSettings.Object);
            _search = new Mock<IIncrementalSearch>(MockBehavior.Strict);
            _search.SetupGet(x => x.SearchService).Returns(_searchService);
            _statusUtil = new Mock<IStatusUtil>(MockBehavior.Strict);
            _outlining = new Mock<IOutliningManager>(MockBehavior.Strict);
            _undoRedoOperations = new Mock<IUndoRedoOperations>(MockBehavior.Strict);
            _operationsRaw = new DefaultOperations(_view, editorOpts, _outlining.Object, _host.Object, _statusUtil.Object, _settings.Object, nav, _jumpList.Object, _search.Object, _undoRedoOperations.Object);
            _operations = _operationsRaw;
        }
コード例 #54
0
        //=====================================================================

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="textView">The text view to use</param>
        /// <param name="serviceProvider">The service provider to use</param>
        /// <param name="aggregator">The classifier tag aggregator to use</param>
        /// <param name="navigator">The text structure navigator to use</param>
        /// <param name="state">The Ctrl key state tracker to use</param>
        /// <param name="enableInCRef">True to enable in <c>cref</c> targets, false if not</param>
        public CSharpGoToDefinitionMouseProcessor(IWpfTextView textView, SVsServiceProvider serviceProvider,
          IClassifier aggregator, ITextStructureNavigator navigator, CtrlKeyState state, bool enableInCRef) :
            base(textView, serviceProvider, aggregator, navigator, state)
        {
            this.enableInCRef = enableInCRef;
        }
コード例 #55
0
 private void FindNext(string text, int position = 0, SearchPath path = null, bool isWrap = true, ITextStructureNavigator navigator = null)
 {
     navigator = navigator ?? _wordNavigator;
     path = path ?? SearchPath.Forward;
     var point = _textBuffer.GetPoint(position);
     _search.FindNext(point, new SearchData(text, path, isWrap), navigator);
 }
コード例 #56
0
ファイル: IncrementalSearchTest.cs プロジェクト: franch/VsVim
 private void Create(params string[] lines)
 {
     _textView = EditorUtil.CreateTextView(lines);
     _globalSettings = new Vim.GlobalSettings();
     _globalSettings.IncrementalSearch = true;
     _globalSettings.WrapScan = true;
     _localSettings = new LocalSettings(_globalSettings, EditorUtil.GetEditorOptions(_textView), _textView);
     _nav = VimUtil.CreateTextStructureNavigator(_textView, WordKind.NormalWord);
     _factory = new MockRepository(MockBehavior.Strict);
     _vimHost = _factory.Create<IVimHost>();
     _vimHost.Setup(x => x.EnsureVisible(_textView, It.IsAny<SnapshotPoint>()));
     _statusUtil = _factory.Create<IStatusUtil>();
     _statusUtil.Setup(x => x.OnWarning(Resources.Common_SearchBackwardWrapped));
     _statusUtil.Setup(x => x.OnWarning(Resources.Common_SearchForwardWrapped));
     _vimData = new VimData();
     _operations = VimUtil.CreateCommonOperations(
         textView: _textView,
         localSettings: _localSettings,
         vimHost: _vimHost.Object,
         statusUtil: _statusUtil.Object);
     _searchRaw = new IncrementalSearch(
         _operations,
         _localSettings,
         _nav,
         _statusUtil.Object,
         _vimData);
     _search = _searchRaw;
 }
コード例 #57
0
 public PaketCompletionSource(IGlyphService glyphService, ITextBuffer textBuffer, ITextStructureNavigator navigator)
 {
     this.textBuffer = textBuffer;
     this.navigator = navigator;
     glyph = glyphService.GetGlyph(StandardGlyphGroup.GlyphGroupVariable, StandardGlyphItem.GlyphItemPublic);
 }
コード例 #58
0
ファイル: MockObjectFactory.cs プロジェクト: Kazark/VsVim
 /// <summary>
 /// Create a Mock over IVimTextBuffer which provides the msot basic functions
 /// </summary>
 public static Mock<IVimTextBuffer> CreateVimTextBuffer(
     ITextBuffer textBuffer,
     IVimLocalSettings localSettings = null,
     IVim vim = null,
     ITextStructureNavigator wordNavigator = null,
     IUndoRedoOperations undoRedoOperations = null,
     MockRepository factory = null)
 {
     factory = factory ?? new MockRepository(MockBehavior.Strict);
     vim = vim ?? CreateVim(factory: factory).Object;
     localSettings = localSettings ?? CreateLocalSettings(factory: factory).Object;
     wordNavigator = wordNavigator ?? factory.Create<ITextStructureNavigator>().Object;
     undoRedoOperations = undoRedoOperations ?? factory.Create<IUndoRedoOperations>().Object;
     var mock = factory.Create<IVimTextBuffer>();
     mock.SetupGet(x => x.TextBuffer).Returns(textBuffer);
     mock.SetupGet(x => x.LocalSettings).Returns(localSettings);
     mock.SetupGet(x => x.GlobalSettings).Returns(localSettings.GlobalSettings);
     mock.SetupGet(x => x.Vim).Returns(vim);
     mock.SetupGet(x => x.WordNavigator).Returns(wordNavigator);
     mock.SetupGet(x => x.ModeKind).Returns(ModeKind.Normal);
     mock.SetupGet(x => x.UndoRedoOperations).Returns(undoRedoOperations);
     mock.SetupProperty(x => x.LastVisualSelection);
     mock.SetupProperty(x => x.LastInsertExitPoint);
     mock.SetupProperty(x => x.LastEditPoint);
     mock.Setup(x => x.SwitchMode(It.IsAny<ModeKind>(), It.IsAny<ModeArgument>()));
     return mock;
 }
コード例 #59
0
ファイル: SearchService.cs プロジェクト: manojdjoshi/dnSpy
		public SearchService(IWpfTextView wpfTextView, ITextSearchService2 textSearchService2, ISearchSettings searchSettings, IMessageBoxService messageBoxService, ITextStructureNavigator textStructureNavigator, Lazy<IReplaceListenerProvider>[] replaceListenerProviders, IEditorOperationsFactoryService editorOperationsFactoryService) {
			if (wpfTextView == null)
				throw new ArgumentNullException(nameof(wpfTextView));
			if (textSearchService2 == null)
				throw new ArgumentNullException(nameof(textSearchService2));
			if (searchSettings == null)
				throw new ArgumentNullException(nameof(searchSettings));
			if (messageBoxService == null)
				throw new ArgumentNullException(nameof(messageBoxService));
			if (textStructureNavigator == null)
				throw new ArgumentNullException(nameof(textStructureNavigator));
			if (replaceListenerProviders == null)
				throw new ArgumentNullException(nameof(replaceListenerProviders));
			this.wpfTextView = wpfTextView;
			editorOperations = editorOperationsFactoryService.GetEditorOperations(wpfTextView);
			this.textSearchService2 = textSearchService2;
			this.searchSettings = searchSettings;
			this.messageBoxService = messageBoxService;
			this.textStructureNavigator = textStructureNavigator;
			this.replaceListenerProviders = replaceListenerProviders;
			listeners = new List<ITextMarkerListener>();
			searchString = string.Empty;
			replaceString = string.Empty;
			searchKind = SearchKind.None;
			searchControlPosition = SearchControlPosition.Default;
			wpfTextView.VisualElement.CommandBindings.Add(new CommandBinding(ApplicationCommands.Find, (s, e) => ShowFind()));
			wpfTextView.VisualElement.CommandBindings.Add(new CommandBinding(ApplicationCommands.Replace, (s, e) => ShowReplace()));
			wpfTextView.Closed += WpfTextView_Closed;
			UseGlobalSettings(true);
		}
コード例 #60
0
        public GoToDefMouseHandler(IWpfTextView view, IOleCommandTarget commandTarget, IClassifier aggregator,
                                   ITextStructureNavigator navigator, CtrlKeyState state)
        {
            _view = view;
            _commandTarget = commandTarget;
            _state = state;
            _aggregator = aggregator;
            _navigator = navigator;

            _state.CtrlKeyStateChanged += (sender, args) =>
            {
                if (_state.Enabled)
                    this.TryHighlightItemUnderMouse(RelativeToView(Mouse.PrimaryDevice.GetPosition(_view.VisualElement)));
                else
                    this.SetHighlightSpan(null);
            };

            // Some other points to clear the highlight span:

            _view.LostAggregateFocus += (sender, args) => this.SetHighlightSpan(null);
            _view.VisualElement.MouseLeave += (sender, args) => this.SetHighlightSpan(null);
        }