Forum > Pas2JS

[SOLVE] Problem with pas2Js and code completion

(1/1)

cappe:
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?

PascalDragon:
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  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---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:
Thanks, now it works. Although it was not necessary to write this code before. How come it now gives these problems?

PascalDragon:
Because pas2js was improved and thus supports/uses more syntax than Lazarus 2.0.12 supports.

Navigation

[0] Message Index

Go to full version