FAQs on the exercise VS Code Personalization and Snippets
There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply () below.
If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.
Join the Discussion. Help a fellow learner on their journey.
Ask or answer a question about this exercise by clicking reply () below!
You can also find further discussion and get answers to your questions over in #get-help.
Agree with a comment or answer? Like () to up-vote the contribution!
Need broader help or resources? Head to #get-help and Tips and Resources. If you are wanting feedback or inspiration for a project, check out Projects.
Looking for motivation to keep learning? Join our wider discussions in Community
the csharp.json snippet within my vs code is not the same as what’s in the video for snippets. I tried adding what the video has and got loads of errors. Not sure if this is normal, or if it’s just something on my end. This is what I get when opening the csharp.json snippet in my vs code.
{
// Place your snippets for csharp here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
// “Print to console”: {
// “prefix”: “log”,
// “body”: [
// “console.log(‘$1’);”,
// “$2”
// ],
// “description”: “Log output to console”
// }
}
Found that, for some reason, indentations were causing issues starting with the “static void” section. replacing the indentations with just regular spaces seemed to work and not give issues or errors.
I’m in the same boat as you, was going to attempt to copy in the code but I was seeing errors due to indentation too. Not sure if you’ve found a work-around but hopefully an answer is provided soon
{
// Place your snippets for csharp here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
“Main method”: {
“prefix”: “main”,
“body”: [
“using System;”,
“”,
“class Program”,
“{”,
" static void Main(string args)“,
" {”,
" ${1:// Your code here}“,
" Console.WriteLine("Hello, World!");”,
" }",
“}”
],
“description”: “Log output to console”
}
}
40 seconds into Video 4 it calls for View → Command Palette. I don’t get a Command Palette option under View, nor does a search present one, so none of the subsequent instructions for opening settings.json work.
Searching for "Preferences: Open User Settings (JSON) does not turn up anything and does not open a file/tab settings.json.
Can someone help me open settings.json? A google search has led to instructions and videos that also don’t help. For example, Shift-Ctrl-P opens the search window and F1 reports “Help is not available for the current context.”
After writing the csharp.json code and saving, I went to the Program.cs file, deleted its contents, and typed “mai” and tab. Nothing happened. The snippet was not inserted.
Hi!
So I’ve followed the steps in the setting up the enviroment part even if I skipped editing the font size and spaces.
For some reason the command palette refused to find csharp.json…
Any tips?
I didn’t have a csharp.json file yet so I created a new global snippet and named it that. I copied over the code from the video and saved before trying the “main” snippet and this is what it gave me: