question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add param block snippet

See original GitHub issue

Summary of the new feature

On my stream with Scott Hanselman, he wasn’t sure on how to write a param block because we have snippets for individual parameters, not param blocks.

I’d be nice to have a snippet of a param block, with a parameter inside.

Proposed technical implementation details (optional)

Take the current parameter snippet, and wrap it in a param block and call it the param-block snippet.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
rkeithhillcommented, Jul 11, 2019

I think there’s a difference between a “teaching” style snippet and a “productivity” snippet. The above, as a productivity snippet, wouldn’t work for me because I’d end up deleting more stuff than I would have typed in the first place. For me, this would be a productivity snippet:

[CmdletBinding()]
param(
    [Parameter()]
    [${1:type-name}]
    $${2:parameter-name}
)
$0
2reactions
AspenForestercommented, Jul 11, 2019

Something like this: Note where the $0 moved to.

"Parameter_Block" : {
        "prefix": "param-block",
        "body": ["[CmdletBinding()]",
            "param (",
        "    [parameter()]",
        "    [${1:TypeName}]",
        "    $${2:ParameterName}$0",
        ")"],
        "description": "A Parameter block to get you started."
    }
Read more comments on GitHub >

github_iconTop Results From Across the Web

Snippets in Visual Studio Code
Snippets in Visual Studio Code. Code snippets are templates that make it easier to enter repeating code patterns, such as loops or conditional-statements....
Read more >
javascript - How can I add or update a query string parameter?
I wrote the following function which accomplishes what I want to achieve: function updateQueryStringParameter(uri, key, value) { var re = new RegExp("([?
Read more >
Using AMPscript Variables in Code Snippet Blocks - YouTube
In the third episode of this series you will learn how to use code snippet blocks to organize your AMPscript code.
Read more >
PHP Add and Remove Query String Variables - WP-Mix
Add Query String Variable​​ This function accepts three variables: $url – URL to which the query-string variable should be added. $key – query- ......
Read more >
Code Block Macro | Confluence Data Center and Server 8.0
Add a Code Block macro to your page to display code examples with syntax highlighting. This is great for sharing code snippets such...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found