智能文件搜索窗口可以忽略空格并在代码中搜索?
有谁知道一个基于Windows的搜索工具,易于使用并且是程序员 友好的。
我正在寻找的功能:
忽略搜索中的空格
=能够
myTestFunction ( $parameter, $another_parameter, $yet_another_parameter )
{ doThis();
使用不使用正则表达式的查询
myTestFunction($parameter,$another_parameter,$yet_another_parameter){doThis();
进行查找。
“语义上”搜索代码(对我来说,它必须是 PHP):
- 仅在注释中搜索
- 仅在函数名称中
- 搜索 搜索名为 $xyz 的参数
- 搜索(插入代码构造这里)只有
如果周围没有,那么是时候有人开发它了! :) 我为此开出了赏金。
Does anybody know a Windows based searching tool that is easy to use and is programmer
friendly.
The functions I am looking for:
Ignore white space in search
= capable to find
myTestFunction ( $parameter, $another_parameter, $yet_another_parameter )
{ doThis();
using the query
myTestFunction($parameter,$another_parameter,$yet_another_parameter){doThis();
without Regexes.
Search code "semantically" (for me, it would have to be PHP):
- Search in comments only
- Search in function names only
- Search for parameters that are named $xyz
- Search in (insert code construct here) only
If there is none around, it's high time somebody developed it! :)
I have opened a bounty for this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
请参阅我们的 SD 搜索引擎。这是一个语言敏感的搜索引擎,旨在搜索大型代码库,具有针对 C、C++、Java、C#、COBOL、JavaScript、Ada、Python、Ruby 和许多其他语言的特殊语言分类器,包括您的特定目标语言 PHP ( PHP4 和 PHP5)。
我认为它可以满足您的所有要求。
它对语言元素进行索引,因此跨大型代码库的搜索速度非常快(Linux Kernal ~~ 750 万行 --> 2.5 秒)。 (索引步骤运行
在 Windows 上,但显示引擎采用 Java。)
搜索命中显示在单行上下文命中窗口中,其中显示文件和行号,以及突出显示命中的行。单击命中将显示源代码,选项卡会适当展开,即使对于具有奇数行计数规则的语言(例如 GCC WRT 表单字符),行计数也会正确,并突出显示命中行和命中文本。单击源窗口将启动您最喜欢的文件编辑器。
因为它理解语言元素,所以它忽略特定于语言的空白。它会跳过评论,除非您坚持要检查它们。因此,搜索会忽略空格、注释和行边界(如果语言认为行边界是空格,这就是存在特定于语言的扫描器的原因)。查询语言允许您指定所需的语言标记(引号中的特定标记,或通用标记,例如标识符 I、数字 N、字符串 S、运算符 O 和标点符号 P),并对标记值以及一系列代币。
您的示例搜索:
将精确地向搜索引擎表达为:
但可能会更容易(更少键入)找到它:
其中 I=myTest* 表示以 myTest 和 开头的标识符>... 意思是“附近”。
如果您坚持的话,搜索引擎还提供对文本的正则表达式搜索。
所以你仍然有类似 grep 的搜索(比索引搜索慢很多)
但也有命中窗口和源显示窗口。
See our SD Search Engine. This is a language-sensitive search engine designed to search large code bases, with special language classifiers for C, C++, Java, C#, COBOL, JavaScript, Ada, Python, Ruby and lot of other languages, including your specific target langauge PHP (PHP4 and PHP5).
I think it does everything you requested.
It indexes the language elements so search across large code bases are extremely fast (Linux Kernal ~~ 7.5 Million lines --> 2.5 seconds). (The indexing step runs
on Windows, but the display engine is in Java.)
Search hits are shown in one-line context hit window showing the file and line number, as well as the line with the hit highlighted. Clicks on hits bring up the source code, tabs expanded appropriately, and the line count right even for languages which have odd line counting rules (such as GCC WRT form characters), with the hit line and hit text highlighted. Clicking in the source window will launch your favorite editor on the file.
Because it understands language elements, it ignores language-specific whitespace. It skips over comments unless you insist they be inspected. Searches thus ignore whitespace, comments and lineboundaries (if the language thinks lineboundaries are whitespace, which is why there are langauge-specific scanners). The query language allows you to specify which language tokens you want (specific tokens in quotes, or generic tokens such as identifiers I, numbers N, strings S, operators O and punctuation P) with constraints on the token value as well as a series of tokens.
Your example search:
would be expressed to the search engine precisely as:
but it would probably be easier (less typing) to find it as:
where I=myTest* means an identifier starting with myTest and ... means "near".
The Search Engine also offer regular expressions searches on the text, if you insist.
So you still have grep-like searches (a lot slower than indexed searches)
but with the hit window and source display windows too.
我使用 ack 确实成功地完成了这种事情,特别是在尝试在大型代码库中查找内容时。我自己在 Linux 上运行它,但我看不出它有什么理由不能在 Windows 或至少在 Cygwin 上运行。检查一下,我想您会发现它正是您正在寻找的。
I use ack really successfully for this kind of thing, particularly when trying to find things in large codebases. I run it linux myself but I don't see any reason why it won't run on windows or in Cygwin at the very least. Check it out, I think you'll find it is exactly what you're looking for.
为此,您可以(并且我认为应该)使用一些自定义代码
token_get_all()
另请参阅可用令牌
一个简单的正则表达式就足够了。这取决于您的正则表达式库,但大多数都带有空格修饰符/标志。
For this you could (and I think should) use some custom code using
token_get_all()
See also the available tokens
A simple regex should be sufficient. It depends on your regex-library, but most come with a whitespace modifier/flag.
对于 Windows 桌面搜索,我使用 Agent Ransack。我用它来替代 Windows 搜索。
您可以使用正则表达式,但如果您想避免直接输入它们,可以使用一个很好的输入屏幕。
For my Windows desktop search, I use Agent Ransack. I use this as a replacement for the windows search.
You can use regular expressions, but there is a nice entry screen if you want to avoid entering them directly.
查看 Google 桌面 API,它有一组非常强大的方法来完成您正在寻找的事情。
当然,它需要您安装 Google 桌面。
稍微查看一下之后,它提供了一些功能,但并不像您所需要的那么具体。
Take a look at Google Desktop API, it has very powerful set of methods to do what you're looking for.
Of course it requires you to have the Google Desktop installed.
After reviewing it a little, it provides some functionality but not that specific as what you require.
我真的很喜欢 Crimson Editor 并且它允许 RegEx 搜索。在过去的六年里,它对我帮助很大。我认为它会满足您的需求。尝试一下。
I really like Crimson Editor and it allows RegEx searches. It has helped me a bunch over the past six years. I think it will fit your needs. Try it.
我使用 TextPad 在 Windows 中搜索代码文件。它有一个非常方便的在文件中查找功能(搜索/在文件中查找),您可以使用正则表达式来满足任何搜索要求。在搜索结果中,它将列出文件位置、行号和该行的片段。
I use TextPad for searching code files in Windows. It has a very handy find-in-files function (Search / Find In Files) and you can use regex which should meet any search requirements. In the search results it will list the file location, line number and a snippet from that line.