C
C#3w ago
Joshwuh

✅ VS Code C# Highlighting?

In the official extension for VS Code, it looks like the highlighting would match Visual Studio's. However, it doesn't for me. Does it work for you?
No description
43 Replies
Joshwuh
JoshwuhOP3w ago
reality:
No description
Joshwuh
JoshwuhOP3w ago
specifically, the Console should be green/teal and WriteLine should be off yellow
ero
ero3w ago
do you have a solution open? and yes it is supposed to work
Joshwuh
JoshwuhOP3w ago
I created a new directory and did dotnet new console --use-program-main
Joshwuh
JoshwuhOP3w ago
No description
ero
ero3w ago
so you don't have a solution open
Joshwuh
JoshwuhOP3w ago
it appears not. I didn't even know that was a thing it's a single project, does it require a solution? not familiar with that
ero
ero3w ago
have you done any c# before this?
Joshwuh
JoshwuhOP3w ago
yes all in VS though usually solution creation is step 1
ero
ero3w ago
vs requires a solution as well
Joshwuh
JoshwuhOP3w ago
weird. okay. does that fix the highlighting? I'll give it a shot
ero
ero3w ago
yes, the devkit goes off of which solution you have open and the projects in that solution are the ones that get analysis
Joshwuh
JoshwuhOP3w ago
okay. when I click open solution it doesn't give the option to create a new one. is that part of dotnet new and I just didn't follow directions?
ero
ero3w ago
the devkit is capable of generating the solution automatically, but only when you have a "proper" workspace open (aka not multiple directories with unrelated projects like you have now) dotnet new sln and dotnet sln add, though
Joshwuh
JoshwuhOP3w ago
thank you so much for helping
ero
ero3w ago
always check out dotnet new -h and dotnet sln -h also dotnet new list
Joshwuh
JoshwuhOP3w ago
thanks 🙂
Anton
Anton3w ago
look up slngen for the sake of your future sanity
ero
ero3w ago
(i've never needed this in my life)
Anton
Anton3w ago
your loss
ero
ero3w ago
i think it's yours, actually :p needing some extra tool
Anton
Anton3w ago
well I can create a solution for the projects I want with one command
ero
ero3w ago
well i already have all the solution files and don't need to generate anything
Anton
Anton3w ago
and if I only want a single project, it would figure out and add all of its references automatically merging solution files becomes a piece of cake too just rerun the command to recreate it not even bother with its idiotic syntax
ero
ero3w ago
"merging solution files"? can't say i've ever had to do something like that
Anton
Anton3w ago
if a PR adds a new project, with master having a new one already, the PR branch would have to rebase so you do end up having to merge them sometimes
ero
ero3w ago
a new project of the same name as an existing project? or what do you mean you just do dotnet sln add idk what the issue is the one thing i will say though is that it's very frustrating that vscode is so behind on adding slnx support
Anton
Anton3w ago
well you have to manually know what to add if it's a solution containing all the projects and it might have dependencies
ero
ero3w ago
you add the project that's missing ?
Anton
Anton3w ago
with slngen you can wildcard recursively and make it figure out dependencies
ero
ero3w ago
solution files are simply more than just project aggregators
Anton
Anton3w ago
with the tool you just don't bother looking at that at all you just run a command and get back an up to date thing not the way I use them
ero
ero3w ago
yeah same with dotnet sln add, you also just run a command
Anton
Anton3w ago
so it works for me it can't wildcard you have to give it the path
ero
ero3w ago
you run it once per project, it's really not a big deal
Anton
Anton3w ago
and you have to call it one by one for each project
ero
ero3w ago
plus in ides like rider and vs, the project is added to the sln automatically upon creation
Anton
Anton3w ago
yes, but it is annoying
ero
ero3w ago
even in vscode
Anton
Anton3w ago
I'd rather not have to deal with it
ero
ero3w ago
well i mean it's definitely a non-issue, but by all means, include solution files in your gitignore and confuse your contributors
Anton
Anton3w ago
I keep them exactly for this reason so that tool is not required But I use it for myself constantly
Unknown User
Unknown User2w ago
Message Not Public
Sign In & Join Server To View

Did you find this page helpful?