Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix exting documentation, add docs for new project provider and paren…
…t lenses. Also, move versions table to a more prominent location
- Loading branch information
Showing
8 changed files
with
149 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package docs | ||
|
||
import mdoc.StringModifier | ||
import mdoc.Reporter | ||
import scala.meta.inputs.Input | ||
|
||
class NewProjectModifier extends StringModifier { | ||
|
||
override val name: String = "new-project" | ||
|
||
override def process( | ||
info: String, | ||
code: Input, | ||
reporter: Reporter | ||
): String = { | ||
val isVscode = info == "vscode" | ||
val newScalaProject = | ||
if (isVscode) "Metals: New Scala project" | ||
else "new-scala-project" | ||
val chooseWindow = | ||
if (isVscode) | ||
"\n5. Choose whether to open a new window for the created project or use the existing one." | ||
else "" | ||
|
||
val fromButtons = | ||
if (isVscode) | ||
"\nThe same command will be invoked when clicking the \"New Scala Project\" button in the Metals view." | ||
else "" | ||
s"""|## Create new project from template | ||
| | ||
|It is possible using Metals to easily setup a new project using the exiting [giter8](https://github.com/foundweekends/giter8/wiki/giter8-templates) templates. | ||
|This is an equivalent to the `sbt new` command, which uses the same mechanism. | ||
|There is a great number of templates already available and it should be easy to find something for yourself. | ||
|To start the setup you can use the $newScalaProject command, which works as following: | ||
|1. Choose the template and then: | ||
| 1. Use the proposed templates. | ||
| 2. Choose "Discover more" and then choose from the list downloaded from the Giter8 wiki page. | ||
| 3. Input a custom Github repository following the `organization/repo` schema. | ||
|3. Navigate to the parent directory that you want to create your new project in. | ||
|4. Choose the name or accept the default one. | ||
|$chooseWindow | ||
|$fromButtons | ||
| | ||
|If you feel like a template should be included in the default displayed ones do not hesitate to create a | ||
|[PR](https://github.com/scalameta/metals/blob/cda5b8c2029e5f201fb8d0636e0365d796407bd9/metals/src/main/scala/scala/meta/internal/builds/NewProjectProvider.scala#L308) | ||
|or file an issue. | ||
|""".stripMargin | ||
} | ||
|
||
} |
45 changes: 45 additions & 0 deletions
45
metals-docs/src/main/scala/docs/ParentLensesModifier.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package docs | ||
|
||
import mdoc.StringModifier | ||
import mdoc.Reporter | ||
import scala.meta.inputs.Input | ||
|
||
class ParentLensesModifier extends StringModifier { | ||
override val name: String = "parent-lenses" | ||
|
||
override def process( | ||
info: String, | ||
code: Input, | ||
reporter: Reporter | ||
): String = { | ||
|
||
val isVSCode = info == "vscode" | ||
val gotoToSuper = | ||
if (isVSCode) "Metals: Go to super method" else "goto-super-method" | ||
val superMethodHierarchy = | ||
if (isVSCode) "Metals: Reveal super method hierachy" | ||
else "super-method-hierarchy" | ||
val additionalInfo = | ||
if (info == "vscode") "\nYou can also bind those commands to a shortcut." | ||
else "" | ||
|
||
s"""|## Go to parent code lenses | ||
| | ||
|Metals has the ability to display code lenses that, when invoked, | ||
|will go to the parent class that contains the definition of the method or symbol. | ||
|Unfortunately, it might cause some lag in larger code bases, | ||
|which is why it is not enabled currently by default. | ||
| | ||
|To enable the feature you need to modify the setting `metals.superMethodLensesEnabled` to `true`. | ||
| | ||
|Even without using the code lenses it's still possible to navigate the method hierarchy | ||
|using two commands: | ||
| | ||
| - `$gotoToSuper` - immediately goes to the parent of the method the cursor is pointing to | ||
| | ||
| - `$superMethodHierarchy` - displays the full method hierachy and enables to move to any parent, | ||
|it is best used with the Metals Quick Pick extension. | ||
|$additionalInfo | ||
|""".stripMargin | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters