Beispiel #1
0
        static void AddFilteredRazorTemplates(CompletionDataList list, bool atTemplates, bool stripLeadingAt)
        {
            //add the razor templates then filter them based on whether we follow an @ char, so we don't have
            //lots of duplicates
            int count = list.Count;

            MonoDevelop.Ide.CodeTemplates.CodeTemplateService.AddCompletionDataForMime("text/x-cshtml", list);
            for (int i = count; i < list.Count; i++)
            {
                var d = (CompletionData)list[i];
                if (atTemplates)
                {
                    if (d.CompletionText[0] != '@')
                    {
                        list.RemoveAt(i);
                    }
                    else if (stripLeadingAt)
                    {
                        //avoid inserting a double-@, which would not expand correctly
                        d.CompletionText = d.CompletionText.Substring(1);
                    }
                }
                else if (d.CompletionText[0] == '@')
                {
                    list.RemoveAt(i);
                }
            }
        }
		static void AddFilteredRazorTemplates (CompletionDataList list, bool atTemplates, bool stripLeadingAt)
		{
			//add the razor templates then filter them based on whether we follow an @ char, so we don't have
			//lots of duplicates
			int count = list.Count;
			MonoDevelop.Ide.CodeTemplates.CodeTemplateService.AddCompletionDataForMime ("text/x-cshtml", list);
			for (int i = count; i < list.Count; i++) {
				var d = (CompletionData) list[i];
				if (atTemplates) {
					if (d.CompletionText[0] != '@') {
						list.RemoveAt (i);
					} else if (stripLeadingAt) {
						//avoid inserting a double-@, which would not expand correctly
						d.CompletionText = d.CompletionText.Substring (1);
					}
				} else if (d.CompletionText[0] == '@') {
					list.RemoveAt (i);
				}
			}
		}