Skip to content

Allow prepareRename to return ranges that do not include original position #58907

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

Closed
mjbvz opened this issue Sep 18, 2018 · 2 comments
Closed
Assignees
Labels
api feature-request Request for new features or functionality rename verification-needed Verification of issue is requested verified Verification succeeded
Milestone

Comments

@mjbvz
Copy link
Collaborator

mjbvz commented Sep 18, 2018

Problem
TypeScript would like to support renaming files by hitting F2 anywhere in the import path.

import * as _ from './dir1/dir2/file'

Here, hitting F2 anywhere in in the string './dir1/dir2/file' should trigger a rename only on the file part of the path. However, in prepareRename, we currently can't return rename ranges that do not include this original rename position. This means that we cannot support hitting F2 anywhere on `'./dir1/dir2/``

Proposal
Relax this restriction, either eliminating it entirely or perhaps only requiring the rename range to be on the same line as the original position

@mjbvz
Copy link
Collaborator Author

mjbvz commented Sep 18, 2018

We'd also like to support hitting f2 on the class keyword to rename a class:

class Foo {}

This also requires returning a rename range that does not include the original rename position

@jrieken jrieken added the feature-request Request for new features or functionality label Sep 19, 2018
@jrieken jrieken added this to the October 2018 milestone Sep 24, 2018
@mjbvz mjbvz changed the title Allow prepareRename to return ranges that do no include original position Allow prepareRename to return ranges that do not include original position Sep 27, 2018
@jrieken
Copy link
Member

jrieken commented Oct 3, 2018

@mjbvz I have eased the restrictions and also removed from workaround check from the TS extension but still wasn't able to test this. It seems TS server errors on a rename request on the class-keyword...

@jrieken jrieken closed this as completed Oct 8, 2018
@jrieken jrieken added the verification-needed Verification of issue is requested label Oct 29, 2018
@mjbvz mjbvz added the verified Verification succeeded label Oct 31, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api feature-request Request for new features or functionality rename verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

2 participants