posit-dev / posit-dev/air

Add extra format selection tests

Open
#125 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
446
Forks
32
Avg merge
16h 48m
Merged PRs (30d)
1

Description

We currently don't have any tests ensuring that other things inside braces don't get formatted when we select a portion of a braced list

Tests 1 and 3 here should format the whole braced expressions, but tests 2 and 4 should only format the selection itself

            #[rustfmt::skip]
            let (doc, range) = TextDocument::doodle_and_range(
"0+0
1+1
<<{
  2+2>>
  3+3
}
4+4
",
            );
            let output = client.format_document_range(&doc, range);
            insta::assert_snapshot!(output);

            #[rustfmt::skip]
            let (doc, range) = TextDocument::doodle_and_range(
"0+0
1+1
{<<
  2+2>>
  3+3
}
4+4
",
            );
            let output = client.format_document_range(&doc, range);
            insta::assert_snapshot!(output);

            #[rustfmt::skip]
            let (doc, range) = TextDocument::doodle_and_range(
"0+0
1+1
{
  2+2
  <<3+3
}>>
4+4
",
            );
            let output = client.format_document_range(&doc, range);
            insta::assert_snapshot!(output);

            #[rustfmt::skip]
            let (doc, range) = TextDocument::doodle_and_range(
"0+0
1+1
{
  2+2
  <<3+3
>>}
4+4
",
            );
            let output = client.format_document_range(&doc, range);
            insta::assert_snapshot!(output);

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the existing tests around TextDocument::doodle_and_range and client.format_document_range. Add the four braced-list selection cases shown in the issue and update their insta snapshots so tests 1 and 3 format the whole expression while tests 2 and 4 format only the selection.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
testing-qa
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.