Metals: Strawman roadmap

Created on 4 Nov 2017  ·  8Comments  ·  Source: scalameta/metals

LSP supports many interesting use cases. I'm going to list a few that are within reach:

  • document formatting

    • supporting scalafmt via LSP should be easy. I've essentially done a more complicated version of this in vscode-scalafmt, and if we have a JVM server this is much easier.
  • linting

    • sending the results of scalafix linting rules is easy (they're called diagnostics in LSP lingo). We are already working on a POC in #1
  • symbols (listing, renaming)

    • the LSP supports workspace/symbol requests to list all the symbols in the workspace matching a query string
    • also it supports textDocument/documentSymbol to list all the symbols in a document
    • finally it supports textDocument/rename for renaming a symbol in the workspace (this could be cool, and potentially achievable with Scalafix)
  • go to definition

    • the textDocument/definition is for jumping to the definition of a symbol (this has been done already in metadoc)
  • autocompletion

    • this is way harder, obviously, but I would like to have a discussion on how the presentation compiler can play together with Scalameta in this area

A reference to the full spec of LSP is here: https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md

All 8 comments

To me, autocompletion, textDocument/definition and textDocument/rename are the killer features. I'm glad you're working on this @gabro, I think a hybrid of the presentation compiler and semanticdb can be a very interesting avenue to explore to provide people with better tooling.

I agree @jvican! Those would finally give any editor a great Scala experience without the burden of a full-fledged IDE.

definition and rename are definitely within reach using scalameta and scalafix respectively.
For autocompletion, I've zero experience on how the presentation compiler works, but I hope that will change soon :D

Hi! I just discovered this project and I'm really glad that it already exists! 👏 I was thinking how to use scalameta for creating a Scala language server, but I don't know almost anything about it and it would take me a lot of time to start and make anything working..

Here are some more LSP requests that, I think, could be in reach of SemanticAPI:

  • textDocument/hover to show type information on hover
  • textDocument/signatureHelp to show method/constructor signature when filling its parameters
  • textDocument/references to find project-wide references for the given symbol. I guess, once you have workspace/symbol, it should be easy.
  • textDocument/documentHighlight similar to references, but local to the document (docs also say it's more "fuzzy")
  • textDocument/codeAction to apply scalafixes?
    > The code action request is sent from the client to the server to compute commands for a given text document and range. These commands are typically code fixes to either fix problems or to beautify/refactor code.

Those are really good suggestions @laughedelic! We've just got the ball rolling and it's very promising. We'll see where this take us :)

autocomplection - I have seen IDEs help complect code before but I'm not sure it's a feature we should enable.

@ShaneDelmore you mean snippets?

I was just being silly. To be more helpful, regarding the original bullet point:
/s/autocomplection/autocompletion

I think the roadmap we have in the README is comprehensive enough. Closing.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jastice picture jastice  ·  32Comments

hedefalk picture hedefalk  ·  12Comments

oharboe picture oharboe  ·  27Comments

virtualdvid picture virtualdvid  ·  17Comments

olafurpg picture olafurpg  ·  16Comments