Glad you got something working!
> The only thing which is important is to kill the server and restart it when
> you change this file (I know you know that, but I tell that if somebody
> whish to manage that).
We haven't optimized for that. We need to tell the server to drop its
template cache somehow and the easiest way is to just restart the
server. We could listen in the completions directory for new files
coming and changing, but since most people will be consuming existing
templates rather than writing their own, I feel this is lower
priority. I could be convinced otherwise, though...
> I have started to create my own
> client\scripts\plugins\mongo\mongoContentAssist.js to manage completion with
> collection name (ex: db.collectionN...), but I think I will have a lot of
> problem.
> This completion should request the Mongo Server with Ajax, but as this
> server is not in the same host than Node.js, I will have to use JSONP. But
> using JSONP gives you not the capability to manage ajax with synchronysous.
> I'm afraid that completion will not work.
Yes, the completions engine is currently synchronous. We haven't put
much thought into accepting asynchronous completions. However, doing
a server call for each completion invocation seems too expensive even
if asynchronous and server is local. I would recommend doing this
work in the background on the client when the page loads (eg-
webworker) so all the information is cached prior to any invocation.
Some of this info could be stored in local storage. This is exactly
how we handle indexing of referenced js files and it seems to work
quite well.
>
> I have too several problems :
>
> 1) 'db' variable is not known so there are syntax errors. I have tried to
> investiage to see how to 'document' variable is managed but it's hard for me
> (try to add my own Mongo DB definition in the
> \client\scripts\plugins\esprima\types.js but it doesn't work).
Two solutions here:
1. add a line like this at the top of each script that uses it:
/*global db */
2. add a .jshint file in your project and add a section for predefs.
See an example at the end of this gist:
https://gist.github.com/3708560
> 2) I think template completion should be improved, because it doesn't manage
> context. When you type directly 'getElementById', completion displays this
> function although this method belongs to 'document'.
Our templates could use a bit of a clean. But yes, templates do not
recognize context. That is by design to a certain extent. Templates
are just a snippet that gets added based on a prefix. More complex
analysis requires our regular completion assistant
(esprimaJsContentAssist).
For 0.4.0, I will be removing some of the existing templates since
they don't add much (except noise).
> 3) it should be cool if completion could displays a second window to
> displays some description (like Java Editor of Eclipse). For Javascript you
> could displays JSDoc. In th etemplates you could add some comments
> (db.getCollectionNames() returns the collection names of Mongo, please see
> the link xxxx).
This is something that I have thought about a lot and this would be
very useful. Would you mind raising an issue for this? I would like
to see this happen, and plan to look at this, but I don't think I can
get to it for 0.4.0.
> 4) I think the template completion should depends on a sub-scope (I have
> noticed that you have a scope for cs, for js), because for instance jQuery
> methods appears, but if you don't use jQuery, I think it's shame. In my case
> when I type db. (Ctrl+Space), getElementById appears (it should not).
See my comment above about cleaning up the templates. I think we
would be better served by having a more typed understanding of jquery
rather than using templates. I'll be removing most of the jquery
templates (or maybe somehow make them optional);
> For the moment I hack the scripted, but if I have understood, you have the
> intention to improve scripted to become extensible.
Yes, this is our intention. Please be explicit as to what extension
points you require. There are many possibilities and we won't be able
to get to everything for 0.4.0 and so we need to prioritize.
> Hope you will understand my comments (none offense with your great work!)
Thanks for the feedback. It is helpful.
>
> Many thank's for your help.
>
> Regards Angelo
>
>
>
> 2013/1/17 Kris De Volder <
kris.de...@gmail.com>
>>
>> Andrew already explained a bit about contents assist.
>>
>> You also seem to want something to run a script from scripted. One thing
>> that is fairly easy right now (current version of scripted) is add
>> keybindings to run shell scripts.
>> You could probably use this mechanism to bind a key to run the script in
>> the editor.
>>
>> If you haven't already, have a look at the docs for this feature here:
>>
>>
https://github.com/scripted-editor/scripted/wiki/Executing-Shell-Commands
>>
>> Kris
>>
>> --
>>
>>
>
>
> --
>
>