Hi Dave,

Thanks for your input. As someone else mentioned, JSDT works by
embedding a Rhino interpreter. You define your custom object model
using stubs (empty definitions of all the Javascript "classes").

Unfortunately, it seems Mikolaj's javascriptcomplete.vim is not really
extensible in the same manner as the HTML/XML completion scripts.
While it does make an attempt at finding declared objects and reading
their properties/methods, there is no option to supply your own
"external" Javascript file (eg. the file containing the stubs). The
external file reading code that exists is only for Javascript
contained within HTML.

Additionally, I'm pretty sure the script can't handle objects that are
properties of objects. Consider the following code snippet:

var test1 = new MyClass();
var obj = new Object();
obj.test2 = test1;

The object "test1" would work correctly with javascriptcomplete
(assuming MyClass() was defined in the current file). However, the
Mikolaj's script would not recognise that test2 is a "MyClass" object,
and therefore the completion wouldn't work.

I can live with that shortcoming for now, the first step I would like
to take is to let the javascriptcomplete.vim see my external file of
Javascript "class" stubs. Does anyone have experience working with the
javascriptcopmlete.vim? I need to be able to append my own file to the
list of external files. I'm happy to hardwire it for my own editor
environment.

Cheers,
Gareth

On Feb 24, 10:19 am, David Fishburn <[email protected]> wrote:
> On Tue, Feb 23, 2010 at 4:55 AM, Gareth Oakes <[email protected]> wrote:
>
> ...
>
> > There is a custom object model in use on this application platform and
> > I would like to omnicomplete my Javascript objects according to their
> > methods and properties. What is the best way to let omnicomplete
> > recognise my new object structures? (The object definitions are "baked
> > in" to the application, although I do have access to the completion
> > files for Eclipse JSDT).
>
> Hmm, I would be interested in seeing the format of the JSDT files.
>
> What I did for the Adobe Flex MXML completion was used the framework
> that Mikolaj wrote (see vim72/xmlcomplete vim72/htmlcomplete).
>
> What it allows you to do is define some Vim Lists and Dictionaries
> (since you have a static list of classes and methods this should work)
> and then copy autoload/htmlcomplete.vim to use javascript syntax
> instead of <tags> for html and xml.
>
> That is the reason I asked about the format of the JSDT files.  I
> wrote a simple Vim script which converted one output format into the
> above format for the MXML tags.
>
> HTH,
> Dave

-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to