Questions tagged [code-snippets]

For issues relating to the creation, use, and maintenance of code snippets.

A snippet is a small region of re-usable source code, machine code or text. Ordinarily, these are formally-defined operative units to incorporate into larger programming modules. Snippets are often used to clarify the meaning of an otherwise "cluttered" function, or to minimize the use of repeated code that is common to other functions.

Snippets can be created and used in many newer IDEs to insert a nearly functional code. With placeholders it is then possible to tab through the missing parts and fill in the variable names of other missing code parts.

For a fast practical use of a theoretical concept it is often preferred to show it on a snippet as an excerpt of the used code with the variable names foo and bar.

1929 questions
0
votes
1 answer

How can I disable custom editor in SnippetDesigner and keep other features?

I use the SnippetDesigner extension for Visual Studio mainly for its Export to Snippet feature. But, once exported, I prefer to edit my snippets in VS as XML rather than using the custom editor that is also part of SnippetDesigner. Is there an easy…
Trevor Reid
  • 3,310
  • 4
  • 27
  • 46
0
votes
2 answers

Advanced Custom Fields code displayed as plaintext when written in Code Snippets plugin. How to fix?

On Wordpress, I’m trying to add a link to single product page using Code Snippets with Advanced Custom Fields. Instead of a link, my code displays as plaintext. I have tried this code: function product_datasheet_below_summary() { ?> $link =…
Nick Schmitt
  • 7
  • 1
  • 3
  • 8
0
votes
1 answer

Escaping $ dollar sign character in RStudio snippets

I want to write a snippet that will allow me to put a string of text in multiple locations in my code, including after a $, to give the following expected result: source("C:/R/Functions/[inserted_text].R") .env$[inserted_text] <- [inserted_text] I…
Josh
  • 1,210
  • 12
  • 30
0
votes
2 answers

How to add php if condition in this snippet

Can anyone modify the following code with an if condition to do the followings: if the tab named "uwa_auction_bids_history" exists then the reordering of the tabs to be done as is, but if it doesn't exist, only the first 2 tabs to be reordered…
0
votes
1 answer

VS Code - Snippet Transform text with spaces for test methods

I've had this useful snippet in Sublime Text 3 for a while, and I am trying to replicate it in VS Code but with no success.
jsonUK
  • 345
  • 3
  • 9
0
votes
1 answer

HowTo create a snippet to repeat the code line in a variable number

How to create a numpy array of any shape within an snippet? For HTML there is a snippet which generates several list entries. link ul>lix3 I'm missing the right search term to find the json syntax...may someone can give me an example?
incognito
  • 199
  • 3
  • 16
0
votes
2 answers

I am trying to add the close function

I have created an email subscription form at site footer. But the problem is, when i click the close icon, the form do not disappears. var button = document.querySelector("#close"); button.addEventListener("click", function() { var t =…
0
votes
1 answer

How can I edit an unnecessary