示例#1
0
        private void OnTextViewMouseHover(object sender, MouseHoverEventArgs ee)
        {
            ITextBuffer buff = null;
            //find the mouse position by mapping down to the subject buffer
            SnapshotPoint?point = m_textView.BufferGraph.MapDownToFirstMatch
                                      (new SnapshotPoint(m_textView.TextSnapshot, ee.Position),
                                      PointTrackingMode.Positive,
                                      snapshot => m_subjectBuffers.Contains(buff = snapshot.TextBuffer),
                                      PositionAffinity.Predecessor);

            if (point != null)
            {
                ITrackingPoint triggerPoint = point.Value.Snapshot.CreateTrackingPoint(point.Value.Position,
                                                                                       PointTrackingMode.Positive);

                EnvDTE.DTE      dte = SQVSUtils.GetService <EnvDTE.DTE>();
                EnvDTE.Debugger dbg = dte.Debugger as EnvDTE.Debugger;

                if (dbg != null && dte.Debugger.CurrentMode == dbgDebugMode.dbgBreakMode)
                {
                    string filename = SQLanguageServiceEX.GetFileName(buff);

                    SQProjectFileNode node = _languageService.GetNode(filename);
                    SQVSUtils.CreateDataTipViewFilter(_serviceProvider, node);
                }
                else if (!m_provider.QuickInfoBroker.IsQuickInfoActive(m_textView))
                {
                    //m_session = m_provider.QuickInfoBroker.TriggerQuickInfo(m_textView, triggerPoint, true);
                    /*Setting DEBUG_PROPERTY_INFO.bstrFullName enables the button. I think it uses that name to persist the data tip to a file. It sure would be nice if the documentation gets enhanced one of these days!*/
                }
            }
        }
示例#2
0
        public ITagger <T> CreateTagger <T>(ITextBuffer buffer) where T : ITag
        {
            ISQLanguageService service = SQVSUtils.GetService <ISQLanguageService>();

            //return new AttributeScopeTagger(TextSearchService, TextStructureNavigatorSelector, buffer, service as SQLanguageService, _classificationRegistry, _classifierAggregator) as ITagger<T>;
            return(buffer.Properties.GetOrCreateSingletonProperty(delegate() { return new AttributeScopeTagger(TextSearchService, TextStructureNavigatorSelector, buffer, service as SQLanguageService, _classificationRegistry, _classifierAggregator); }) as ITagger <T>);
        }
示例#3
0
 internal SQIntellisenseController(IServiceProvider serviceProvider, ITextView textView, IList <ITextBuffer> subjectBuffers, SQIntellisenseControllerProvider provider)
 {
     m_textView             = textView;
     m_subjectBuffers       = subjectBuffers;
     m_provider             = provider;
     _serviceProvider       = serviceProvider;
     m_textView.MouseHover += this.OnTextViewMouseHover;
     _languageService       = SQVSUtils.GetService <ISQLanguageService>() as SQLanguageServiceEX;
 }
        int IVsSimpleObjectList2.GoToSource(uint index, VSOBJGOTOSRCTYPE SrcType)
        {
            SQObjectLibraryNode node;

            if (GetChild(index, out node))
            {
                SQVSUtils.OpenDocumentInNewWindow(node._declaration.Url, node._filenode.ProjectMgr.Site, node._declaration.Span.iStartLine);
                return(VSConstants.S_OK);
            }
            else
            {
                return(VSConstants.S_FALSE);
            }
        }
        private void SquirrelProjectNode_OnProjectPropertyChanged(object sender, ProjectPropertyChangedArgs e)
        {
            if (e.NewValue != null)
            {
                SQLanguageServiceEX languageservice = (SQLanguageServiceEX)ProjectPackage.GetGlobalService(typeof(ISQLanguageService));
                if (e.PropertyName == GeneralPropertyPageTags.IntellisenseEnabled.ToString())
                {
                    languageservice.IntellisenseEnabled = SQVSUtils.GetProjectPropertyBool(this, GeneralPropertyPageTags.IntellisenseEnabled.ToString());
                }

                /*else if (e.PropertyName == GeneralPropertyPageTags.ClassViewEnabled.ToString())
                 *  languageservice.ClassViewEnabled = SQVSUtils.GetProjectPropertyBool(this, GeneralPropertyPageTags.ClassViewEnabled.ToString());*/
            }
        }
        public ITextBuffer[] GetLoadedBuffers(out string[] notloadedfiles)
        {
            List <ITextBuffer> h          = new List <ITextBuffer>(_nodes.Count);
            List <string>      freshfiles = new List <string>(_nodes.Count);

            foreach (SQProjectFileNode node in _nodes)
            {
                string path = node.Url;
                var    v    = SQVSUtils.GetBufferAt(path, node.ProjectMgr.Site);
                if (v != null)
                {
                    h.Add(v);
                }
                else
                {
                    freshfiles.Add(path);
                }
            }
            notloadedfiles = freshfiles.ToArray();
            return(h.ToArray());
        }
示例#7
0
        private void url_MouseDown(object sender, MouseButtonEventArgs e)
        {
            TextBlock     block = sender as TextBlock;
            SQDeclaration d     = block.Tag as SQDeclaration;

            if (d != null)
            {
                SQVSUtils.OpenDocumentInNewWindow(d.Url, presenter.serviceProvider, d.Span.iStartLine);
            }

            /*if(Dispatcher.CheckAccess())
             * {
             *  SQVSUtils.OpenDocumentInNewWindow(d.Url, presenter.serviceProvider, d.Span.iStartLine);
             * }
             * else
             * {
             *  Dispatcher.BeginInvoke((Action)delegate ()
             *  {
             *      SQVSUtils.OpenDocumentInNewWindow(d.Url, presenter.serviceProvider, d.Span.iStartLine);
             *  });
             * }*/
        }
        void RegisterError(bool isnewversion, SQDeclaration d, string filepath, ref SQCompileError error)
        {
            if (isnewversion)
            {
                RemoveNodesWithFilepath(filepath);
                _nodeErrors.Remove(filepath);
                if (error != null)
                {
                    _nodeErrors[filepath] = error;
                }

                _errorHandler.RemoveMessageWithPartialKey(filepath);
                //RemoveNodesWithFilepath(filepath);
                //MapObjects(GetNode(filepath), d);
            }
            _nodeErrors.TryGetValue(filepath, out error);
            if (isnewversion && error != null)
            {
                TextSpan ts = new TextSpan();
                ts.iStartLine  = ts.iEndLine = error.line - 1;
                ts.iStartIndex = error.column - 1;
                string             key  = GenerateMessageKey(filepath, ts);
                CompleteErrorEvent func = new CompleteErrorEvent((e) =>
                {
                    e.Line          = ts.iStartLine;
                    e.Column        = ts.iStartIndex;
                    e.Document      = filepath;
                    e.HierarchyItem = GetNode(filepath);
                    int length      = ts.iEndIndex - ts.iStartIndex;
                    e.Navigate     += (s, ee) =>
                    {
                        SQVSUtils.OpenDocumentInNewWindow(filepath, _serviceProvider, ts.iStartLine, ts.iStartIndex, 1);
                    };
                });
                _errorHandler.PostMessage(TaskErrorCategory.Error, TaskCategory.CodeSense, func, false, key, error.error);
            }
        }
示例#9
0
 public SQQuickInfoSource(SQQuickInfoSourceProvider provider, ITextBuffer subjectBuffer)
 {
     _subjectBuffer   = subjectBuffer;
     _provider        = provider;
     _languageService = SQVSUtils.GetService <ISQLanguageService>() as SQLanguageServiceEX;
 }
示例#10
0
        public ITagger <T> CreateTagger <T>(ITextBuffer buffer) where T : ITag
        {
            ISQLanguageService service = SQVSUtils.GetService <ISQLanguageService>();

            return(new AttributeScopeTagger(TextSearchService, TextStructureNavigatorSelector, buffer, service as SQLanguageService, _classificationRegistry, _classifierAggregator) as ITagger <T>);
        }
示例#11
0
        public ICompletionSource TryCreateCompletionSource(ITextBuffer textBuffer)
        {
            ISQLanguageService service = SQVSUtils.GetService <ISQLanguageService>();

            return(new SQCompletionSource(GlyphService, NavigatorService.GetTextStructureNavigator(textBuffer), textBuffer, service as SQLanguageServiceEX));
        }