Code Monkey home page Code Monkey logo

Comments (6)

lgrammel avatar lgrammel commented on June 16, 2024 1

I've added a "Select expression occurrences" code action in v1.117.0. When you select an expression (selection boundaries must match expression), you can invoke the P42 action menu and start a multi-cursor selection on all occurrences:

action-select-expression-occurrences

This is different from the VS Code standard multi-cursor, because it checks that the expression occurrences use the same variables, this context, etc.

from js-assistant.

lgrammel avatar lgrammel commented on June 16, 2024

Thanks for the suggestion! I'll think about how to best resolve this with a single refactoring.

It's already possible to achieve the renaming with a refactoring combo:

  1. extract l
  2. change it's value
  3. inline l

example-20220612

from js-assistant.

lgrammel avatar lgrammel commented on June 16, 2024

I thought more about this and evaluated various ways of achieving this. It turns out you can easily achieve this by using multiple cursors:

  1. select "l"
  2. start multiple cursors with โ‡งโŒ˜L
  3. change to this
  4. end multiple cursors with Esc

Since there is a pretty elegant built-in solution, I'm wondering how P42 could improve on this.

from js-assistant.

hediet avatar hediet commented on June 16, 2024

This only works if l is not part of some other word.

from js-assistant.

lgrammel avatar lgrammel commented on June 16, 2024

Ah, right. One idea I have is a replace expression code assist where you could select an expression, invoke the action, and then all it's occurrences would be replaced with a text that you'd enter in a text box. Would that be closer to what you imagine?

from js-assistant.

hediet avatar hediet commented on June 16, 2024

That would be cool!

from js-assistant.

Related Issues (20)

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.