Okay so I have to admit that at this point in my life I have been doing c# development for about 10 years now, and for about 99.9% of that I have depended on visual studio (the other 0.1% has been JetBrains rider, which I like but I just don't think it's as good as Visual Studio).
Not too long ago microsoft released a new text editor (IDE?) called vscode π€ now I'm not shy when it comes to opinions on text editors, my previous go to was Sublime Text, which I personally think is an amazing editor but they ruined with version 3. I did move briefly to Atom, but when MS came out with Visual Studio code, I fell in love immediately.
I have never coded with it though. I don't know why this is the case but here I am - I thought to myself you know what might be a good idea? let's try and setup a comfterble environment for an avid visual studio user and blog about it!
Let's start fresh
Now I have a few (but not many extensions) I normally have a few more enabled but for the blog post let's stick with as few as possible.
Extensions:
C# - This extension I think gives the editor power to do intellisense and such
Json Tools - This an amazing tool for working with json
Paste Json as code - have a block of JSON you want to make into a class? This is the extension for you
PlantUML - An easy way to produce UML diagrams that I use occasionally
Todo++ - This is on the cutting block thanks to Microsoft ToDo app, but this used to be my goto todo app
Let's load a project
Okay so I recently did a blog post about a music DSL - https://dev.to/joro550/idea-for-my-own-dsl-to-produce-music-4og5
I have half heartidly starting making a parser for the language, it will be a good place to start as it is a small project with very few tests right now.
I will say immediately that I find it weird not just double clicking my sln file, I had to drag and drop my src folder from my file explorer into my editor. But not a big deal - but now for the real test, let's build.
Pressing my usual Ctrl+Shift+B
to build gave me a few prompts and eventually spat out a file:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "shell",
"args": [
"build",
// Ask dotnet build to generate full paths for file names.
"/property:GenerateFullPaths=true",
// Do not generate summary otherwise it leads to duplicate errors in Problems panel
"/consoleloggerparameters:NoSummary"
],
"group": "build",
"presentation": {
"reveal": "silent"
},
"problemMatcher": "$msCompile"
}
]
}
I can kind of see immediately how this is about to work, it has a command which happens to be dotnet
and arguments that is an array build
I'm assuming that this will be the same as when you run dotnet build
in the cli.
Noramlly to run tests in visual studio I have resharper, which means I can press a good amount of button combinations the test everything in my solution. Because this is a Resharper thing I'll have to actually look up running tests in Visual studio code.
So seeing as ther eseems to be no real way of doing this, my first instinct is to add a task to tasks.json
, I feel like this should work:
{
"label": "test",
"command": "dotnet",
"type": "shell",
"args": [
"test",
],
"group": "test",
"presentation": {
"reveal": "silent"
},
"problemMatcher": "$msCompile"
}
But test
does not appear when I press my usual hotkey, which makes me think I'm doing something wrong.
Pressing Ctrl+Shift+P
and doing a search leaves me with nothing. Maybe one to come back to let's try debugging..
Debugging
Pressing my usual f5
hotkey and... well
Well.... okay, this is not really what I expected.
Looking at it it looks like it's added a launch.json
but has added a bunch of errors. Hm. Deleting that "configuration" and adding another for a .Net core console app gives me other issues.
Being honest with you I thought this would be an easy task - and a good little blog post to show how awesome and easy it was to set this up but I think I'm genuinley stuck maybe I'll make another blog post once I've pushed passed these issues.
For now
Farewell :D
Top comments (0)