Recent

Author Topic: [SOLVE] Problem with pas2Js and code completion  (Read 3026 times)

cappe

  • Full Member
  • ***
  • Posts: 191
[SOLVE] Problem with pas2Js and code completion
« on: April 03, 2021, 08:36:19 am »
I am using lazarus 2.0.12 with pas2js 2.0.4.

Open the first image, pressing CTRL + SPACE after "j:" gives me the error "web.pas (1019,49) Error: it was expected: instead JSValue was found" and opens web.pas as from the second image.

How can I fix code completion?
« Last Edit: April 03, 2021, 11:23:05 am by cappe »

PascalDragon

  • Hero Member
  • *****
  • Posts: 5481
  • Compiler Developer
Re: Problem with pas2Js and code completion
« Reply #1 on: April 03, 2021, 11:08:02 am »
Whenever I have such problems with not yet supported syntax I use the following trick (the following only needs to be done once):

  • go to Tools -> Codetools Defines Editor
  • go to Edit -> Insert Node Below -> Define Recurse
  • enter the following values:
          Name: InLazIDE
          Description: Define InLazIDE everywhere
          Variable: InLazIDE
          Value from text: 1

And then adjust the code like this:

Code: Pascal  [Select][+][-]
  1. procedure debug(Obj1: JSValue); {$ifndef InLazIDE}array of JSValue;{$endif}

This way the compiler (in this case pas2js) will still see the declaration, but the IDE's codetools won't and thus they won't complain.

cappe

  • Full Member
  • ***
  • Posts: 191
Re: Problem with pas2Js and code completion
« Reply #2 on: April 03, 2021, 11:22:50 am »
Thanks, now it works. Although it was not necessary to write this code before. How come it now gives these problems?

PascalDragon

  • Hero Member
  • *****
  • Posts: 5481
  • Compiler Developer
Re: [SOLVE] Problem with pas2Js and code completion
« Reply #3 on: April 03, 2021, 11:27:13 am »
Because pas2js was improved and thus supports/uses more syntax than Lazarus 2.0.12 supports.

 

TinyPortal © 2005-2018