Re: I want to search my project source code

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Matthew Wilson <matt(at)tplus1(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: I want to search my project source code
Date: 2007-10-29 14:00:37
Message-ID: 20071029140037.GB2517@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lane wrote:

> I wouldn't recommend trying to use a standard FTS to index code:
> code is not a natural language and the kinds of searches you usually
> want to perform are a lot different. As an example, I glimpse for
> "foo" when looking for references to a function foo, but "^foo"
> when seeking its definition (this relies on the coding conventions
> about function layout, of course). An FTS doesn't think start-of-line
> is significant so it can't do that.

+1. The nice thing about a tool that understands code is that you can
query it in ways that make sense to code. For example I can search for
"all files that include foo.h" or "all callers of function bar" or "all
occurences of the symbol baz". I use cscope for this, which integrates
nicely into my text editor (vim), and others have told me they use
kscope which puts it inside a nice GUI window, if you care about such
things.

--
Alvaro Herrera http://www.amazon.com/gp/registry/5ZYLFMCVHXC
"I would rather have GNU than GNOT." (ccchips, lwn.net/Articles/37595/)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message davidrboyer 2007-10-29 14:02:41 postgresql in PHP
Previous Message Albe Laurenz 2007-10-29 10:13:31 Re: Stored Procs Vs User Defined Functions vis-a-vis UDF's in Postgresql