Smart selection with double clicks for VS Code.

Overview

Smart Clicks VS Code

Visual Studio Marketplace Version

Smart selection with double clicks for VS Code.
GIF Demo

Usage

Double clicks on the code.

Rules

bracket-pair

Pair to inner content of brackets.


(foo, bar)
 └──────┘

dash

- to identifier.

   ▽
foo-bar
└─────┘

html-attr

= to HTML attribute.

<div class="btn"></div>
     └─────────┘

html-element

< to the entire element.

<div><div></div></div>
└────────────────────┘

html-tag-pair

Open and close tags of a HTML element.

<div><div></div></div>
 └─┘              └─┘

js-arrow-fn

=> to arrow function.

       
(a, b) => a + b
└─────────────┘

js-assign

= to assignment.

        
const a = []
└──────────┘

js-block

Blocks like if, for, while, etc. in JavaScript.


function () {     }
└─────────────────┘

import { ref } from 'vue'
└───────────────────────┘

js-colon

: to the value.

     
{ foo: { bar } }
       └─────┘

jsx-tag-pair

Matches JSX elements' start and end tags.

  
(<Flex.Item>Hi</Flex.Item>)
  └───────┘     └───────┘

Configuration

All the rules are enabled by default. To disable a specific rule, set the rule to false in smartClicks.rules of your VS Code settings:

// settings.json
{
  "smartClicks.rules": {
    "dash": false,
    "html-element": false
  }
}

Sponsors

Credits

Inspired by HBuilderX, initiated by 恐粉龙.

License

MIT License © 2022 Anthony Fu

Comments
  • [Feature request] Make double-clicking closing brackets also select

    [Feature request] Make double-clicking closing brackets also select

    Right now selection only works when double-clicking the opening bracket. If possible, it would be nice if the selection also worked when using the closing brackets.

    e.g.

    class Solution {
        solve(s0: string, s1: string) <-- selection by clicking here : boolean {
            // some code
        } <-- or here
    } <-- or here
    

    Just an idea 🤷‍♂️

    pr welcome 
    opened by FallDownTheSystem 2
  • 一点改善体验的想法

    一点改善体验的想法

    https://user-images.githubusercontent.com/88266810/159731601-18f10573-0d61-457a-8bcb-9323ce2e105e.mp4

    对于html来说,把触发点设置为"<"字符会不会有点容易误触😣,很容易点到右侧的标签名和左侧的空白,可以设定为"<" ,再加上左侧的最近空白处,这样鼠标就可以很自然的偏左边去点击,而不用精准点击,这样也许会舒服一些😌

    opened by ghost 1
  • 一点点想法

    一点点想法

    https://user-images.githubusercontent.com/88266810/159694408-b72eaad0-9a1e-4e2d-a3ff-de9df56cf158.mp4

    有时候经常需要删除代码重写,一段代码还好可以快捷键删除,但是遇到一堆的时候,特别是嵌套的时候还有父级子级,手一滑过又得缩一缩,要是内容过多,还得滑动滚动屏幕去选择,手特别的累。 因此可以双击标签">"后面选择整个元素,或者如果看不到后面的标签,则可以双击开头的标签"<"

    opened by ghost 0
  • 安排上了,提一个建议,来自hbuildex

    安排上了,提一个建议,来自hbuildex

    Clear and concise description of the problem

    ![hbx](https://raw.githubusercontent.com/each1026/ImageSave/master/uPic/image 2022-11-11 at [email protected])

    代码块这里可以添加个这个规则,hbx 这块做的体验非常好

    Suggested solution

    另外,选中速度也还有优化空间

    Alternative

    No response

    Additional context

    No response

    Validations

    • [X] Follow our Code of Conduct
    • [X] Read the Contributing Guide.
    • [X] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
    enhancement 
    opened by each1026 1
  • [feature] Double right click to copy selection to clipboard

    [feature] Double right click to copy selection to clipboard

    Assume JS project without TS and we have config like below:

    contentLayoutNav: 'vertical', // vertical, horizontal
    

    If we want to change the value to horizontal we can enable double right-click to copy the selection. Once it's copied we can press middle mouse button twice on vertical value inside quotes to replace it with clipboard content.

    opened by jd-solanki 0
  • [Feature suggestion]: dot delimited strings (nested objects)

    [Feature suggestion]: dot delimited strings (nested objects)

    Hi Anthony. Thanks for an awesome extension.

    I often need to replace an object e.g. and it would be really nice if I could double click the . and then route.query would be selected.

          query: {
            ...route.query,
            downpayment: newValue
          }
    
    opened by madsh93 2
  • [Feature suggestion]: Keybinding for smart selection.

    [Feature suggestion]: Keybinding for smart selection.

    In VS Code, a selection is trigger when we press ctrl/command + d.

    Is it possible that the extension reacts to ctrl/command + d keybinding when there's selected text in cache.

    The final effect is when focus the cursor on any position of abc-def-gh, press ctrl/command + d for the first time, abc (for example) is auto-selected by VS Code. Then press the same keybinding for the second time, the extension reads selected text with VS Code API and extends selection to the whole variable abc-def-gh.

    I'm not sure if I made myself clear.

    @antfu

    Best wishes

    opened by syy11cn 0
Releases(v0.1.1)
Owner
Anthony Fu
A ship in harbor is safe, but that is not what ships are built for.
Anthony Fu
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
esse bot envia sinais, do gamer double blaze, direto para chats do telegram. leave the star ⭐️

Bot Blaze Double A blaze.com, site de aposta online, operada pela empresa Prolific Trade N.V. e bastante popular nas mídias sociais. Em um de seus jog

Elizandro Dantas 42 Dec 30, 2022
A utility package to help implement stateless CSRF protection using the Double Submit Cookie Pattern in express.

Double CSRF A utility package to help implement stateless CSRF protection using the Double Submit Cookie Pattern in express. Dos and Don'ts • Getting

Psifi Solutions 24 Dec 28, 2022
Crypto-tracker - Get crypto currency data in one click. Followed by a few more clicks.

https://crypto-tracker-ayaanzaveri08.vercel.app/ Crypto Tracker Crypto Tracker tracks crypto with the CoinGecko API. This app uses the React framework

Ayaan Zaveri 0 Apr 30, 2022
This project is built with JavaScript, Webpack, HTML & CSS, Leaderboard api. When user clicks on Refresh button it hits the api and responds with the data, The user can also post data to the api

leaderboad Description the project. this project is about the leaderboad i did during Microverse to build a website for adding Data to the API and fet

Emmanuel Moombe 4 May 30, 2022
Import/Export data from and to your database in just few clicks.

Strapi Plugin Import Export Entries Import/Export data from and to your database in just few clicks. Features Import Import data directly from the Con

Baptiste Studer 72 Dec 28, 2022
VSCode extension for managing text selection.

Selection Manager This Visual Studio Code extension will allow you to manage selected text. The aim of this extension is to increase productivity by u

Sanel Hadžini 2 Apr 12, 2022
An enhanced HTML 5 file input for Bootstrap 5.x/4.x./3.x with file preview, multiple selection, and more features.

bootstrap-fileinput An enhanced HTML 5 file input for Bootstrap 5.x, 4.x, and 3.x with file preview for various files, offers multiple selection, resu

Kartik Visweswaran 5.2k Jan 3, 2023
Nepali Multi Date Picker for jQuery. Supports both single date selections and multiple date selection.

Nepali Multi Date Picker A simple yet powerful date picker based in Nepali calendar. Supports both single date selections and multiple date selection.

Sanil Shakya 4 May 23, 2022
Multiple Selection Combo Box using Bootstrap 3

MagicSuggest v2.1.6 Bug Fix (fix) Disabled arbitrary HTML and SCRIPT execution on input. MagicSuggest v2.1.5 (fix) prepend close button instead of app

null 1.3k Dec 22, 2022
This plugin for Obsidian adds commands for increasing/decreasing the blockquote level of the current line or selection(s).

Blockquote Levels This plugin for Obsidian adds commands for increasing/decreasing the blockquote level of the current line or selection(s). Usage The

Carlo Zottmann 15 Dec 19, 2022
A code formatter for the Motoko smart contract language.

Motoko Formatter · A Prettier plugin for the Motoko programming language. Setup After making sure Node.js is installed on your local machine, run the

DFINITY 25 Dec 19, 2022
A VS Code extension to practice and improve your typing speed right inside your code editor. Practice with simple words or code snippets.

Warm Up ?? ??‍?? A VS Code extension to practice and improve your typing speed right inside your code editor. Practice with simple words or code snipp

Arhun Saday 34 Dec 12, 2022
A collection of smart contracts for the Stackup platform 🤖 📑

Contracts A collection of smart contracts for the Stackup platform. Dev Blog Deployed Contracts See releases for deployed contracts of previous versio

Stackup 16 Nov 29, 2021
Ethereum Smart Contracts for locking your Ether and ERC20 tokens based on time and price conditions

SmartHold - a simple way to lock and hold your ETH or ERC20 in a smart contract This is a BETA software that has not been audited for security. USE AT

Paweł Urbanek 22 May 5, 2022
♦ Crowd funding project using Smart Contracts on the Ethereum. Created with Next.js and Tailwind CSS.

Crowdcoin ♦ Crowd funding project using Smart Contracts on the Ethereum. Created with Next.js and Tailwind CSS. Project from "Ethereum and Solidity: T

Luiz Fernando Veríssimo 2 Dec 14, 2022
First smart contract deployed on Rinkeby.

Inbox-Contract First smart contract deployed on Rinkeby. It has a basic constructor which accpets a string and assigns the string to the message varia

Stanley Moukhametzianov 1 Dec 26, 2021