New
Apps 6,336Makers 6,315This week 13
Promote your app−30%
1views in
the last 30 days

Pharo Language Server

A Pharo client extension for VSCode.

Supported files

This extension support .st files and .class.st files (tonel format)

Features

We present here the existing features

Generic feature

Code highlighting

Highlighting

Breadcrumbs & Outline

Breadcrumbs & Outline

Native tests support

Native test image

The native Test Explorer integration requires Pharo Language Server 5.0.1 or later.

Supported Language Server feature

Code formatting

Format gif

Tonel file formatting

Tonel file formatting

Hover

Hover

Auto-completion

Auto-Completion

Help with method signature

Signature help gif

Diagnostics

Diagnostics gif

Code Lens (Run Tests)

Run test gif

Jump type Definition

Jump type Definition gif

Debug Adapter Protocol feature

  1. Break on halt
    1. Show the stack
    2. Show the variables
    3. Add watch

Break on halt

  1. Step, step in, step out

Step the stack gif

Moose Book (Notebook for Moose/Pharo)

MooseBook is a way to use a notebook with Pharo

Additional feature

The additional feature can be access using the command palette of VSCode

  1. Save the Pharo image
  2. Execute and show the result The Pharo: Show Pharo Language Server Diagnostics command inspects VM/image configuration, process and connection status, and server version.
  3. Select the active Pharo image with Pharo: Select Active Pharo Image. The extension validates the selected image and VM, asks before switching, saves the running image, updates the current workspace setting, and reloads VS Code. The status bar shows which image is connected; other VS Code windows are unaffected.

Inspect gif

  1. Execute and print the result

Print gif

  1. Keep variable state

Keep Variable state gif

  1. Explore variable state

Explore variable state gif

  1. Show the current server version

Show version gif

  1. Saving a tonel file in VSCode, save the corresponding methods/class in the Pharo image

  2. Access Pharo Image

Access Pharo Image gif

Installation

The easiest way is to execute the pharo.installIt command using VSCode command panel.

Specific version of the language server

You can also follow the walkthroughs to download a pre-configured version of the Language Server.

Walkthroughs

Or, to install the extension in an existing image :

  1. Install VSCode
  2. Install the Pharo extension
  3. Download a Pharo Language Server image or install the server in a pre-existing image
  4. Download a VM (headless or not) for the image
  5. Set up the Pharo extension property
    1. pharo.pathToVM: is the path to the VM executable, or a command available on PATH (for example, pharo)
      1. Windows: C:\path\to\pharo.exe
      2. Linux: /path/to/pharo
      3. MacOS: /path/to/Pharo.app/Contents/MacOS/Pharo
    2. pharo.pathToImage: is the absolute path to the image
    3. pharo.imageWorkspace: expose pharoImage:/ as a workspace folder (useful for tools that read workspace files, such as AI assistants with virtual workspace support)

The Pharo Test Explorer discovers packages, test classes, and test methods on demand. Run a package, class, or individual method from VS Code's native test controls; failures and execution errors are reported separately with durations and source locations when the Tonel method can be resolved. Use Pharo Tests: Rerun Failed Pharo Tests to repeat the latest failed/error methods, or Pharo Tests: Refresh Pharo Tests after changing the image. Targeted debugging is not exposed yet by the current Pharo test RPC contract.

Iceberg change states

The Iceberg Source Control view separates Image vs Repository resources reported by Pharo, the Iceberg Index, and Unsaved VS Code Buffers. The first two come from the server's Iceberg status contract; dirty editor buffers are tracked locally and are not represented as changes already installed in the running image. Diff actions compare the server-provided current and original resources. The extension does not infer a separate on-disk working tree or image state when the server does not report it.

Manually try the Test Explorer and Iceberg changes

These features need a running Pharo image and Language Server configured with pharo.pathToVM and pharo.pathToImage. Iceberg change groups also require a valid Iceberg repository in the image.

  1. Run tests: open VS Code's Testing view and expand a package and test class to discover their children. Run one test method with the inline Run button, then run its class or package from the corresponding Run button. The result should appear in the Test Explorer. If a test fails or errors, its message and duration are shown; use Pharo Tests: Rerun Failed Pharo Tests to repeat those tests. Use Pharo Tests: Refresh Pharo Tests after changing tests in the image.
  2. Inspect Iceberg changes: open Source Control and inspect the repository's Image vs Repository and Iceberg Index groups. These groups show only states reported by Pharo. To check Unsaved VS Code Buffers, edit a repository-scoped pharoImage: class document and leave it unsaved; its URI must include the iceRepository query parameter for it to be associated with that repository. Saving sends the edit to the running image, so it leaves the unsaved-buffer group; Pharo may then report an image/repository or Iceberg-index change.

Source Control groups are hidden while empty. Image vs Repository and Iceberg Index only show changes reported by Pharo; they are not populated by making an unsaved editor change.

From version v1.0.0, please use at least version v1.1.0 of the Pharo Language Server.

Using VMs from the Pharo Launcher

Assuming you have the official Pharo Launcher installed, you can also configure the extension to use the launcher's VMs along with the language server image like so:

(The example above is using VSCode with macOS 13)

Thanks

This extension is inspired from the one of Leonardo Nascimento for smalltalk.

Thanks a lot Leonardo!

Description taken from the repository README.

Ratings

–
0 ratings
5 0
4 0
3 0
2 0
1 0

Rate this app

Sign in to rate

Comments 0

Sign in to comment

No comments yet.

Related apps

#vscode · #pharo · #smalltalk