Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add working "get started" example #4855

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

adamnfish
Copy link

@adamnfish adamnfish commented Mar 3, 2025

At the moment, the "Get started" button on the homepage links to the Installation documentation, but doesn't include instructions on setting Scalafmt up for a project. I have observed that this creates significant friction for engineers that are new to Scala.

It's tough to discover that there are two required pieces of configuration, and what the values of these should be. Even on the configuration page (which addresses more complex examples) there's no clear of example of a minimal working config definition that teams can start from. This means Scalafmt is only accessible to engineers that already know how it works, or that have somewhere else to copy a working config file from.

This change adds a note to the top of the Installation documentation, because:

  1. this page is linked from "Get started" so it is the first thing people see
  2. It's reasonable to interpret "Installing" to mean setting up Scalafmt on the project

We use the @STABLE_VERSION@ reference so that these docs will always point to the correct version of Scalafmt. This is especially important because there are two different versions of Scalafmt (scalafmt-core / sbt-scalafmt), which is a detail that someone just setting up IDE formatting won't need to understand.

I think this proposal addresses the 99% use case of someone just wanting sensible auto-formatting in their IDE and needing to fill in the required pieces of configuration without any customisation. I'm open to the idea that something like this could go on the homepage (at https://scalameta.org/scalafmt/) instead and of course, if this isn't aligned with the documentation's goals then let's chat about that instead 🙏

At the moment, the "Get started" button on the homepage links to the
Installation documentation, but doesn't include instructions on
setting Scalafmt up for a project.

It's tough to discover that there are two required pieces of
configuration, and what the values of these should be. Even the
configuration page (which addresses more complex examples) there's no
clear of example of a minimal working config definition that teams can
start from. This means Scalafmt is only accessable to engineers that
already know how it works, or that have somewhere else to copy a
working config file from.

This change adds a note to the top of the Installation documentation,
because:

1. this page is linked from "Get started" so it is the first thing people see
2. It's reasonable to interpret "Installing" to mean setting up Scalafmt on the project

We use the `@STABLE_VERSION@` reference so that these docs will always
point to the correct version of Scalafmt. This is especially important
because there are two different versions of Scalafmt (`scalafmt-core`
/ `sbt-scalafmt`), which is a detail that someone just setting up IDE
formatting won't need to understand.
Copy link
Collaborator

@kitbellew kitbellew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you, it's a good suggestion.

Comment on lines +13 to +14
version = @STABLE_VERSION@
runner.dialect = scala3
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. move this to the very first example in the configuration page
  2. mark each of these two lines there with a # mandatory comment
  3. use scala213; if we are talking about complete newbies, using scala3 for 2.13 is likely to lead to very unhappy outcomes.

@@ -5,6 +5,22 @@ title: Installation

You can use Scalafmt from your editor, build tool or terminal.

Create a configuration file called `.scalafmt.conf` at the root of your
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replace this section with a simple

## Configuration

head and below it a link to the configuration page, possibly with a short note stressing importance of this step.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants