Delphi 10.4.1 is a quality-focused release, and this goes for code completion too! As well as helping you mimic classic code completion behaviour, we’ve fixed and tweaked many items.
When RAD Studio 10.4 was released, we redesigned Code Insight. While old (‘classic’) code insight is still available as a setting, by default Delphi now uses an asynchronous, non-blocking technology for code completion and related features. It means the IDE should not pause while typing, and you can use code completion while debugging, as well as many other benefits (searching completion results, for example.) You can read more about the tech here.
In 10.4.1 we’ve focused on polishing code insight. Because 10.4.1 is a quality release, there are very few new features – there are some new settings! – but the majority of the work is resolving bugs and tweaking behaviour. Here are some things you may want to know about: new settings, key fixes, and some special notes for very large projects.
Table of Contents
New Code Completion Settings
Underlining Matches
10.4’s new code completion shows more results than old classic completion, by also listing items not just that start with what you typed (the ‘filter’ text), but that contain what you typed. (In 10.4.1, there is a setting to control including these extra items: see below.)
This is useful because it lets you explore and search the completion list by typing. Sometimes, it can be hard to see why a particular result is included in the list, and so in 10.4.1 the matching part of a symbol is now underlined.
In this screenshot, you can see that ‘ScaleFactor’ was included because it contains ‘act’.
You can turn underlining off in the Options dialog – see the very next section for info on new settings.
Getting Classic Code Completion Behaviour
By default, the new code completion does not completely copy the old classic code completion behaviour. It shows more results, and uses a different algorithm to auto-select the best item in the list.
In 10.4.1, we added four settings, which combined allow you to get exactly the same behaviour as classic completion. All four are on the new Insight Options tab of the UI > Editor > Source page in the Options dialog.
‘Filter text is underlined’ controls the new feature to underline the match, noted above.
To mimic classic code completion you can change the settings like so:
- ‘List all symbols that start with the filter first’: on
- ‘Select shortest matching symbol’: off (instead it selects the closest in scope)
- ‘Filter text is underlined’: off
- ‘Show symbols that contain filter’: off (though we do recommend keeping this on; it adds more and useful results)
Key Quality Fixes
The 10.4.1 What’s New page lists many fixes, and I recommend you read the list. However, some that are particularly worth pointing out include:
- Both memory usage and performance are improved. The language server should use less memory, and it should be faster
- Some improvements targeted specifically at very large projects (and thankyou to our beta testers here)
- Packages are very much improved – there are several points in the documentation
- Error Insight (‘red squigglies’) sometimes had a delay updating when an error was resolved, and sometimes the length of the red squiggly line was wrong; both are fixed
- Issues where Tooltip / Help Insight did not always show full information are fixed
- Many other fixes – I truly do recommend you read the What’s New, it’s over a page-long list of changes to Code Insight alone.
Very Large Projects
Noted above are some changes for very large projects. Here is a quote from one of our customers about 10.4.1, which they have kindly allowed me to share:
Congratulations to the LSP team!
I have now managed to open&run our flagship app on 10.4.1. And – magic! – code completion finally works in our IFDEF-ridden main unit. I think last time code completion worked there was somewhere around D5 times …
It takes about 15 sec to work for the first time (it probably feeds enormous amount of units to the LSP) but after that it is a pure bliss to use!
Thank you!
This particular app is just under 3 million lines of code. And it’s the first time Code Insight has worked in that location since Delphi 5.
Every release, we continue to improve Delphi and C++Builder. 10.4.1 is notable because it’s a quality-focused release. We will continue to improve and change the IDE every time we ship a new version, and we hope that the code insight fixes alone, let alone the 800+ other fixed bugs, make 10.4.1 a very worthwhile version for you to install.
Design. Code. Compile. Deploy.
Start Free Trial Upgrade Today
Free Delphi Community Edition Free C++Builder Community Edition
You should make sure you indicate Code Completion is for Delphi ONLY.
Still no fix for C++ again David ?
We’re still working on C++ code completion. Stay tuned…
I have got the RAD Studio 10.4.1 and no Insight options in the Options dialog :/
Sorry, my fault. I was on the another PC, ofcourse with 10.4 😐
No worries! I was surprised, and about to ask you for the build number to check 🙂
I also had a hard time finding it:
Options->User interface->Editor->Source-> page of Code Insight
Looks good, but could be that great if LSP would finally support the new inline var features – along with “find declaration” and so on…
Hi Gerad – it should support inline variables. Find declaration has some issues and occasionally goes through another code path. What specific issues are you seeing? It would be great if you can link QPs, please.
I am on “Embarcadero® Delphi 10.4 Version 27.0.38860.1461 – ” and inline variables still causes problems with the Ctrl+Alt+N & Ctrl+Alt+P function. The list of methods shown will stop at the method with inline variables. I hope I am on the wrong build, but I believe that should be 10.4.1
Hi David, thank you for the update. Yes, a lot of problems has been resolved aftery years of waiting.The hint with D5 is telling me that you really have quality problems. BUT: I think it’s very good that it is finally being addressed publicly!
But Code Insight still have problems and also the squigglies still have problems (do not appear or won’t disappear). The IDE still have a lof of stability problems. I dont want repeat the problems here. You know it.
From my point of view (paying customer since Turbo Pascal 2.0) it is at last a huge step. But is a only a first step in the right direction.
Please go this way. More attention to stability, bug fixing AND documentation. Be more offense with problems
best regards
Sven
Hi Sven,
Odd, I thought I replied to this yesterday! Re D5, I read it as that we are doing the right thing now.
Re red squigglies: we may have reports that cover this, but it’s always good if you can turn on logging and file a bug report showing exactly what’s going on for you. The bug report is on quality.embarcadero.com and info about logging is here:
http://docwiki.embarcadero.com/RADStudio/Sydney/en/Code_Insight_Reference#Filing_Bugs_and_Log_Files If your logs contain source code, you can email them to [email protected] with info about the report they apply to.
Good to know we’re going the right way. We plan to continue.
This is definitely a great improvement, thank you. The IDE is still pretty flaky but this is a definite improvement. Agree with Sven about the “squigglies” and the stability: code insight often just doesn’t work. But I’m staying positive and hoping that there will be more stability-related releases soon.
Re my reply to Sven, please turn on LSP logs and test with them: they will show what the issue is to our engineers. http://docwiki.embarcadero.com/RADStudio/Sydney/en/Code_Insight_Reference#Filing_Bugs_and_Log_Files
Hi David,
regarding “red squigglies” i have couple of suggestions on Structure pane:
* move them to separate window and dock that window to the bottom (similar to Messages. well, maybe you can add tab to Messages window, call it smth like “Live errors” and put all those interactive messages there). right now refreshing error list prevents to use Structure view normally
* make Structure pane state persistent as long as file is not changed. right now you can spend some time finding (or observing) something in Structure, then switch to other unit for a sec, then go back – and see that Structure is auto-refreshed and all your navigation and state is lost. this is very unproductive – especially for working with large units
PS. one more small suggestion regarding productivity: in Find references window provide an option to clear window content each time before new Find references action is to be executed. When exploring some code and using Find references feature (very cool feature btw!) many times – the window becomes overloaded very quickly. you can even make this behavior default. actually in most cases there is no need to collect searches.
PPS. i can provide lot more of input regarding speed of work and productivity, if necessary
I can agree with Mykailo, this pane update would be very helpful. BUT. First solve the existing bugs. I have the fear that new features would led to new bugs and currently it take years for embt to fix these. May be they can speed up their quality checks to a new level. A stable IDE would speed up things automatically (If your IDE chrashes every 30 minutes you know what I mean)
Thankyou Mykhailo! These are all great ideas.
Could you enter them in our feature request list please? This is quality.embarcadero.com (the same as when you file a bug report, but select type: Feature when creating an entry.)
You mentioned you have more to suggest – that’s great! Please add anything you want to. You can also email me at firstname dot lastname @embarcadero.com if you want to discuss them (I would ask you enter the feature requests in the site above, but we can certainly chat about them via email.)
for some reason i can’t login to quality.embarcadero.com with the same account i use to login to members.embarcadero.com
nope, logged in,
so its ok 🙂
added as RSP-30914, RSP-30915 and RSP-30916
also please take a look at suggestions on theming:
RSP-31034, RSP-31035, RSP-31036
Thankyou 🙂
LSP in C++ Builder 10.4.1 is improved but unfortunately not always useful. There is no code completion in header files. The identifiers presented in .cpp source files are typically incomplete.
I’m glad it’s improved, we have been working on it, but you’re right, it’s not always working as it should. We plan a big push for improvement.
Re header files, this is actually a very complex problem that other C++ language servers also struggle with. The basic idea is, a header is valid in the context of a file in which it’s included. So if you invoke code completion, which is parsed using the compiler (even if it’s in LSP, using clang internally) then how do you know how to parse it? You need to have some heuristics, such as, see if you can find a file where it’s included and invoke CC on that file but for the header it includes.
We do aim to tackle this; it’s on our radar.
Thanks David:
While on 10.4.1 for the first time I have autocomplete for C++ with limitations, there is no auto-completion whatsoever for Delphi with LSP. I also made the registry entries for LSP to generate logs and there are none. I don’t know how to get support or report any logs. This is not a good trend. My SA will run out later this year and out of options, I think I might just bow out at this point.
As to C++ LSP in headers, should not at at least local identifiers be recognized? Thanks again.
Hi Navid,
> there is no auto-completion whatsoever for Delphi with LSP. I also made the registry entries for LSP to generate logs and there are none. I don’t know how to get support or report any logs.
Just to check, did you close the IDE first before adding these registry items? http://docwiki.embarcadero.com/RADStudio/Sydney/en/Code_Insight_Reference#Filing_Bugs_and_Log_Files
And for the log path, C:\Users\\AppData\Local\Temp\DelphiLSP, it’s worth checking if it’s in another folder if your IDE is run with any unusual privileges, eg Admin.
If none of that solves it, Support is the next step. You mentioned you have active update subscription? You can file a support ticket here: https://www.embarcadero.com/support Click the button on the right, “Get Product Support”. They’ll be able to help with logs.
Thanks for looking into this. Logs are essential for us to fix the bug, and we would like to fix any bug like this that causes problems for you.
Thanks David:
Yes, I followed the instructions correctly. Since my last post, I uninstalled everything, cleaned up the Windows Registry and reinstalled 10.4.1. LSP finally activated and generated logs. I did stress testing, i.e. added a whole lot of GetIt packages after adding the IDE tools I use (some TMS, CodeSite Studio, MMX Code Explorer, Documentation Insight). LSP came on after each step.
As for Delphi, reserved words do not show up for autocomplete.
Create a class, add a private field and the field name does not show when declaring public properties.
Create an interface for the class. The unit compiles but LSP does not autocomplete any interface names and the interface declaration is marked as an error with a red squiggly line and listed as an error in the Structure view pane.
I will submit the log to Quality Portal for whatever it’s worth, but in my opinion, LSP was not ready for prime time.
Hi Navid – just to check, since we’ve been discussing both Delphi and C++ code insight, if you need C++ logs the procedure is different. Please see our QA staff member’s comment here: https://quality.embarcadero.com/browse/RSP-23599
where is the download?
cannot find it on
https://cc.embarcadero.com/RecentUploads.aspx
Please look on https://my.embarcadero.com/ . We’re moving away from CodeCentral. My.Embarcadero is a new site that lists your licenses, your downloads, etc. You can log in using your normal EDN credentials.
Delphi 10.4.1 The compilation of projects is 25% slower compared to the Delphi 10.3.3.
I have problems with LSP when I open project written in older 10.3 version (Delphi), LSP is not working, any advice? Thank you!
The best thing would be to contact Support, please, they may be able to help. https://www.embarcadero.com/support and click the ‘Get Product Support’ button on the right.
You can also turn on LSP logs and file a QP report (which Support may also ask you to do) – please see comments above for info. That will help our engineering team resolve any bugs.
Hey David, been pulling my hair out for the last couple of days. Have been migrating my old codebase to CLANG and C++ V17, and every time I hover over anything was getting “calculating” followed by “unable to find file: [the file i’m currently looking at!]”. Is this something wrong with C++ Builder or my particular setup? If I change back to the “classic Borland C++” it seems to kinda work, but my whole point was to move to the new CLANG compiler, something that Embarcadero is encouraging people to do. Should this break IDE functionality?
Thanks heaps for any insight you can provide.
That’s a bug. Maybe some day Embarcadero will start eating its own dog food and notice the product isn’t what they think it is..
Still happens with 11.1.5 which supposedly fixed C++ builders completion. It can’t even autocomplete a standard empty Windows application with 1 button added. “Calculating…” tooltip popsup for a second and that’s it.
Does this still happen if you save the project and reopen it? Code completion has issues with files that exist but are not on disk. (It’s fine if they are modified, ie are different in the IDE than on disk, but not fine if they exist only in the IDE and there’s no corresponding file at all.)
Where can it be turned off? It’s very annoying, impractical.
Yes, it is in the options.
To change Delphi between using LSP and the Classic Code Insight implementation, choose:
Delphi (Language Server Protocol): the new LSP support.
Delphi (Classic Code Insight): the old implementation of Code Insight used in 10.3.3 and earlier. When you select this option, you turn the LSP off.
http://docwiki.embarcadero.com/RADStudio/Sydney/en/Code_Insight_Reference#Changing_Code_Insight_.2F_LSP_Manager
Unfortunately the 64 bit debugger is still useless..
Is it right, that the new LSP in Delphi finds methods in units that not included in the uses? And is it possible that the unit with this method who not have declared in uses can be automatically added?
Right now, no, those aren’t features of LSP. (Sometimes it can show methods not in the uses clause in specific circumstances, but not often enough that we document it as a feature.) Both those are great feature requests which we’ve noted – thanks!
By the way, LSP has some good improvements in 10.4.2, coming soon.