Giter Club home page Giter Club logo

dragos-vscode-scala's Introduction

Build Status

Scala language server for VS Code

demo

This is an experiment for building a Language Server for Scala, in Scala.

  • language server: A Scala-based implementation of the language server protocol
  • scala: A Typescript-based Scala extension (language client). Ideally it will be ported to Scala.js
  • ensime-lsp: An implementation of the Language Server based on Ensime

The language server may be backed up by ensime or directly by the presentation compiler. Ideally, the language server ca be used as a basis for implementing support for any language, not just Scala.

How to try it out

UPDATE: The extension is published to Marketplace. You can still use the instructions below to start contributing.

Download an existing release and install it in Code by choosing Install from VSIX in the Extensions view.

Make sure you have an existing .ensime file before starting code in that directory (sbt ensimeConfig should create it if you have sbt-ensime already setup)

What works

  • errors as you type
  • code completion
  • goto definition (F12 and CMD-F12)
  • hover
  • file structure (definitions)

Building

tl;dr

$ sbt publishLocal
$ cd scala
$ npm install # only the first time, to download dependencies
$ npm install -g vsce typescript # if you don't have Typescript installed globally
$ vsce package

You should see a file ensime-scala-0.0.4.vsix (or whatever version you are building). Now install it in Code by choosing Install from VSIX in the Extensions view.

The root Sbt project controls all the Scala parts of the build. The client is written in Typescript (it's really minimal) and lives under scala/. This one is built using Code's tools.

  • languageserver/ contains the language-independent server implementation. It does not implement the full protocol yet. Features are added by-need, when the reference implementation in ensime-lsp/ needs it
  • ensime-lsp/ implements an Ensime based Scala language server
  • scala/ The typescript extension (eventually should migrate to Scala.js)

ensime-lsp is what you will want to build most of the times. It's launched with coursier by the client, for it to be as simply as possible.

You should use sbt publishLocal which publishes the server under ~/.ivy2/local, so the client finds it easily.

Running

You can open code inside the scala/ directory and use F5 to debug the extension. This picks up the changes in the server (make sure you published it locally using sbt publishLocal!) and allows quick iteration.

Settings

If VSCode is running behind a proxy add the following standard VSCode proxy settings (File -> Preferences -> Settings):

{ "http.proxy": "http://host:port/" }

This setting is translated as Coursier's vm arguments: -Dhttp.proxyHost=host -Dhttps.proxyHost=host -Dhttp.proxyPort=port -Dhttps.proxyPort=port.

Publish

> publishSigned
> sonatypeRelease

Then cd scala/ and run vsce publish

dragos-vscode-scala's People

Contributors

dragos avatar alexarchambault avatar fede0664 avatar smarter avatar jc776 avatar nightscape avatar simon-nicholls avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.