Пример #1
0
        public ICompletionData[] GenerateCompletionData(string fileName, TextArea textArea, char charTyped)
        {
            // We can return code-completion items like this:

            //return new ICompletionData[] {
            //	new DefaultCompletionData("Text", "Description", 1)
            //};

            NRefactoryResolver resolver = new NRefactoryResolver(iForm.ProjectContent.Language);

            Dom.ResolveResult rr = resolver.Resolve(FindExpression(textArea),
                                                    iForm.ParseInformation,
                                                    textArea.MotherTextEditorControl.Text);
            List <ICompletionData> resultList = new List <ICompletionData>();

            if (rr != null)
            {
                var completionData = rr.GetCompletionData(iForm.ProjectContent);
                if (completionData != null)
                {
                    AddCompletionData(resultList, completionData);
                }
            }
            return(resultList.ToArray());
        }
        public ICompletionData[] GenerateCompletionData(string fileName, TextArea textArea, char charTyped)
        {
            // We can return code-completion items like this:

            //return new ICompletionData[] {
            //	new DefaultCompletionData("Text", "Description", 1)
            //};

            NRefactoryResolver resolver;

            if (mainForm.Language == "C#")
            {
                resolver = new NRefactoryResolver(mainForm.myProjectContent, ICSharpCode.SharpDevelop.Dom.LanguageProperties.CSharp);
            }
            else
            {
                resolver = new NRefactoryResolver(mainForm.myProjectContent, ICSharpCode.SharpDevelop.Dom.LanguageProperties.VBNet);
            }
            Dom.ResolveResult rr = resolver.Resolve(FindExpression(textArea),
                                                    textArea.Caret.Line,
                                                    textArea.Caret.Column,
                                                    fileName,
                                                    textArea.MotherTextEditorControl.Text);
            List <ICompletionData> resultList = new List <ICompletionData>();

            if (rr != null)
            {
                ArrayList completionData = rr.GetCompletionData(mainForm.myProjectContent);
                if (completionData != null)
                {
                    AddCompletionData(resultList, completionData);
                }
            }
            return(resultList.ToArray());
        }
Пример #3
0
        public override List <ICompletionEntry> GetCompletionData(IProjectContent projectContent)
        {
            List <ICompletionEntry> result  = primaryResult.GetCompletionData(projectContent);
            List <ICompletionEntry> result2 = secondaryResult.GetCompletionData(projectContent);

            if (result == null)
            {
                return(result2);
            }
            if (result2 == null)
            {
                return(result);
            }
            foreach (ICompletionEntry o in result2)
            {
                if (!result.Contains(o))
                {
                    result.Add(o);
                }
            }
            return(result);
        }
Пример #4
0
        public override ArrayList GetCompletionData(IProjectContent projectContent)
        {
            ArrayList result  = primaryResult.GetCompletionData(projectContent);
            ArrayList result2 = secondaryResult.GetCompletionData(projectContent);

            if (result == null)
            {
                return(result2);
            }
            if (result2 == null)
            {
                return(result);
            }
            foreach (object o in result2)
            {
                if (!result.Contains(o))
                {
                    result.Add(o);
                }
            }
            return(result);
        }
		public virtual ICompletionItemList GenerateCompletionListForResolveResult(ResolveResult rr, ExpressionContext context)
		{
			if (rr == null)
				return null;
			IProjectContent callingContent = rr.CallingClass != null ? rr.CallingClass.ProjectContent : null;
			List<ICompletionEntry> arr = rr.GetCompletionData(callingContent ?? ParserService.CurrentProjectContent, this.ShowItemsFromAllNamespaces);
			return GenerateCompletionListForCompletionData(arr, context);
		}
		protected void AddResolveResults(ResolveResult results, ExpressionContext context)
		{
			insertedElements.Clear();
			insertedPropertiesElements.Clear();
			insertedEventElements.Clear();
			
			if (results != null) {
				AddResolveResults(results.GetCompletionData(ParserService.CurrentProjectContent), context);
			}
		}