Been having this with most Delphi versions over the years, so I'm wondering if maybe it's just something wrong with my code or is this the expected behavior from the IDE..
Normally when you place the cursor over a procedure/function/variable etc you can press Alt+Up and it goes to wherever it was declared whether in the same unit or in separate ones, just like if you right-click and pick "Find Declaration", but very often this doesn't work, even if when you hover the mouse over and after a second it tells you like.. "Declared in xx.pas", but it still won't go there. Even if I type unitname.proc and try on the proc, it still doesn't jump to the proc. If I open the unit (ctrl+enter over the unit) first once, even if I close it afterwards, then it works.
Is there any reason why this happens?
This happens because the related systems are driven by their own special parser that's different from the one in the compiler, and it's been very buggy and poorly maintained for years now. It's been a known issue for a long time, but it's apparently pretty low-priority for the folks at Embarcadero.
Go to "Project">"Options...">"Compiler".
Here tick the following boxes:
"Debug information"
"Local symbols"
"Reference info"
Press "OK".
Restart Delphi.
This is solved the problem in my case (Delphi 7).
Good luck
I ran into this problem with the latest (as of 5/2/16) version of RadStudio (RadStudio/Delphi Berlin).
My settings, more or less, already matched those suggested by tcxbalage.
Here's the RadStudio Berlin equivalent:
Project | Option... | Delphi Compiler | Compiling | Debugging:
Local symbols: true
Symbol reference info: Reference info
Here's what I did that got the "Find Declaration" support working correctly:
1) I changed
Symbol reference info
to "Definitions Only".
2) Pressed "OK".
3) Reopened Project | Options and change "Symbol reference info" back to "Reference info". Pressed "OK".
4) Rebuilt my project.
Hope this helps anybody else who runs into the same problem.
Do you have set an output path for compiled units that contains an environment variable? That's what made CTRL+Click stop working for me.
I also encountered such a problem after switching to C++ Builder 10.4. Changing the "Use 'Classic' Borland compiler" setting to "true" helped me.
Related
I have a question about Xcode (Swift). Sometimes when I write an if statement. Something like this:
if(a == 2){
//do Sth
} else {
//do Sth
}
Xcode throws me an error: "Invalid character in source file"
I know it is no big deal and fixed by clicking on "Fix-it" but I want
to know what is the problem. That doesn't make sense to me...
My Xcode is on 7.2 and I am using Swift - I don't know if this is just a Swift problem.
For me it's the ESC key - it's completely reproducible! If I go to search and hit ESC in the search window I also find the occurrences marked - and can replace those with nothing. But it's not shown even with "Show invisible"!
final solution: Bind ESC keybinding to "Cancel". It's that simple.
I was having this problem. The way I solved it is by 1) copying whatever you have into Sublime Text or another code editor and having a look (you may need to enable viewing hidden characters). Mine had a code in there DC2 which is some sort of ASCII control character. For me it was caused by the fact that I had put the playground into manual execute and bound a keyboard shortcut to it that seemed to be entering that control character every time I executed it using the shortcut. I just changed the shortcut and removed the ASCII characters as I was able to see them in Sublime Text. (The link in the comments to the OP concerning left to right mode made no sense and didn't work for me.)
I encountered this problem when I was using a non-Apple keyboard with my iMac. Probably your case too. They add unnecessary control characters! One way to fix it in Xcode ischoose from the menu Editor>Show Invisibles and see if there are any unwanted characters where the error is being thrown and remove them.
Editor->Show Invisibles did not show the character that was causing a problem for me. No-break-space (u00a0) will be shown as a space with no "dot" indicator. However, that's really hard to see and I completely missed it the first time. Zoom helps.
One way I found to detect invalid characters is to use Visual Studio Code and enable the settings:
"editor.renderControlCharacters": true
"editor.renderWhitespace": "all"
This has the same visibility issue with no-break-space as Xcode, however it does show other special characters.
To make it more obvious and possibly detect more invalid characters, install the extension "ascii-unicode-escape" and follow the instructions.
I don't understand why Xcode allows these invalid characters, inserts them into your source files for no reason, and doesn't even give an option to detect them! I'm trying to write code, not secrets in invisible ink, damnit!! I guess it's less of an issue for compiled code, which will show an error, but not so convenient with shader code.
I'm having the same issue. I found a solution after extensive testing. Hopefully it could save others extensive hours of researching into this terrible Xcode experience.
The problem is I have a FILCO Minila keyboard, which has the 'App' key right next to 'left arrow'. I would accidentally hit 'App' when typing really fast, and it enters a 'DEL'(Data Link Escape, Unicode 0010) invisible character. It could only be seen when copy-pasted to Sublime. It's not even visible under Xcode's own 'Editor -> Show Invisibles'(Talking about good user experience...)
Magically this doesn't happen to Sublime or VSCode, only to Xcode. So no excuses for Xcode I guess?
The fix is to download Karabiner, an advanced keymapper for macOS, and invalidate the 'App' key or map it to something else. Karabiner would also invalidate your keymapping in the system default keyboard config. So you would have to remap stuff like 'cmd', 'alt' if you've customized them. If so, be sure to map both left & right modifier keys in Karabiner, because according to Karabiner's key event viewer, the system default keymap would map left_alt & left_cmd to right_cmd and right_alt... Just annoying as hell...
It took me 2 months to realize this problem and 2 hours to actually find out it's the 'app' key that's the culprit and fix it.
I'm using XCode 10.1.
With Xcode: Xcode does not help even after showing invisibles.
Then you can copy the code to Sublime Text => you will see these invisible characters which are the <0x0f>. Click the image to see in details.
With Sublime Text 3, it works!
=> Then you know where to remove the redundancies. Hope that helps!
Are you using the option ⌥ key for any keyboard shortcuts? This was my issue. It seems combining the option key with other keys can insert hidden characters.
For me, this happened when I used the ⌃+⌥+p shortcut in Xcode to resume the SwiftUI preview canvas. It added a 0x10 character. I discovered this, as other posters have recommended, by pasting the code from Xcode into Sublime Text.
(NB: I should have been using ⌘+⌥+p).
Is it possible - only compile/make source in C++ Builder (XE7) without the long delay of linking?
If yes, is there a shortcut key for it?
It would be very useful when I just want to check if my code compiles at a point, but don't want to execute it.
mauroaraujo is right - since BCB4 or thereabouts the Project menu has an item that is misleadingly labelled 'Build ' + current source file. This compiles the current .cpp file (compiler switch -c). The item description in the documentation is a bit misleading as well.
The standard keyboard shortcut is Alt+F9 - the same as it always has been ever since the times of Turbo C/C++ (with the possible exception of some early C++Builder incarnations). The shortcut might change or disappear when certain editor key mappings are selected, though.
There seems to be no direct equivalent to 'Syntax check' item that becomes available in the Project menu when the current source is a .pas file, but for most practical purposes it should be close enough.
What the IDE doesn't seem to have is a command for compiling all sources without linking (sort of like a 'syntax check all sources'). However, you may be able to build a custom target where the link phase is configured to do nothing.
Delphi 7 i am not able to debug my application as half the code in my delphi 7 form unit,as it is not showing blue dots on the left hand side gutter,not able to reach any of the break points when i run my application..
The way you explain it - if one unit has some breakpoints available, but others not, then it sounds like that code is unreachable / unused. The Delphi compiler is smart enough to the point where it does not compile any code which it detects is never used. And if it doesn't compile, then there is no way to use breakpoints there.
This is sort of a workaround but it works.
Build your app;
Delete the exe file generated just to be sure it will be created again;
Select all your code and paste it into notepad;
Save your "Blank" file into Delphi;
Select all the text from notepad;
Paste it again into Delphi file and save it;
Build your app again;
I had this same problem with a special character pasted into my source code.
If after doing this you still can´t compile just paste your code for us to review it.
Not sure if this is the problem, but Optimisation is turned on by default. The compiler could be removing code. When you debug, can see the code in the editor, but the breakpoint won't hit the lines that have been optimised out.
You can turn off optimisation in Project Options > Compiler > Optimization, but a better technique is:
* Project Options > Directories/Conditionals
* In the Conditional defines box, add "DEBUG" and click Ok
* Return and add "NDEBUG" and click Ok
* Now at the top of the file which you want to debug add this code:
{$IF Defined(DEBUG)}
{$O-} // Debug build
{$ELSEIF Defined(NDEBUG)}
{$O+} // Non-debug (ie. release) build
{$IFEND}
Then you can simply define the type of build as "DEBUG" when you want to debug. Set as "NDEBUG" just before release. Not sure if its your problem, but hope that helps.
Go to menu Project | Options...
Go to Tab Compiler
check all flags in Debugging frame
Sometimes some class methods or fields marked erroneous(that red underline) by IDE, but the project successfully compiled and executed(no error or warning).
If I hold mouse pointer on this erroneous sections I got this tool tip : "'TSomeClass' does not contain a member named 'SomeMethod'" or "Undeclared identifier 'SampleIdentifier'".
Is that a kind of IDE bug or am I wrong somewhere?
That feature is called Error Insight and is known not to work reliably. AFAIK you can't fix that. If it bothers you enough you'll have to disable it.
This is an old question, but I found it when searching for a similar issue. I have a large project group with over a dozen packages, and Error Insight was broken for only one of them. The issue appeared after upgrading to Delphi 10 Seattle.
In Project Options | Delphi Compiler, make sure "Use MSBuild externally to compile" is false. This fixed the Error Insight behavior in my project.
The debugger steps into the source code on errors (like with F7), but I want to restore the normal working mode where the Delphi basic DCUs (the library) are only compiled into my code, and the sources are not used in debugging.
For example, on an error in my program, the debugger is stepping into Controls.pas, into TControl.Click. The normal case (right after installation) is for Delphi to step over these methods.
Should I recompile Controls.pas without debug information? If so, how?
I extending this theme with additional information to better understanding:
We use Delphi6 Prof. what have problem with Mouse (System Error Code 5).
So we want to recompile to Controls.pas to replace the Mouse Position getter code.
Then:
I created a folder for it: "c:\D\Common\Delphi_Patches\Delphi_6\"
I put the original Controls.pas into it.
I modified the Controls.pas, replaced the position getter code.
I set the Delphi's Library path, set the first folder to "c:\D\Common\Delphi_Patches\Delphi_6\"
With these steps I can compiled the source with mouse-safe code.
Ok, but then the Delphi everytime steps into Controls.pas on F7, and on any exceptions - this is very "angermaker" thing.
No matter that I removed the "Controls.pas" from the Library path - then the debugger is finding the original "Controls.pas" for it, and opens it... :-(
We don't use "Use Debug DCU-s" in any codes.
I tried to remove "Debug Information" from compiler options, but it is no matter, the Delphi is opens the original Controls.pas...
So I search the way to Delphi don't step into "Controls.pas", but use my dcu...
I hope this provide better context to understand the problem.
I think that you need to Shift+Ctrl+F11 (tools/options) then in Compiler, uncheck "Use debug DCU"...Then if an exception occurs it wont break into the RTL or VCL sources.
Since you are compiling your own version of a Delphi unit, you can disable debug info in that unit. Add {$D-} to the source code of the unit(s) in question.
As I see the solution is:
create a project the uses only the new Controls.pas.
unset the "Debug information" option in compiler options.
build dcu
put the dcu into a library folder
hide the new Controls.pas from this library folders.
Wite this trick the I cannot "step into" controls.pas.
Regards: dd
I had this same problem with Delphi XE8.
You can untick the "Project >> Option >> Compiling >> Use debug .dcus" and it will continue tracing into System unit and so on.
I found that the best way to stop this is to open your Application.dproj file - which is in XML. In it, you can change the settings as follows:
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
<DCC_AssertionsAtRuntime>false</DCC_AssertionsAtRuntime> <--- note false
<DCC_DebugDCUs>false</DCC_DebugDCUs>
<VerInfo_Locale>1033</VerInfo_Locale>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<DCC_RemoteDebug>false</DCC_RemoteDebug>
</PropertyGroup>