Skip to main content
Jump to: navigation, search

Difference between revisions of "VJET/JS code assist and validation for two or more js files"

(New page: For code assist and validation to work between 2 or more js files you must add a vjetdoc comment at the top of the file. Below illustrates how this works. 1. Create a VJET project with tw...)
 
 
(14 intermediate revisions by one other user not shown)
Line 2: Line 2:
  
 
1. Create a VJET project with two JS files firstfile.js and secondfile.js
 
1. Create a VJET project with two JS files firstfile.js and secondfile.js
 
  
 
src/firstfile.js
 
src/firstfile.js
Line 10: Line 9:
 
2. Add the contents such as the following:
 
2. Add the contents such as the following:
  
 
+
Contents of firstfile.js<br/><br/>
Contents of firstfile.js
+
 
[[Image:Vjet_PastedGraphic-7.png]]
 
[[Image:Vjet_PastedGraphic-7.png]]
  
 
3. Create files secondfile.js and at the top of secondfile.js&nbsp; add this line
 
3. Create files secondfile.js and at the top of secondfile.js&nbsp; add this line
  
<!-- code start-->
+
<source lang="javascript">//< needs(firstfile)</source>
<pre style="margin-left:20px; font-size:1.4em; background-color:#fdfdfd">//< needs(firstfile)</pre><!-- code end-->
+
  
Then type control + space. Now you will see functions and variables from firstfile.js
+
Then type control + space. Now you will see functions and variables from firstfile.js<br/><br/>
 
[[Image:Vjet_PastedGraphic-6.png]]
 
[[Image:Vjet_PastedGraphic-6.png]]
  
Line 25: Line 22:
 
That's is it for 2 files.. now if you want to support more than 2 you can add as many needs statements that you want.
 
That's is it for 2 files.. now if you want to support more than 2 you can add as many needs statements that you want.
  
Let's update the contents of secondFile.js and add the result variable.
+
Let's update the contents of secondFile.js and add the result variable.<br/><br/>
 
[[Image:Vjet_PastedGraphic-8.png]]
 
[[Image:Vjet_PastedGraphic-8.png]]
  
  
Now we create thirdfile.js and need firstfile.js and secondFile.js (note: the needs statement is case sensitive)
+
Now we create thirdfile.js and need firstfile.js and secondFile.js (note: the needs statement is case sensitive)<br/><br/>
 
[[Image:Vjet_PastedGraphic-9.png]]
 
[[Image:Vjet_PastedGraphic-9.png]]
  
  
 
Here is the example project that you can import into eclipse and try it out yourself.
 
Here is the example project that you can import into eclipse and try it out yourself.
[[^jsassistacrossfilesexample.zip]]
+
[[Media:jsassistacrossfilesexample.zip|jsassistacrossfilesexample.zip]]
  
[[Category:VJET]]
+
[[Category:VJET|JsCodeAssist]]

Latest revision as of 02:10, 17 January 2013

For code assist and validation to work between 2 or more js files you must add a vjetdoc comment at the top of the file. Below illustrates how this works.

1. Create a VJET project with two JS files firstfile.js and secondfile.js

src/firstfile.js

src/secondfile.js

2. Add the contents such as the following:

Contents of firstfile.js

Vjet PastedGraphic-7.png

3. Create files secondfile.js and at the top of secondfile.js  add this line

//< needs(firstfile)

Then type control + space. Now you will see functions and variables from firstfile.js

Vjet PastedGraphic-6.png


That's is it for 2 files.. now if you want to support more than 2 you can add as many needs statements that you want.

Let's update the contents of secondFile.js and add the result variable.

Vjet PastedGraphic-8.png


Now we create thirdfile.js and need firstfile.js and secondFile.js (note: the needs statement is case sensitive)

Vjet PastedGraphic-9.png


Here is the example project that you can import into eclipse and try it out yourself. jsassistacrossfilesexample.zip

Back to the top