This Project is a port of the helloworld-minimal-sample to ScalaJS. It is based on the extension accessible-scala.
Please check there on how to describe a VSCode Extension.
A step-by-step tutorial for ScalaJS using this example project.
Here is the original: visualstudio.com/api/get-started
-
Clone this project:
git clone https://github.com/pme123/vscode-scalajs-hello.git
-
Open VSCode in the
sbt
console:open
This will run
fastOptJS
and then open the Extension Host of VSCode. -
Run the Hello World command from the Command Palette (
⇧⌘P
) in the new VSCode window. -
Type
hello
and selectHello World
.- You should see a Notification Hello World!.
There seems not to be support for debugging Scala code directly in VSCode (at least I did not find how to do this).
However you can achieve this:
- Run the extension from VSCode. There is a launch configuration in
.vscode/launch.json
. so just pressF5
and another VS Code window opens in debug mode. - You have to set the Breakpoints in the generated Javascript (
out/extension.js
). Throughextension.js.map
the breakpoint will stop in your Scala code.
If you work in this mode, make sure in your sbt console to transpile to Javascript continuously (
~fastOptJS
). So you see all your changes.
Check out the (vsc-extension-quickstart.md) for some general VSCode Extension explanations.
The project uses the following:
-
ScalaJS for general coding: ScalaJS
The
extension.js
from helloworld-minimal-sample, is nowsrc/main/scala/extension.scala
. -
ScalablyTyped for JavaScript facades: Scalably Typed
The Hello World only uses the
vscode
bindings. But you can use any other Typescript binding supported by ScalablyTyped. -
sbt for building the project: SBT
-
scalajs-bundler for bundling the JavaScript dependencies: scalajs-bundler.
- Publishing to the Marketplace.
- Add Testing.