Meteor iron:router as library in Intellij 14 - intellij-idea

I'm attempting to mark all packages in my Meteor project as JavaScript libraries so I can have features such as auto-completion, etc. in Intellij 14.
Following the instructions found here:
I opened up the package.json file under /.meteor,
clicked on the "import packages as libraries" option (yes, iron:router is listed)
However, the Router object remains unresolved, even though it worked for the other libraries. I noticed someone mentioned later:
Code completion for other Underscore.js functions such as bind, partial, etc and packages like Iron:Router and others are not as complete
Edit:
Pressing alt-enter with the Router object selected, as Matt K suggested, only gives the options of creating a variable named "Router" or renaming the reference, not actually resolving the iron:router library as a dependency.
Does anyone have any suggestions on resolving the iron router library?

Turns out this was as easy as I thought it was with going to .meteor/packages.json and clicking on "import packages as libraries". Not sure what the issue was before but following that same 2-step process whenever the listing changes solves any library recognition issues.

Related

How to link folder/packages in intellij?

I come with this odd question, after look on the intelliJ forums I have no results.
I started to work in a project that has multiple gradle modules.
There is one module that has another module referencing it.
Lets say I have ModuleA with all my classes, each class I add on a new package appears also in ModuleB
When I checked on the folders of ModuleB I noticed a weird icon.
Checking the folder (right-click) I can see the option:
Go to Link Target
That basically takes me to ModuleA's folder configuration.
I could find no gradle configuration that makes these references or how to reproduce it.
Any idea how?
These are Symbolic links and are created in Bash. This doesn't have anything to do with gradle.
More info here

IntelliJ + Play Framework routes file red underline error

Image of the errors
I don't how to fix this red underlines I recently got in my routes files.
What I did:
I split up my routes files into 3 files:
- routes
- rest.routes
- web.routes
And after I did, IntelliJ said something about "We have a new program that can handle .routes files" and I clicked yes to it. <-- Stupid me :(
Can also mention that I cant remember what addon that was installed, and I cant find any addons that differs from previous versions.
Before there was no "spellchecking" on the file, but now I get this box in top of the file saying "Project SDK is not defined 'Setup SDK' ". It also gives the red "undelining" similar to spellchecking under every single line of code in the file.
The code itself works great, its just very frustrating to have these red lines everywhere.
Anyone know how to get rid of it?
Highly appreciated!
IntelliJ 2017.2 and Play Framework 1, I had this problem one day. Took me awhile to figure out but it was the Scala plugin that made this fail for me. After uninstalling the Scala plugin it works again.
I also faced similar issue recently. The plugin that Intellij asks to install in this case is Erlang. You just have to uninstall it (or just suppress the warning).
To uninstall Erlang go to Preferences.. -> Plugins. Then search for Erlang and select. Then click uninstall (on the right pane).
First, setup Java SDK (even if you use scala)
Second, try to compile code (run play application) and recheck routes files. I suggest that IDEA use compile routes classes to verify config.
Third, check syntax of your conf/routes . Are you sure want use -> ?

Intellij can not locate some classes - Play SBT. Intellij bug?

I have a few import statements in my project that are displayed in RED. Intellij shows 'Cannot resolve symbol' errors, and I am not able to autocomplete these classes or their methods. However, when I run my project it runs perfectly fine. This is strange so much so, that lets say I have an import statement
import org.apache.velocity.app.Velocity
It cannot resolve the 'Velocity' class, even though when I do a ctrl+b selecting the 'app' package, it clearly shows the Velocity class:
I am lost in this and I am struggling to code like this. Any help will be appreciated.
Best Regards.
EDIT: In my project, some of the dependencies are also not resolved, although I refreshed my project multiple times. The exact same dependencies are resolved in my colleague's system, who is using the same code-branch and environment as me.
I can see that the unresolved dependencies lie inside the play.sbt package, but are still not resolved. Is there a compatibility issue between Intellij("15.0.2") and SBT("0.13.8" mentioned in build.properties of my app)?
Reimport project using option 'Import project from external model' and choose 'sbt'. In next window choose options like 'use auto-import' and download 'sources for SBT and plugins'.

Adding a directory path under IntelliJ 12 claims Library 'LibraryName' is not used and has no effect

I maintain an IntelliJ plugin (Codename one) and we need to control the users classpath. I'm adding a classpath either via the plugin or manually by going to here:
And pressing the + sign where I pick Java:
Then choose classes:
This seems to work OK:
But the completion and other such functionality doesn't work and when I go back the entry is disabled and I get this error message:
This doesn't really tell me anything?
A workaround is to open the .iml file in a text editor, and add the following to the orderEntry list:
<orderEntry type="library" scope="PROVIDED" name="LibraryName" level="project" />
Unfortunately this isn't very practical and it only solves some of the problems I'm experiencing. Any direction or hint would be appreciated here.
Edit: Adding screenshot of preferences UI:
Second Edit: Screenshot of the module section
The answer from kukido is good, for additional details though check out this: http://devnet.jetbrains.com/message/5509300
Essentially what I want is to still have my module but add a dependency programmatically which can be done by:
ModifiableRootModel model = ModuleRootManager.getInstance(module).getModifiableModel();
model.addLibraryEntry(library);
model.commit();
This doesn't really tell me anything?
IntelliJ is trying to warn you that you have created a library, but it is not referenced anywhere in the project. It is gently asking "Did you mean to add this library as a dependency?".
The entry is not disabled. It is greyed out to show that it is not referenced in any module as a dependency. Once you add the library to the dependencies list, the color will change.
It is a two-step process:
Create a library
Reference new library in a module
Code completion is not working because your module is not aware of the library classes.
Module dependencies
Non-referenced and referenced libraries

IntelliJ IDEA Report Highlighting error when using routes in Controller

I have a Scala Play project. I'm using Play 2.2.1. I downloaded Scala, Play 2 supported and SBT plugins. Everything is OK, but When I call route on Action in the Controller appear following error(Look screenshots):
I'm using IntelliJ IDEA 12.1.6 Ultimate version. Scala version 2.10.2
Anybody know how to fix this problem?
Thanks in advance!
Edit
When I generate my project to Intellij IDEA via "play idea" command in play console, and I opened project in IDEA project structure was such:
Then I saw answer #millhouse and discussing on this githup([Play 2.2] "play idea" creates not working source mapping in target) and I removed following folders from Sources Folders:
target\scala-2.10\src_managed\main\controllers
target\scala-2.10\src_managed\main\views
and "Report highlighting error" disappeared, but now there is another error:
and
my route:
And I've changed "Sources Folders" as shown below:
But it doesn't help me. And remains "Unspecified value parametrs" error.
millhouse's answer helped me find the right answer. Play 2.2 (and perhaps earlier versions, haven't checked) output a scala version of the routes file to project_dir/target/scala-2.10/src_managed/main So for IntelliJ to get the highlighting right you need to make sure that src_managed/main is added as a source folder. The reverse routes for javascript are for some reason included in project_dir/target/scala-2.10/classes_managed so you'll have to add that as well. (In your screenshot it looks like classes_managed is set to excluded so you'll want to un-exclude it by pressing the x button on the right hand side.)
Here's a screen shot of my project structure:
Update:
In Play 2.3 (or perhaps recent versions of IntelliJ) adding the classes_managed no longer fixes the problem. Instead of adding classes_managed to the project's sources add it to it's dependencies. By doing that IntelliJ should be able to pick up the compiled routes.class.
This is a common problem, it's because IntelliJ needs to be shown where to look for the compiled Scala templates and routes file. Here's how I fixed it on my IntelliJ 12.1 installation:
Go to the Module Settings for your project in IntelliJ (select the top-level, hit F4)
Choose the Modules item in the Project Structure window that appears
Select the projectname item (as opposed to the projectname-build item)
Add the compiler's output directory to the Source Folders items;
For Scala 2.10 it's target/scala-2.10/classes
I personally find the IntelliJ UI for this to be very non-intuitive; you might need to take the target directory and/or one of its subdirectories out of the Excluded Folders first
After applying that change, IntelliJ should see the results of compiling each routes and .scala.html file as just-another source file, so they won't show as "broken" and auto-complete should work for them.