Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize


Specifies options for determining the extent of a word.

This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.

Namespace:  Microsoft.VisualStudio.TextManager.Interop
Assembly:  Microsoft.VisualStudio.TextManager.Interop (in Microsoft.VisualStudio.TextManager.Interop.dll)

public enum WORDEXTFLAGS

Member nameDescription
WORDEXT_CURRENTFinds a word or token containing a specified position, if any such word or token exists.
WORDEXT_FINDEXPRESSIONFind simple expressions, like *pFoo.
WORDEXT_FINDTOKENFinds words and tokens. See Remarks.
WORDEXT_FINDWORDFinds words only. See Remarks.
WORDEXT_NEARESTFinds the word or token nearest to a specified position.
WORDEXT_NEXTFinds the nearest word or token whose first character is greater than a specified position.
WORDEXT_PREVIOUSFinds the nearest word or token whose last character is less than a specified position.

For the WORDEXT_FINDWORD value, "FINDWORD" refers any of the following:

  • keyword

  • identifier

  • number

For the WORDEXT_FINDTOKEN value, "FINDTOKEN" refers to any of the following:

  • keyword, identifier, or number

  • operator (for example, ++ or %)

  • delimiter (for example, quotation marks (") or comment marks (// or /))

  • white space

Thus, by specifying a value of WORDEXT_FINDWORD, you return a word extent that corresponds to a keyword, a number, or an identifier. For example, if the text were "a[1]," the "a" or the "1" could be returned, but the whole expression would not be returned. However, if you specify a value of WORDEXT_FINDTOKEN, then you would return any keyword, number, or identifier, or you would return operators, delimiters, or white space. Thus, if the text were "a[1] ", any single character of the string could match, but any larger portion of the string would not.


The term "token" is not related to a language token in compiler terminology.

COM Signature

From textmgr.idl:

typedef enum _wordextflags
   WORDEXT_CURRENT        = 0x0000,
   WORDEXT_PREVIOUS       = 0x0001,
   WORDEXT_NEXT           = 0x0002,
   WORDEXT_NEAREST        = 0x0003,
   WORDEXT_FINDWORD       = 0x0000,
   WORDEXT_FINDTOKEN      = 0x0004,
© 2015 Microsoft