JetBrains / resharper-angularjs

ReSharper plugin for AngularJS support
Apache License 2.0
134 stars 25 forks source link

When installed knockoutjs intellisense stops working #26

Open nunofilipecosta opened 10 years ago

nunofilipecosta commented 10 years ago

When this extension is active, visual studio's / web essentials intellisense support for knockoutjs stops working..

Is it possible to create a resharper-knockoutjs extension ? I would gladly start it but I have no previous experience in creating resharper extensions...

Thanks

citizenmatt commented 10 years ago

This extension shouldn't affect the VS/Web Essentials intellisense, at least not directly - ReSharper itself takes over the code completion for JavaScript. This can be disabled in the ReSharper -> Options -> IntelliSense -> General options page (select Limited ReSharper IntelliSense and check the languages you want ReSharper to handle and uncheck the languages for VS)

That said, of course it's possible to create a Knockout extension. I don't know Knockout well enough to know what features to add, but from what I can see, it's mostly about a mini-DSL in the data-bind attributes. So that would require parsing the mini-DSL and providing code completion - and it would have to know the scope of the objects. These are similar to the issues I'm working on with parsing AngularJS expressions.

I think this extension would be a good place to start if you want to try and start your own, and I'm more than happy to help (with pointers to the right thing, if I can't contribute code). But in my opinion, the best place to start is a feature list! Write out the things you'd like to see in a ReSharper extension, and we can see what it would take to get them implemented.

nunofilipecosta commented 10 years ago

If i Limited ReSharper IntelliSense because for javascript of KnockoutJS it will not show AngularJS IntelliSense , if I enable it it does not show KnockoutJS , I don't think anyone will ever mix both libraries but I don't think it's reasonable to keep changing settings when changing project I will be coding ...

But I'm really interested in creating the Knockout extension and the features should be very simple, I think you are right " it's mostly about a mini-DSL in the data-bind attributes"

IntelliSense on the data-bind attribute for Built in bindings Custom binding View model members

like in this blog Jonh Papa wrote http://www.johnpapa.net/knockout-intellisense-in-visual-studio-2012/

citizenmatt commented 10 years ago

Cool post - I didn't realise VS did all this! I'm in grave danger of being nerd sniped on this.

The mini-DSL bit is one of the most interesting parts of ReSharper extensibility, but also one of the most under-documented - it's not for the faint of heart, sadly. That said, if you're interested, it's the code here: https://github.com/JetBrains/resharper-angularjs/tree/master/src/resharper-angularjs/Psi/AngularJs.

Interestingly, I think the Knockout syntax could be easier to handle than angular - the binding syntax seems to be quite simple - binding: member, binding: member. Angular has custom expressions.

Right now, I'm thinking about starting a new repo for knockout support. But I need to read up on knockout and better understand what it's doing and how it could work in ReSharper first...

nunofilipecosta commented 10 years ago

I will read the resharper extension documentation in order to get the basic stuff ready ( coding, building, debug , testing ), and try to make some modification of some kind in a fork of angulajs extension