Control+单击功能在 Delphi XE 中不起作用
在 Delphi 7 中,每当我按住 Control 键并单击某个函数/过程时,它就会转到该函数/过程。但它在 Delphi XE 中不起作用 - 至少不是所有功能都起作用。我在 ExtUtils.pas 中有一个名为 Associate 的函数 该函数已正确编译,因此编译器可以找到 ExtUtils.pas(当然,ExtUtils 已添加到 Uses 子句中,并且其文件夹已添加到“库路径”中)。但是,当我按住 Control 键并单击该功能或单位名称时,它不会将我带到那里。
有办法解决这个问题吗?
更新1: 此外,按住 Control 键并单击函数(在当前单元中声明)不会将光标移动到声明该函数的 INTERFACE 部分。
更新2:
我临时将 ExtUtils 单元放入项目文件夹中,现在它可以工作了。因此,Control+Click 本身可以工作,但 IDE 似乎无法找到该单元,即使它的文件夹存在于库路径和浏览路径中。
类似报告:
http://webcache.googleusercontent.com
http://webcache.googleusercontent.com
http://cc.embarcadero.com/Item/28269
这里有一份报告(参见下面的答案)
新测试:
我已经完全卸载了Delphi(并手动删除了文件和注册表残留物)。然后又重新安装了。除了 CodeSite 之外,没有安装任何其他工具,甚至没有安装数据库。然后我创建了一个新项目。它包含一个按钮。当我单击该按钮时,它会运行 TestMe 过程,该过程在名为 TestUnit.Pas 的外部 PAS 文件中定义。我在库路径和浏览路径中添加了该库的路径。但是 Control+Click on TestMe 程序仍然无法工作!如果我将鼠标悬停在 TestMe 过程上,弹出窗口会显示“在 TestUnit 中声明”,其中“TestUnit”一词是一个蓝色链接。如果我单击它,我会听到 Windows 系统声音,但 IDE 不会将我带到那里(到设备)。
TestMe 程序是这样的:
procedure TestMe;
begin
Beep(800, 500);
end;
如果我按住 Control 键并单击 Beep 程序,它会将我带到 Windows.pas。所以,这是有效的。 如果您想要进行不同的测试,请告诉我。
更新:
现在可以了!没有任何明显的原因!我只是打开并关闭并编译了该项目。但除了这两个之外,我没有对 Delphi 进行任何更改: AutoSave options->编辑器文件和项目选项。
更新:
这不可能!!!
因此,现在当我按住 Control 键并单击 TestMe 过程时,我可以访问 TestUnit.pas 文件。 因此,我将不想在初始测试中(Delphi 重新安装之前)工作的原始 PAS 文件 (ExtUtils.pas) 移至 TestUnit.pas 所在的同一文件夹中。你猜怎么着:我可以打开(使用 Control+单击)TestUnit.pas,但不能打开 ExtUtils.pas!!!!
Delphi 的行为如此奇怪且不一致!
更新:
我编辑了 ExtUtils.pas,现在无法再次打开 TestUnit.pas。 Ken White 不会让我说 Delphi 可能存在错误。所以我不能将“bug”与“Delphi”一起使用。有人可以帮我把这些词拼凑起来吗?
更新:
我完全删除了对 ExtUtils.pas 的任何引用 - 因此我将项目恢复到它可以工作的位置(使用 TestUnit)。但现在这个错误仍然存在。即使几秒钟前它与 TestUnit 一起工作,现在它也不再工作了。
更新:
现在我意识到一件重要的事情:在我的源代码(在测试项目中)中,我有一行可编译代码:
procedure TForm1.Button1Click(Sender: TObject);
begin
TestMe;
end;
此代码不会出现蓝点 - 因为它不会被编译。在程序运行的那几分钟里,我看到了蓝点。 我还排除了“自动保存选项->”编辑器文件和项目选项可能是导致此问题的原因。
更新:
我找到了解决问题的方法......几分钟:我将项目和库移动到不同的文件夹中(任何位置都可以)。 Ctrl+单击将起作用一段时间。如果我将文件放回到原始文件夹中,它甚至可以工作。因此,Delphi 似乎保留了某些文件的某种缓存。只要缓存被破坏并且保留缓存,control+单击就不起作用。但是,当我移动文件时,它必须重新创建该缓存,以便它可以正常工作,直到问题再次出现并将其存储在缓存中。
In Delphi 7 whenever I control+clicked a function/procedure it took me to that function/procedure. But it is not working in Delphi XE - at least not with all functions. I have a function called Associate in ExtUtils.pas
The function is correctly compiled so the compiler can find the ExtUtils.pas (and of course the ExtUtils is added to the Uses clause and its folder its added in 'Library path'). But when I control+click the function or the unit name, it doesn't take me there.
Any way to fix this?
UPDATE1:
Also, Control+Click on a function (declare in the current unit) does not move the cursor in the INTERFACE section where the function is declared.
UPDATE2:
I temporary put the ExtUtils unit in project's folder and now it works. So, the Control+Click by itself it works but it seems that the IDE has problems finding the unit even it its folder is present in Library Path and Browsing Path.
Similar reports:
http://webcache.googleusercontent.com
http://webcache.googleusercontent.com
http://cc.embarcadero.com/Item/28269
One report right here (see answers below)
New test:
I have fully uninstalled Delphi (and manually delete the files and registry leftovers). Then reinstalled again. NO additional tools except CodeSite were installed, not even the databases. Then I created a new project. It contains a button. When I click the button, it runs the TestMe procedure which is defined in an external PAS file called TestUnit.Pas. I added the path to this library in Library Path and Browsing Path. But the Control+Click on TestMe procedure is still not working! If I hover the mouse over the TestMe procedure, the pop-up says "Declared in TestUnit", where the 'TestUnit' word is a blue link. If I click it I hear a Windows system sound but the IDE doesn't take me there (to the unit).
The TestMe procedure is this:
procedure TestMe;
begin
Beep(800, 500);
end;
If I control+click the Beep procedure, it takes me to Windows.pas. So, this is working.
Please let me know if you have in mind a different test.
UPDATE:
And now it works! Without any apparent reasons! I just open and closed and compiled the project. But I make no changes to Delphi except these two: AutoSave options-> Editor files and Project Options.
UPDATE:
This cannot be!!!
So, now I can access the TestUnit.pas file when I control+click on TestMe procedure.
So, I moved the original PAS file (ExtUtils.pas) that didn't wanted to work in my initial test (before Delphi reinstall) in the same folder where TestUnit.pas is. Guess what: I can open (with control+click) to TestUnit.pas but not the ExtUtils.pas!!!!
Delphi acts so strange and inconsistent!
UPDATE:
I edited ExtUtils.pas and now I cannot open AGAIN TestUnit.pas.
Ken White won't let me say that Delphi could possible have bugs. So I cannot use the 'bug' together with 'Delphi'. Can anybody put these words together for me?
UPDATE:
I totally removed any reference to ExtUtils.pas - so I restored the project to the point where it worked (with TestUnit). But now the bug persists. Even if few seconds before it worked with TestUnit now its not working again.
UPDATE:
Now I realize an important thing: in my source code (in the test project) I have a single line of compilable code:
procedure TForm1.Button1Click(Sender: TObject);
begin
TestMe;
end;
The blue dots does not appear for this code - as it wouldn't have been compiled. In those few minutes when the program worked, I have seen the blue dots.
I have also excluded 'AutoSave options-> Editor files and Project Options' as a possible cause for this issue.
UPDATE:
I have found a way to fix the problem... for few minutes: I move the project and the library in a different folder (any location will do it). The control+click will work for a while. It even works if I put the files back into the original folder. So, it seems that Delphi keeps some kind of cache of some files. As long as the cache is broken and it keeps the cache, control+click won;t work. But when I move the files, it has to recreate that cache so it will work until the issue reappears and it is stored in the cache.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(10)
这里我们有 5 位使用 Delphi 2010 的开发人员,还有 2 位也使用 XE,我们在按住 Ctrl 键单击时遇到了与您相同的情况。它似乎随机停止工作。我们永远找不到解决这个问题的模式或解决方案。所以我们时不时会听到小隔间里传来咒骂声……
当这种情况发生时,我会使用shift-ctrl-F进行搜索。
西尔万
Here we are 5 developers using Delphi 2010 and 2 also using XE and we are experiencing the same thing with the Ctrl-click as you. It seems to stop working randomly. We never could find a pattern or a fix for that. So from time to time we hear swearing coming from cubicles...
When that happens, I use shift-ctrl-F, to do a search.
Sylvain
首先感谢大家针对这个问题给出的提示。也许这是很久以前的问题了,但最后,经过多次尝试,我认为问题原因实际上是在“项目源代码”
IDE版本中:Delphi XE
请尝试:
在项目选项中>>> Delphi编译器>>编译,确保:
调试信息:true
符号参考信息:
删除{$REFERENCEINFO OFF}
或者改为 {$REFERENCEINFO ON}
注意,第 2 步非常重要,即使第 1 步完成,没有第 2 步仍然无法浏览源码。
First, thanks for you all to give hints about this problem. Maybe this is a question long time ago, but at last, after tried many many times, I think the problem cause is, actually, in the "project source code"
IDE version: Delphi XE
please try:
in the Project Options >> Delphi Compiler>>Compiling , ensure:
Debug Information: true
Symbol Reference Info: Reference info
remove {$REFERENCEINFO OFF}
or change to {$REFERENCEINFO ON}
Note that step 2 is very important, even step 1 done, it still can not browse source without step 2.
我使用的是 Delphi 5,按住 Ctrl 键单击也有问题,我不知道它是否仍然在新的 Delphi IDE 中工作,但我可以使用 CTRL-SHIFT-UpArrow 或 DownArrow 从声明到实现。
希望有帮助。
I'm using Delphi 5 and the Ctrl-click have also problems, i don't know if it still working in the new delphi IDEs but i can go from declaration to implementation using CTRL-SHIFT-UpArrow or DownArrow.
Hope it helps.
Delphi 中始终有这两个不同的选项:
库路径 - 编译应用程序时使用。
浏览路径 – 由 Code Insight 使用,即在按住 Control 键单击标识符时。
您需要检查第二个。它必须包含您尝试使用 Ctrl+Click 导航的源文件的路径。
There have always been these two distinct options in Delphi:
Library path – used when compiling your app.
Browsing path – used by Code Insight, i.e. when control-clicking identifiers too.
You need to check the second one. It must include the path(s) to the source files you are trying to navigate with Ctrl+Click.
我发现,如果我在界面部分使用记录类型并且它不是由类型表达式定义的,则 Ctrl-Click 和其他跳转功能(Ctrl+Shift+向上/向下)将不起作用。
使用上面的代码,我无法使用 Ctrl+Shift+Down 跳转到该过程的实现。我必须使用的修复:
使用 Delphi XE4 进行测试。
I've found that if I use a record type in the interface section and it's not defined by a type expression, Ctrl-Click and other jumping functions (Ctrl+Shift+Up/Down) won't work.
With the code above I can't jump to implementation of the procedure with Ctrl+Shift+Down. The fix I have to use:
Tested with Delphi XE4.
备查。使用 Delphi 2010,我发现
interface
部分中virtual
前面的;
会有所不同;此
;
字符可能会破坏 CTRL+Click(代码洞察)功能。尽管如此,编译得很好。For future reference. Using Delphi 2010 i have found that a
;
precedingvirtual
in theinterface
section makes a difference;This
;
character can break the CTRL+Click (code insight) functionality. Compiles fine nonetheless.我刚刚在 Delphi 11 中创建了一个包含两个项目的新组项目。之后,我在使用 Ctrl + Click 跳转到函数时遇到了问题。我右键单击 groupproject 并执行“Clean All”,然后“Build All”,之后它再次为我工作。
I had just made a new groupproject with two projects in Delphi 11. After that I was having problem using Ctrl + Click to jump to functions. I right clicked the groupproject and did "Clean All" and then "Build All" after that it was working for me again.
(符号参考信息)除非启用调试信息和本地符号(见上文),否则此选项无效。
代码补全和代码导航功能 (Ctrl+Click) 仅在“符号参考信息”设置为“参考信息”时才起作用。
(Symbol Reference info)This option has no effect unless Debug information and Local symbols (see above) are enabled.
Code completion and code navigation features (Ctrl+Click) work only when Symbol Reference info is set to Reference info.
解决了!
它对我有用,更改代码洞察类型。
Solved!
It works for me, change the Code Insight type.
这种情况经常发生在我身上,特别是当同时打开两个 IDE 时。
我发现解决这个问题的方法是:
此时,代码导航(Ctrl+单击)应该可以工作。
This happens to me quite often, specially when two IDE is opened at the same time.
The way I have found to fix this is:
At this point, the code navigation (Ctrl+Click) should work.