Thursday, December 17, 2015

Expanding Source Files

The first version of my source code viewer had a fatal flaw: It could only display one file at a time.

When I code, I usually break things up into several files.

I don't want to open every file; So, I took advantage of the fact that PHP has two ways into include a file: include() and require(). The code viewer will put a link to the code if included with include(). If I use require() it will include the code from the required file in line and light up the line with a purple background.

You can expand and hide the required code by clicking on the line.

As mentioned in the last post. I am trying to write this program in vim and vim is driving me batty.

I wanted the program to include the files with a recursive call. But something wasn't working.

I took the low road and wrote the code so that it buffers the code from the various files and re-orders them the way I like.

Anyway, this exercise of writing a program in vim was very useful as it showed me how the tools one uses to write code affects the code.

Here is the current version of the code viewer:

Hmm, I just tried saving this post by hitting esc and typing :w. I appear to have gone off the deep end.

No comments: