-
Notifications
You must be signed in to change notification settings - Fork 28
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
C# Intellisense #12
Comments
To confirm we need the WebAPI app running in the background to get the plugin to give output? |
Yes. The API should run at The This is a Windows-only prototype at the moment |
@jchannon I wrote a Powershell one-liner that makes installing the Sublime Plugin easier
To remove the Plugin
EditIf you want to try it out without running the WebAPI try Mac
Windows
|
Nice progress @shirhatti! |
Nice! I'm wondering if we try and get this working via Omnisharp as that has all the functionality we need at the moment. Its tied to NRefactory though so there would be effort needed to move Omnisharp across to Roslyn once that is complete. Thoughts? UPDATE: There is currently this https://github.com/moonrabbit/OmniSharpSublime but @nosami had to hack it to work and some of the features don't seem to work but the base is there. Do we try and get that into a stable state? |
HI Guys I would love this. I did some work try to port the typescript plugin for sublime from 2 to 3. It followed the exact same approach: typescript language services hosted somewhere and using HTTP to get errors/intellisense suggestions. OmniSharpServer follows the same paradigm, I love the work @nosami did but his initial estimations are that its quite some work Maybe the two projects could benefit from a common API ? |
NRefactory has already started to implement intellisense using Roslyn - see https://github.com/icsharpcode/NRefactory/blob/roslyn/ICSharpCode.NRefactory.CSharp/Features/Completion/CompletionEngine.cs and they are making headway on rewriting their automated code issues / refactorings. It's actually quite simple - but there is no point in making the switch over until the refactorings are ported over to Roslyn. OmniSharp server gives you much more than intellisense - https://github.com/nosami/OmniSharpServer/tree/master/OmniSharp If I made the switch over to using the Roslyn branch of NRefactory now, you would lose quite a bit of functionality. If I dropped the NRefactory dependency and switched over to Roslyn, the OmniSharp server would be much simpler than it is now I think, but it wouldn't have any refactorings. At this moment in time, the only way to get the best of both would be for OmniSharp to have two ASTs in memory for each file, the Roslyn version and the NRefactory version. That seems a little excessive, although doable. Really I think the best solution is to just wait for NRefactory to finish their porting work. Then OmniSharp server should just work against Roslyn without too many changes. I won't be changing any of the public API regardless. |
I should probably add that you can already do Asp.Net vNext programming with https://github.com/nosami/Omnisharp and https://github.com/sp3ctum/omnisharp-emacs today :) If I were a Sublime user, I'd build it myself. I estimate a couple of days work to get all features into the client. The only downside (?) is that it's not using Roslyn (yet). |
@nosami very cool to see this. Shameless plug but scriptcs users would definitely love this. |
@nosami I wasn't aware that NRefactory has started to use Roslyn. I agree with your assessment that the best solution is to wait for NRefactory to finish their porting work. @astralhpi Do you have any plans to implement this with moonrabbit/OmniSharpSublime ? +cc @sayedihashimi @shanselman for thoughts? |
@shirhatti OmniSharpSublime already uses OmniSharp it just needs a bit of polish as @nosami and I had to hack it to get it working with Sublime |
@shirhatti I'm afraid I don't have any documentation but it's not too difficult to work out. You just need to start the server using the instructions here https://github.com/nosami/OmniSharpServer This is an early version of a POC that me and @PaulCampbell built for sublime - The @moonrabbit version is nicer code, but I think this illustrates better how to interact with the server. This code is using standard form posts (x-www-form-urlencoded) to make a request to the server, but you can also send the parameters as a JSON object if you prefer. If you don't care about getting documentation for each completion result (uses MonoDoc on *nix which is slow) then you probably want to add :-
The OmniSharp code is broken up into a feature per folder (almost). You can figure out the requests by looking at the Request.cs in each folder, e.g. https://github.com/nosami/OmniSharpServer/blob/master/OmniSharp/AutoComplete/AutoCompleteRequest.cs |
Also we need to consider the current ST3 plugin wants a sln file but we |
Adding @davidfowl to see if he has thoughts on this? |
I've created a PR for the ST3 plugin so we don't have to hack it to work OmniSharp/omnisharp-sublime#5 |
I've been in touch with https://dotnetfiddle.net/ who provide intellisense in the browser. They use Roslyn apparently and I have managed to convince them to OSS their intellisense code so we can take a look https://twitter.com/sergey_litvinov/status/497391229068247041 |
Omnisharp won't work by itself, you'll need to run the design time host since we don't use csproj files. |
Omnisharp doesn't need csproj files either. On Thu, Aug 7, 2014 at 4:23 PM, David Fowler notifications@github.com
|
@davidfowl we already have vnext nancy app working without csproj with omnisharp |
Visual Studio uses this same Design Time Host that @davidfowl mentions. If we can hook that up 👆 o it's likely to be the best option. We have worked on a prototype and make some progress already. @shirhatti can you give an update on DTH and describe what it will take to enable IntelliSense with it? |
It's not the best option it's really the only option. The design time host is the way to get the lost of resolved references, source files, compilation settings etc from a vnext project system. Anything else you do would be an estimation and would probably be inaccurate. You can get the same effect by running through the vnext runtime's code paths but that's exactly what the design time host does. |
@davidfowl Sounds great. I should integrate that with OmniSharp from the sound of it. I wondered how to deal with that. |
Adding this for reference. |
Does the DTH work outside of Windows? |
Mine is jasonimison1 |
Mine is |
Mine is |
mine is |
@shirhatti @jchannon @nosami @Mpdreamz @shanselman @davidfowl @glennc I have posted meeting notes from today at https://github.com/ligershark/Kulture/wiki/Initial-meeting---2014.08.03. Feel free to edit that doc as you like. I'm really excited about this. Let's see what we can build together. |
Regarding my action point, was your thought to pull in OmniSharpSublime into the Kulture plugin ie/make it a dependency? |
@jchannon I don't think that it needs to be a dependency. We can add that to the install guide for readme.md. |
Done! Do you think its worth setting a list of items that we definitely want from OmniSharpSublime then a list of "nice to haves"? I've done PRs for it regarding making sure it has the latest OmniSharpServer version and I've done Find Usages for it (not merged as of yet) but was going to do something else next but then thought you guys might want something specific? |
I saw the info added to the readme about this and tried to get it working on my Mac yesterday. I managed to get the OmniSharpSublime server running and could see requests and responses from it in the Sublime console as I typed, but the responses didn't contain anything that looked like completion options. Is this actually supposed to work with ASP.NET vNext yet, or is there more work to do there? |
@bmsullivan I had to download latest version of OmniSharpServer instead of that one supplied with OmniSharpSublime repository and build it to got this working. |
@kuzirashi Thanks, I'll try that! |
Yes there is outstanding PRs on OmniSharpSublime to make sure it uses latest OmnisharpServer. Fingers crossed it gets merged ASAP |
@bmsullivan |
Updating to the latest OmniSharpServer did the trick! Thanks! I did notice that things look a bit incomplete (e.g. Tried to complete "Redirect" within a controller with no result. Not sure which isn't working: parent class methods or loading libraries). I presume that's just where things stand right now? |
@jchannon thanks a lot! Regarding your question, could we discuss the prioritization of features in a new issue? |
Possibly. Check in activity monitor if mono sgen is running when you open On Tuesday, 9 September 2014, bmsullivan notifications@github.com wrote:
|
@jchannon - To be clear: a lot of the completions work. I get context-appropriate keywords, properties of user created classes, methods for common BCL classes like String, etc. What I'm not getting, specifically, are completions for members of the Mvc Controller class within my Controller-inherited class. I've also noticed some inconsistency in completing inherited members in subclasses of my own simple objects - old base class properties that have been deleted still appear in the completion list until a new member is added to the base class. All the sort of stuff I would expect from a work in progress, for sure. Just curious I'm the only one seeing the behavior. If there's any way I can assist with the effort, I'd be happy to. |
@bmsullivan might be worth setting a simple repro up and speaking to @nosami |
Anyone had any luck getting OmniSharpSublime working on Windows? |
I've not tried it |
@bmsullivan If you're seeing stale completions, then the chances are that the sublime plugin isn't updating the server correctly. For example, in vim, every time a buffer switch is made, vim first updates the server with I don't use it, so not sure, but it sounds like a small fix on the client. As for the Controller members, that should certainly work providing that the MVC assemblies were loaded by OmniSharp server when it started. Try starting the server manually and check the output as it does the initial solution load. |
@nosami Sorry to have taken so long to respond. Now that I look at what OmniSharp is loading, it makes sense. In ASP.NET vNext, NuGet references are stored globally (on my Mac, they're in ~/.kpm/packages) rather than in a packages directory alongside the solution. Is there any way to give OmniSharp an additional set of places to look for dlls? If that's possible, it still seems like it's going to be a bit of a chore to get the right completions. If it knew where to look for the packages, it could look in all the project.json files found under the solution directory for their dependencies and versions, but those would only be top-level packages (e.g. I might have Am I missing an easier way to do this? Edit: After reading a bit more of the previous messages in this thread (shame on me for not doing so earlier), is that what integration with the Design Time Host is supposed to achieve? |
@bmsullivan Yes, that's exactly what the DTH integration will achieve :) https://github.com/nosami/OmniSharpServer/blob/master/OmniSharp/Solution/CSharpProject.cs#L65 <- This is pretty (very) crude, but it should automatically pick up dlls from your ~/.kpm/packages folder. |
@nosami Thanks! Looking at the source a bit more closely, I think the problem may be that I'm working without a solution file or a project file. It doesn't look like it will ever look for anything in the .kpm directory that's not specifically referenced in a project file. Am I seeing that right? I think I may hack together something to handle my specific scenario since I've got a presentation on vNext coming up that I'd like to show this in. |
@bmsullivan Yes, you're absolutely right. I have to confess to having not used vNext since the global package cache was introduced so didn't test that PR at all. If you do hack something together, care to submit a PR? I get to spend very little time working on it at the moment. It only needs to be something temporary to tide people over until DTH integration. |
@nosami I'd be happy to! I got something working last night. It's quite naive and brute force, but it works for the simple scenario I want to demo. I'll try to make it slightly less brain-dead so that it doesn't affect non-vNext scenarios and submit a pull request this evening. |
@nosami Created a pull request for you (and anyone else on this thread who might be interested) at OmniSharp/omnisharp-server#108. As stated, it's likely very fragile, use at your own risk. :-) |
The project has moved to https://github.com/OmniSharp/Kulture. If we should continue this conversation let's open a new issue there. Closing now. |
C# Intellisense
Investigating using Roslyn (In-memory C# compiler) and DesignTimeHost to provide code completions in Sublime
Initial Prototype
Initial prototype lives at SublimeSharp
The text was updated successfully, but these errors were encountered: