You are here: PSPad forum > Bug report / Hlášení chyb > Please fix/add JS code explorer classes support

Please fix/add JS code explorer classes support

Goto Page: 1 2 Next

#1 Please fix/add JS code explorer classes support

Posted by: Litegod | Date: 2006-01-19 13:30 | IP: IP Logged

First of all thanks for the greatest code editor out there! I use PSpad for every type of file, because of the great filetype support, highlighting and code structure support.

I'd like to request a feature, perhaps you can call it a bug.

Lately I'm struggling with JavaScript classes and prototyping. The PSpad code explorer has great support for JavaScript variables and functions, but not for classes and prototyping syntax.

A class syntax example:

function Car(brand, color, features)
{
this.brand = brand || false;
this.color = color || '';
this.features = features || new Array();

this.getColor = function()
{
return this.color;
}
}

Car.prototype.build = function()
{
alert( 'A '+ this.getColor() +' car of brand "' + this.brand + '" has ' + this.features.length + ' features!' );
}

Can this syntax be implemented so that the classes, with their properties and methods can be detected and listed in the PSpad code explorer window?

Please let me know if this is possible!

Thanks in advance!

Post Edited (01-19-2006 14:31)

Options: Reply | Quote | Up ^


#2 Re: Please fix/add JS code explorer classes support

Posted by: Lion-T | Date: 2006-07-04 12:41 | IP: IP Logged

Hi@all,

@first many thanx for this greatful PSPad application. smiling smiley We like it and working daily with them.

Now we have the same wishes like Litegod.
By daily working with PSPad and developing object-oriented in JavaScript we need all classes in Code Explorer too for better navigating. It easier to locate classes in a large JavaScript file. winking smiley

So PSPad-Team,

PLEeeASE pimp the Code Explorer smiling smiley for JavaScript classes.

Many thanks in advanced and greetingz from Germany

smiling smiley Lion-T smiling smiley

Options: Reply | Quote | Up ^


#3 Re: Please fix/add JS code explorer classes support

Posted by: pspad | Date: 2006-07-04 12:44 | IP: IP Logged

How can I different in line
function Car(brand, color, features)
if is it class or function ?

Options: Reply | Quote | Up ^


#4 Re: Please fix/add JS code explorer classes support

Posted by: Lion-T | Date: 2006-07-05 08:35 | IP: IP Logged

Hi,

In opened file you must find the JavaScript reserved keyword 'prototype' and in the same line the keyword 'function' (without function name).

Example:
-> object.prototype.method=function(list of parameters){
... statements etc.
}

smiling smiley Lion-T smiling smiley

Options: Reply | Quote | Up ^


#5 Re: Please fix/add JS code explorer classes support

Posted by: pspad | Date: 2006-07-06 04:34 | IP: IP Logged

You means search source first to make a list of prototypes and then parse it ?
JScript wasn't projected for classes from the begin and this construction is force classes implementation...

Options: Reply | Quote | Up ^


#6 Re: Please fix/add JS code explorer classes support

Posted by: arturm | Date: 2006-07-06 09:00 | IP: IP Logged

And how detect members? Finding "this.member = " ? For me this is too messy. JS doesn't have classes. Objects are created using constructors which are normal functions, usually with plenty of "this" inside.

Options: Reply | Quote | Up ^


#7 Re: Please fix/add JS code explorer classes support

Posted by: Lion-T | Date: 2006-07-14 08:30 | IP: IP Logged

Hello,

I think, it's not to difficult to parse JavaScript source code by keyword 'prototype' with Regular Expressions and from this position as next step to find the keyword 'function'.

How do you realize this with the reserved JavaScript word 'function' momentary?

I think, you could take the same procedure for parsing 'prototype'.

I hope you could find a solution because it's very helpful for developing.

Many thanx.

With best regards.

smiling smiley Lion-T smiling smiley

Options: Reply | Quote | Up ^


#8 Re: Please fix/add JS code explorer classes support

Posted by: pspad | Date: 2006-07-14 08:38 | IP: IP Logged

I need example.
How can I know classes, prototypes and function in JavaSource code from one line of the source code ?

Options: Reply | Quote | Up ^


#9 Re: Please fix/add JS code explorer classes support

Posted by: ElMonty | Date: 2006-07-19 19:58 | IP: IP Logged

Hi,

another one who would be really glad, if this could be implemented in PSPad! But first: PSPad is the coolest Editor ever!!!grinning smiley

Since Javascript isn't designed for real classes and only simulates it via objects and functions, I believe that it is difficult to parse that in the code explorer.

Maybe we should redefine our wish of that...
For myself, I would be really satisfied, if the code explorer could show all the "prototype"-functions in it:

e.g. objName.prototype.DoSomething=function(a,b) ==> Code-Explorer could display then an entry: objName.DoSomething(a,b)

That's the thing what I miss at most, because I develop large JS-Files with a lot of 'prototype'-functions in it and if you want to jump to a particular function, you always have to search or scroll manualy to it. In files with more than 3000 lines this is quite anoying tongue sticking out smiley

I don't need that the code-explorer display/parses all the members and properties of the objects. It would be nice, but displaying all "functions" is more helpfull.

Maybe a categorization could be added to the code-explorer for javascript. I have seen this on one of your screenshots... There is already a group for Variables and then all functions are listed. Maybe there could be another group for functions and prototype-functions as well..

By the way.. the code-explorer seems to have a bug when parsing variables in such prototype-functions. e.g. a variable with an equal name is displayed 5 times with nearly the same line numbers.. I think this is, because they are declared in 5 different functions. But the variable scope is limited to that function.
So either the code-explorer should display the variables 5 times, but only with the line-numbers of the function where it is declared or it should display only one time with all line numbers in every function....

Many greetings

Options: Reply | Quote | Up ^


#10 Re: Please fix/add JS code explorer classes support

Posted by: Paul F | Date: 2006-08-08 08:52 | IP: IP Logged

I agree, ElMontys request would make single biggest improvement to the code explorer for Javascript:

if the code

x.prototype.y = function(z...)

appeared in code explorer as

x.y(z...)

Support for internal class definitions (e.g. "this.y = function(z...)" is maybe not as crucial for me as I know it will be within that object's constructor so its fairly easy to find anyway... I guess if you have very large constructors you start to need it, basically any "this.x" should be treated in the same way as you already treat "var x"

Anyway I have switched from Textpad to PSPad and I am already in dreamland with new excellent features, anything you add to PSPad is making the best better :D

Thanks

Paul

Options: Reply | Quote | Up ^


Goto Page: 1 2 Next





Editor PSPad - freeware editor, © 2001 - 2021 Jan Fiala, Hosted by Webhosting TOJEONO.CZ, design by WebDesign PAY & SOFT, code Petr Dvořák, Privacy policy and GDPR