Jump to content
pyscripter

Found why LSP stopped working in Delphi 11.2 and 11.3

Recommended Posts

See [RSP-41949] LSP does not work when project includes modified file found in the search path - Embarcadero Technologies for details.   Has anyone been bitten by this?

 

Code Insight now works in my PyScripter project.   I thought that cyclic unit dependencies may be the cause and spent quite a bit of time reducing them.  I guess, that this was time well spent, but it was not the source of the LSP failures.

 

Edited by pyscripter

Share this post


Link to post
52 minutes ago, pyscripter said:

I regularly work on a project that has local forked copies of over a dozen Delphi RTL, VCL, and Fmx units. While LSP is not exactly stable, it usually works in 11.3. 

 

I do sometimes lose the ability to find symbol declarations with CTRL+Click, and in that case, CTRL+G often works instead. But it's not always broken for me.

 

Hopefully that QA report will help them fix a few more LSP bugs.

Edited by Brandon Staggs

Share this post


Link to post

@Brandon Staggs Could you please try the minimal project attached to the QA report.  Does it work for you?

I think the bug affects units that either use directly the forked units or units that depend on such units.

Edited by pyscripter

Share this post


Link to post

It does not work for me.

I've very likely bitten by this bug numerous times but I didn't know the reason until now.

Share this post


Link to post

@pyscripter

  • If the test is "Ctrl+click" in "Test;   (procedure)", in my IDE (RAD11.3 patch 1), the cursor goes to "procedure TForm1.Test;" as expected
  • when I click in "Winapi.Messages,"  (in uses clauses), the cursor goes to your new "Winapi.Messages.pas" in your project too!
    • if I delete this from "uses clauses", the cursor goes to "Winapi.Messages.pas in RAD sources folder" (as expected by default) and Ctrl+click in "Tests" still working as expected too
  • if is this, then all works as expected

Share this post


Link to post

@programmerdelphi2k

You are right. It works with WinApi.Messages.

I have added another project with JclSysUtils instead of WinApi.Messages. The project will compile fine if you have Jcl installed. LSP fails with that project. It also fails if you use System.Variants instead of WinApi.Messages. But in that case the project does not compile.

I will try to find out what triggers the failure.

Share this post


Link to post

@pyscripter

 

I has this case, normally, Code-Editor/LSP assistence stop code-complition work:

Example:

  1. im creating a new unit to create a class (any) basic nothing advanced. 1create 1 destroy, 1 method any
  2. then, I decide use "interface" in my new class, then...
  3. I create a new unit for my new "interface"... ok
  4. now, I go back to my unit class and add my unit-interface in my uses and add my interface in my class declaration (TInterfacedObject, ImyInterf....) as usual
  5. now, I try use new class-INTERFACED (now) in my form1 test, and the code-complition does not works anymore... (already known "red-lines" in Editor)
  6. summary: I need close the project, and re-opent it and all it's ok
  7. sometimes I see on window Messages: LSP starting

did you try this too?

Edited by programmerdelphi2k

Share this post


Link to post

It turns out that the causes of LSP failure were more complex than I originally thought.

In the attached project in TestCI-JclSysUtils LSP does not work. The project is relatively simple. It has three units

  • Unit1.pas (a form with one button)
  • uCommonFunctions.pas (contains three functions)
  • JclSysUtils (an exact copy of the Jcl unit)

With Jcl installed it compiles and runs fine.

 

Here is the interesting thing. LSP starts working if:

  • either you remove an unused import of JclPeImage from the uses clauses of uCommonFunctions
  • or you remove the "forked" JclSysUtils from the project.

Looks like LSP is a lot more fragile than is should be.   I was without IDE support in my a project, since Delphi 11.2 was released and it took substantial effort and a bit of luck to restore it.

 

TestCI-JclSysUtils.zip

Edited by pyscripter
  • Like 1

Share this post


Link to post

After working on 11.3 for months, my conclusion is that the LSP-based code completion and code navigation is much much unstable than the old non-LSP versions. I always have to kill the LSP server to get it back to normal...

  • Like 1

Share this post


Link to post
15 hours ago, pyscripter said:

It turns out that the causes of LSP failure were more complex than I originally thought.

Little has changed since Godzilla, or maybe some of that is back again.

 

I still use a clean bat when switching between 'Build Configurations', that limits the problem even today. What it does is delete all DCUs which exist from all but the current 'Build Configuration'.

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×