microsoft / microsoft/TypeScript

Disable formatting a region of code using directives

Open
#18,261 29 comments 99 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Awaiting More Feedback Domain: Formatter Suggestion VS Code Tracked
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

From: https://github.com/Microsoft/vscode/issues/33772

TypeScript Version: 2.4.0 / nightly (2.5.0-dev.201xxxxx)

Feature Request
Add a way to disable formatting of a region of code. An example of this is js beatuify's preserve directive:

// Use preserve when the content is not javascript, but you don't want it reformatted.
/* beautify preserve:start */
{
    browserName: 'internet explorer',
    platform:    'Windows 7',
    version:     '8'
}
/* beautify preserve:end */

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

No repository file, test, or entry point is named. Start by reading the linked VS Code issue and the js-beautify preserve-directive example, then trace TypeScript's formatting entry points. Done means a directive-delimited region remains unformatted while surrounding code is formatted, with tests covering the behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.