Partial Expression Completer is based on the concept of "partial expressions". For example, str.mUnknown(i) represents an unknown method call with the arguments str and i. Given that as input (assuming str is a string and i is an int), the results will include str.Substring(i), str.IndexOf(, i), and System.Convert.ToInt32(str, i). The important thing to notice here is that the suggested method may be a static method or have a different receiver and may have some empty argument positions to be filled in. In fact, the system interprets mUnknown(str, i) as exactly the same query.

To invoke the system, position your cursor on the partial expression or highlight the partial expression and then press the key combination sequence Ctrl+K, Ctrl+Space. Note that the second key combination is the same as for calling Visual Studio's Intellisense. Also, an alternate, more powerful view can be accessed by the key combination sequence Ctrl+K, Ctrl+Q.

A tool window will popup which will first just say "Loading..."; the results will appear as they are computed. Each result has a number next to it which is the score used to order the results; this number is unlikely to be meaningful outside of debugging and can be ignored. The results can be browsed by using the arrow keys or scrolling with the mouse. A result can be selected by hitting the Enter key or double-clicking with the mouse. The query can be cancelled by hitting the Esc key or clicking away.

The results are filtered by the return type of the context. A line with str.mUnknown(i) alone is a search for methods which return void. If the return type is unknown, prefix the query with var foo = to create a context where any non-void type is valid.


Partial expression Examples What it does
.mUnknown str.mUnknown(i), mUnknown(str, i), mUnknown() Unknown method. Takes zero or more arguments and matches a method or constructor call which uses all of those arguments. Only matches instance methods which take one of the arguments; other argument positions may be left empty.
.fUnknown str.fUnknown, mUnknown(str.fUnknown) Unknown field. Matches zero or one field/property lookups.
.ffUnknown str.ffUnknown, mUnknown(str.ffUnknown) Unknown fields. Matches zero or more field/property lookups. Like .fUnknown repeated.
.xUnknown str.xUnknown, mUnknown(str.xUnknown) Unknown lookup. Matches zero or one field/property lookups or zero-argument method calls like GetFoo().
.xxUnknown str.xxUnknown, mUnknown(str.xxUnknown) Unknown lookups. Matches zero or more field/property lookups or zero-argument method calls like GetFoo(). Like .xUnknown repeated.
xxUnknown xxUnknown, mUnknown(xxUnknown) Unknown value. Matches any local or global (i.e. static field/property). May also have zero or more field/property lookups or zero-argument method calls like GetFoo().
(type name) partial expression (int) m(str, i), (XmlReader)xxUnknown Require type. Specifies a partial expressions return type (otherwise the type will be determined from context).
type name XmlReader, FileStream Unknown value of type. Same as (type name) xxUnknown.


  • XmlReader xr = xx
    • Queries for any expression of type XmlReader
    • Equivalent to querying on just "XmlReader"
  • string s = "Hello World!"; int i = 3; char c = s.m(i)
    • Finds methods that take a string and an int
    • Equivalent to char c = m(s, i)
  • FileStream fs = m(file.xx)
    • Finds methods that take the variable "file" or some lookup of it and return a FileStream
  • foo.xx < bar.xx
    • Finds lookups under foo and bar of values which are comparable
  • foo.xx = bar.xx
    • Finds writable properties of foo and corresponding readable values within bar that can be assigned to them

Last edited Jun 4, 2012 at 3:24 AM by perelman, version 3


No comments yet.