GithubHelp home page GithubHelp logo

shifter's Introduction

Shifter for Visual Studio

Build

Download this extension from the Visual Studio Marketplace or get the CI build.


Shifter shifts the text under the caret depending on the text. For example, if the caret is on a number, Shifter will increase or decrease the number. This makes common tasks super quick and keyboard friendly.

Shifter

The value being shifted is either the text where the caret is placed, or the selected text range.

Shifter

If using multiple carets, each selected text will be shifted separately.

Keyboard shortcuts

  • Shift up: Ctrl+Alt+Up
  • Shift down: Ctrl+Alt+Down
  • Incremental Shift up: Shift+Ctrl+Alt+Up
  • Incremental Shift down: Shift+Ctrl+Alt+Down

Supported shifts

Numbers, including decimals, will increase or decrease with a value that depends on the number of decimals (supports incremental shift).

Hex colors will either brighten or darken slightly when shifted.

Named colors will shift to the adjacent named color in the pallet. For instance, shifting up blue will make it royalblue.

Guids will be incremented or decremented when shifted. A quick way to change a guid slightly.

Boolean values such as true/false, on/off, yes/no will shift to the opposite regardless of shifting direction.

Incremental shifts

Shifter

With incremental shift each selection will be shifted incrementally in order from top/left to bottom/right.

How can I help?

If you enjoy using the extension, please give it a ★★★★★ rating on the Visual Studio Marketplace.

Should you encounter bugs or if you have feature requests, head on over to the GitHub repo to open an issue if one doesn't already exist.

Pull requests are also very welcome, since I can't always get around to fixing all bugs myself. This is a personal passion project, so my time is limited.

Another way to help out is to sponsor me on GitHub.

shifter's People

Contributors

lordfanger avatar madskristensen avatar softworkz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

shifter's Issues

Shifter does not honor casing for named colors in XAML

Description

I was able to install Shifter and Color Preview mostly so that I could use the extensions with XAML. It appears that the named Color values are always provided in lower case, which is more appropriate for CSS. My suggestion is that Shifter be sensitive to whether or not it is running on a XAML file and to use Pascal casing for the color names.

Steps to reproduce

  1. Install Shifter. Install Color Preview or use the experimental "Show inline color previews" on the XAML Miscellaneous section under the Text Editor XAML language.
  2. Open a XAML file that contains Color specifications. I use the Xamarin Forms and Maui incarnation. A good file to choose is the App.xaml file, since it is a common place to specify Color definitions.
  3. Use Shifter's Ctl-Alt-Up or Ctl-Alt-Down to toggle color values.
  4. Note that named colors are all lower case.

Expected behavior: [What you expected to happen]
Named values should be lower case for CSS and Pascal case for XAML. Other file extensions may honor different rules.

Actual behavior: [What actually happened]
Named colors are all lower case regardless of file type.

[Feature request] Sequentially shift numbers in consecutive lines

Description

I'll often have many lines of code that should contain monotonically increasing integer values, 1 per line, often from copying+pasting a single line repeatedly, or from using the Duplicate Line command.

For example, I might have a multi-line SQL string that I've added column index numbers to (which are then used in SqlDataReader.GetFoobar(Int32) (I know I could use column-names, but sometimes it's just easier/simpler to use column ordinals), or a multi-line String.Format call with comments to remind me which args parameter argument corresponds to which format placeholder:

const String MY_SQL = @"
SELECT
    foo, -- 0
    bar, -- 1
    baz, -- 2
    qux -- 3
FROM
    table
";

using( SqlDataReader rdr = ... )
{
    String foo = rdr.GetString(0);
    Int32 bar = rdr.GetInt32(1);
    Decimal baz = rdr.GetDecimal(2);
    // etc
}

or:

String formatted = String.Format(
    format: "hello {0}, why don't you see {1} hiding in trees? because {2]. Why do {1} paint their toenails red? So they can hide in {3}. What's the loudest {4} in the {5}? {6} eating {7}",
    /*0:*/ "<yourName>",
    /*1:*/ "elephants",
    /*2:*/ "they're really good at it",
    /*3:*/ "cherry trees",
    /*4:*/ "sound",
    /*5:*/ "savanna",
    /*6:*/ "giraffes",
    /*7:*/ "cherries"
 );

...but originally those lines would have looked like this half-way through editing:

const String MY_SQL = @"
SELECT
    foo, -- 0
    foo, -- 0
    foo, -- 0
    foo -- 0
FROM
    table
";

...and...

String formatted = String.Format(
    format: "hello {0}, why don't you see {1} hiding in trees? because {2]. Why do {1} paint their toenails red? So they can hide in {3}. What's the loudest {4} in the {5}? {6} eating {7}",
    /*0:*/ , ""
    /*0:*/ , ""
    /*0:*/ , ""
    /*0:*/ , ""
    /*0:*/ , ""
    /*0:*/ , ""
    /*0:*/ , ""
    /*0:*/ , ""
 );

...respectively.

...so having some way of automatically incrementing identical integers in consecutive lines would be nice.


I'm happy to submit a PR for this functionality - though I've previously submitted PRs some of for your other projects but they're still sitting unread :(

Shift Up and then Shift Down does not give the same color

Description

Shouldn't shifting up one color and then shifting down one color give the original color?

Steps to reproduce

In CSS
border-bottom: 1px solid #d6d5d5;
Shift Up
border-bottom: 1px solid #d8d7d7;
Shift Down
border-bottom: 1px solid #cdcccc;

Another example
outline: 1px solid #26b050;
If you shift up to very light and then down to dark you never get back to green. It is just shades of grey.

Expected behavior: Shift up and then down should give the original hex color

Actual behavior: The color looks similar but the hex is different.

Extension doesn't work?

Describe the bug
This extension doesn't work for me. I tried it in Visual Studio Enterprise 17.4.4, and in Visual Studio Professional 17.2.x. DO you have suggestions on how to troubleshoot why it isn't working?

To Reproduce
Steps to reproduce the behavior:

  1. Go to code editor
  2. double click to highlight a variable
  3. Press Ctrl+Alt+Up
  4. Nothing happens

Expected behavior
Extension to work.

Screenshots
n/a

Additional context
I checked TOols > Options > Environment > Keyboard and made sure I saw entries for Shifter.

Allow Number Shifting with Increments Depending on Caret Position

Is your feature request related to a problem? Please describe.

Example 1 - CSS

.line {
    width: 0.25em;
}

Now I want to shift through 

like: 0.35, 0.45, 0.55, 0.65
or: 1.25, 2.25, 3.25, 4.25  

Example 2 - C#

var timeout = 1000;

Incrementing by 1 is not useful. I'd rather want to increment by 100 or by 1000 for example.

Describe the solution you'd like

This could be made dependent on the caret position.

For example 1: when the caret is right to the 5, increment by 0.01, when it's between 2 and 5, increment by 0.1 and when it's right to the 0, increment by 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.