paddymahoney / metals

🚧 WIP Language Server for Scala

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Metals

This project is an experiment to implement a Language Server for Scala using Scalameta semanticdb and the Scala presentation compiler.

⚠️ This project is very alpha stage. Expect bugs and surprising behavior. Ticket reports and patches are welcome!

Project Goals

This project has the following goals:

  • a good UX for the final users, including simple installation and setup
  • low memory requirements
  • integration with scalameta-based tools, such as Scalafix and Scalafmt

Roadmap

Below is a rough summary of what features have been implemented. Even if some checkbox is marked it does not mean that feature works perfectly. Some of those features are a likely outside the scope of this project, we are still learning and exploring what's possible.

  • Compile errors with the Scala Presentation Compiler (textDocument/publishDiagnostics):
    • On build compile
    • As you type
  • Integration with the sbt server:
    • Run custom sbt command on save
    • Receive compilation errors (textDocument/publishDiagnostics)
  • Linting with Scalafix (textDocument/publishDiagnostics):
    • On build compile
    • As you type
  • Refactoring with Scalafix:
    • Quick-fix inspections (textDocument/codeAction)
      • Remove unused imports
    • Rename local symbol (textDocument/rename)
    • Rename global symbol (textDocument/rename)
  • Formatting with Scalafmt:
    • Whole file (textDocument/formatting)
    • Selected range (textDocument/rangeFormatting)
    • On save (textDocument/willSaveWaitUntil)
    • As you type (textDocument/onTypeFormatting)
  • Code assistance:
    • Auto-complete symbols in scope as you type (textDocument/completions)
    • Auto-complete global symbol and insert missing imports (textDocument/completions)
    • Show parameter list as you type (textDocument/signatureHelp)
    • Show type at position (textDocument/hover)
  • Go to definition with SemanticDB (textDocument/definition):
    • Inside the project
    • From project files to Scala dependency source files
    • From project files to Java dependency source files
    • From project dependency to project dependency
  • Find references with SemanticDB (textDocument/references):
    • In file (textDocument/documentHighlight)
    • In project
    • In dependencies
  • Lookup symbol definition by name:
    • In file (textDocument/documentSymbol)
    • In workspace (workspace/symbol)
  • Symbol outline:
    • In file as you type (textDocument/documentSymbol)

Contributing

See the contributing guide.

Team

The current maintainers (people who can merge pull requests) are:

Acknowledgement

Huge thanks to @dragos for his work on a Scala implementation of the LSP (see: https://github.com/dragos/dragos-vscode-scala). This project helped us get quickly started with LSP. Since then, we have refactored the project's original sources to the point where only a few simple case classes remain.

Related work

Why Metals?

Metals = Meta (from Scalameta) + LS (from Language Server)

About

🚧 WIP Language Server for Scala

License:Apache License 2.0


Languages

Language:Scala 98.2%Language:TypeScript 1.5%Language:Shell 0.2%Language:Groovy 0.2%