Ask Your Question

Do not understand how to create snippets with variables

asked 2020-08-25 04:35:43 -0600

piscvau gravatar image

updated 2020-08-25 08:32:44 -0600

I do not understand how to enter code for snippets with variable names. I create a new snippet and I get aan empty window in the editor. From there I would like to enter the code for a new test: def test_file_variable(self): string =

res = dstring_parse(string)
display_PathPoints(res, variable)

shouldbe = [

self.assertEqual(res, shouldbe)

I need a variable name instead of variable How can I do this?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2020-08-25 08:35:08 -0600

updated 2020-08-25 08:35:28 -0600

The syntax is %(name|type|default)s and the type and default are optional. Examples:


You can also use environment variable references for the defaults:


The documentation for this is at and there are examples in the default set of snippets in the Snippets tool.

edit flag offensive delete link more


Hello Please excuse me but I still do not understand and I am afraid I need more details. I did look into the documentation and the examples but it did not help. For example if I look at the 'from' snippet I see: |m|from %(module)s import |!| I see there a variable named module but I have not idea about what |m| and |!| is about. Coming back to my need for a snippet about a test, is I put %(name)s in the name of the function after def, I get a syntax error

piscvau gravatar imagepiscvau ( 2020-08-26 04:36:16 -0600 )edit

|m| tells Wing to match the indent of the context when placing the snippet and |!| is the final resting place of the caret after data entry for the snippet is complete. These and the other syntax options are described in the documentation at

Wingware Support gravatar imageWingware Support ( 2020-08-26 08:24:36 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2020-08-25 04:35:43 -0600

Seen: 290 times

Last updated: Aug 25 '20