insertSpaces formatting option doesn't always work
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- typescript
- Domain
- tooling
Research direction
Start by running the provided ts-node reproduction and tracing the format and applyEdits entry points. Add a regression test covering a tab inside a quoted value alongside an indentation tab, and verify that formatting removes only the tab outside the quotes.
Written by the indexing model from the issue text.
Description
Steps to reproduce. Run the following program using ts-node or similar.
import { format, applyEdits } from 'jsonc-parser';
const JSONString = `{"hello": \t"\tworld"}`;
const edit = format(JSONString, undefined, { insertSpaces: true});
const res = applyEdits(JSONString, edit);
console.log(res);
We would expect the following output
{
"hello": " world"
}
But we actually get
{
"hello": " world"
}
Interestingly, if we remove the tab inside the quotes, the tab outside is removed as expected. This seems like an error since formatting should only care about tabs outside quotes.
- Dominant language
- TypeScript
- Stars
- 759
- Forks
- 66
- Avg merge
- 5d 10h
- Merged PRs (30d)
- 7
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/node-jsonc-parser
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
microsoft/node-jsonc-parser#125 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
microsoft/node-jsonc-parser#105 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
microsoft/node-jsonc-parser#103 · 2 comments · 8 reactions ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 48/100
microsoft/node-jsonc-parser#97 · 2 reactions ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
microsoft/node-jsonc-parser#95 · 1 reaction ·
All issues in microsoft/node-jsonc-parser
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
danielmiessler/LifeOS#2218 ·