Skip to content

Commit

Permalink
remove various references to Eclipse and Scala IDE (scala#2676)
Browse files Browse the repository at this point in the history
  • Loading branch information
SethTisue authored Jan 25, 2023
1 parent 00a343e commit fa38737
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 88 deletions.
6 changes: 3 additions & 3 deletions _overviews/macros/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,15 +223,15 @@ The walkthrough in this guide uses the simplest possible command-line compilatio
* Macros needs scala-reflect.jar in library dependencies.
* The separate compilation restriction requires macros to be placed in a separate project.

### Using macros with Scala IDE or Intellij IDEA
### Using macros with Intellij IDEA

Both in Scala IDE and in Intellij IDEA macros are known to work fine, given they are moved to a separate project.
In Intellij IDEA, macros are known to work fine, given they are moved to a separate project.

### Debugging macros

Debugging macros (i.e. the logic that drives macro expansion) is fairly straightforward. Since macros are expanded within the compiler, all that you need is to run the compiler under a debugger. To do that, you need to: 1) add all (!) the libraries from the lib directory in your Scala home (which include such jar files as `scala-library.jar`, `scala-reflect.jar` and `scala-compiler.jar`) to the classpath of your debug configuration, 2) set `scala.tools.nsc.Main` as an entry point, 3) provide the `-Dscala.usejavacp=true` system property for the JVM (very important!), 4) set command-line arguments for the compiler as `-cp <path to the classes of your macro> Test.scala`, where `Test.scala` stands for a test file containing macro invocations to be expanded. After all that is done, you should be able to put a breakpoint inside your macro implementation and launch the debugger.

What really requires special support in tools is debugging the results of macro expansion (i.e. the code that is generated by a macro). Since this code is never written out manually, you cannot set breakpoints there, and you won't be able to step through it. Scala IDE and Intellij IDEA teams will probably add support for this in their debuggers at some point, but for now the only way to debug macro expansions are diagnostic prints: `-Ymacro-debug-lite` (as described below), which prints out the code emitted by macros, and println to trace the execution of the generated code.
What really requires special support in tools is debugging the results of macro expansion (i.e. the code that is generated by a macro). Since this code is never written out manually, you cannot set breakpoints there, and you won't be able to step through it. The Intellij IDEA team will probably add support for this in their debugger at some point, but for now the only way to debug macro expansions are diagnostic prints: `-Ymacro-debug-lite` (as described below), which prints out the code emitted by macros, and println to trace the execution of the generated code.

### Inspecting generated code

Expand Down
2 changes: 1 addition & 1 deletion _overviews/scala-book/oop-pizza-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,4 +216,4 @@ To experiment with this on your own, please see the *PizzaOopExample* project in

- [github.com/alvinj/HelloScalaExamples](https://github.com/alvinj/HelloScalaExamples)

To compile this project it will help to either (a) use IntelliJ IDEA or Eclipse, or (b) know how to use the [Scala Build Tool](http://www.scala-sbt.org).
To compile this project it will help to either (a) use IntelliJ IDEA or Metals, or (b) know how to use the [Scala Build Tool](http://www.scala-sbt.org).
3 changes: 1 addition & 2 deletions _overviews/scala-book/preliminaries.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,10 @@ One good thing to know up front is that comments in Scala are just like comments

## IDEs

The three main IDEs (integrated development environments) for Scala are:
The two main IDEs (integrated development environments) for Scala are:

- [IntelliJ IDEA](https://www.jetbrains.com/idea/download)
- [Visual Studio Code](https://code.visualstudio.com)
- [Scala IDE for Eclipse](http://scala-ide.org)



Expand Down
1 change: 0 additions & 1 deletion _overviews/scala-book/scala-repl.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,5 @@ In addition to the REPL there are a couple of other, similar tools you can use:

- [Scastie](https://scastie.scala-lang.org) is “an interactive playground for Scala” with several nice features, including being able to control build settings and share code snippets
- IntelliJ IDEA has a Worksheet plugin that lets you do the same things inside your IDE
- The Scala IDE for Eclipse also has a Worksheet plugin

For more information on the Scala REPL, see the [Scala REPL overview]({{site.baseurl}}/overviews/repl/overview.html)
2 changes: 1 addition & 1 deletion _overviews/scala3-migration/tooling-tour.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Scala 3 support for Maven will soon land in the [scala-maven-plugin](https://git

### Metals

[Metals](https://scalameta.org/metals/) is a Scala language server that works with VS Code, Vim, Emacs, Sublime Text and Eclipse.
[Metals](https://scalameta.org/metals/) is a Scala language server that works with VS Code, Vim, Emacs, Sublime Text, and other editors.

Scala 3 is already very well supported by Metals.
Some minor adjustments for the new syntax changes and new features are coming.
Expand Down
79 changes: 0 additions & 79 deletions _overviews/tutorials/scala-with-maven.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,82 +163,6 @@ After adding this, `mvn package` will also create `[artifactId]-[version]-jar-wi
- `mvn clean`
- `mvn package`: compile, run tests, and create jar

### Integration with Eclipse ([Scala IDE][24])
There are instructions at the [Scala Maven Plugin FAQs][23], but I thought I'd expand a bit. The [maven-eclipse-plugin][33] is a core plugin (all plugins prefixed with "maven" are, and are available by default) to generate Eclipse configuration files. However, this plugin does not know about our new Scala source files. We'll be using the [build-helper-maven-plugin][34] to add new source folders:

...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>src/main/scala</source>
</sources>
</configuration>
</execution>
<execution>
<id>add-test-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>src/test/scala</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
...

After adding that to your `pom.xml`:

1. Run `mvn eclipse:eclipse` - this generates the Eclipse project files (which are already ignored by our archetype's `.gitignore`)
2. Run `mvn -Declipse.workspace="path/to/your/eclipse/workspace" eclipse:configure-workspace` - this adds an `M2_REPO` classpath variable to Eclipse
3. Run `mvn package` to ensure you have all the dependencies in your local Maven repo

Unfortunately, the integration isn't perfect. Firstly, open up the generated `.classpath` file (it will be hidden by default as it's a dotfile, but it should be in your project root directory; where you ran `mvn eclipse:eclipse`). You should see something like this near the top.

<classpathentry kind="src" path="src/test/scala" output="target/test-classes" including="**/*.java"/>
<classpathentry kind="src" path="src/main/scala" including="**/*.java"/>

Change the `*.java` to `*.scala` (or duplicate the lines and change them to `*.scala` if you also have Java sources).

Secondly, open the `.project` eclipse file (again, in the same folder). Change `<buildSpec>` and `<natures>` to look like this. Now Eclipse knows to use the Scala editor, and it won't think that everything is a syntax error.

<buildSpec>
<buildCommand>
<name>org.scala-ide.sdt.core.scalabuilder</name>
</buildCommand>
</buildSpec>
<natures>
<nature>org.scala-ide.sdt.core.scalanature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>

Finally, in Eclipse, under "File" choose "Import..." and find your project.

#### Using [m2eclipse-scala][35] for Eclipse integration
m2eclipse-scala is a work in progress, and their website/repository may have updated information.
It aims to ease integration between m2eclipse and Scala IDE for Eclipse.

Under "Help -> Install New Software", enter "https://alchim31.free.fr/m2e-scala/update-site" and hit enter.
You should see "Maven Integration for Eclipse -> Maven Integration for Scala IDE".

After it installs, go to "New -> Project -> Other" and select "Maven Project".
Search fo "scala-archetype" choose the one with the group "net.alchim31.maven".
The wizard will more or less guide you through what was done with `mvn archetype:generate` above, and you should end up with a new Scala project!

To import an existing project, simply go to "File -> Import -> Existing Maven Project" and find the directory containing your project.

## Adding Dependencies
The first thing I do is look for "Maven" in the project page. For example, Google's [Guava] page includes [Maven Central links][28]. As you can see in the previous link, The Central Repository conveniently includes the snippet you have to add to your `pom.xml` on the left sidebar.

Expand Down Expand Up @@ -277,7 +201,6 @@ I'm not going to explain all of Maven in this tutorial (though I hope to add mor
[21]: https://search.maven.org/#search%7Cga%7C1%7Ca%3A%22maven-assembly-plugin%22
[22]: https://davidb.github.io/scala-maven-plugin
[23]: https://davidb.github.io/scala-maven-plugin/faq.html
[24]: https://scala-ide.org
[25]: https://scala-lang.org/api/current/index.html#scala.App
[26]: https://docs.scala-lang.org/tutorials/tour/polymorphic-methods.html
[27]: https://code.google.com/p/guava-libraries/
Expand All @@ -286,7 +209,5 @@ I'm not going to explain all of Maven in this tutorial (though I hope to add mor
[30]: https://search.maven.org/#search%7Cga%7C1%7Cscopt
[31]: https://mvnrepository.com
[32]: https://docs.scala-lang.org/contribute.html
[33]: https://maven.apache.org/plugins/maven-eclipse-plugin/
[34]: https://www.mojohaus.org/build-helper-maven-plugin/
[35]: https://github.com/sonatype/m2eclipse-scala
[36]: https://github.com/scala/scala-module-dependency-sample
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ We also collected numbers about the used programming tools. First, we were inter

<div style="text-align: center;"><h6>Which editor do you normally use, and which editor did you use for the course?</h6><div id="editors">&nbsp;</div></div>

The collected numbers are markedly different. In no small part this is due to the fact that the [Scala IDE for Eclipse](https://scala-ide.org) introduced a new [worksheet](https://github.com/scala-ide/scala-worksheet/wiki/Getting-Started) component used throughout the lectures.
The collected numbers are markedly different. In no small part this is due to the fact that the Scala IDE for Eclipse introduced a new [worksheet](https://github.com/scala-ide/scala-worksheet/wiki/Getting-Started) component used throughout the lectures.

We'd like to close with some fun, and partially surprising, information on the demographics of those who took the course and completed our survey. Here is a world map showing the number of participants per country&mdash; darker colors indicate a larger number of students per-country:

Expand Down

0 comments on commit fa38737

Please sign in to comment.