Skip to content

Latest commit

 

History

History
115 lines (79 loc) · 7.87 KB

README.md

File metadata and controls

115 lines (79 loc) · 7.87 KB

Atom IDE Scala language client

Scala & Dotty support for Atom IDE, powered by Metals, Dotty and Ensime language servers.

🚧 WORK IN PROGRESS 🚧

The project is in active development and may have some rough edges. You are welcome to try it out and provide any feedback in the Gitter chat or Github issues.

This plugin is written in Scala.js, so if you are a Scala developer looking for better development experience in Atom, you're encouraged to contribute. Check the contributing guide and open issues especially the ones marked with help wanted label.

The work of this plugin is to launch the language server and wire communication with it to the Atom IDE services. Most of the interesting stuff is happening on the server side, so check also the scalameta/metals project.

During development some reusable parts were split into separate repos:

  • scalajs-atom-api: Scala.js facades for Atom-related APIs (including atom-languageclient)
  • sbt-atom-package: an sbt plugin wraping apm and simplifying development of Scala.js-based Atom plugins

Features

⚠️ This list is outdated and refers only to the Metals features. Check each supported server documentation to find out which features they support.

Here is a list of the features which are implemented. It doesn't mean that they all work well, just that they are implemented on the server side and are supported by this plugin. Also notice that some features may take time to activate after you open a new file or change code.

  • Formatting with Scalafmt:
    • Add .scalafmt config to the project
    • Use CmdShiftC hotkey
    • It formats the whole file
  • Diagnostics (linting with Scalafix and presentation compiler):
    • If you have .scalafix configuration in the project, you will see linting messages in the diagnostics panel and red underlines in the code
    • You will also see compilation errors from the presentation compiler as you type
  • Definitions:
    • Hold Cmd and hover to preview the definition or click to jump to the source
  • References:
    • Right-click on a symbol and choose Find References in the context menu
    • Or open command palette and run Find References command
  • Code Highlights:
    • When cursor is placed on a symbol, all its occurrences in the file should get highlighted
  • Datatips (type on hover):
    • Just hover over a symbol to see its type
    • You can also hold Alt to see the type of symbol under the cursor
  • Outline view (symbols tree):
    • Use AltO to open it
  • Auto completions as you type with presentation compiler
    • This is experimental and requires some extra setup
  • Signature Help (experimental UI):
    • When you type a method name and an open parenthesis you should see information about method parameters

See also default Atom IDE keybindings.

For the full list of implemented and planned features see the overview of the Metals project.

Installation

You can install it by following this link or by running this command:

apm install ide-scala

On the first launch it will automatically install its dependencies if needed:

Usage

This plugin can work with different Scala language servers. You can use it for Scala-2.12 Metals projects as well as for the Dotty projects.

In any case it is expected that you first follow the corresponding language server setup instructions to prepare your project. Usually it involves installing an sbt plugin and running some setup command for every new project. The Atom plugin will check the project setup and choose the right server automatically. This is configurable:

  • you can select a default server which will be used for all new projects (you're still expected to setup your projects manually until servers can do it on their own)
  • you can turn off automatic server choice if you always want to use same server

Plugin gets activated only when you open a .scala file.

⚠️ Notice that when you close all tabs with Scala files, language server will be stopped. See atom-languageclient#141 for discussion on this behavior.

Metals

  1. Follow Metals installation instructions to prepare a project.
  2. Open this project in Atom. Once you open a Scala file, you will see the server launching.

Dotty

  1. Setup a Dotty sbt project and run sbt configureIDE in it.
    Official instructions may tell you to run launchIDE in sbt, but this command can only launch VS Code, so just use configureIDE instead and open the project in Atom.
  2. Open this project in Atom. Once you open a Scala file, you will see the server launching.

Ensime

🚧 Ensime support is very much experimental, because the LSP implementation of the Ensime server is quite unstable at the moment. So even if the client works well, the server might be broken and you won't see any features working. 🚧

  1. Follow Ensime documentation to generate an .ensime project file.
  2. Open this project in Atom. Once you open a Scala file, the server will start (bu you may not notice it).
  3. Open the developer console (CmdAltI) and observe the logs (most likely errors).

Follow ensime-server#1935 for more information and get involved if you want to use Ensime LSP server.