Spket Eclipse plugin - multiple files

Get help with Spket IDE.

Spket Eclipse plugin - multiple files

Postby Bilsa » Sun Jan 13, 2008 1:29 am

Hi!

I'm wondering why the Content Assist doesn't work with multiple files? is it a bug?

This is what I mean:

script1.js
-----------

function script1() {};


script2.js
-----------

function script2() {
script1();
};


The script1 function is not recognized by the content assist, only if they are in the same file.

Is there any way to include all script files in my project?

Thank you!
Bilsa
 
Posts: 5
Joined: Sun Jan 13, 2008 1:22 am

Postby eric_suen » Sun Jan 13, 2008 6:06 am

You can using tag @include in comment to do that, for example, in script2.js, you can add comment
Code: Select all
//@include "script1.js"
before first statement, for whole project, you can create a file called "include.js"(of cause you can using other name), and include all the files to that file like
Code: Select all
/*
* @include "script1.js"
* @include "script2.js"
*/

And then include that file in your javascript file, this demo http://www.spket.com/demos/demo3.html show you how to use comment to improve code assist.
eric_suen
Site Admin
 
Posts: 669
Joined: Wed Sep 28, 2005 7:00 am

Postby Bilsa » Sun Jan 13, 2008 11:46 am

Thank you! that was what I was looking for :)
Bilsa
 
Posts: 5
Joined: Sun Jan 13, 2008 1:22 am

Postby letssurf » Mon Jul 14, 2008 9:16 pm

can this not be automated? it's very annoying to have to place @include (not even a JSDoc attrib) and have an include file
letssurf
 
Posts: 1
Joined: Mon Jul 14, 2008 9:14 pm

.jsb files

Postby cafebabe » Wed Apr 01, 2009 6:41 pm

if you are using spket in eclipse you can generate a .jsb file which will tell eclipse what js files to include for code complete w/ spket.

I wrote this small perl script to parse our source directory & build a stripped down .jsb file (which is all that is needed for code complete) , this was written to run on a windows machine. You need to set the $jsbFile and $source variables to where you want the $jsbFile written out and the locaiton of yoru $source directory that holds all your js files.

Note: This script uses the find binary installed as part of cygwin.

Code: Select all
open(JSB, ">$jsbFile"); # open jsb file for overwrite
print "Finding .js files:\n";
open(FIND, "cd $source;find * -name '*.js' |"); # find gives us a stream of .js files relative to $source
print "Writing .jsb:\n";
print JSB "<?xml version='1.0' encoding='utf-8'?><project path='' name='Portal'><target name='Everything'>";

while(<FIND>) {
   chomp();
   s/\//\\/g; # replace all / with \
   print JSB "\n<include name='$_'/>";
}
close(FIND);
print JSB "\n</target></project>";
close(JSB);


you can right click on your project & reload javascript profile which will reload all contents of all js files in your $source folder.
Hope this is helpful.
cafebabe
 
Posts: 14
Joined: Tue Mar 31, 2009 9:31 pm

Postby cafebabe » Tue Apr 14, 2009 4:01 pm

correction:
while this does generate a .jsb and it does include all libraries it does not do so in the correct order and thus breaks code complete for some libs. Some recursive method is needed to fully resolve this. I have written some perl modules to do just that, specifically with Ext libs in conjunction w/ our own libs. If anybody is interested in these modules let me know.
cafebabe
 
Posts: 14
Joined: Tue Mar 31, 2009 9:31 pm

for extjs development

Postby cafebabe » Thu Apr 30, 2009 4:14 pm

To solve the issue of dependencies not being loaded in the correct order I have written a small tool to find them and write out a .jsb file which will load them in the correct order. It looks for @class and @extends tags in addition to the[code] Ext.extend() [/code]mechanism to determine inheritance. Anyone familiar with perl is welcome to take a look, I have written a test file that demonstrates how to use the libs to generate a .jsb. Suggestions / comments welcome.

The project is on google code here listed as jsb-builder... as i have not posted 10 items i cannot include a link yet...

Hope this helps.
cafebabe
 
Posts: 14
Joined: Tue Mar 31, 2009 9:31 pm

Re: Spket Eclipse plugin - multiple files

Postby addipas » Tue Aug 03, 2010 3:52 pm

I'm interesting to the tool to produce jsb file of the own js files.
I'm sorry, but I still not understand how to properly set the jsb file in Eclipse (using Spket 1.6.18 as plugin in Eclipse Helios)

I have 2 js files:
/root/workspace/project/A.js,
/root/workspace/project/B.js

if I add
@include "/root/workspace/project/A.js"
in B.js, code completion works properly from B.js

I still do not understand how to set it via jsb file.
I've added a Javascript Profile trying with Library "prototype" or "jquery" or "commons".
No result.
Can you support me in the right configuration?
addipas
 
Posts: 3
Joined: Tue Aug 03, 2010 3:40 pm

Re: Spket Eclipse plugin - multiple files

Postby eric_suen » Wed Aug 04, 2010 2:03 am

Have you reload the profile? you can use context menu in project explorer, choose item "Reload JavaScript Profile"...
eric_suen
Site Admin
 
Posts: 669
Joined: Wed Sep 28, 2005 7:00 am

Re: Spket Eclipse plugin - multiple files

Postby addipas » Wed Aug 04, 2010 5:35 pm

first of all thank you for your fast answer.
ok. It works.
One thing is not working and it was confusing me, leading to tell that code completion was not working.

Code completion is working, But tips related to JSDoc is not working.
Look at the following two possible scenarious:

==============================
file A.js
==============================
/**
* Description AAAAA
* @version 1.0
* @constructor
*/
function classA(){
/**
* desc A
* @type String
*/
this.attrA = 'a';

/**
* desc B
* @type String
*/
this.attrB = 'b';
}
a = new classA();
a.<CTRL+ENTER> <-------- HERE code completion and jsdoc tips is working


==============================
file B.js
(Case with jsb file with <include name='/path/to/A.js'/> )
==============================

aa = new classA();
a.<CTRL+ENTER> <-------- HERE code completion works, but jsdoc tips don't



==============================
file B.js
(Case with @include)
==============================
/**
* @include "/path/to/A.js"
*/
aa = new classA();
a.<CTRL+ENTER> <-------- HERE both code completion and jsdoc tips works
addipas
 
Posts: 3
Joined: Tue Aug 03, 2010 3:40 pm

Re: Spket Eclipse plugin - multiple files

Postby addipas » Wed Aug 04, 2010 5:38 pm

errata :
of course change:
---------------------------
aa = new classA();
a.<CTRL+ENTER>
---------------------------

in
---------------------------
aa = new classA();
aa.<CTRL+ENTER>
---------------------------
addipas
 
Posts: 3
Joined: Tue Aug 03, 2010 3:40 pm

Re: Spket Eclipse plugin - multiple files

Postby Sorbing » Fri Feb 10, 2012 9:22 am

I created "assist.jsb" file in the root project. Run "Reload Javascript Profile".
But the documentation in the file "node.js" can not connect ..
What did I do wrong? Thank you.
Code: Select all
<?xml version='1.0' encoding='utf-8'?>
  <project path='/home/stas/www/galleries' name='galleries'>
  <target name='Everything'>
    <include name='node.js'/>
  </target>
</project>
Sorbing
 
Posts: 27
Joined: Wed Oct 19, 2011 2:52 pm
Location: Ukraine, Kyiv

Re: Spket Eclipse plugin - multiple files

Postby eric_suen » Fri Feb 10, 2012 5:56 pm

you need add that jsb to your javascript profile, otherwise it will not be loaded.
eric_suen
Site Admin
 
Posts: 669
Joined: Wed Sep 28, 2005 7:00 am

Re: Spket Eclipse plugin - multiple files

Postby Sorbing » Mon Feb 13, 2012 10:08 am

Thank you. I missed it.
Sorbing
 
Posts: 27
Joined: Wed Oct 19, 2011 2:52 pm
Location: Ukraine, Kyiv

Re: Spket Eclipse plugin - multiple files

Postby GustavR » Tue Oct 22, 2013 3:47 pm

Do I really have to run a Perl script just to say to Spket "use evereything you find in the specified JavaScript source folder"?
I can't really believe it, maybe I'm doing something wrong? I have two locations of standard ExtJs class structure (Ext.define) that are conforming to the ExtJs standard (classname := path).
How do I get Spket to recognice my own classes? They are within the JavaScript build path also the JavaScript build path has its root at the src folder of the stanard ExtJs classes.
When I manually create a jsb-file and just put all classes in there (in no matter what order) it works perfectly fine. But this is a pain in the neck. The jsb-file has no information that the file system has not, I just went through the folders alphabetically and wrote the js-files into the jsb-file. But this can't be it? I can also add my files manually to Spket, but as there are several of them, this is a pain in the neck too. Why can't I add folders as folders (at the moment when I add a folder all files directly in it are added)? I would add my src folder and everything would be fine, all files in there are js-files and Spket should parse all of them. Why not use the standard Include/Exclude build path logic?
GustavR
 
Posts: 2
Joined: Tue Oct 22, 2013 3:36 pm

Next

Return to General discussion

Who is online

Users browsing this forum: Yahoo [Bot] and 0 guests

cron