Git Product home page Git Product logo

vsc-around's Introduction

Around extension for VS Code

Manage token around regions.

This is a bit of an evil-surround port by an Emacs refugee.


Features

Puts before and after token around selected regions.

Just invoke the around.around command and select the token you want to surround your selection with. Some tokens, like parenthesis, will try to be smart by inserting the correct balancing token. Other tokens, like ", will just surround the region with two identical tokens.

Configuration

around uses the mapping around.pairs to control mappings. Each key in the mapping is a string, and each value is a pair of strings. around uses the mapping as follows.

If the supplied trigger string (possibly multiple characters) is a key in the mapping, then the elements in the value are used to surround the selection.

Otherwise, around processes the trigger string character-by-character. For each character, it checks to see if it is a key in the mapping. If so, the value is used as a two-tuple of prefix and suffix text. If not, then a two-tuple with the character in each position is used. In both cases, the first element in the tuple is appended to the prefix text and the second is prepended to the suffix text.

To bind a specific surrounding to a keyboard shortcut, you can add the following code snippet in your keybindings.json.

[
  {
    "key": "ctrl+shift+9",
    "command": "extension.around",
    "args": {
      "start": "(",
      "end": ")"
    }
  }
]

vsc-around's People

Contributors

abingham avatar dependabot[bot] avatar

Watchers

 avatar James Cloos avatar

Forkers

pomdtr

vsc-around's Issues

improve surrounding of blocks

When surrounding a block of text, the desired output is often to have the surround text on new lines.

Ex:

markdown
code
block

->

```
markdown
code
block
```

Default selection

When no word is selected, it could be useful to select the current word by default.

Publish `around` to Open VSX

Dear @abingham,

Please publish this extension to the Open VSX marketplace.

Context

Unfortunately, as Microsoft prohibits usages of the Microsoft marketplace by any other products or redistribution of .vsix files from it, in order to use VS Code extensions in non-Microsoft products, we kindly ask that you take ownership of the VS Code extension namespace in Open VSX and publish this extension on Open VSX.

What is Open VSX? Why does it exist?

Open VSX is a vendor neutral alternative to the MS marketplace used by most other derivatives of VS Code like VSCodium, Gitpod, OpenVSCode, Theia-based IDEs, and so on.

You can read on about Open VSX at the Eclipse Foundation's Open VSX FAQ.

How can you publish to Open VSX?

The docs to publish an extension can be found here. This process is straightforward and shouldn't take too long. Essentially, you need an authentication token and to execute the ovsx publish command to publish your extension. There's also a doc explaining the whole process with an example GitHub Action workflow.

Issue when multiple selections are on the same line

If we have a line with two items we want to surround:

item_1 item_2 -> "item_1" "item_2"

The selection on the first word will be kept, but not the other one on the second word (who should be pushed by 3).

The issue also appear when trying to surround a word by multiple char (ex: """)

Delete / Change surroundings

Maybe out of scope for this extension, but this seems like the next step.

I'll try to contribute to the extension when i'll have some free time :)

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.