Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How best to deal with gigantic source code files in Visual Studio

I'm working on a project which makes substantial use of code generation. Some of the files it generates contain >0.25 million lines of code. VS (2K5) doesn't cope too badly, but R# (4.01) throws an out of memory exception every two minutes or so.

Splitting them out into partial classes/separate files isn't an option in the immediate term, though it may be later.

Are there any clever IDE tricks to dealing with this?

EDIT: so people are immediately saying (very sensibly) 'don't have a file that big' and suggesting ways to break it out into smaller files.

That's fine, but I'm on a time-boxed task taking a look around and deciding what to optimise. My problem is very specifically 'how to view an insanely big file in an IDE without pain', not 'how to refactor the project'. For purposes of the question please imagine the file is read-only. :)

like image 206
alexis.kennedy Avatar asked Oct 16 '08 09:10

alexis.kennedy


2 Answers

I would at least change huge files extention to something like .cpp_gen or .cpp_huge to remove syntax highlighting, outlining etc. and then reassign build tool back to C/C++ compiler tool for them.

like image 183
eugensk Avatar answered Sep 23 '22 17:09

eugensk


Seems like this R# tool (is that Resharper?) is the problem. Can you disable it? Otherwise, changing the file type for the generated code might make sense - presumably, you aren't going to be doing major editing on those files, so losing syntax coloring and other features specific to source files wouldn't be an issue.

like image 30
Mark Bessey Avatar answered Sep 23 '22 17:09

Mark Bessey