scalameta / metals

Scala language server with rich IDE features 🚀
https://scalameta.org/metals/
Apache License 2.0
2.07k stars 323 forks source link

Insert pipe character | when editing multiline strings with stringMargin #859

Closed olafurpg closed 5 years ago

olafurpg commented 5 years ago

Is your feature request related to a problem? Please describe.

When editing multiline strings with .stripMargin it's currently necessary to manually type the | character and indent it.

Describe the solution you'd like

It would be nice if Metals inserted the | character at the correct indentation as we type, the same way it works in IntelliJ.

2019-06-21 20 15 30

Describe alternatives you've considered

In the PR https://github.com/scalameta/metals-vscode/pull/121, we added basic support for similar functionality in the VS Code extension. This solution has several limitations however:

2019-06-21 20 05 30

2019-06-21 20 11 00

Additional context

In LSP there is a textDocument/formattingOnType request that allows us to produce the same behaviour that allows us to implement this analysis on top of tokens and make it work for all editors.

mzarnowski commented 5 years ago

partially fixed by https://github.com/scalameta/metals/pull/865

What is still missing is inserting "|" when copy-pasting inside a multiline strings