开发者

Text editor with function calls references

In the DOS era I used a text editor (forgot the name) which had a outstanding feature. Whenever i was over a function call, hitting a key combination it took me to the function definition. Also, when I was in the function definition, I was able to see all calls to that function. Something like

This function is called from:

  • function1, line 154, source1.c
  • function3, line 500, source2.c

I loved this feature and I miss it. Is there any actual editor with a feature like this?

I'm on windows, but if I can get this function, i'm capable of buy a mac :-D (kidd开发者_开发知识库ing)

Update I'm using php. My example was with .c files because I used that editor with c


The most recent versions of Kate, KDE's advanced text editor, come with a plugin called ctags that does exactly what you want. Since KDE 4, you can install some KDE programs in Windows thanks to the KDE on Windows project. Kate is one of those you can install.

Once you have launched it please go to Settings -> Configure Kate..., choose Plugins from the left pane and enable the ctags plugin.


Since your example returns function call results from multiple files, you probably want not a simple text editor but rather an IDE (Integrated Development Environment) for C. What you describe is a standard feature probably present in every modern-day C(++) IDE. From my personal experience, Visual Studio (e.g. Visual C++ 2008 Express Edition) supports both "Go to definition" and "Find references".


As mentioned previously, this is possible on just about every modern editor. To name a few alternatives in case you're still looking:

ctags has been mentioned. cscope improves on ctags by actually parsing the code so that it can distinguish between, say, the search string in a comment and the search string in actual code. Not sure how it handles callbacks in PHP, since you guys just pass in the function name as a string, right?

vim integrates with ctags and cscope, as does emacs.

vim, I believe, also has a built-in ability to go from a call to the definition, and (implemented as simple string searching) to cycle through calls of a function. It also has the neat feature of querying documentation (by default, man pages, but configurable to other things) on a function name. These are one one-keystroke commands. vim is available on Win32 either as a text-mode client or a GUI app (called gvim).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜