Expansion fields RRS feed

  • Question

  • I have two questions about visual studio expansions:

    - Question 1:

    Is it possible to fill in the default value of the fields _before_ the expansion is actualy visible in the editor? Now I use the following code, but it gives an accessviolation when I want to set the field that is currently focused in the editor. Also the Undomanager is filled with "SetFieldDefault" actions.

    bool result = _expansionProvider.InsertNamedExpansion(_vsTextView, GetSnippetTitle(snippetfile), snippetfile, span, false);
                if (result)
    		foreach (field)
    			expansionsession.SetFieldDefault(fieldname, fieldvalue);

    - Question 2:

    Is it possible to take a snippet, Fill in the fields with a value. And then get the snippet contents in a string variable, without showing the content in the editor? I want to repeat a certain snippet many times, and fill in some values in each repetition. The large block  text, generated by repeating the snippet many times, needs to be inserted into the editor in one time, instead of each time one snippet part is completed.

    Wednesday, September 19, 2012 5:38 PM

All replies