Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

editor.renameOnType causes unwanted renaming outside of HTML tags #110983

Closed
DanielHZhang opened this issue Nov 19, 2020 · 6 comments
Closed

editor.renameOnType causes unwanted renaming outside of HTML tags #110983

DanielHZhang opened this issue Nov 19, 2020 · 6 comments
Assignees

Comments

@DanielHZhang
Copy link

Version: 1.52.0-insider (user setup)
Commit: a36c68b
Date: 2020-11-19T05:37:52.577Z
Electron: 9.3.3
Chrome: 83.0.4103.122
Node.js: 12.14.1
V8: 8.3.110.13-electron.0
OS: Windows_NT x64 10.0.19042
WSL2
Remote-WSL: 0.51.3

Steps to Reproduce:

  1. Enable "editor.renameOnType": true in settings.
  2. Create a Typescript file with the contents below:
function foo(object: Record<string, any>): void {
  const bar = '';
  if (bar === '') {
    bar.toLowerCase();
  }
  
}
  1. Put the cursor on line 6 and type bar.
  2. Wait momentarily for the renameOnType handler to select all occurrences of bar.
  3. Backspace bar on line 6.

Expected:
Only bar on line 6 is deleted, as it is not an HTML tag.

Issue:
All instances of bar are deleted.

See:
typed-array-buffer-schema-WSL-Ubuntu_-test ts-2020-11-19-17-09-52

Does this issue occur when all extensions are disabled?: Yes

@napei
Copy link

napei commented Nov 20, 2020

Am experiencing something similar, but more annoyingly in Typescript with this which makes it disappear from pretty much everywhere in the document.

@tlgreg
Copy link

tlgreg commented Nov 24, 2020

Same with typescript generic types.

@jrieken jrieken assigned aeschli and unassigned jrieken Nov 24, 2020
@jrieken
Copy link
Member

jrieken commented Nov 24, 2020

That's how the feature is meant to work and you should be using "editor.renameOnType": false then

@jrieken jrieken closed this as completed Nov 24, 2020
@IllusionMH
Copy link
Contributor

@jrieken in JS rename on type will be very useful in the same way as in HTML - edit JSX tags.
If I put

// "[typescript]" or
"[javascript]": { 
    "editor.renameOnType": false
}

it obviously disables it in all areas and won't be possible in JSX as well.
Are there plans to have option to disable them in regular code (mostly hurts + problems with 1 character generic types in TS) but leave available for JSX microsoft/TypeScript#51832 ?

@jrieken
Copy link
Member

jrieken commented Nov 24, 2020

We will nuke the current TS implementation and rework the API and setting. This isn't about rename (in the sense of the rename refactoring) but about "linked cursors". See #109923 (comment) as related discussion. E.g the isn't really a language feature but merely an editor feature

@IllusionMH
Copy link
Contributor

We will nuke the current TS implementation and rework the API and setting

@jrieken thank you for clarification. Will look for new implementation/settings, in the meantime will disable it for specific languages.

@github-actions github-actions bot locked and limited conversation to collaborators Jan 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants