Hi,
Cursor 1.0 struggles to find relevant parts of code in my server.js file, which is around 6000 lines long. I deliberately kept the main code in a single file to make it easier to locate related sections.
Previously, Cursor 45.15 handled this large file just fine, but unfortunately, that version is no longer supported! (I really wish it still was).
Do you have any suggestions?
Would it make sense to add an intermediate step ā perhaps using an LLM that can handle large files to extract all the code related to the functionality Iām working on, and then include that extracted parts in my request in Cursor?
Is anyone else experiencing this limitation with Cursor?
Feeling a bit puzzled about the best path forward!
Janis
Hi @JanisS 6000 lines of code could be easily 60k tokens, and the model that makes edits may have difficulties with it.
Claude 4 Sonnet or Gemini 2.5 Pro can handle up to 120k tokens context in regular mode, however its not advisable to go close to the limit as can lead to hallucinations due to context pollution. At most this would give you a few requests per chat thread before context gets full.
From personal experience I would suggest to ask AI how to restructure the JS file into separate modules using Single Responsibility Principle or SOLID. Those approaches to programming give AI the info to separate parts that are independent into their own files and restructure the code.
Ideally you would not keep so much code in a single file as this is very impractical also for human programmers. When programming by hand I would keep functions under 150 lines and a file under 500 or 700 lines. The same applies to AI as all the different functionality in one file confuses it easily.