The Artima Developer Community
Sponsored Link

.NET Buzz Forum
Expansions Part 2: Filtered Completion Lists

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Dan Fernandez

Posts: 456
Nickname: danielfe
Registered: Aug, 2003

Daniel Fernandez is the Product Manager for C# in the developer division at Microsoft.
Expansions Part 2: Filtered Completion Lists Posted: Nov 12, 2003 1:33 AM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Dan Fernandez.
Original Post: Expansions Part 2: Filtered Completion Lists
Feed Title: Dan Fernandez's Blog
Feed URL: /msdnerror.htm?aspxerrorpath=/danielfe/Rss.aspx
Feed Description: Dan discusses Dot Net.
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Dan Fernandez
Latest Posts From Dan Fernandez's Blog

Advertisement

I noticed a great question from Luke Hutteman (of SharpReader fame) on Chris Sells blog.  His question is:

"Will VS.NET also (like IDEA) be smart enough to give me a dropdown with appropriate values for the template-variables? That is, if the template calls for an IList somewhere, will it show a dropdown with all IList-type variables that are in scope at that time?"

Note: If you're interested in the basics of creating expansions, check out my first blog entry on expansions.

Back to Luke's question, the answer is yes it will.  In fact, the foreach expansion does exactly that by showing objects that implement the IEnumerable interface within the specific scope where the expansion was called.  To do this, you can add a <function></function> tag to the literal variable declaration and use the built-in function ListVariablesOfType(type)Below is a fragment of the XML markup of the foreach expansion: 

<literal>
   <id>collection</id>
   <tooltip>Name of collection or array to iterate through</tooltip>
   <function>ListVariablesOfType(System.Collections.IEnumerable)</function>
   <default>collection_to_loop</default>
  </literal>

When the expansion is invoked and the user tabs to the collection variable, they will see a list of IEnumerable collections.

The code section for the foreach expansion (below) is straighforward with the collection literal being declared the same as any other variable.

  <code language="csharp">
   <![CDATA[foreach ($type$ $indentifier$ in $collection$)
  {
   $selected$ $end$
  }]]>
  </code>

PS: If you still want to code in C# but want to use IDEA tools instead of VS, this post makes it sound like we'll soon have a version of IntelliJ for C# :)

Read: Expansions Part 2: Filtered Completion Lists

Topic: Jumping into newsgroups Previous Topic   Next Topic Topic: XBox Live v2

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use