remove that uses again -> code completion works again
This is Delphi 11.3 / WebCore 2.2.3.0 (I've noticed that with a few earlier versions already, not new that is)
Note: I am using an XData server with my current project and thus use all these TXDataWeb components and wondered why Code Completion is gone. So started digging, which component or unit would be responsible and was able to nail it down to that single unit. Other units may be affected, but I did not dig any further for now
Also, have you tried maybe reposition XData.Web.Dataset in the uses list, maybe moving it more to the beginning, so other units get precedence over it?
I an attempt to understand what's going on, I reduced the test case to a minimalistic one, which still shows the issue:
program CodeInsightBreaker;
{$APPTYPE CONSOLE}
{$R *.res}
uses
browserconsole,
XData.Web.Dataset;
type
TFoo = class(TObject)
private
FName: string;
public
property Name: string read FName write FName;
end;
var
LFoo: TFoo;
begin
Writeln('Hello World!');
LFoo := TFoo.Create;
LFoo.Name := 'Bar';
LFoo.Free;
end.
I noticed, that XData.Web.Dataset is not taken from the WebCore installation (as I though first), but from the XData installation I have on that machine as well. My XData version is 5.6 and not 5.12 which would be current. Can this be the source of the issue?
It's ifdef'ed as {$IFNDEF PAS2JS} on purpose I guess, because I can not even compile Bcl.JSON.Converters separately (see code below). See the screenshot, which reports an LSP Server Error, when you hover the curser over Bcl.JSON.Converters - which is probably the reason, why Codeinsight breaks for the whole project.
If define PAS2JS manually on project level, everything works fine - even with my "real" project.
program Project213;
{$APPTYPE CONSOLE}
{$R *.res}
uses
browserconsole
, Bcl.Json.Attributes // <-- compiles fine, but breaks CodeInsight
// , Bcl.Json.Converters // <-- can't find unit "Bcl.JSON.Converters"
;
begin
Writeln('Hello World!');
end.
I believe your Delphi library path (not TMS Web Core library path) is then incomplete, i.e., it doesn't include the directory where Bcl.Json.Attributes unit is located? Which is <xdata>\source\core ( should be TMS XData installation folder)?
In the meantime, I updated XData (including Biz Core of course) and WebCore to their very recent versions.
The breaking CodeInsight is no longer reproducible with the minimalistic demo, so something must have changed.
Apparently, within WebCore, Bcl.JSON.Converters is not supposed to be used/compiled. That PAS2JS define is not set on project level, so the LSP won't see it - thus needs to compile it, which failed before my updates, and thus probably made LSP break, while the Pas2Js compiled everything just fine.
I have one single form/unit in my WebCore project where CodeCompletion is still broken though. Only in that one single unit. All others work. No error message, no nothing. I'll investigate and come back :-)
unit Bcl.Json.Attributes;
{$I Bcl.inc}
interface
uses
Generics.Collections,
{$IFNDEF PAS2JS}
Bcl.JSON.Converters, //only the LSP will "compile" that
{$ENDIF}
Classes;
Olaf, as I said, maybe your library path is wrong?
Installing XData from the installer should not cause that problem, so maybe when you reinstalled, the installer properly updated the library path and now it works.
Yes, Web Core (Pas2JS) should not compile Bcl.Json.Converters, but "Delphi" should. By "Delphi" in quotes I mean the IDE, and that's where code completion comes from. So, for code completion to work in Web Core, the application must be compilable also by DCC32. That's why you should have a correct Win32 library path, so it can find Bcl.Json.Converters. It looks like it was not the case before.
Yes, something must have been broken - I double-checked all paths etc., before doing the upgrade, but I couldn't find anything. It works now - thanks for your patience. Getting your head around that compiler-duality and the PAS2JS define takes a moment