October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

How to Stop an AI Coding Assistant From Reformatting Unchanged Files

Unrelated formatting changes can come from the assistant, an editor save action, or a formatter. Identify the trigger, constrain its scope, and inspect the diff before committing.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If unrelated lines change after an AI coding edit, first find out what caused them: the assistant may have edited them, or your editor or formatter may have reformatted the file on save, while typing, pasting, or committing. Disable or narrow the trigger that actually caused the churn, give the assistant a clear repository rule, and review the diff before staging. These controls work together; none replaces the others.

Identify what is reformatting the file

Make a small change, save, and inspect the diff. If the extra edits appear only after saving, temporarily turn off the relevant save-formatting action and repeat. If they appear as soon as the assistant applies its edit, the assistant may have included them in its change. Formatting can also be triggered by an extension, a language-specific action, or a commit action, so do not assume the model is responsible just because it was the last tool you used.

As an Amazon Associate I earn from qualifying purchases.

Check the diff after each step that might trigger formatting. This helps separate the assistant’s edit from changes made by the editor or formatter. If more than one mechanism is active, adjust each one independently: an AI instruction cannot switch off an IDE formatter, and a formatter setting cannot prevent unrelated semantic edits by an assistant.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Turn off or narrow automatic formatting

VS Code

VS Code distinguishes formatting the entire active file with Format Document from formatting selected text with Format Selection. Automatic formatting may also run on save, while typing, or when pasting, through editor.formatOnSave, editor.formatOnType, and editor.formatOnPaste. The VS Code Basic Editing documentation says these gesture-triggered behaviors are off by default; if formatting is happening unexpectedly, check user and workspace settings as well as extensions and language-specific actions. See VS Code: Basic Editing.

#1 Best Overall
Logitech Ergo K860 Wireless Ergonomic Split Keyboard with Wrist Rest | Curved split keyframe, pillowed wrist rest, Bluetooth, USB connectivity with included USB Receiver, Windows Mac compatible
  • Improved Typing Posture: Type more naturally with a curved, split keyframe and reduce muscle strain on your wrists and forearms thanks to the sloping keyboard design
  • Pillowed Wrist Rest: Curved wrist rest with memory foam layer offers typing comfort with 54 per cent more wrist support; 25 per cent less wrist bending compared to standard keyboard without palm rest
  • Perfect Stroke Keys: Scooped keys match the shape of your fingertips so you can type with confidence on a wireless keyboard crafted for comfort, precision and fluidity
  • Adjustable Palm Lift: Whether seated or standing, keep your wrists in total comfort and a natural typing posture with ergonomically-designed tilt legs of 0, -4 and -7 degrees
  • Ergonomist Approved: The ERGO K860 wireless ergonomic keyboard is certified by United States Ergonomics to improve posture and lower muscle strain

To disable all three triggers in user or workspace settings, use:

{
  "editor.formatOnSave": false,
  "editor.formatOnType": false,
  "editor.formatOnPaste": false
}

Only change the settings that match the trigger you observed. Turning them all off may remove useful formatting behavior. Format-on-paste is not supported by every formatter because it requires range-formatting support. The cited VS Code overview does not establish a universal changed-lines setting across language formatters, so these settings alone cannot promise that every extension will limit formatting to changed lines.

Rank #2
Sale
Logitech Wave Keys Ergonomic Wireless Keyboard with Palm Rest - Graphite
  • Feel the Wave: Get comfier with Wave Keys, the ergonomic wireless keyboard shaped to help workdays go easier on you
  • Type in comfort all day long: The wavy design of this compact keyboard places your hands, wrists and forearms in a natural typing position
  • More palm support, less pressure: A cushioned palm rest with memory foam supports you all day long and gives you more wrist support (1)
  • Smoother days, your way: Personalize your Wave Keys experience using the Logi Options+ App, where you can choose shortcuts that save time and keep your work flowing (2)
  • Ergo-certified: The Wave Keys Ergonomic Keyboard has been designed and tested according to criteria set out by leading ergonomists and is approved by United States Ergonomics

IntelliJ IDEA

In IntelliJ IDEA, open Settings | Tools | Actions on Save | Reformat code. JetBrains documents options to exclude filename or folder patterns and, when the project is under version control, choose between Whole file and Changed lines. Reformat-on-commit is also available for Git and Mercurial and targets added or modified code. See JetBrains: Reformat and rearrange code.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use the narrowest scope that meets your needs: exclude a file or directory that must retain its formatting, or choose changed lines instead of the whole file when that option is available. These controls affect IntelliJ’s formatting actions; they do not constrain what an AI assistant edits.

Rank #3
Arteck Split Ergonomic Keyboard with Palm Rest, 2.4G USB Wireless Keyboard
  • Split Design Ergonomic: Split design helps to position wrists and forearms in a natural, relaxed position. Arteck Split Ergonomic Keyboard with Cushioned Wrist and Palm Rest, 2.4G USB Wireless Comfortable Natural Ergonomic Split Keyboard, for Windows Computer Desktop Laptop
  • Wrist Rest: Soft cushioned wrist rest helps you to rest your wrist and forearm while typing and makes work easier and more comfortable.
  • Easy Setup: Simply insert the nano USB receiver (stored at the back of the keyboard) into your computer and use the keyboard instantly.
  • 6-Month Battery Life: Rechargeable lithium battery with an industry-high capacity lasts for 6 months with single charge (based on 2 hours non-stop use per day).
  • Package contents: Arteck Split Ergonomic Keyboard, nano USB receiver (stored at the back of the keyboard), USB-C charging cable, welcome guide, our 24-month warranty and friendly customer service.

Give the assistant a persistent scope rule

For GitHub Copilot, repository-wide instructions belong in .github/copilot-instructions.md. Path-specific instruction files can live under .github/instructions. GitHub documents these as natural-language Markdown guidance for the assistant; see GitHub: Adding repository custom instructions for GitHub Copilot.

A useful repository-wide rule is:

- Preserve the existing style and formatting of files you edit.
- Make only changes needed for the requested task; do not reformat unrelated files or lines.
- Do not run a whole-file formatter unless the task explicitly asks for it.
- Before finishing, inspect the diff and call out any formatting-only changes outside the requested code.

Keep the instruction concrete and consistent with the repository’s actual conventions. For file-specific exceptions, use a path-specific instruction rather than applying an unnecessary rule to every file.

Rank #4
Sale
Wireless Keyboard and Mouse Combo, 2.4G Ergonomic Wave Keys(Black)
  • 【Wave Ergonomic Wireless Keyboard and Mouse Combo】The wireless keyboard features a wave key and wrist rest design that naturally fits your fingers and relieves wrist strain. The adjustable stand allows you to set the keyboard to the most comfortable height, making it ideal for long-term use. Note: The USB receiver is located on the back of the mouse.
  • 【Wireless Optical Mouse】The wireless mouse is designed with comfort in mind, featuring a contoured shape that fits snugly in the palm and complements the natural curve of your right hand. All controls are easily within reach. This mouse is equipped with forward and back functions, allowing you to navigate the web faster and more efficiently than ever before.
  • 【Plug-and-Play 2.4G Wireless Connection】One 2.4 GHz USB receiver can connect both the keyboard and mouse, or they can be used separately. Plug and play—no software download is required. The 2.4 GHz wireless connection offers a strong and reliable signal up to 33 feet (10 meters), without delays.
  • 【Automatic Power Saving Function】The ULSOU wireless keyboard and mouse combo features an automatic power-saving function. After 30 seconds of inactivity on the keyboard and 15 minutes of inactivity on the mouse, both devices enter sleep mode to conserve battery life. This greatly extends battery life, and any button press will activate the devices again. The keyboard requires 1 AA battery, and the mouse requires 1 AA battery. (batteries not included).
  • 【Wide Compatibility and Dual System Layout】This wireless keyboard and mouse combo is compatible with Windows XP/Vista/7/8/10/11, Mac, and other operating systems. It’s suitable for desktops, Chromebooks, PCs, laptops, and more. You can switch between Windows and macOS by pressing FN+Q or FN+W.

Instructions steer the assistant but do not enforce its behavior. GitHub cautions that, because AI is non-deterministic, Copilot may not always follow custom instructions exactly the same way each time; see GitHub: Customizing Copilot responses. Pair repository guidance with formatter settings and diff review rather than relying on prompt text alone.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Exclude files or protected sections from formatting

When a file or code fragment must keep its current layout, configure the formatter itself. JetBrains documents filename and directory glob exclusions, as well as comment markers that leave the code between configured off/on markers untouched during reformatting. See JetBrains: Reformat and rearrange code.

Best Value
Kensington Pro Fit Ergonomic Wired Keyboard- Black (K75400US) | Built in wrist cushion, adjustable reverse tilt, low noise keys, spill proof wipe down build, USB plug and play
  • Built-in wrist rest and neutral grip supports, cushions, and positions the wrist for comfort and neutral hand alignment.
  • Built-in wrist rest supports, cushions, and cradles the wrists.
  • Quiet keys mean typing is smooth, easy, and non-disruptive.
  • Spill-proof keys make cleanup fast and easy; Meets MIL-STD-810H Method 504.3 Contamination by Fluids testing for resistance to breakdown when exposed to cleaning and disinfecting solvents such as alcohol and bleach for at least 24 hours
  • Caps lock, numbers lock, scroll lock, and F-keys are popular features that make typing and navigating easier and more efficient.

Use comment markers only when they are valid and appropriate in that language, and confirm the active formatter recognizes them. They are controls for JetBrains formatter behavior, not universal markers understood by every formatter or instructions to the AI. Where comments are unsuitable, prefer file or directory exclusions or the formatter’s own documented configuration.

Review and stage a focused diff

After the assistant’s edit and again after staging, check whether the changed files and hunks match the task. VS Code’s Source Control view can compare the original and changed files and marks additions, modifications, and deletions; see VS Code: Source Control.

Look for files the task did not require, broad hunks with only small semantic changes, whitespace-only movement, line-ending changes, import reordering, quote or semicolon churn, and generated or lock files. These are review clues, not proof that a change is harmless. If a noisy hunk may contain a behavior change, do not discard it blindly: separate the intended code from formatting churn first, then revert or stage only what you can safely identify. Stage focused files or hunks and inspect the staged diff before committing.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose the control that matches the problem

Where the change comes from Control to adjust What it does not control
Editor formats on save, typing, or paste Disable the matching trigger or configure its scope The assistant’s own edits
Formatter rewrites a file or section Use supported changed-lines behavior, file/path exclusions, or formatter markers Other formatters or the assistant
Assistant edits unrelated code Add a clear repository or path-specific instruction Automatic IDE or commit formatting; exact model compliance
Changes are already present in the diff Review, selectively revert, and stage focused hunks Preventing the same trigger next time

These examples cover VS Code, IntelliJ IDEA, and GitHub Copilot. They do not establish equivalent settings for every editor or coding assistant. If you use another tool, identify whether the change happens during the assistant’s edit, on save, or at commit, then check that tool’s official documentation for the corresponding control.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.