Do you put anything in your code specifically for “Find in Project”?

Avatar of Chris Coyier
Chris Coyier on (Updated on )

During a having a team meeting the other day, a code formatting idea came up that I thought was super interesting. It had to do with formatting code in a such a way that made it easier to find what you were looking for later with any code editors “Find in Project” feature.

Here’s what it was.

When declaring a function in JavaScript, put a space after the function name and before the opening parenthesis, like…

function doSomething () {


That space between doSomething and () is perfectly fine. Then when you call the function, don’t use a space, like this:


It’s just a syntax convention.

But now, “Find in Project” is more useful. If we want to quickly find where that function was defined, we can search for “doSomething ()”, and if we want to find instances of where it is used, we can look for “doSomething()”.

You could extend the idea to classes or whatever too:

class myThing {

  constructor () {


  doThing () {



let example = new myThing();

I’d say that’s worth doing.

It reminds me of when I need to where a Ruby method is definied, I can always search for “def foo” since that “def ” is required for creating the method.

I can imagine a scenario where it might be useful to define base classes in CSS like .module { but then if it’s a variation or nested or used again for any other reason… .module{.

Here’s a classic:

Leaving TODO comments throughout your code base turns a “Find in Project” for “TODO” an instant list of things you need to work on. Surely that could be even more nuanced, incorporating things like priority levels and assignments. Perhaps even emoji’s to help like Charlotte suggested!

Here’s an interesting one:

I like the idea of “long names”. I suppose the longer and more descriptively you name things, the easier they are to search for and get specific results (avoiding repetitive matches like you would with very simple names).

Comments are a great place to leave things to search for. I often use a convention where I put my own name in the comment if I want people to know it was me leaving the comment, but it’s not necessarily for me.

.thing {
  overflow: hidden; /* [Chris]: ugkghk this fixed a layout thing but I didn't have time to figure out exactly why. */

A smattering of responses: