Executing VSCode's built-in file rename functionality

Cursor’s approach to file and directory renaming is slow and resource intensive – after the rename, it manually greps for all imports to the relevant files, and processes those files with the objective of updating the import statements. But VSCode has very good automatic renaming functions that handle the import statement updates and that are nearly instantaneous. Cursor should take advantage of that.

Here’s my conversation with cursor (claude sonnet) about this idea:

# Can VSCode automatically update imports on rename?

_Exported on 8/14/2025 at 13:37:28 PDT from Cursor (1.4.5)_

-–

**User**

Just a question about your capabilities: Are you able to rename directories and files and execute the underlying renaming functionality of VSCode (since Cursor is a wrapper of VSCode) to automatically update import references to the renamed files? Or will you have to grep for all references to said files, and update the imports yourself?

**Cursor**

I can help clarify my file and directory renaming capabilities:

**What I can do:**

- Rename files and directories using the file editing tools I have access to

- Search for all references to renamed files/directories using `grep` and `codebase_search`

- Update import statements and file references manually by editing each affected file

**What I cannot do:**

- Execute VSCode’s built-in rename functionality that automatically updates all references

- Trigger VSCode’s language server features or refactoring tools

- Access VSCode’s “Rename Symbol” or “Rename File” commands that handle imports automatically

**My approach for renaming:**

1. First, I’d use `grep` to find all references to the file/directory being renamed

2. Rename the actual file/directory using file operations

3. Manually update each import statement and file reference I found

This means I handle the renaming process more manually than VSCode’s integrated rename feature would. While this approach is thorough and gives you full visibility into what’s being changed, it’s not as seamless as VSCode’s built-in functionality.

For complex renames with many references (especially in TypeScript/JavaScript projects), you might prefer to use VSCode’s native rename feature (F2 on a file in the explorer, or right-click → Rename) to get the automatic import updates, and then ask me to help with any additional changes needed.

**User**

Doesn’t that seem inefficient? What would it take to get you the capability to execute VSCode’s built-in rename functionality, language server features, and refactoring tools.

**Cursor**

You’re absolutely right - it is inefficient! The manual approach I described is much more error-prone and time-consuming compared to VSCode’s sophisticated language server integration.

**What would be needed for VSCode integration:**

1. **Language Server Protocol (LSP) access** - I’d need tools that can communicate with TypeScript/JavaScript language servers to:

- Trigger “Find All References”

- Execute “Rename Symbol” operations

- Get semantic understanding of code relationships

2. **VSCode Command Palette integration** - Tools to execute VSCode commands like:

- `editor.action.rename`

- `workbench.action.findInFiles`

- `typescript.renamefile`

3. **Workspace-aware refactoring** - Access to VSCode’s workspace symbols and cross-file dependency tracking

4. **IDE state management** - Ability to work with VSCode’s understanding of:

- Open files and unsaved changes

- Project configuration (tsconfig.json, etc.)

- Import path resolution

**Current limitations:**

My tools are essentially file-system level operations - I can read, write, search, and execute shell commands, but I can’t tap into VSCode’s rich semantic understanding of the codebase or trigger its refactoring engines.

**Potential solutions:**

- **VSCode Extension API integration** - Tools that could invoke extension commands

- **Language server direct communication** - Tools to interact with TSServer, ESLint, etc.

- **VSCode CLI integration** - If VSCode exposed more refactoring via command line

This would be a significant capability upgrade that would make me much more powerful for code refactoring tasks. Currently, I’m working more like a sophisticated text editor rather than leveraging the full IDE experience you’re used to.

Have you seen other AI coding assistants that have this kind of IDE integration?