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

cursor replace code command when i really don't want that #2566

Open
nidhoggfgg opened this issue Jan 10, 2025 · 3 comments
Open

cursor replace code command when i really don't want that #2566

nidhoggfgg opened this issue Jan 10, 2025 · 3 comments

Comments

@nidhoggfgg
Copy link

Platform: Windows11
cursor version: 0.44.11

problem:
i only want to use cusror to start cursor, and use code to start vscode.
so i click something like "register cusror command" when install cursor.
but hell, the cursor replace the code command too.

when i go to folder where the cursor is, i look this:
image
path: C:\Users{username}\AppData\Local\Programs\cursor\resources\app\bin

and if i delete the code to fix it temporarily, when cursor updated, it come back😅.

this is a bug, because i didn't choose something like "register code command" when install, but still it give me the code command.

i hope this can be fixed, otherwise it's unhappiness for using cursor

@dduede
Copy link

dduede commented Jan 14, 2025

I've investigated this issue myself and the way cursor handles the installation is inherently flawed.

When installing VSCode, the user has 2 options on windows:

  • The User install (this is the default): Installs VSCode in the %localappdata% directory and updates the User PATH env variable
  • The System Install: Installs VSCode in %ProgramFiles% and updates the System PATH env variable

On the other hand, cursor only provides a User Install BUT it also updates the System PATH env variable. System Environment Variables apply for all users while User Environment Variables only apply to the current user. Usually, User Environment variables take precedence over system environment variables, with a few exceptions. PATH is one of these exceptions.

Since System PATH is always evaluated first and Cursor injects its binary path into the System PATH variable, windows will always find the Cursor code.cmd first if:

  • The User uses VSCode User Install
  • The User installed VSCode System Install AFTER Cursor (due to the way PATH is handled, first come first served)

Workarounds

There are several options to work around this issue until cursor fixes it, but none of these options are optimal.

A: Fix Environment Variables

  • Open your Environment Variable Settings and edit the System PATH.
  • Remove the Path to cursor (something like C:\Users\{username}\AppData\Local\Programs\cursor\resources\app\bin)
  • Edit the User PATH and add a new entry, pointing to the cursor app\bin directory
  • Make sure the Cursor App Path is listed AFTER the VSCode path (C:\Users\{username}\AppData\Local\Programs\Microsoft VS Code\bin) when using the default VSCode User Install.

Note: This is how cursor should manage the environment variable in the first place, but this alone is not a reliable long-term fix.

B: Delete code.cmd

This file shouldn't be reachable via PATH if the user does not request explicit registration of code as a cursor alias.
The file can be found in %LOCALAPPDATA%\Programs\cursor\resources\app\bin

Note: An update may re-introduce the file, depending on how cursor handles updates.

C: Use the VSCode System Install

On https://code.visualstudio.com/ click on "other platforms" below the download button on the main page or follow this link: https://code.visualstudio.com/Download
Download the VSCode System Install
Uninstall VSCode User Install before installing the System variant.

This will add VSCode via the System PATH. In some scenarios, this may still break. In this case, the environment variables need to be updated

Suggested fix in cursor

Considering the User is presented with the option to register either code or cursor but it always registers both, the logic of the registration script should be altered:

  1. Do not use the System Environment PATH
    The script should not update the System Environment Variables but the User Environment variables.
    Cursor is installed into a user directory. Using the System Environment PATH can break the installation on Multi user systems.

  2. Do not add files to PATH that aren't needed
    The code and cursor binaries should be split into their own binary directories, which can then be added independently to the path. Alternatively, create the cursor.cmd and code.cmd on the fly when requested.

@ydmingg
Copy link

ydmingg commented Jan 14, 2025

it's been fixed

@vurg
Copy link

vurg commented Jan 21, 2025

Not been fixed in WSL.

(base) user@machine:~$ which code
/mnt/c/Users/User/AppData/Local/Programs/cursor/resources/app/bin/code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants