Am moving my (TMS Web Core) Delphi working projects to VSC. I have a medium sized application that uses async functions. Am having trouble because it seems that the compiler in VSC does not take the [async] attribute on the function declaration. If I comment the line like this: //[async] then another error indicates that it is expecting an async function.
Didn't find any documentation on how to implement differently the async functions in VSC. So far they work perfectly on the Delphi Sydney CE.
Am using the latest versions, VSC 1.63.2, Web Core VSC 1.9.5379, FNC UI 188.8.131.52 with its corresponding latest FNC Core. Samples and other simple apps compile and run fine.
In addition there are also four warnings, basically the same four times, mentioning these units:
The warning is this :
Method "SetFont" hides method of base type "TControl" at c:\Users\julio.vscode\extensions\tmssoftware.tmswebcore-1.9.5379\resources\coresource\WEBLib.Controls.pas(530,22)
It was also throwing an error on a FNC unit related to ASM. As soon as I find a way to reproduce it will post it.
I cannot see an issue with Async here in VSC. We use it in many projects.
Are you sure you have a clean install of the latest version and what is the minimal code to reproduce what exact error message?
We'll look at possible (harmless) warnings that might still popup in connection with the pas2js compiler for the FNC component libraries.
It is a pristine installation indeed. Is a one month old windows 11 dell XPS laptop. Yesterday I installed VSC and downloaded the (just purchased) TMS Webcore VSC. Also installed the latest FNC Suite VSC for the fist time. This machine does not have any delphi or other IDE.
But the project is not new. I copied it from my older machine (where it compiles and runs fine on Sydney).
My goal has been to be able to compile Web Core projects in the mac M1, so probably over the weekend will test there. Lazarus never worked there anyway.
Am going to create a new, minimal VSC WebCore project using async and will check if it fails there, and will post results.
OK I created a basic test application (attached) but first I completely removed VSC and all components/extensions by cleaning the folders in appdata, and the .vscode. Then I reinstalled all new, this time I grabbed VSC from the microsoft store and the TMS WebCore extension from within the VSC IDE. It installed
visual studio core version: 1.63.2
tms webcore 1.9.5379
Omnipascal 0.18.0 auto installed by TMSwebcore module installation
I didn't install any FNC components yet.
The project still fails with:
error: 'SemiColon' Expected found 'function' (line 19)
warning: unknown custom attribute 'async'
Am sure if you repeat the "full clean" visual studio code in this way you will replicate the error. There are some leftovers if you only reinstall VSC without deleting the appdata and others. I followed the full removal reference here
asynctest.zip (6.5 KB)
I completed now the request implementation and this new version of the test application works fine in delphi, but still does not compile on VSC, same as before ( [async] compile error ).
the way it works is that it just loads the code received via WebHttpRequest and shows it on the webmemo text.
asynctestV2.zip (21.8 KB)
Good news. I installed VSC and WebCore and FNC suite on my mac Air M1 (Monterrey 12.1).
I tested my same "asynctestV2" project. Without any modifications it just runs under Visual Studio Code on the Mac, but still doesn't on windows. So the problem resides somewhere on the windows implementation.
Please, can you post screenshots of the errors you are getting?
Sure. The first thing I did today (California time zone) is to open VSC to make the screenshots.
The funny thing this morning is that even though the errors are present, on Windows, both V1 and V2 programs do run, although the application shows an unlicensed software message, guess it is because the reinstalling I did. That is a matter for another thread I guess.
Previously they didn't run because of the error with the red X.
Here you have a screenshot for V1 and one for V2 of the asynctest test app.
On v2, what you get is a syntax error from OmniPascal, because probably attributes are not supported for objectless functions. But that doesn't prevent you from compiling and running the app. Are you able to compile?
Fortunately this seems to be gone.
My true interest is running my real app, hope all goes well now.