Skip to content

Commit 4c7c629

Browse files
authored
Merge pull request #1034 from olafurpg/metals
Write blog post about Metals
2 parents 76f2093 + f66431c commit 4c7c629

File tree

2 files changed

+161
-0
lines changed

2 files changed

+161
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ bin/serve
2222

2323
### For Bundler:
2424
```
25+
bundle install
2526
bundle exec jekyll serve --incremental
2627
```
2728

_posts/2019-04-16-metals.md

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
---
2+
layout: blog-detail
3+
post-type: blog
4+
by: Ólafur Páll Geirsson, Gabriele Petronella, Jorge Vicente Cantero
5+
title: "Write Scala in VS Code, Vim, Emacs, Atom and Sublime Text with Metals"
6+
---
7+
8+
We are excited to announce the release of
9+
[Metals v0.5](https://scalameta.org/metals/blog/2020/04/12/mercury.html). Metals
10+
is a Scala language server that supports code completions, type at point, goto
11+
definition, fuzzy symbol search and other advanced code editing and navigation
12+
capabilities.
13+
14+
Metals can be used in VS Code, Vim, Emacs, Atom and Sublime Text as well as any
15+
other
16+
[Language Server Protocol](https://microsoft.github.io/language-server-protocol/)
17+
compatible editor. Metals works with sbt, Gradle, Maven and Mill thanks to
18+
[Bloop](https://scalacenter.github.io/bloop/), a fast Scala build server. Adding
19+
support for other build tools is possible through the
20+
[Build Server Protocol](https://github.com/scalacenter/bsp/blob/master/docs/bsp.md).
21+
22+
Metals is developed at the [Scala Center](https://scala.epfl.ch/) along with
23+
contributors from the community.
24+
25+
## Features
26+
27+
In this post we are going to demonstrate how to use Metals with VS Code. To get
28+
started, install the
29+
[Scala (Metals)](https://marketplace.visualstudio.com/items?itemName=scalameta.metals)
30+
extension on the VS Code Marketplace and open an sbt project directory. The
31+
Metals extension will prompt you to import the build.
32+
33+
![Import sbt build](https://i.imgur.com/0VqZWay.png)
34+
35+
The build import step can take a while to run and once complete, you can enjoy
36+
the features of Metals.
37+
38+
### Diagnostics
39+
40+
Syntax errors update as you type and type errors are published on file save.
41+
42+
![](https://i.imgur.com/JYLQGrc.gif)
43+
44+
A
45+
[separate `bloop` command-line interface](https://scalacenter.github.io/bloop/setup)
46+
can be installed to test and run programs from a terminal using the same
47+
compilation artifacts as Metals.
48+
49+
### Type at point
50+
51+
Hover over an identifier to see its expression type, symbol signature and
52+
documentation.
53+
54+
![Type at point](https://i.imgur.com/vANZ0Xh.gif)
55+
56+
Observe how the active expression is highlighted as the cursor moves.
57+
58+
### Code completions
59+
60+
As you type, code completions are suggested for a range of use-cases such as
61+
overriding a method from a superclass or generating an exhaustive pattern match
62+
for a sealed type.
63+
64+
![Code completions](https://user-images.githubusercontent.com/1408093/56036958-725bac00-5d2e-11e9-9cf7-46249125494a.gif)
65+
66+
Observe that imports are automatically inserted as you complete symbols that are
67+
not present in the scope.
68+
69+
### Parameter hints
70+
71+
When writing arguments for a method call, use parameter hints to see the method
72+
signature and available method overloads.
73+
74+
![Parameter hints](https://i.imgur.com/TzLelzP.gif)
75+
76+
### Goto definition
77+
78+
Jump to symbol definitions in your project sources and Scala/Java library
79+
dependencies.
80+
81+
![Goto definition](https://i.imgur.com/bCIhFof.gif)
82+
83+
### Find references
84+
85+
Find all usages of a symbol in the workspace, including implicits and `apply`
86+
methods.
87+
88+
![Find references](https://user-images.githubusercontent.com/1408093/51089190-75fc8880-1769-11e9-819c-95262205e95c.png)
89+
90+
### And more
91+
92+
Visit the
93+
[Metals documentation](https://scalameta.org/metals/docs/editors/overview.html)
94+
to learn more about other supported features. The website also includes
95+
instructions for how to use Metals with the editors Vim, Emacs, Atom and Sublime
96+
Text. However, note that the best supported editor is VS Code.
97+
98+
## Collaboration with VirtusLab
99+
100+
As part of a new collaboration between the Scala Center and
101+
[VirtusLab](https://virtuslab.com/), VirtusLab will be contributing engineers to
102+
work on Metals over the coming months. The VirtusLab engineers
103+
[Marek Żarnowski (@marek1840)](https://github.com/marek1840) and
104+
[Tomasz Godzik (@tgodzik)](https://github.com/tgodzik) have already contributed
105+
several impressive pull requests:
106+
107+
- `textDocument/foldingRange`
108+
([#632](https://github.com/scalameta/metals/pull/632)): code folding that
109+
understands Scala syntax.
110+
- `textDocument/documentHighlight`
111+
([#621](https://github.com/scalameta/metals/pull/621)): highlight occurrences
112+
of a symbol in the current file.
113+
- `textDocument/completion`
114+
([#640](https://github.com/scalameta/metals/pull/640)): override def
115+
completions without the need to type "override def ".
116+
117+
It is our pleasure to welcome Marek and Tomasz to the team and we look forward
118+
to working together with them to improve the Scala code editing experience.
119+
120+
## Future work
121+
122+
Metals currently does not support several common IDE features:
123+
124+
- Refactorings such as rename symbol, add missing import, add inferred result
125+
type, move class, extract value.
126+
- Running a main function or unit test with attached debugger.
127+
- Triggering code completions, type at point and goto definition in `*.sbt`
128+
files.
129+
- Working with hybrid `*.scala` and `*.java` projects, although you can try
130+
using the
131+
[Eclipse Java Language Server](https://github.com/eclipse/eclipse.jdt.ls) for
132+
editing `*.java` only projects.
133+
134+
Metals may not be a good fit if you frequently rely on these features. You might
135+
want to try [IntelliJ IDEA](https://www.jetbrains.com/idea/) instead, which has
136+
great Scala support and implements all of the features listed above.
137+
138+
## Share your feedback
139+
140+
Please give Metals a try and share your feedback on
141+
[Gitter](https://gitter.im/scalameta/metals) or by reporting issues to the
142+
[Metals GitHub repository](https://github.com/scalameta/metals/).
143+
144+
## Credits
145+
146+
Code completions, type at point and parameter hints are implemented using the
147+
Scala presentation compiler, which is maintained by the Scala compiler team at
148+
Lightbend.
149+
150+
Metals started as a fork of the
151+
[dragos-vscode-scala](https://github.com/dragos/dragos-vscode-scala) repository
152+
in late 2017 and has since then grown into a project with over 40 contributors:
153+
Ólafur Páll Geirsson, Gabriele Petronella, Alexey Alekhin, Marek Żarnowski,
154+
Iulian Dragos, JesusMtnez, Johan Muedsam, Ben Hutchison, Jonathan Shen, Martin
155+
Duhem, PanAeon, Ayoub Benali, Gabriel Volpe, Shane Delmore, Tomasz Godzik, fc,
156+
Carlo Sana, Jakub Kozłowski, Eugene Melekhov, Jesús Martínez, Corey O'Connor,
157+
Eugene Burmako, Pavel Logvinov, Yashwanth Yadavalli, Arnout Engelen, Carlos
158+
Quiroz, Chris, Cody Allen, David Strawn, Edoardo Vacchi, Eric Peters, Evgeniy
159+
Tokarev, Joe Ferris, Jozef Koval, Martijn Hoekstra, Michael Pollmeier, Rory
160+
Graves, Ross A. Baker, Tim Nieradzik, Alexandre Archambault, keiSunagawa.

0 commit comments

Comments
 (0)