Opening Dart projects in IntelliJ - intellij-idea

I can't seem to import dart projects, I have the dart plugin installed, have it enabled, selecting both the dart project's pubspec.yaml or build.dart seem to give me the error "Cannot import anything from _.dart / _.yaml".
If I select the root directory of the dart project and select create modules from existing sources (since it's not a maven/gradle/eclipse project), it gets picked up as a python project and there is no way to select a dart SDK.
Right clicking and clicking add framework support only gives me python related frameworks such as Django and App Engine (Python). Trying to add a project facet, there are tons of options, everything from Vaadin, to GWT, to Scala, etc, but no Dart.
The official Dart page for dart-support gives me an error 404: https://www.jetbrains.com/idea/help/Preparing_for_Dart_Development.html
(related to Netbeans + Eclipse + Dart -> IntelliJ)
(PS, this project was created in Dart Editor)

File > Open > selecting the folder does it for me (WebStorm). I don't know what create modules should do.
When I open a file it asks me if I want to make it a Dart project, and I'm done.

Related

Using kotlinx.coroutines in IntelliJ IDEA project

I am trying to learn coroutines and so I fire up IntelliJ and create a scratch file. But when I type in my coroutines I get compiler complaints such as runBlocking is an unresolved reference. So this is not an android project or any such thing. Just a scratch file in a basic Kotlin project.
How do I bring in the coroutine stuff so I stop getting errors?
runBlocking and other high-level coroutine utilities are not in the Kotlin standard library, but instead are a part of the library kotlinx.coroutines.
To use this library in your project you must download its binaries and add a dependency on them to the project. Usually declaring a library dependency is a line or couple of lines in a build file, if you use build systems like Gradle or Maven. However in a plain IntelliJ project it's possible to get that library from Maven Central almost without hassle:
Open project structure
In the "Modules" page select a module which you use as a context of the scratch file (I suppose there will be just one module).
Switch to "Dependencies" tab and hit the plus button.
then in a context menu select "Library" -> "From Maven"
paste maven coordinates of the kotlinx.coroutines library artifact:
org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.3
where 1.3.3 is the version of that library. You can find the latest available version here: https://github.com/Kotlin/kotlinx.coroutines/blob/master/README.md
be sure to check "Transitive dependencies" and "Sources" boxes.
After hitting OK the library will be downloaded from Maven Central repository with all its dependencies and added to your module. Then it will be possible to use runBlocking in your project or scratch files.
You should add kotlin coroutines library to your project. The simplest way to do it is to get it from Maven repo. At this moment actual version of library is 1.3.2 The address of library in maven repo you could find here
At moment of writing the address of library is
org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.2
In plain IDEA IntelliJ project you should make following steps:
1) Go to project structure
2) Then go to Modules page and Dependencies Tab
3) Press "+" button. Select library from "Maven"
4) In search bar use address org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.2 of library in maven repo and add it.
5) Press OK then Apply. And recompile your project. That is it. Now you could use coroutines in your project.

PySpark IntelliJ IDE Interpreter [duplicate]

There is a tutorial in the IDEA docs on how to add a Python interpreter in PyCharm, which involves accessing the "Project Interpreter" page. Even after installing the Python plugin, I don't see that setting anywhere.
Am I missing something obvious?
With the Python plugin installed:
Navigate to File > Project Structure.
Under the Project menu for Project SDK, select "New" and
Select "Python SDK", then select "Local".
Provided you have a Python SDK installed, the flow should be natural from there - navigate to the location your Python installation lives.
I was getting the error (IntelliJ on Ubuntu 18.04) while python SDK was configured.
To fix that, I had to do this:
File -> Project Structure -> Modules
Click on the Dependencies tab, and click on + and select the python SDK
Click on Apply
After that, the warning went away and autocompletion also started working properly
So here is a simple project, where I have used Selenium and added that using external path
Now you need to open Project Structure and go to SDK Section
Now Select your project's virtual environment. In the Classpath tab add the PYTHONPATH by clicking + button
and now the modules will be recognized
If you have multiple modules in your project, with different languages, you can set the interpreter in the following way:
File -> Project Structure...
Select Modules in the list on the left
Select the Python module in the list of modules
On the right-hand side, either choose an existing Python SDK from the dropdown list, or click on the New... button to create either a virtualenv, or create a new Python SDK from a Python installation on your system.
Follow these steps:
Open Setting (Ctrl + Alt + s)
Click on plugins
Find Browse Repositories and click
Search for "python"
Select Python SDK or pycharm
Restart the IDE
Go to project structure
Select the python SDK in projects or create a new project with python SDK.

How to properly import a Play 2+ project in IntelliJ 14+ with all integrated features (run, debug, test)?

I work on a Java based Play! project for severals months now and I'd like to import it completely in IntelliJ, meaning being able to run, compile, test and debug from IntelliJ, without the need to use the command line.
According to this post from Jetbrain, it seems to be possible, if I quote the article it says clearly : "Now you don’t need to switch between IntelliJ IDEA and Play console anymore. Everything is available right from your favorite IDE.", but I can't figure out a way to achieve this for now, even if I follow the tutorial provided by Jetbrains.
Here are the steps I've been throught :
Open my fav IDE IntelliJ ;)
Go to the project list window.
Import project
Import from external model and choose SBT as suggested in Jetbrains tutorial.
option "Use auto import" checked, option "create directories for empty content roots automatically" checked. Project SDK Java 1.7
Global sbt settings : JVM From project JDK.
Finish
By now, if I try to make the project and launch it from IntelliJ, I'll get scala compiling errors related to routes object. Thanks to this post, we can understand that this happens because scala routes are located to specific folders that needs to be included in IntelliJ sources settings for this project. So next step was :
File -> Project Structure -> Modules
Add target/scala-2.10/classes:target/scala-2.10/resources_managed:target/scala-2.10/src_managed as sources folders.
But my problem remains the same, routes object being unrecognized.
Notes : I have no scala facets in my project structure configuration nor can add one.
IntelliJ provides integrated support for the Play Framework for Scala and Java. Support is currently only available in IntelliJ Ultimate Edition (see the Frameworks and Technology section).
Assuming Ultimate Edition, the setup for Play is incredibly easy. Simply create a new project by importing build.sbt, then choose Add Framework Support and choose Play 2.
Once complete, you can start and stop Play using the Play 2 Run/Debug configuration. No command line necessary.
Here is a more in depth look at IntelliJ's Play project configuration.
You could try the command play idea if you are using play or activator idea if you are using activator. That will do the magic.

Netbeans + Eclipse + Dart -> IntelliJ

At the moment I have 3 IDEs running at the same time, Netbeans for PHP and Python related projects (support for both are poor in Netbeans), Eclipse STS for Java/Spring/Scala projects (STS hangs when the projects get too big) and Dart IDE for Dart projects.
I'm trying out IntelliJ seeing as it has decent support for all the languages I'm working in and somehow it's a lot more stable, much faster, much more intuitive, but I can't figure out how to import multiple projects ... (that's something that just works in both Netbeans and Eclipse)
... there's a Maven Projects tab on the right, if I click the + sign it perfectly imports multiple maven projects for me and lists them in the project box, as soon as I import a non-maven project using file -> import project, all my other projects disappear and I have to re-import those projects via the Maven Projects tab. If I import a non-maven project first and then the maven projects using the Maven Projects tab on the right, I can mix one Dart project and multiple maven projects.
The suggestion out there is to import them as modules under a project, so I create an empty new project called Workspace, I select JDK 1.7 for the project SDK. Under module I click the + sign, find my project, select the pom.xml, add all the pom.xml files for that project and click ok - now I have a project with multiple modules.
Repeat for another project, import all the modules, and first project disappears.
How do I have multiple projects with their own "modules" (modules which are actually standalone projects) in IntelliJ. If projects are the eclipse equivalent of workspaces, is it possible to have multiple workspaces open? If not, how do I switch between them? (if switching is too much hassle, I'll create one mega-project and just add all projects as modules)
You can have multiple projects open in separate IntelliJ windows. Every time you open or create a project, or open a build file such as pom.xml or build.gradle, IntelliJ asks you whether you want to open the project in the same window or a new one.

How to import and run existing plugins from intellij community edition repo

I'm trying to import and run the IntelliJ git4idea (Git Integration) plugin in order to play around and contribute some of my own code.
I've pulled the Intellij community edition from the github repo, and imported the git4idea plugin as a project. I'm running the Intellij community edition
My main issue is this:
After importing all the modules, the git4idea module comes up as a general module type, and not a plugin module type.
This means that when trying to create a new run\debug configuration, I get [none] under "Use classpath of module", instead of of the ability to select the git4idea plugin. This obviously results in a "Run configuration error: no plugin module specified for configuration".
So the question is -
How can I change the general type of imported "git4idea" to plugin type?
Or better yet, what are the steps required in order to import and build/debug/run a plugin from the Intellij community edition repo?
I was able to solve this by manually reordering file directories, sorting out dependencies and editing the .iml file. The type of plugin is defined by changing type="JAVA_MODULE" to type="PLUGIN_MODULE".
...
This is the answer given by Dmitry Jemerov on the official Jetbrains plugin development forum:
The easiest answer to this is "don't". The IntelliJ IDEA Community
Edition project is set up to be developed as a whole, and the
dependencies are set up accordingly. If you want to hack on the Git
plugin, you simply run IDEA using the provided run configuration, it
runs with all plugins enabled, and you simply make whatever changes
you need and test them using the main run configuration.
If you really want, you can set up a new plugin module and point it to
the source code of the git4idea plugin inside the IntelliJ IDEA
Community Edition Git checkout. This is not too hard, but it's
something you'll need to do from scratch, and you can't use the
existing .iml file.
I had the same no plugin module specified for configuration issue. To work around it, instead of importing, I created a new plugin project and used the existing code directory.
when you import the intelij plugin projects
You should run the 'runIde' task in gradle.
Step-by-step instruction
Build your IDEA plugin (usually done with gradle build).
Start Intellij IDEA.
If you have any project opened, go to menu "File->Close all projects" to return to Intellij IDEA startup screen.
Install the plugin you've just built: on the left side of the "Welcome to Intellij IDEA" startup screen go to "Plugins", then click "gear" icon on the right side, it's located to the right of "Marketplace" and "Installed". From the pop-up menu select "Install Plugin from Disk...", navigate to plugin file (usually in build folder) and click "Ignore and continue" when you see the warning message saying something about signature.
Restart Intellij IDEA.
Open the folder with your IDEA plugin.
Wait until IDEA imported your Gradle project.
Put breakpoints inside your plugin code so you can debug it.
Go to menu "Run->Edit configurations".
In the "Run/Debug Configurations" window on the left side click "+".
Select "Gradle" from the pop-up menu.
On the right side change "Name" to "gradle-run-ide" (without quotes).
On the right side under "Run", inside "Tasks and arguments" field enter runIde ("i" must be capital, other letters small).
Click "OK" to save changes.
Go to menu "Run->Debug 'gradle-run-ide'".
A new, black-colored IDEA window should appear.
In this black-colored IDEA window do whatever you need to do in order to invoke methods of your plugin. When you invoke them, the first IDEA window should stop you on breakpoints you set previously.
Happy debugging.
After changing type="JAVA_MODULE" to type="PLUGIN_MODULE" in *.iml file I was getting following error -
Error running 'IdeaPlugin': Wrong SDK type for plugin module
To fix this go to -
Module Settings -> Platform settings -> SDKs.
Click on Add new SDK
Select Intellij Platform plugin SDK
For home directory select your Inetllij installation dir
Select JAVA SDK you want to use with it.
Once this is added got to Module Settings again
Module Settings -> Project settings -> project.
In Project SDK change the JAVA sdk to the SDK we just added in the above steps.
Run/Debug you plugin now.