Open MK-Alias opened 6 years ago
@Alias-777 What version of the C# extension are you on? You wrote ? :S
in your issue. Once you install the latest version, you should be able to click on the folder icon next to the green flame and select any solution you want:
I wrote ? because the name "omnisharp" was in my mind, because of constantly seeing this word in the output console. I didn't really know what was being referred. Sorry! :D. But i'm using 1.15.2 . and I always update.
There was no folder icon next to the green flame when It was using the template. Perhaps the parser that parses the SNL files gave up because of the macro code (al lot of ${VARS} that are parsed by my template engine) inside does not make any sense to it. As soon as I changed the extension from SLN to .template the folder showed up after restarting vscode and everything worked as expected.
I'm was using the SNL extension in a non-valid way, which is most likely part of the problem, because of unexpected syntax. The only real problem was not being able the choose a sln (next to the green fire).
Edit: Also the paths to the source-code of the templates is non-valid. It only becomes valid after parsing it.
More concrete repro: use dotnet to create a csproj and 2 solutions, a.sln
and b.sln
. Add the csproj to b
. Edit a
to contain a parse error. Open VS Code in that folder. OmniSharp will fail to start and won't show the folder icon because something goes wrong when it attempts to read a
. Renaming a
to c.sln
allows omnisharp to load.
Thanks @Alias-777 for filing this interesting issue. @akshita31 I've assigned it to you to take a look. Presumably this is going to require changes to omnisharp to fix.
@rchande that repro looks more objective then mine! The main problem seems to be after failing on A it does not analyze and use B anymore. If A = C then it fails but already has analyzed B and uses that one. Again this is a minor issue, but still would be nice if it can be fixed somehow.
Thanks!
Even if the folder doesn't appear on the icon, you should be able to invoke the 'OmniSharp : Select Project' command in VS Code to pick the correct solution.
Along the same lines: how do i set a default sln to use when i point to a folder with multiple slns?
@vramanx @janaka is working on a PR to contribute that functionality: https://github.com/OmniSharp/omnisharp-vscode/pull/2053
Environment data
VS Code version: Version 1.23.1 Commit d0182c3417d225529c6d5ad24b7572815d0de9ac Date 2018-05-10T17:11:17.614Z Shell 1.7.12 Renderer 58.0.3029.110 Node 7.9.0 Architecture x64
C# Extension version: ? :S
Steps to reproduce
Make a project directory with some template sln/csproj (useless when not processed) files which are alphabetically before the real (processed template) sln/csproj files. For example:
Omnisharp will use the template instead of the real MyProject.sln file.
Expected behavior
A good working editor instead of only having basic syntax highlighting.
Actual behavior
Facilities like autocomplete does not work outside of the working file because omnisharp is using a template file - which does not contain any useful information - instead of the real Solution File. A workaround is to rename my templates so not to use the SNL or CSPROJ extension. For example rename: MyProject.template.sln -> MyProject.sln.template. In which case omnisharp will ignore the file. I've seen other languages make use of choosing a project/xml/sln file from the editor which will be used. Something like that would be pretty nice!
Obliviously this is a very minor issue, especially if you know that renaming the templates will solve it. Just wanted to make a note of it!