-
Notifications
You must be signed in to change notification settings - Fork 354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement goto definition with low CPU and memory overhead #332
Changes from 28 commits
280ffb9
c18495b
ec15dcf
2c327bb
f6c4366
f2e3d82
5e0a941
599425c
ae09098
667510d
4132081
17e30c9
07fdb8d
6f9acc4
c94ea7a
628d766
75ac015
4dcb2e9
7d085df
2566691
f91e7d8
fa1351e
59bda2a
a2bb282
6f4192b
6519b46
3579a69
53cd1dd
44b0f4c
889b282
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
rules = [ | ||
RemoveUnused | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,17 +3,18 @@ id: installation-contributors | |
title: Installation | ||
--- | ||
|
||
> ⚠ ️ This project is very alpha stage. Expect bugs and incomplete documentation. | ||
> ⚠ ️ This project is very alpha stage. Expect bugs and incomplete | ||
> documentation. | ||
|
||
The following instructions are intended for contributors who want to try Metals | ||
and provide feedback. We do not provide support for day-to-day usage of Metals. | ||
|
||
## Requirements | ||
|
||
* Scala 2.12.4, down to the exact PATCH version. Note that Scala versions 2.11.x and | ||
2.12.6 are not supported. | ||
* Java 8. Note that Java 9 or higher has not been tested. | ||
* macOS or Linux. Note that there have been reported issues on Windows. | ||
- Scala 2.12.7, down to the exact PATCH version. Note that Scala versions 2.11.x | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe make the Scala version dynamic using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good idea, done. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The docs don't build actually at the moment because the |
||
and 2.12.6 are not supported. | ||
- Java 8. Note that Java 9 or higher has not been tested. | ||
- macOS or Linux. Note that there have been reported issues on Windows. | ||
|
||
## Global setup | ||
|
||
|
@@ -30,57 +31,66 @@ You can install the plugin with: | |
addSbtPlugin("org.scalameta" % "sbt-metals" % "@VERSION@") | ||
``` | ||
|
||
You can add the plugin to a specific project (adding it to `project/plugins.sbt`) or globally adding it to: | ||
You can add the plugin to a specific project (adding it to | ||
`project/plugins.sbt`) or globally adding it to: | ||
|
||
- (sbt 1) `~/.sbt/1.0/plugins/plugins.sbt` | ||
- (sbt 0.13) `~/.sbt/0.13/plugins/plugins.sbt` | ||
|
||
### VSCode extension | ||
|
||
> ***N.B.*** This project is still in development - right now you will need to run the VSCode plugin | ||
> as described [here](getting-started-contributors.html#running-a-local-version-of-the-vscode-extension) | ||
> **_N.B._** This project is still in development - right now you will need to | ||
> run the VSCode plugin as described | ||
> [here](getting-started-contributors.html#running-a-local-version-of-the-vscode-extension) | ||
|
||
## Per-project setup | ||
|
||
These steps are required on each project. | ||
|
||
### Quick-start | ||
The quickest way to get started with Metals is to use the `metalsSetup` command in sbt. | ||
|
||
The quickest way to get started with Metals is to use the `metalsSetup` command | ||
in sbt. | ||
|
||
``` | ||
sbt | ||
> metalsSetup | ||
``` | ||
|
||
The command will create the necessary metadata in the `.metals` directory | ||
(which you should not checkout into version control) and setup the `semanticdb-scalac` compiler | ||
plugin for the current sbt session. | ||
The command will create the necessary metadata in the `.metals` directory (which | ||
you should not checkout into version control) and setup the `semanticdb-scalac` | ||
compiler plugin for the current sbt session. | ||
|
||
You should not checkout the `.metals` directory into version control. We recommend to add it to your | ||
project's `.gitignore` or/and to your global `.gitignore`: | ||
You should not checkout the `.metals` directory into version control. We | ||
recommend to add it to your project's `.gitignore` or/and to your global | ||
`.gitignore`: | ||
|
||
``` | ||
echo ".metals/" >> .gitignore | ||
``` | ||
|
||
Note that in sbt 0.13 you will need to invoke `metalsSetup` (or `semanticdbEnable`) whenever you close and | ||
re-open sbt. For a more persistent setup, keep reading. In sbt 1 you don't need to do it because Metals will | ||
automatically invoke `semanticdbEnable` every time it connects to the sbt server. | ||
Note that in sbt 0.13 you will need to invoke `metalsSetup` (or | ||
`semanticdbEnable`) whenever you close and re-open sbt. For a more persistent | ||
setup, keep reading. In sbt 1 you don't need to do it because Metals will | ||
automatically invoke `semanticdbEnable` every time it connects to the sbt | ||
server. | ||
|
||
### Persisting the semanticdb-scalac compiler plugin | ||
Some features like definition/references/hover rely on artifacts produced by a compiler plugin | ||
called `semanticdb-scalac`. | ||
|
||
`metalsSetup` enables the plugin on the current session (by invoking `semanticdbEnable`), but you | ||
can choose to enable it permanently on your project by adding these two settings in your sbt build | ||
definition: | ||
Some features like definition/references/hover rely on artifacts produced by a | ||
compiler plugin called `semanticdb-scalac`. | ||
|
||
`metalsSetup` enables the plugin on the current session (by invoking | ||
`semanticdbEnable`), but you can choose to enable it permanently on your project | ||
by adding these two settings in your sbt build definition: | ||
|
||
```scala | ||
addCompilerPlugin(MetalsPlugin.semanticdbScalac) | ||
scalacOptions += "-Yrangepos" | ||
``` | ||
|
||
### Start editing | ||
|
||
Open your project in VSCode (`code .` from your terminal) and open a Scala file; | ||
the server will now start. | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Benchmarks | ||
|
||
Date: 2018 October 8th, commit 59bda2ac81a497fa168677499bd1a9df60fec5ab | ||
``` | ||
> bench/jmh:run -i 10 -wi 10 -f1 -t1 | ||
[info] Benchmark Mode Cnt Score Error Units | ||
[info] MetalsBench.indexSources ss 10 0.620 ± 0.058 s/op | ||
[info] MetalsBench.javaMtags ss 10 7.233 ± 0.017 s/op | ||
[info] MetalsBench.scalaMtags ss 10 4.617 ± 0.034 s/op | ||
[info] MetalsBench.scalaToplevels ss 10 0.361 ± 0.005 s/op | ||
> bench/run | ||
[info] info elapsed: 3265ms | ||
[info] info java lines: 0 | ||
[info] info scala lines: 1263569 | ||
[info] bench.Memory.printFootprint:11 iterable.source: "index" | ||
[info] bench.Memory.printFootprint:12 Units.approx(size): "16.9M" | ||
[info] bench.Memory.printFootprint:24 count: 12L | ||
[info] bench.Memory.printFootprint:25 Units.approx(elementSize): "1.41M" | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this still in use?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, ls4ps is not strictly used either because the
metals
project has 2 source files at the moment. I will clean up themetals
project once we add language server stuff.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant the interactive part specifically, but there's no rush to clean this up now, I agree