コード例 #1
0
ファイル: Library.cs プロジェクト: ugurak/nemerle
 internal void AddNode(LibraryNode node)
 {
     lock (this)
     {
         _root = new LibraryNode(_root);
         _root.AddNode(node);
     }
 }
コード例 #2
0
        void CreateModuleTree(
            LibraryNode root,
            LibraryNode current,
            ScopeNode scope,
            string namePrefix,
            ModuleID moduleId)
        {
            if ((null == root) || (null == scope) || (null == scope.NestedScopes))
            {
                return;
            }

            foreach (ScopeNode subItem in scope.NestedScopes)
            {
                NemerleLibraryNode newNode = new NemerleLibraryNode(
                    subItem, namePrefix, moduleId.Hierarchy, moduleId.ItemID);

                string newNamePrefix = namePrefix;

                // The classes are always added to the root node, the functions to the current node.
                //
                if ((newNode.NodeType & LibraryNode.LibraryNodeType.Members) != LibraryNode.LibraryNodeType.None)
                {
                    current.AddNode(newNode);
                }
                else if ((newNode.NodeType & LibraryNode.LibraryNodeType.Classes) != LibraryNode.LibraryNodeType.None)
                {
                    // Classes are always added to the root.
                    //
                    root.AddNode(newNode);
                    newNamePrefix = newNode.Name + ".";
                }

                // Now use recursion to get the other types.
                //
                CreateModuleTree(root, newNode, subItem, newNamePrefix, moduleId);
            }
        }
コード例 #3
0
        void CreateModuleTree(
            LibraryNode root,
            LibraryNode current,
            ScopeNode   scope,
            string	  namePrefix,
            ModuleID	moduleId)
        {
            if ((null == root) || (null == scope) || (null == scope.NestedScopes))
                return;

            foreach (ScopeNode subItem in scope.NestedScopes)
            {
                NemerleLibraryNode newNode = new NemerleLibraryNode(
                    subItem, namePrefix, moduleId.Hierarchy, moduleId.ItemID);

                string newNamePrefix = namePrefix;

                // The classes are always added to the root node, the functions to the current node.
                //
                if ((newNode.NodeType & LibraryNode.LibraryNodeType.Members) != LibraryNode.LibraryNodeType.None)
                {
                    current.AddNode(newNode);
                }
                else if ((newNode.NodeType & LibraryNode.LibraryNodeType.Classes) != LibraryNode.LibraryNodeType.None)
                {
                    // Classes are always added to the root.
                    //
                    root.AddNode(newNode);
                    newNamePrefix = newNode.Name + ".";
                }

                // Now use recursion to get the other types.
                //
                CreateModuleTree(root, newNode, subItem, newNamePrefix, moduleId);
            }
        }
コード例 #4
0
ファイル: Library.cs プロジェクト: vestild/nemerle
 internal void AddNode(LibraryNode node)
 {
     lock (this)
     {
         _root = new LibraryNode(_root);
         _root.AddNode(node);
     }
 }
コード例 #5
0
ファイル: NemerleViewFilter.cs プロジェクト: 89sos98/nemerle
        /// <summary>
        /// ���������� Find All References ������ ���� ��������� (� ����������� ������� ����� � �� ��-Nemerle ��������) 
        /// � ����������� ������ "Find Symbol Results" ������
        /// </summary>
        /// <remarks>
        /// �������� Source.Goto, � �������������� ���������� ������
        /// ����� ������� ��� ������� ���������� ������ � _library ����� ����� NemerleLibraryManager
        /// ����� �������� IVsObjectSearch.Find - ��������� ���������� �� ������, ������� ����� � ������� _library.GetList2(),
        /// IVsObjectSearch � ���� ������� ������ �������� � � ��������� �������� (���� �� �����������, �.�. ��� ������� ������� ������ ������ ���� VSOBSEARCHCRITERIA),
        /// � ������� ��� ���������� ������ � ������ Find Symbol Results (��� �������)
        /// 
        /// ���������� � ������� �� ����:		
        /// http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/951158dd-fc98-4325-b07d-bab65b372603/
        /// http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/793f916d-80a6-4944-b058-7166d48d3a32
        /// http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/3d85e968-f735-420c-b9c8-d57ed7839d36
        /// 
        /// �������� ��� ������ �� ����� ������� IVsObjectSearch.Find ������� �������� �� IVsFindSymbol.DoSearch 
        /// http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivsfindsymbol.dosearch.aspx
        /// ���� �����-�� ���� ��� ����� � ������ Find
        /// http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/08b71611-2c94-40e7-a79e-3be843c974ea/
        /// </remarks>
        private void FindReferences()
        {
            int line, col;

            // Get the caret position
            ErrorHandler.ThrowOnFailure(this.TextView.GetCaretPos(out line, out col));

            var findSvc = (IVsObjectSearch)Source.Service.GetService(typeof(SVsObjectSearch));

            //IVsNavInfo navInfo;

            if(findSvc != null)
            {
                string caption;
                var infos = Source.GetGotoInfo(TextView, false, line, col, out caption);
                if((infos != null) && (infos.Length > 0))
                {
                    var criteria = new[]
                    {
                        new VSOBSEARCHCRITERIA
                        {
                            eSrchType = VSOBSEARCHTYPE.SO_ENTIREWORD,
                            grfOptions = (uint)_VSOBSEARCHOPTIONS.VSOBSO_CASESENSITIVE,
                            szName = "<dummy>",
                            dwCustom = Library.FindAllReferencesMagicNum,
                        }
                    };

                    var inlm = Source.Service.GetService(typeof(INemerleLibraryManager));
                    if(inlm != null)
                    {
                        var nlm = (NemerleLibraryManager)inlm;

                        var libSearchResults = new LibraryNode("<dummy2>", LibraryNode.LibraryNodeType.References, LibraryNode.LibraryNodeCapabilities.None, null);

                        foreach(var i in infos)
                        {
                            var inner = new GotoInfoLibraryNode((NemerleLanguageService)Source.LanguageService, i, caption);
                            libSearchResults.AddNode(inner);
                        }

                        nlm.OnFindAllReferencesDone(libSearchResults);
                        IVsObjectList results;
                        var hr = findSvc.Find((uint)__VSOBSEARCHFLAGS.VSOSF_EXPANDREFS, criteria, out results);
                    }
                }
            }
        }