To enable Scala language support in your IDE, you can integrate Scala Language Server (Metals) by following these steps:
-
Install Coursier and read How to start Metals?.
-
Once Coursier is installed, open a terminal and execute
coursier bootstrap org.scalameta:metals_2.13:1.2.2 -o metals -f
which will generate ${BASE_DIR}/metals and ${BASE_DIR}/metals.bat (according your OS). -
Open the New Language Server Dialog. This can usually be found under the IDE settings related to Language Server Protocol (LSP). For more information, refer to the New Language Server Dialog documentation.
-
Select Scala Language Server (Metals) as the template from the available options. This will populate the command field with a default command. You need to adjust this command to point to the location of the extracted generated ${BASE_DIR}/metals.bat file.
-
Adjust the command in the template to reference the location of the generated metals file.
-
Optional: You may also customize the mappings section according to your preferences.
-
Click OK to apply the changes. You should now have Scala language support enabled in your IDE, with the Metals integrated.