Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Files without a project #207

Closed
jrieken opened this issue May 4, 2015 · 8 comments
Closed

Files without a project #207

jrieken opened this issue May 4, 2015 · 8 comments
Assignees

Comments

@jrieken
Copy link
Contributor

jrieken commented May 4, 2015

In VSCode we encounter solo cs-files which don't belong to a project. While we OmniSharp cannot provide semantic features (IntelliSense, type check, etc) we could enable syntactical features which require a parse tree only (Formatting, outline, etc)

@nosami
Copy link
Contributor

nosami commented May 4, 2015

Heh... nice to hear you talk about VSCode on here :)

We should be able to support this scenario already, by specifying the folder to the cs file. We do this in other editors already.

@filipw
Copy link
Member

filipw commented May 7, 2015

@nosami This doesn't work right now AFAIK because the project systems (asp.net 5 and msbuild) try to find projects in the folder (sln and project.json respectively) and if they don't find any projects, they just exit without populating workspace with anything.

scriptcs project system is the only one that discovers loose files and adds them to workspace but it's csx only

@nosami
Copy link
Contributor

nosami commented May 7, 2015

Ah, ok. I was getting confused with the old server which does work this way.
On 7 May 2015 20:19, "Filip W" [email protected] wrote:

@nosami https://github.com/nosami This doesn't work right now AFAIK
because the project systems (asp.net 5 and msbuild) try to find projects
in the folder (sln and project.json respectively) and if they don't find
any projects, they just exit without populating workspace with anything.

scriptcs project system is the only one that discovers loose files and
adds them to workspace but it's csx only


Reply to this email directly or view it on GitHub
#207 (comment)
.

@jrieken
Copy link
Contributor Author

jrieken commented May 12, 2015

@filipw - and you go with mscorlib which comes with desktop clr/mono right? So no happy path for core clr users? wondering if we could funnel in some default lib for this case...

@filipw
Copy link
Member

filipw commented May 12, 2015

yeah right now it just uses desktop/mono mscorlib.
in fact, the whole csx thing is #ifdeffed against ASPNET50 too

I have started a separate repo so that all the same information could be retrieved from CSX files when omnisharp itself runs on coreclr https://github.com/filipw/scriptcs-dnx this is very rough outline now, but this approach should be replacing the embedded scriptcs dlls in the future

btw, one more thing, at the moment roslyn scripting doesn't support core clr, in fact it doesn't even work on mono, so scriptcs uses roslyn binaries on windows and mono.csharp on mono

but going back to the original topic, I think orphan *.cs files could be treated similarly to *.csx files and just added to workspace in a loose way; that would like you say require determining the runtime, plus some organizational decisions regarding how to code it in - would that be a new specialized project system that runs at the end or would that be part of msbuildprojectsystem for example, to basically gather all the loose files it didn't need as part of msbuild projects

@jrieken
Copy link
Contributor Author

jrieken commented May 13, 2015

Agreed - orphan cs files should be handled in a similar fashion to csx files. We already have a little magic in place that associates an unknown file to the best matching project (https://github.com/OmniSharp/omnisharp-roslyn/blob/master/src/OmniSharp/Roslyn/BufferManager.cs#L80) but there is no fallback or default project. So, in the same spirit of OmniSharp v1 I would keep this in place and add an OrphanProject which takes all other files.

@akshita31
Copy link
Contributor

akshita31 commented Jun 28, 2018

@filipw @jrieken I have been trying to add a OrphanProjectSystem for the orphan files. But the main problem I am running into is how to identify whether a particular document is an orphan document or has a project associated with it. I tried to invoke the GetDocument on the workspace and if a null is returned, then assuming that this is a orphan file. However, the problem with this approach is that the ProjectUpdate runs asynchronously for MSBuild Project system, hence the initialization of the orphan system is running before the projects have been added to the workspace, so even the files associated with a project are being treated as orphan files. Here is the branch : master...akshita31:orphan_system .Any suggestions ?

@odalet
Copy link

odalet commented Apr 13, 2019

Hi, I still experience the formatting issue when opening a standalone .cs file:
There is no formatter for 'csharp'-files installed.
I'm running VSCode 1.33.1 (user setup) and Omnisharp 1.18.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants