Add lightning components support

Issue #49 resolved
Nathen Drees created an issue

This is mostly just to get this on your radar, but lightning components are currently in beta, expected to become GA sometime in the next few releases (maybe at Dreamforce?). They have a totally different development style and would need different UIs, but will be important to support since Salesforce is making a big push for people to use them.

Comments (89)

  1. Nathen Drees reporter

    Now that Lightning Components are GA, are there plans to support this? We're starting to develop them and having an IDE would be a big benefit.

  2. Scott Wells repo owner

    Yep, that will be the focus of the 1.7 release family. I have two more deployment/retrieval features that I want to address (static resource bundles and delete propagation/destructive changes) and then I'll be moving on to Lightning support.

  3. Vivek M. Chawla

    Scott, I know that lightning is not officially supported yet. However, when trying to save (deploy) a lightning-related file (ie. .cmp file), if there are any compile errors the file will not be saved to the org (good!), but there is also no feedback in the IDE that the save / deploy failed (BAD).

    Should we be identifying issues like this now, or will they all fall under the umbrella of "lightning support not ready"?

  4. Jonathan Toland

    I mentioned this on Twitter. I think it should be a separate issue. I think metadata is metadata from a deploy standpoint and shouldn't be affected by Lightning.

  5. Scott Wells repo owner

    Well, there is a difference. Based on my own experience playing with lightning components in and outside of IC, you cannot deploy only part of an aura bundle successfully, e.g., just a .css/.cmp/.js file. Best case scenario, it will deploy successfully but effectively replace the existing bundle with one containing only the deployed file, but more often it just bombs out. The error is reported on the bundle directory, if memory serves, and not being a file, I can't add the error to the Problems View.

    The workaround until I add formal support for lightning components is to deploy the entire aura bundle and not the single file. The easiest way to do this is to use Deploy All Metadata and then do a Custom selection on the bundle directory itself. I still don't think that deployment error messages will be displayed properly right now, but hopefully I'll get that squared away quite soon as part of a first phase of lightning support work.

  6. Scott Wells repo owner

    Regarding Vivek's question above, I've forced an error on a content file from an aura bundle and see why it's not being added to the Problems View. I should be able to address that in the very short term even before I add formal support. Look for a small update to the plugin in the next day or so to give better feedback on lightning component errors.

  7. Vivek M. Chawla

    I modified the .css file in a Lightning component bundle, and then tried to deploy it as part of the entire component bundle. Unfortunately, it would not save (deploy) any of the changes in my .css file.

    I also tried deploying the entire Aura folder. Still no luck. I just can't get IDEA / IC to save lightning metadata to the org.

  8. Jonathan Toland

    That's strange it's been working for me all day. If compilation fails in another place like the component then it obviously won't save. Scott just pushed a release that should make those issues visible in the Problems window. Did you update? Did you restart? Check idea.log?

  9. Scott Wells repo owner

    Even with the update I posted earlier, I've only seen the API give back errors for .cmp, .evt, and .app files. I haven't seen them for .js and .css files, presumably because those aren't actually parsed by Salesforce. I would expect them to deploy, though, valid or not. I wonder if perhaps you're seeing the same issue on deployment that you're seeing on retrieval now. It would make sense since the same filters would apply. Let me spin you a quick build with the fix and make it available here for you to try out.

  10. Vivek M. Chawla

    @dnalot I'm working with the 1.6.7.1 build that Scott released yesterday, but I'm not seeing anything in the problems window, even when forcing an error in a .cmp file by leaving the ">" character off the end of the closing </aura:component> tag.

    Doing this should give me the following error:

    Failed to save undefined: markup://c:helloHTML:14,17: ParseError at [row,col]:[15,17] Message: XML document structures must start and end within the same entity.: Source

    But the only thing that I see is a quick flash of a popup (looks like it could be a progress indicator popup), followed by nothing. No indication that anything happened, good or bad. I looked into my idea.log file, and couldn't see any entries with "IlluminatedCloud" in them. Any suggestions on what I should look for?

    @RoseSilverSoftware Sorry for the noob question, but how do I install the pre-release build? Will doing so change how plugin updates work? Thanks!

  11. Scott Wells repo owner

    Settings>Plugins>Install plugin from disk..., select the file you downloaded using the link above, and then allow the IDE to restart.

  12. Scott Wells repo owner

    Yeah, I saw it yesterday as well. Hopefully the test build above takes care of it. Can you guys check it out and let me know? Assuming it does help, I'll go ahead and post a new build today.

    Oh, and Vivek, installing the pre-release build won't affect your ability to take updates. I've kept the version number the same so when I post a build with a higher version number (even if it's the same bits), it'll automatically update to that.

  13. Jonathan Toland

    Trying now!!! PS I evangelized IC to a consulting practice in Europe yesterday and trying to get it into my old ISV 💵

  14. Scott Wells repo owner

    Hugely appreciated! Let me know if there's anything I can do to help.

    And of course let me know if the test build helps, hurts, or doesn't change anything.

  15. Jonathan Toland

    Fixed:

    • Deploy existing file
    • Errors in Problems window

    Not working:

    • Deploy new file (e.g. JS controller)
    • Auto deploy bundle
    • Errors in context or indicator anything went wrong

    Regressed: N/A

    Dubious:

    • I used to highlight *.cmp as Visualforce. Now I can't even right click them after a restart (as of last release).
  16. Scott Wells repo owner

    Thanks for the update. Let me get one more deployment enhancement out (undeploy) and then I'll return to Lightning Components. My fear is that I could end up sidetracked taking care of little things for quite a while vs. just jumping into the deep end and making it a first-class feature.

    As for the dubious item, I can't think of anything I did in this update that would cause that. Anything useful in our good friend idea.log?

  17. Scott Wells repo owner

    Do me a favor and use File>Invalid Caches and Restart. Now that I know you've associated new extensions with the VF file type, I can see how things might be in a weird state. Honestly, they may continue to be in a weird state associating .cmp files with the Visualforce file type even after a rebuild, but let's see what happens. And definitely let IDEA do a full rebuild, not just IC's Rebuild button. Those reassigned file types may be cached in a bad state.

  18. Scott Wells repo owner

    Oh, and if there are still issues after doing that, I would recommend you reassociate the .cmp and .evt extensions with the HTML file type until I have first-class support. That will ensure that IC's VF support won't try something with those files and hit an unexpected dead end.

  19. Scott Wells repo owner

    FYI, I have a change locally that automatically deploys the entire bundle contents when any subset is modified. In other words, you won't have to do an explicit force deployment of the entire bundle every time. CTRL+S/CMD+S and such will work just fine. I'll try to get a small update out with it on Monday after I've tested it a bit more. Obviously not full support by any stretch, but I'm trying to see if I can do a few things to make things reasonably pleasant in the interim.

  20. Vivek M. Chawla

    @RoseSilverSoftware Thanks, Scott! That will be a welcome change! It will definitely make things more pleasant while you work on first-class Lightning support. Thanks!

  21. Scott Wells repo owner

    Okay, I have a build ready with MUCH better handling of deployment for Lightning component contents, both how errors/warnings are reported and how deployment can be activated. I want to do more testing on it before rolling it out broadly because the changes do sit in the middle of the core deployment flow (though they should only kick in when a very specific condition is met), but I'm happy to make a pre-release build available if you want to give it a spin (which also helps my validation task!).

    Here are the install links:

    IDEA 12 https://drive.google.com/file/d/0B2eoK6ID4_FeczVNWVJfRHdZRUE/view?usp=sharing

    IDEA 13 https://drive.google.com/file/d/0B2eoK6ID4_FeWHl5WUxLQ0RRUzg/view?usp=sharing

    IDEA 14+ https://drive.google.com/file/d/0B2eoK6ID4_FeM1I2M3hfejdrakE/view?usp=sharing

    To install, just download the appropriate archive file, and then use Settings>Plugins>Install plugin from disk.... Navigate to the downloaded archive, select it, and allow the IDE to restart. This will not affect your ability to upgrade to the next official release.

    Oh, and this build also includes the change to make Selected the default scope when starting a deployment or retrieval operation from the context menu. Otherwise the last configured scope is used.

  22. Scott Wells repo owner

    Great! As expected from the pre-release status, I may have introduced bugs not just around Lightning components, but deployment in general. I plan to test it thoroughly over the next few days, but please let me know about issues you may find, particularly those that seem to be regressions to deployment of other metadata types. Thanks!

  23. Scott Wells repo owner

    Oh, one thing I'll add about the Problems View error reporting for Lightning Component contents...the errors I get back from the API are quite different from those I get back for other metadata types. For other types I get back an actual object containing the metadata object name, the metadata file's filename, the row and column, warning vs. error, and an error message. For these I get back an error message that contains what could be an ambiguous filename (if more than one .cmp, .evt, or .app file has the same base name), an error message, and sometimes line and column info. I've created a heuristic for parsing (via a small number of well-defined reg exp) and decoding those, then correlating them to files in the file system for error attribution, but my guess is that it's not going to be perfect. Minimally I imagine I'll need to add more patterns, and of course ambiguous names of files ignoring extensions may cause the wrong file to be attributed. I've raise this with the folks at Salesforce in hopes of getting more definitive error information back from the API. In the interim, be aware that this may happen.

  24. Scott Wells repo owner

    I've made some additional progress on this so that IC will now properly handle adds/removes/moves/renames of Lightning Component bundle contents. In the process I've discovered that the deployment API does not like you to send a file with an empty body or, in the case of a .js file, an invalid JavaScript body (e.g., just a comment). As a result, before I release this incremental progress, I'll need to make Lightning bundle file creation use minimally valid contents. Otherwise you get nice unusable error messages back from the API.

    I'll see if I can make another pre-release build with these changes available in the next day or two. I think with these (along with whatever other bug fixes are required), IC becomes an okay place to do Lightning development while I'm adding all the stuff people really want like completion, reference navigation, integrated component docs, etc.

  25. Vivek M. Chawla

    Thanks, Scott. These are great changes to see coming. I've been using the interim build you put out the other day and I'm finally enjoying the goodness of IC+Lightning.

    I think that this could really be IC's sweet spot (Lightning / JS development). It's really heartening to see how quickly you're addressing all these issues. Thank you!

  26. Jonathan Toland

    It's because of Aura JSONStreamReader referenced above. A minimum valid file is {}. Empty should be fine for CSS but I haven't tried.

  27. Scott Wells repo owner

    Yup, that's what I've confirmed as well. What stinks is that the reported error is:

    Deployment failed (UNKNOWN_EXCEPTION) - UNKNOWN_EXCEPTION: An unexpected error occurred. Please include this ErrorId if you contact support: 2047702628-281648 (-2131426776)

    Give a valid JavaScript body and no error. So yeah, when you add files to a component via IC, I'll be populating them with a minimally valid body.

  28. Jonathan Toland

    Or maybe templates like for Apex? That's basically what Dev Console does. Interestingly leading comment and trailing semicolon are okay. That's especially helpful since every JS compiler I'm aware of generates them (at the very least CoffeeScript and TypeScript I've tried so far).

  29. Scott Wells repo owner

    I didn't go into details, but yes, the idea would be to add new file templates for each of these file types (app, component, event, javascript-for-lightning, CSS-for-lightning) and first-class entries for creating those under File>New or right-click>New.

  30. Vivek M. Chawla

    @RoseSilverSoftware I think I have found an issue with the updated component save process.

    I have a Lightning app bundle called "helloWorldApp". I was able to make changes to the helloWorldApp.app file and deploy them successfully. Everything seemed like it worked ok.

    Then, I tried to make an update where I added a component via <c:HelloEditRecord.cmp />. Since I mistakenly added .cmp to the end of the component's name, this caused a deployment error. IC caught this and displayed the errors in the Problems tab (Great! This works! Thank you for that fix!)

    The problem is that after I fixed the code to remove the .cmp from the component name, IC still could not deploy to SFDC. I tried saving, and force-saving, and each time the progress bar would show, do work, but always end with the same error I got when I had the .cmp in the name.

    I tried completely deleting the <c:HelloRecordEdit /> tag, but IC still kept getting errors. It seems like IC just kept trying to deploy the original file (with the error) regardless of what changes I made to it.

    FYI: The error message in Problems view is: Invalid Descriptor Format: c:HelloEditRecord.cmp[COMPONENT]

    Not sure if I should open a new bug for this, or if it's just another strange deployment issue with Lightning.

  31. Scott Wells repo owner

    Vivek, I think I just reproduced the issue. I think it's a matter of where errors are getting reported in some cases and my inability to selectively remove them. To be specific, when I just did this, the error message, like yours above, didn't contain any information about the actual file containing the error. As a result, when added to the Problems View, the error was attributed to the project directory (that's my fallback right now just to get it in front of you). Unfortunately I'm not sure when I can safely remove errors that are attributed to the project directory, so the entry sticks around even after the associated problem has been resolved. One way you can clear the Problems View of these errors is to perform a full deployment (Deploy All Metadata).

    Because of these limitations with the Problems View, and because it's one of the things keeping me from making Illuminated Cloud available in other JetBrains IDEs such as WebStorm, I'm planning to replace it with a custom problems view that does exactly what I need and gives me much better control over when and where problems are reported and when they're cleared.

  32. Vivek M. Chawla

    Scott, I like the plan to make a custom problems view, especially since that will open IC up to so many more customers. :-) WebStorm + IC would be an amazing combo!

    I'll try using Deploy All Metadata to see if that helps. Thanks for the suggestion.

  33. Scott Wells repo owner

    Thanks for the feedback. I wish that were the only obstacle to getting it working in WebStorm, but it's not. There are two other features that are missing in the plugin SDK for the minor IDEs, customization of the new project/module wizard and code coverage. Evidently there's a "lightweight" alternative to the former, but I'm unable to find a substitute for the latter. I am in active discussions with JetBrains about options there, though.

  34. Sławek Gołąbek

    Scott, I had too much work yesterday, but today I checked lightning components development and there is a little problem with error log, but I see that You know that already. Although for me it works ok, because there is no problem with deploying and retrieving.

  35. Scott Wells repo owner

    Thanks, Slawek. Yes, there are still some issues with the problems view. As noted above, those will likely exist until I implement my own with much greater control over reported error lifecycle. Glad to hear that just moving components in and out is working better, though!

    I've had a VERY busy week which is why I haven't had a chance to put out an official update. I'll see if I can polish up things a bit this weekend and put out something on Monday with the fixes I've provided so far plus perhaps some file templates for the Lightning file types. I think that would represent valuable incremental progress on this feature, and then another good step for this and other issues would be a dedicated problems view, so perhaps I'll do that next. Hopefully that will give you guys enough to work with while I put together completion, navigation, integrated docs, etc., which will certainly take more time to get in place.

  36. Daniel Sokolowski

    Is there a way to create an aura component from within the plugin? When you right click on the src/aura folder there is no obvious choice or option which is why I'm asking.

  37. Scott Wells repo owner

    Daniel, you can use File>New>Package to create a new folder. Not the most intuitive thing in the world. Then you just need to follow Lightning's naming conventions for bundle components when naming the files you add under that folder. I'll be making this all first-class when I take on this enhancement request, of course.

  38. Scott Wells repo owner

    First-class support for Lightning development is still coming. I'm still trying to button up some deployment-related items and will need to update the plugin for Spring '16 soon. My current estimate is that I will get started on this in earnest in February and plan to have multiple incremental releases as I complete useful aspects. More details to come in the next several weeks as I clear my plate enough to move to this.

  39. Vivek M. Chawla

    Hi @RoseSilverSoftware ! It's been awhile since I've used IC. Great job shoring up the deploy/retrieve functionality!

    I noticed that Lightning Component support has been pushed back to 1.8.0.0. Any idea of how this translates to realtime? Is this a feature that we can hope to see within the next few months, or is this a late 2016 feature release?

    Thanks! Vivek

  40. Scott Wells repo owner

    Vivek, I'm getting started on it this week and plan to have it wrapped up before the June TrailheaDX developer conference. I had originally planned to have it in place by now, but I decided to work on the offline debugger first since that's likely valuable to more users than Lightning support right now...though that seems to be changing almost daily right now as I'm seeing interest in Lightning ramp up significantly!

    I should be posting updates with considerable progress starting in the next few weeks as I iterate on the feature set.

  41. Scott Wells repo owner

    Quick update on this...I've FINALLY gotten started on full first-class support for Lightning dev in IC! I plan to release functionality incrementally as it's ready. For example, I already have syntax highlighting, completion, and integrated documentation in place for system components and will release that in the next few days. I'll also be adding completion and navigation for Lightning-specific concepts as well as the ability to create/navigate between the various contents of Lightning components and apps. I'll definitely appreciate early feedback from folks using IC for Lightning dev as I roll out pieces of functionality.

  42. Vivek M. Chawla

    @RoseSilverSoftware This is great news! Especially the syntax highlighting!

    Do you know if IC will be able to tell IntelliJ's XML inspector how to look at .app files so IntelliJ doesn't think there are always XML errors with new files? Things like that, and syntax highlighting are small, but will go a long way to improving the "feel" of developing lightning components with IC.

    Once again, thanks for your hard work on IC! Can't wait to see what happens in the next few releases! :-)

  43. Scott Wells repo owner

    Yes, that's part of what I already have. Here's a screenshot of the current WIP:

    LightningSupportPreview.png

    Just like with Visualforce, I'm "injecting" the Lightning markup concepts into IntelliJ's native HTML editor. When all is said and done, it should be a really nice way to do Lightning dev!

  44. Vivek M. Chawla

    Woohoo! Love it! You even have the lightning bolt icons for the files! Excellent small touch!

  45. Nathen Drees reporter

    Thanks Scott, playing with it now. Most things seem to work great, except for the preview feature. I don't have that option in my menu, is that something I need UE for?

    Obviously my CSS and JS files still don't have much support since i'm on the CE.

  46. Scott Wells repo owner

    Preview should be available if you're in an application bundle (any file in that directory) or a Visualforce page. Where are you when you're trying to preview? If it's a bug (or oversight), it should be trivial to fix.

  47. Nathen Drees reporter

    I'm trying to just preview my lightning component, which is in the aura folder. I right click in the folder and don't see any option to preview.

    Screen Shot 2016-05-02 at 10.41.49 AM.png

    Screen Shot 2016-05-02 at 10.44.10 AM.png

  48. Scott Wells repo owner

    Correct. It's only present for applications right now. I modeled that after the behavior in Developer Console where the Preview button was only available for apps. Are you able to preview components elsewhere? If so, I'm very happy to add that. I can throw that in with the fix for the other issue you've found with deployment.

  49. Nathen Drees reporter

    Gotcha, doesn't look like you can preview components directly. I do see this for apps so I think this is working as intended.

  50. Scott Wells repo owner

    Still making steady progress on this as tracked through a few other stories. The next major phase will be Lightning-specific completion for expressions and attribute values.

  51. Scott Wells repo owner

    More progress delivered in 1.7.1.5:

    • Issues 49/146 - Improved JavaScript/CSS completion for Visualforce and Lightning in IntelliJ IDEA Ultimate Edition.
  52. Dmitry Omelchenko

    Scott, quick question is it possible at the moment to navigate from component's handler to JS method declaration in their controller by holding 'Alt' and clicking to method name in the handler action? I've just tried to do it but got message "Cannot find declaration to go to". Also if I mouseover on method's name in the controller it says "Unused property". Is that not implemented yet or maybe some bug? Thanks!

  53. Scott Wells repo owner

    Dmitry, funny that you ask. I actually have navigation for JavaScript developed, but it's currently disabled in the shipping product because of some performance issues. I'm going to try to address those issues during the third phase of Lightning dev work and have it enabled. As with the completion for JavaScript in Community Edition, it won't be "smart" navigation, but it should allow you to navigate from usages to declarations. Be on the lookout for that in the next few weeks.

  54. Dmitry Omelchenko

    Another thing looks like code autocomplete doesn't work as expected in JS controllers. For example I added a local variable to JS method then I started to type this variable name on next line and it showed me a long list of suggestions where my variable almost at the end, see the screenshot below. I believe it should be first, shouldn't it?

    Screen Shot 2016-07-20 at 17.27.07_2.png

  55. Scott Wells repo owner

    Interesting. Yes, it should be showing "close" completions toward the top of the list. I'll take a look.

  56. Scott Wells repo owner

    Dima, I'm on my family vacation this week so I won't really get a chance to look at this until next week.

  57. Rick Hedin

    This seems like a good place to ask a general question. Part of my objective is to get a set of files outside of Salesforce, so I can put them into git.
    Does one put the .xml files into .gitignore? Do I just include the files that I would normally directly edit?

  58. Scott Wells repo owner

    Dmitry, I've been sidetracked by some non-Lightning work for a while. My plan is to return to this a bit this week but in earnest right after I return from Dreamforce. I'll make sure that the Javascript completion issue gets attention at that point. I apologize for the long delay...

  59. Scott Wells repo owner

    Some enhancements included in 1.7.9.0, in particular better completions for functions in Lightning expressions. More Lightning completion and reference enhancements coming over the next several weeks.

  60. Scott Wells repo owner

    While not 100% complete in terms of completions and reference injection, this is basically done. I'm working the editor gaps as other stories.

  61. Log in to comment