I'm using sbt 1.0.4 (latest as of this writing), and running sbt console brings me into the Scala REPL (project uses Scala 2.12.4). What is the keyboard command to invoke code completion? Tab does not work for me, it just adds a tab character and backspace is broken successively. I'm starting sbt from Bash in Linux.
Such that Indexe<key> -> IndexedSeq, for example.
There is a related question. So there is a bug that affects sbt console, but one can just run sbt and then from the sbt prompt enter console, and then Tab works as expected.
Related
I want to add one extra sbt shell in the IJ. How to do it?
I want to run some sbt commands inside a two different SBT Shells.
An easy solution is to run one SBT in the sbt shell and the second in a terminal. You can run a terminal inside of the IDE by using menu View | Tool Windows | Terminal - see Terminal in the IDEA Help. When you open a terminal, it is opened with a project directory as a current directory. You type sbt and you have another sbt running for your project.
This second SBT has some limitations compared to a SBT shell:
you cannot navigate to errors and warnings by clicking on them
the SBT will not reload when you press Reload SBT in the IDE
Still, depending on what you want, it might provide a working solution.
What steps are needed to configure the IntelliJ debugger to attach to scala Play tests managed by sbt?
In IntelliJ 2019, you can attach the debugger to the sbt run command using the debug button in the sbt shell with no configuration changes.
However, the debugger does not attach to the test command.
Consider attaching the debugger via IntelliJ's sbt shell:
In the sbt projects tool window select checkbox Use sbt shell for builds
Open sbt shell tool window (usually found at the bottom)
Click Attach debugger to sbt shell button (the icon looks like a bug)
In the status bar it should say Connected to the target VM (see the image bellow)
Set breakpoints in your test
Execute test command in the sbt shell tool window
Debug sbt shell window should open and execution should stop at the first breakpoint.
Note if you are using Play like OP, then by default Play runs tests in forked JVM, so for the above technique to work try setting Test / fork := false in build.sbt.
First, you need to run your SBT with -jvm-debug [port] like:
sbt -jvm-debug 5005
Then open dialog Run/Debug Configuration and click on Remote.
On the newly created configuration set up the correct host and port (usually localhost and 5005) and click on apply.
Then when you'll just need to run this configuration and set up breakpoints. After that just run test inside SBT console.
I'm almost sure that this must have been asked and answered, but I've failed to find an answer in a forest of "almost but not quite" related tissues.
Scenario. I have an SBT project cloned from Git, but it has only source and build.sbt. It builds fine from a command-line sbt, but has no IntelliJ specific project files.
I do "import project", and get to a point where IntelliJ mostly seems to recognize the project. However, several problems remain:
The project has no SDK. This is an easy fix, as the IDE prompts to add one, but I mention it, as it might have relevance to the other problems.
The project (after adding an SDK) will not run. It claims to build properly, but on running, it reports "Error: Could not find or load main class blah.Blah". Now, I intermittently get this on a brand new project, and the solution has always been to pop up the SBT console and build it from there. After that, the problem typically goes away. But...
In this project, there is no option for the SBT console. I can start one from the Terminal, but that's not the one that solves the problem in 2) above. Normally, SBT console is available to me on the bottom line, next to tabs like "Run" "Terminal" "Todo" and the like. But it's not there, and it's not on the View->Tool Windows list (not even greyed out). However, the "SBT" window is offered, but that only handles SBT structure, not actual operations.
This question may sound silly for you, but I have been searching the Internet for a while and couldn't find the answer. How can I open SBT Tool Window in Intellij (scala and SBT plugins obviously installed)?
In Menu: View -> Tool Windows there should be two entries:
SBT
SBT Console
The first you can use to refresh IDEA project structure from SBT and view dependencies.
The second gives you a console where you can run sbt commands.
Update:
As Justin already aded:
As of IntelliJ IDEA 2017.1 Build #IC-171.3780.52 there is a new and (imho) better way:
(If you are working with an SBT project, that is)
When you open the SBT Tool Window, you will find a new scala terminal icon:
This will open an sbt console session with your sbt project import settings.
One major benefit is that you will actually (finally) get links to your code lines for compiler warnings and errors.
To be able to open SBT Console from View -> Tool Windows you first need to install the plugin required for it.
You can find the SBT plugin by searching for it under Settings -> Plugins -> Browse repositories
Plugin homepage: https://github.com/orfjackal/idea-sbt-plugin
In IntelliJ 2017.1, an sbt shell is integrated with the Scala plugin. You can open it from an icon on the sbt project view toolwindow, or from the "Tools" menu
In Intellij 16 SBT Console menu item no longer exists and in Debian 7 (XFCE) Alt-F12 doesn't work.
To run SBT console:
select View -> Tool Windows -> Terminal (for Alt-F12)
type sbt and console works
You can either use above or simply use Alt+F12
I had an issue where the sbt shell launcher was not on the bottom of the IDE and the sbt was not listed as an option under Tools. Discovered that the issue was after expanding a zip file of a scala project to my workspace, the build.sbt file was not in the root folder of the project structure, but nested one subfolder down. When importing this project into intellij it was not properly configuring it as an sbt project. After removing the project, exploding the zip in such a way that the build.sbt was in the root of the project and reimporting the issue was resolved.
I had a similar, but slightly different issue. First, I didn't have the Scala plugin installed on my version of IntelliJ. Once done, I restarted the app. Then created a new project (even though I was trying to open an existing one). When creating the project I made sure to put the root directory of the project as the root folder of the project I wanted to import (the one that has the sbt file). IntelliJ synched my new project with the existing one and I was good to go.
I am using a the NetBeans 7.x IDE. I have a Netbeans Application module. I use the Build and the Run buttons from the IDE. The module runs just fine when I press Run Project or F6 button. I like to run
this from the command line. Since everything was build automatically for
me I have no idea where things are or how to run it. There are several jar files in the project/build/public-package-jars. Is there a way to see what command and options the Run Project is using ?
Go to the root of the application (or wherever there is a build.xml file) on the command line and run ant -p. That will list all of the available options for building and running the application.