public override void OnCaretMoved(CodeWindowManager mgr, IVsTextView textView, int line, int col)
        {
            base.OnCaretMoved(mgr, textView, line, col);

            string text = mgr.Source.GetText(line, col - 1, line, col);
            if (text.Equals(";"))
                OnIdle(false);
        }
Esempio n. 2
0
 /// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="DocumentProperties.Close"]/*' />
 public void Close()
 {
     if (this.tracker != null && this.visible)
     {
         NativeMethods.ThrowOnFailure(tracker.OnSelectChange(null));
     }
     this.tracker = null;
     this.mgr     = null;
 }
Esempio n. 3
0
 /// <include file='doc\ViewFilter.uex' path='docs/doc[@for="ViewFilter.ViewFilter"]/*' />
 public ViewFilter(CodeWindowManager mgr, IVsTextView view) {
     this.pvaChar = IntPtr.Zero;
     this.mgr = mgr;
     this.service = mgr.LanguageService;
     this.source = mgr.Source;
     this.commentSupported = this.service.Preferences.EnableCommenting;
     this.textView = view;
     NativeMethods.ThrowOnFailure(view.AddCommandFilter(this, out nextTarget));
     this.textViewEvents = new NativeMethods.ConnectionPointCookie(view, this, typeof(IVsTextViewEvents));
 }
Esempio n. 4
0
 /// <include file='doc\ViewFilter.uex' path='docs/doc[@for="ViewFilter.ViewFilter"]/*' />
 public ViewFilter(CodeWindowManager mgr, IVsTextView view)
 {
     this.pvaChar          = IntPtr.Zero;
     this.mgr              = mgr;
     this.service          = mgr.LanguageService;
     this.source           = mgr.Source;
     this.commentSupported = this.service.Preferences.EnableCommenting;
     this.textView         = view;
     NativeMethods.ThrowOnFailure(view.AddCommandFilter(this, out nextTarget));
     this.textViewEvents = new NativeMethods.ConnectionPointCookie(view, this, typeof(IVsTextViewEvents));
 }
Esempio n. 5
0
 /// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="DocumentProperties.DocumentProperties"]/*' />
 protected DocumentProperties(CodeWindowManager mgr) {
     this.mgr = mgr;
     this.visible = true;
     if (mgr != null) {
         IOleServiceProvider sp = mgr.CodeWindow as IOleServiceProvider;
         if (sp != null) {
             ServiceProvider site = new ServiceProvider(sp);
             this.tracker = site.GetService(typeof(SVsTrackSelectionEx)) as IVsTrackSelectionEx;
         }
     }
 }
Esempio n. 6
0
 /// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="DocumentProperties.Dispose"]/*' />
 protected virtual void Dispose(bool disposing)
 {
     // If disposing equals true, dispose all managed
     // and unmanaged resources.
     if (disposing)
     {
         // Dispose managed resources.
     }
     this.tracker = null;
     this.mgr     = null;
 }
Esempio n. 7
0
 /// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="DocumentProperties.DocumentProperties"]/*' />
 protected DocumentProperties(CodeWindowManager mgr)
 {
     this.mgr     = mgr;
     this.visible = true;
     if (mgr != null)
     {
         IOleServiceProvider sp = mgr.CodeWindow as IOleServiceProvider;
         if (sp != null)
         {
             ServiceProvider site = new ServiceProvider(sp);
             this.tracker = site.GetService(typeof(SVsTrackSelectionEx)) as IVsTrackSelectionEx;
         }
     }
 }
Esempio n. 8
0
 /// <include file='doc\ViewFilter.uex' path='docs/doc[@for="ViewFilter.Dispose"]/*' />
 public virtual void Dispose()
 {
     if (this.textView != null)
     {
         Marshal.ReleaseComObject(this.textView);
         this.textView = null;
     }
     this.service = null;
     if (this.nextTarget != null)
     {
         Marshal.ReleaseComObject(this.nextTarget);
         this.nextTarget = null;
     }
     this.textTipData = null;
     this.mgr         = null;
     if (this.pvaChar != IntPtr.Zero)
     {
         Marshal.FreeCoTaskMem(pvaChar);
         pvaChar = IntPtr.Zero;
     }
     GC.SuppressFinalize(this);
 }
 public override ViewFilter CreateViewFilter(CodeWindowManager mgr, IVsTextView newView)
 {
     return new NShaderViewFilter(this, mgr, newView);
 }
Esempio n. 10
0
 /// <include file='doc\LanguageService.uex' path='docs/doc[@for="LanguageService.OnCaretMoved"]/*' />
 /// Переопределяем этот метод, чтобы вызвать SynchronizeDropdowns у 
 /// NemerleTypeAndMemberDropdownBars, а не CodeWindowManager, а так же обновить 
 /// информацию в Engine о активном файле и позиции в нем. Это требуется для ускорения
 /// типизации методов с которыми в данный момент взаимодействует пользователь.
 public override void OnCaretMoved(CodeWindowManager mgr, IVsTextView textView, int line, int col)
 {
     if (mgr.DropDownHelper != null)
     {
         var dropDownHelper = (NemerleTypeAndMemberDropdownBars)mgr.DropDownHelper;
         dropDownHelper.SynchronizeDropdownsRsdn(textView, line, col);
         UpdateViewInfo(textView, line, col);
     }
 }
Esempio n. 11
0
 public override ViewFilter CreateViewFilter(CodeWindowManager mgr, IVsTextView newView)
 {
     return new MetaModelLanguageViewFilter(mgr, newView);
 }
Esempio n. 12
0
 public override ViewFilter CreateViewFilter(CodeWindowManager mgr, IVsTextView newView)
 {
     return new NeoLuaViewFilter(mgr, newView);
 }
Esempio n. 13
0
        public int GetTextViewFilter(IVsIntellisenseHost pISenseHost, IOleCommandTarget pNextCmdTarget, out IVsTextViewFilter pTextViewFilter)
        {
            pTextViewFilter = null;

            IVsTextLines buffer;
            ErrorHandler.ThrowOnFailure(bufferCoordinator.GetSecondaryBuffer(out buffer));

            var secondaryFilePath = FilePathUtilities.GetFilePath(buffer);

            if (secondaryFilePath == null)
                secondaryFilePath = NemerleSource.GetStubFileForSecondaryBuffer(buffer);

            var secondaryFileIndex = Location.GetFileIndex(secondaryFilePath);
            var primaryFileindex = Location.GetFileIndex(_filePath);

            bool doOutlining = LanguageService.Preferences.AutoOutlining;
            LanguageService.Preferences.AutoOutlining = false;

            if (_projectInfo != null && LanguageService.GetSource(buffer) == null)
            {
                // создаем и регистрируем в проекте временный source, чтобы не сломалась логика
                // конструктора NemerleSource (см вызов LanguageService.AddEditableSource)
                //_projectInfo.ReplaseOrAddSource(new FileNemerleSource(secondaryFileIndex));
                _projectInfo.AddEditableSource((NemerleSource)LanguageService.CreateSource(buffer));
            }

            NemerleSource source = LanguageService.GetOrCreateSource(buffer) as NemerleSource;
            source.SetBufferCoordinator(bufferCoordinator);

            if (_projectInfo != null)
            {
                _projectInfo.Engine.RequestOnBuildTypesTree();
            }

            LanguageService.Preferences.AutoOutlining = doOutlining;

            _windowManager = LanguageService.CreateCodeWindowManager(null, source);

            language.AddCodeWindowManager(_windowManager);

            // увеличиваем внутренний счетчик openCount, для того чтобы впоследствии корректно отработала логика закрытия соурса
            source.Open();

            TextViewWrapper view = new TextViewWrapper(languageHost, pISenseHost, bufferCoordinator, pNextCmdTarget, source);
            _windowManager.OnNewView(view);

            pTextViewFilter = view.InstalledFilter;
            NemerleViewFilter nemerleFilter = pTextViewFilter as NemerleViewFilter;
            if (null != nemerleFilter)
                nemerleFilter.BufferCoordinator = this.bufferCoordinator;

            // сохраним значение DocumentEvents в переменной класса, чтобы исключить преждевременное уничтожение
            // объекта и автоматическоей отписывание от событий.
            //
            // Источник решения:
            // PRB: Visual Studio .NET events being disconnected from add-in (http://www.mztools.com/articles/2005/mz2005012.aspx)
            _documentEvents = _projectItem.DTE.Events.get_DocumentEvents(_projectItem.Document);

            _documentEvents.DocumentClosing += _documentClosingEventHandler;

            return VSConstants.S_OK;
        }
Esempio n. 14
0
 /// <include file='doc\LanguageService.uex' path='docs/doc[@for="LanguageService.RemoveCodeWindowManager"]/*' />
 public void RemoveCodeWindowManager(CodeWindowManager m) {
     this.codeWindowManagers.Remove(m);
 }
Esempio n. 15
0
 // Override this method if you want to insert your own view filter
 // into the command chain.  
 /// <include file='doc\LanguageService.uex' path='docs/doc[@for="LanguageService.CreateViewFilter"]/*' />
 public virtual ViewFilter CreateViewFilter(CodeWindowManager mgr, IVsTextView newView) {
     return new ViewFilter(mgr, newView);
 }
Esempio n. 16
0
 /// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="DocumentProperties.Close"]/*' />
 public void Close() {
     if (this.tracker != null && this.visible)
         NativeMethods.ThrowOnFailure(tracker.OnSelectChange(null));
     this.tracker = null;
     this.mgr = null;
 }
 public override ViewFilter CreateViewFilter(CodeWindowManager mgr, IVsTextView newView)
 {
     this.logger.Log(EventLogEntryType.Information, "Entering: CreateViewFilter()");
     return new OsloCodeGeneratorViewFilter(mgr, newView);
 }
 public PythonViewFilter(CodeWindowManager mgr, IVsTextView view)
     : base(mgr, view)
 {
 }
Esempio n. 19
0
        /// <include file='doc\ViewFilter.uex' path='docs/doc[@for="ViewFilter.ViewFilter"]/*' />
        public ViewFilter(CodeWindowManager mgr, IVsTextView view)
        {
            this.pvaChar = IntPtr.Zero;
            this.mgr = mgr;
            this.service = mgr.LanguageService;
            this.source = mgr.Source;
            this.commentSupported = this.service.Preferences.EnableCommenting;
            this.textView = view;
            NativeMethods.ThrowOnFailure(view.AddCommandFilter(this, out nextTarget));

            // Register text view event handlers
            // Delegate to virtual/overridable method
            RegisterTextViewEventHandlers(view);

            if ((this.service != null) && (this.service.Site != null)) {
                IVsExpansionManager emgr = this.service.Site.GetService(typeof(SVsExpansionManager)) as IVsExpansionManager;
                if (emgr != null) {
                    int fBound;
                    emgr.GetSnippetShortCutKeybindingState(out fBound);
                    this.snippetBound = fBound == 0 ? false : true;

                    // Register expansion manager event handlers
                    // Delegate to virtual/overridable method
                    RegisterExpansionManagerEventHandlers(emgr);
                }
            }
        }
Esempio n. 20
0
 public MetaModelLanguageViewFilter(CodeWindowManager mgr, IVsTextView view)
     : base(mgr, view)
 {
 }
Esempio n. 21
0
 /// <include file='doc\LanguageService.uex' path='docs/doc[@for="LanguageService.OnCaretMoved"]/*' />
 public virtual void OnCaretMoved(CodeWindowManager mgr, IVsTextView textView, int line, int col) {
     if (mgr.DropDownHelper != null)
         mgr.DropDownHelper.SynchronizeDropdowns(textView, line, col);
 }
Esempio n. 22
0
 // После закрытия aspx файла исключим автосгенерированный исходник из списка компиляции проекта
 void OnDocumentClosing(EnvDTE.Document document)
 {
     if (Location.GetFileIndex(document.FullName) == Location.GetFileIndex(_filePath))
     {
         try
         {
             if (_windowManager != null)
                 // RemoveAdornments вызывает уничтожение (close и dispose) view filter и source, связанных с _windowManager
                 _windowManager.RemoveAdornments();
         }
         finally
         {
             _windowManager = null;
             _documentEvents.DocumentClosing -= _documentClosingEventHandler;
         }
     }
 }
Esempio n. 23
0
 /// <include file='doc\LanguageService.uex' path='docs/doc[@for="LanguageService.CreateDocumentProperties"]/*' />
 // Override this method to create your own custom document properties for
 // display in the Properties Window when the editor for this Source is active.
 // Default is null which means there will be no document properties.
 public virtual DocumentProperties CreateDocumentProperties(CodeWindowManager mgr) {
     return null;
 }
        /// <include file='doc\CodeWindowManager.uex' path='docs/doc[@for="DocumentProperties.Dispose"]/*' />
        protected virtual void Dispose(bool disposing)
        {
            // If disposing equals true, dispose all managed
            // and unmanaged resources.
            if (disposing) {
                // Dispose managed resources.

            }
            this.tracker = null;
            this.mgr = null;
        }
Esempio n. 25
0
 /// <include file='doc\LanguageService.uex' path='docs/doc[@for="LanguageService.AddCodeWindowManager"]/*' />
 public void AddCodeWindowManager(CodeWindowManager m) {
     this.codeWindowManagers.Add(m);
 }
 public MockFilter(CodeWindowManager windowManager, IVsTextView view)
     : base(windowManager, view)
 {
 }
Esempio n. 27
0
 public NemerleViewFilter(CodeWindowManager mgr, IVsTextView view)
     : base(mgr, view)
 {
 }
Esempio n. 28
0
 public NShaderViewFilter(NShaderLanguageService langService, CodeWindowManager mgr, IVsTextView view)
     : base(mgr, view)
 {
     this.langService = langService;
 }
Esempio n. 29
0
 /// <include file='doc\ViewFilter.uex' path='docs/doc[@for="ViewFilter.Dispose"]/*' />
 public virtual void Dispose() {
     if (this.textView != null) {
         Marshal.ReleaseComObject(this.textView);
         this.textView = null;
     }
     this.service = null;
     if (this.nextTarget != null) {
         Marshal.ReleaseComObject(this.nextTarget);
         this.nextTarget = null;
     }
     this.textTipData = null;
     this.mgr = null;
     if (this.pvaChar != IntPtr.Zero) {
         Marshal.FreeCoTaskMem(pvaChar);
         pvaChar = IntPtr.Zero;
     }
     GC.SuppressFinalize(this);
 }
Esempio n. 30
0
 public override ViewFilter CreateViewFilter(CodeWindowManager mgr, IVsTextView newView)
 {
     // This call makes sure debugging events can be received by our view filter.
     //
     GetIVsDebugger();
     return new NemerleViewFilter(mgr, newView);
 }
Esempio n. 31
0
        public int GetCodeWindowManager(IVsCodeWindow pCodeWin, out IVsCodeWindowManager ppCodeWinMgr)
        {
            ppCodeWinMgr = null;
            return VSConstants.E_NOTIMPL;

            var model = _serviceProvider.GetService(typeof(SComponentModel)) as IComponentModel;
            var service = model.GetService<IVsEditorAdaptersFactoryService>();

            IVsTextView textView;
            if (ErrorHandler.Succeeded(pCodeWin.GetPrimaryView(out textView))) {
                ppCodeWinMgr = new CodeWindowManager(_serviceProvider, pCodeWin, service.GetWpfTextView(textView));

                return VSConstants.S_OK;
            }

            ppCodeWinMgr = null;
            return VSConstants.E_FAIL;
        }
 public OsloCodeGeneratorViewFilter(CodeWindowManager mgr, IVsTextView view)
     : base(mgr, view)
 {
 }
Esempio n. 33
0
 public IronyViewFilter(CodeWindowManager mgr, IVsTextView view)
     : base(mgr, view)
 {
 }
Esempio n. 34
0
 public virtual void OnCaretMoved(CodeWindowManager mgr, IVsTextView textView, int line, int col){
   if (this.EnableDropDownCombos && mgr.dropDownHelper != null){
     mgr.dropDownHelper.SynchronizeDropdowns(textView, line, col);
     mgr.dropDownHelper.dropDownBar.RefreshCombo(0, mgr.dropDownHelper.selectedType);
     mgr.dropDownHelper.dropDownBar.RefreshCombo(1, mgr.dropDownHelper.selectedMember);
   }
 }