Skip to content

Latest commit

 

History

History
244 lines (174 loc) · 13.2 KB

CONTRIBUTING.md

File metadata and controls

244 lines (174 loc) · 13.2 KB

How to contribute

Please take a moment to review this document in order to make the contribution process easy and effective for everyone involved!

For Getting Started instructions, see:

For issue reporting, use GitHub Issues and follow the procedures documented here:

Personal support requests (or help with a contribution) can be discussed on F# Software Foundation Slack or the F# Discord.

Getting Started

Prerequisites

The exact Node.js version that CI uses is in .tool-versions, and the .NET SDK version is in global.json.

First-Time Build

  1. Fork the Ionide repo https://github.com/ionide/ionide-vscode-fsharp on GitHub.
  2. Clone your fork:
    git clone git@github.com:YOUR_GITHUB_USER/ionide-vscode-fsharp.git
    or if you don't use ssh:
    git clone https://github.com/YOUR_GITHUB_USER/ionide-vscode-fsharp.git
  3. Open the repo in your terminal:
    cd ionide-vscode-fsharp
  4. Build the project by running the build script:
    dotnet fsi build.fsx
  5. Voilà! You're ready to run Ionide.

Skip to the Launching Ionide section if the build succeeded. Otherwise, check out Troubleshooting Build Failures.

Build Pipelines

build.fsx is a Fun.Build script. Without arguments it runs the Package pipeline, the same as CI: it checks the formatting, builds the extension into the release folder, and packages it as a .vsix in the temp folder. Run it at least once after any clone/pull, and before you open a pull request.

dotnet fsi build.fsx

On Mac and Linux, ./build.fsx works too.

When the formatting check fails, format the code with dotnet fantomas src build.fsx.

Pick another pipeline with -p:

dotnet fsi build.fsx -p BuildDev
  • Package: the default, what CI runs.
  • Build: the same build without the formatting check and the .vsix, for a quicker local build.
  • BuildDev: compiles with DEBUG defined and an unminified bundle.
  • Watch: rebuilds on every change, with DEBUG defined.
  • Test: builds the extension and smoke tests it: it downloads VS Code into .vscode-test, starts Ionide on test/smoke/workspace and waits until FSAC answers a hover. CI runs it after Package, and there it tests that build instead of building again. It opens a VS Code window while it runs.

The smoke test is plain JavaScript in test/smoke, not F# compiled with Fable like the extension. For a single test, a second Fable project and a compile step before every test run did not seem worth it. When there are more tests, that is worth reconsidering.

dotnet fsi build.fsx -- -h lists all pipelines.

To try a build in your everyday VS Code instead of the Extension Development Host, install the package from the temp folder:

code --install-extension temp/Ionide-fsharp-0.0.0.vsix

A local build is always version 0.0.0, the version in release/package.json. A CI build puts the version of RELEASE_NOTES.md in the package.

Troubleshooting Build Failures

  • Paket fails to restore ionide-fsgrammar. Paket 11 and later fail to create the git cache for a git dependency on a machine that never restored it before (fsprojects/Paket#4461). Seed the cache once, then build again:
    git clone --mirror https://github.com/ionide/ionide-fsgrammar.git ~/.paket/git/db/ionide-fsgrammar
    On Windows, clone into %USERPROFILE%\.paket\git\db\ionide-fsgrammar.
  • npm install warns about engines. Check node --version. The build needs Node.js 24 or later.
  • The formatting check fails. Run dotnet fantomas src build.fsx and build again.

Launching Ionide

When you're ready to test out some code changes, use VS Code's Run View to build and launch Ionide in a new Extension Development Host, a separate "dev mode" instance of VS Code used for developing extensions.

First, open the Ionide folder in VS Code:

cd ionide-vscode-fsharp
code .

Then open Ionide in a new Extension Development Host with one of the following methods.

Build and Launch Extension

This builds the extension (the Build pipeline) and launches it in a new Extension Development Host.

  1. Open the "Run and Debug" view (cmd+shift+d or ctrl+shift+d).
  2. Choose the Build and Launch Extension launch configuration.
  3. Run it by pressing F5.

Build (dev) and Launch Extension does the same with the BuildDev pipeline, which is easier to debug.

Watch Mode (Recommended)

There are two steps involved in running Ionide in Watch Mode.

TL;DR: watch this video clip:

ionide_watch.mp4
  1. Start the Watch task.
    • Open the command palette (cmd+shift+p or ctrl+shift+p).
    • Enter Tasks: Run Task.
    • Enter Watch.
    • Wait a few seconds. The initial build can take 15-30 seconds.
  2. Run the Launch Only launch configuration.
    • Open the "Run and Debug" view (cmd+shift+d or ctrl+shift+d).
    • Choose the Launch Only configuration.
    • Run it by pressing F5.

Step 1 starts a Watch task that rebuilds Ionide in the background while you change the source code. Wait for its first build to finish before you open the Extension Development Host. To see what it is doing, run Tasks: Show Running Tasks from the command palette.

Working with FSAC (FsAutoComplete)

Most Ionide bugs are actually in FsAutoComplete (FSAC), the F# language server. This repo holds the glue code between FSAC and VS Code. The behaviour you see when you use Ionide is mostly implemented in FSAC.

  1. Fork the FSAC repo https://github.com/ionide/FsAutoComplete on GitHub.
  2. Clone your fork:
    git clone git@github.com:YOUR_GITHUB_USER/FsAutoComplete.git
    or if you don't use ssh:
    git clone https://github.com/YOUR_GITHUB_USER/FsAutoComplete.git
  3. Build FSAC as its CONTRIBUTING.md describes, and copy the path of the build output. It is a path inside the FSAC repo that ends with src/FsAutoComplete/bin/Release/net10.0/fsautocomplete.dll. You can also leave out net10.0/fsautocomplete.dll, Ionide then picks the matching target framework itself. Release is Debug when you build that configuration.
  4. In the VS Code instance that has the Ionide repo open, open the settings (cmd+, or ctrl+,), find FSharp > Fsac: Net Core Dll Path (FSharp.fsac.netCoreDllPath) and paste the path from step 3.
  5. Find FSharp > Fsac: Attach Debugger (FSharp.fsac.attachDebugger) and check the box.
  6. In the "Run and Debug" view, run Build and Launch Extension. After a while a second VS Code instance starts, which you can use to test Ionide with your FSAC.
  7. To attach the debugger, go to the VS Code instance that has the FSAC repo open, and in the "Run and Debug" view, run .NET Core Attach. Choose the dotnet process that shows fsautocomplete.dll --mode lsp --attachdebugger.
  8. Breakpoints in the FSAC solution now hit for the instance from step 6.

There is a video that goes through these steps and fixes a bug in a little more detail.

Remove the settings from steps 4 and 5 to go back to the FSAC that ships with Ionide.

Pull requests

Good pull requests (patches, improvements, new features) are a fantastic help. They should remain focused in scope and avoid containing unrelated commits.

IMPORTANT: By submitting a patch, you agree that your work will be licensed under the license used by the project.

If you have a large pull request in mind (e.g. implementing features, refactoring code, etc.), please ask first. Otherwise you risk spending a lot of time on something the project's developers might not want to merge.

Please adhere to the coding conventions in the project (formatting, accurate comments, etc.). Before you open the pull request, run dotnet fsi build.fsx: CI runs the same Package pipeline on Linux, Windows and macOS, and fails on unformatted code. CI then runs the Test pipeline, which you can run with dotnet fsi build.fsx -p Test.

Add a line about your change to the ### Unreleased section at the top of RELEASE_NOTES.md, and create that section when it is not there. Do not add a version heading: a merged version heading publishes a release, see Release.

Bug reports

A bug is either a demonstrable problem that is caused by Ionide failing to provide the expected feature, or missing, unclear, or misleading documentation. Good bug reports are extremely helpful - thank you!

Guidelines for bug reports:

  1. Use the GitHub issue search: check if the issue has already been reported.
  2. Check if the issue has been fixed: try to reproduce it using the main branch of the repository.
  3. Isolate and report the problem: ideally create a reduced test case.

Please be as detailed as possible in your report. Include your operating system and your dotnet --version, the steps to reproduce the issue, and the outcome you expected. All these details help developers to fix the bug.

Ionide gathers most of this information for you: run F#: Get info for diagnostics from the command palette. It opens a file like this:

Problem

Steps to reproduce

Machine infos

  • Operating system: Darwin
  • Arch: arm64
  • VSCode: 1.100.0
  • UI Kind: Desktop
  • Ionide: 8.0.1

Copy and paste this file into the issue on GitHub and fill the gaps. You can leave the lines that start with <!-- in place, GitHub does not display them.

Feature requests

Feature requests are welcome and should be discussed on the issue tracker. But take a moment to find out whether your idea fits with the scope and aims of the project. It's up to you to make a strong case to convince the community of the merits of this feature. Please provide as much detail and context as possible.

Release

  1. Dependencies

    1. If updating FSAC
      1. Run dotnet paket update --group fsac.
      2. Commit the paket.lock.
    2. If updating ionide-fsgrammar
      1. Open paket.lock.
      2. Find the line remote: https://github.com/ionide/ionide-fsgrammar.git.
      3. Update the hash below it to the latest commit on the main branch.
      4. Commit the paket.lock.
    3. If updating ionide-vscode-helpers
      1. Open paket.dependencies.
      2. Find the lines for github ionide/ionide-vscode-helpers.
      3. Update the hash for all the files.
      4. Run dotnet paket install.
      5. Commit the paket.dependencies and paket.lock.
  2. Rename the ### Unreleased section at the top of RELEASE_NOTES.md to the new version, such as ### 8.0.2 - 24.10.2026 (the date is optional), or add that heading with its notes.

    1. If possible, link the pull request of each change and mention its author.
    2. If updating FSAC, mention the FSAC version and link its release notes.

    The build reads the version from the first release heading, below an ### Unreleased section. It fails when another heading sits above it, such as ## 8.2.0 or ### Next. It also fails when ### Unreleased sits below it, or when a version has two headings. The pull request build also fails when the version is not of the form X.Y.Z, such as a prerelease 8.2.0-beta1, or is older than the newest release.

  3. Open a pull request with the change to RELEASE_NOTES.md, and merge it into main of https://github.com/ionide/ionide-vscode-fsharp.

When RELEASE_NOTES.md changes on main, the Release workflow checks whether its newest version has a tag. When it has none, the workflow runs the Package pipeline and the smoke test, publishes the .vsix to the VS Code Marketplace and the Open VSX Registry, and last tags the commit and creates the GitHub release with the .vsix. Changes that stay in ### Unreleased, and fixes to the notes of a version that is already released, publish nothing.

When a release fails part way, run the workflow again, with Re-run failed jobs or with Run workflow on main. The registries skip a version they already have.