I’m a complete newbie at coding but I’m loving coding with cursor and have already made numerous small projects for my self and my work. I’m finding myself pretty often in need ot referencing another codebase.
Example: I’m coding a small web app for my 5 yearold to learn the clock with tts. This works perfect. I then started making a spelling app with the same approach. But here I’m having trouble getting the tts to work on different devices. It would have been extremely helpful to reference the complete codebase for my clock-app and say “Look at this implementation of tts, this works”.
How do you guys do this?
Hey @Olleman82,
Welcome to the Cursor forum, and thanks for trying Cursor out!
There are two ways you could do this, both with advantages and disadvantages.
- You can open the old project, and copy snippets of the working code into the chat/composer in the new one, so the AI can see the existing code
- You open the folder above each codebase, so that all the apps are present in the file explorer bar on the left. Then you are able to @ them for the AI to see.
Both have disadvantages, so it’d be down to you to see which works best, but do let me know if you have any further questions!
I also have a question that is why cursor does not use the latest version of vscode?
Welcome to coding! Love how you’re teaching yourself by building learning tools for your 5 year old. I have built similar tools for my 8th grader this school year and it has been really gratifying for both of us in so many ways.
When I want Cursor to be able to reference another codebase, I’ll add the reference codebase as a directory in the root of the codebase I am working on, and I’ll give the directory a name that starts with REFERENCE_
By adding a term like ‘reference’ to the directory name, the model usually understands that this directory is not meant to be part of the codebase we’re developing and is provided solely as a reference.
You could also include a line in your .cursorrules file explaining the purpose of this directory and that it should only be used as a reference and never be edited.
3 Likes
Thanks, that’s a good tip because the main problem with that approach is that cursor keeps misstaking this code as a part of the main codebase. I’ll try that name on the folder in conjunction with cursorrules.
As a small side note: Sometimes I see competitions online about how AI has changed the way people work or impacted their lives. For me, the answer is nothing less than that life is just a bit more fun right now. I’ve never been able to code but have always had a good understanding of the logic. Since Cursor came along, I’ve been coding all sorts of things. Sure, it’s a bit of back and forth, and just like many others, I’ve torn my hair out several times because Cursor made changes to parts of the code it should have left alone. But in between, it’s magical to be able to develop full-stack applications and also get help from AI to set up everything around it, like Google Cloud Console or a connection to a database like MongoDB.
Sorry for a bit of rant 
1 Like
This is how I got around it, I did not test it with github, my repo is in ado and I used ssh, ask the AI to reference the repo with the command:
git ls-remote [email protected]:v3/myorg/myproject/myrepo
obviously you need to make sure your local pc can access that repo, I always prefer to access my repos without a password using ssh keys.
this worked for me, good luck.