Skip to content

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

@mjbvz

Description

@mjbvz

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions