question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unifying "do X on save" functionality

See original GitHub issue

Problem VS Code ships with multiple actions that can be triggered on save, including:

  • Trim trailing whitespace
  • Trim trailing new line
  • format document
  • code actions (such as organize imports and fix all)

Each of these actions currently has its own setting. Many of the setting names are generic so it may not be clear they apply on save.

Goals

  • Make it easier to discover built-in do X on save actions
  • Give these settings a more consistent names
  • Potentially allow these actions to be used in a more flexible way (such as from the source action menu)

/cc @kieferrm

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:5
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
mjbvzcommented, Aug 31, 2020

Sketch 3 — Add a new setting

Add a new editor.onSave setting that unifies all of these. This setting would be an array of actions that are run in order:

    "editor.onSave": [
        "format",
        { "codeAction": "bla" },
        "files.trimFinalNewlines"
    ]

Pros

  • Clean
  • single setting

Cons

  • Discoverability
  • We’d need to figure out how this new setting plays with all the existing settings
2reactions
mjbvzcommented, Jan 26, 2019

Sketch 1 — Everything is a source Action

Convert all on save actions into source code actions. Use the single editor.codeActionsOnSave setting to enable or disable individual actions:

"editor.codeActionsOnSave": {
      "source.organizeImports": true,
      "source.format": true,
      "source.trimTrailingNewLines": true,
}

Pros

  • Single setting `editor.codeActionsOnSave``
  • You can easily create keybindings for source actions
  • They would show up in the source context menu.

Cons

  • Order that actions are run in becomes less clear. With our current implementation, we always run code actions and then format for example
  • Creating some code actions, such as format actions, may be expensive.
Read more comments on GitHub >

github_iconTop Results From Across the Web

Connecting a Logitech device to your Unifying Receiver ...
In this video let's take a look at how to connect your Logitech device to a Unifying Receiver on Windows and Mac.Connect up...
Read more >
Logitech Unifying wireless technology: Q&A for the IT ...
The Unifying receiver is a great bonus feature that brings added convenience and flexibility when you want to connect multiple wireless devices to...
Read more >
Is Logitech's Unifying receiver supported? - Ask Ubuntu
Save this question. Logitech has a Unifying receiver that you can add several devices using the same USB device. Is this supported in...
Read more >
Configuring Unified Messaging [Cisco Unity Connection]
When configuring multiple Unified Messaging services in Unity Connection you must create a unique Client ID for each service. Step 6. Do the ......
Read more >
Match conditions for data unification - Dynamics 365
Match rules specify the logic by which a specific pair of entities will be matched. A rule consists of one or more conditions....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found