c9-auto-bump 3.0.530

This commit is contained in:
c9bot 2014-11-27 17:11:22 +00:00
parent b0108959bc
commit c6e4d503f1
323 changed files with 8428 additions and 34252 deletions

View File

@ -1,46 +0,0 @@
env:
node: true
browser: true
amd: true
builtin: true
mocha: true
jasmine: false
rules:
handle-callback-err: 1
no-debugger: 1
no-undef: 1
no-inner-declarations: [1, "functions"]
no-native-reassign: 1
no-new-func: 1
no-new-wrappers: 1
no-cond-assign: [1, "except-parens"]
no-debugger: 3
no-dupe-keys: 3
no-eval: 2
no-func-assign: 1
no-invalid-regexp: 1
no-irregular-whitespace: 3
no-negated-in-lhs: 1
no-regex-spaces: 3
no-reserved-keys: 3
no-unreachable: 1
use-isnan: 2
valid-typeof: 1
no-redeclare: 3
no-with: 1
radix: 3
no-delete-var: 2
no-label-var: 3
no-shadow-restricted-names: 2
handle-callback-err: 1
no-new-require: 2
no-unused-vars: [3, {vars: "all", args: "none"}]
no-undef: 1
semi: 3
no-extra-semi: 3
default-case: 3
space-after-keywords: [1, "always"]
spaced-line-comment: 3
// valid-jsdoc: [1, { requireReturn: false, requireParamDescription: false, prefer: { "return": "return" } }]

10
.gitignore vendored
View File

@ -19,8 +19,6 @@ plugins/c9.run/todo
docs/generate/output
docs/generate/lib/node_modules
plugins/c9.docker/bin/node_modules/
node_modules/vfs-local/test/mock2/
plugins/c9.fs/mock/
# ignore node_modules
node_modules/*
@ -41,11 +39,6 @@ node_modules/kaefer/node_modules/
!node_modules/connect-architect
!node_modules/pty.js
!node_modules/ui
!node_modules/react-bootstrap
!node_modules/oldclient
node_modules/oldclient/node_modules
node_modules/oldclient/plugins-server/c9.api.project/tmp*
node_modules/vfs-local/test/mock
node_modules/vfs-ssh/__worker.js
@ -60,15 +53,14 @@ node_modules/c9/node_modules
plugins/c9.proxy/proxy.cfg
plugins/c9.proxy/haproxy
plugins/c9.proxy/haproxy-*
**/.module-cache/
.c9revisions
.settings
.c9config
.c9
.c9/project.settings
*.watch
*.pid
*.swp
*#*
npm-debug.log
foo.js

240
LICENSE
View File

@ -1,239 +1,21 @@
Cloud9 Software Development Kit Non-commercial License Agreement
BETA TEST LICENSE
1. Introduction
1.1 The Cloud9 Software Development Kit (referred to in this License Agreement
as the "SDK" and specifically including the Cloud9 system files, the Cloud9
computer software source code, Cloud9’s Ace editor plugin and Cloud9’s
terminal plugin) is licensed to you subject to the terms of this Non-commercial
License Agreement.
By downloading this software you (the "Licensee") agree to this beta test license.
1.2 Any software provided along with the SDK (such as some of the files in the
node_modules directory) that is associated with a separate license agreement is
licensed to you under the terms of that separate license agreement.
A. Cloud9 IDE, Inc (the "Vendor") is in the process of developing a new version of the Cloud9 software product (the "Pre-Release Software"), which Vendor hopes to market in the near future.
This License Agreement forms a legally binding contract between you and Cloud9
in relation to your use of the SDK.
B. Vendor would like to field-test a preliminary version of its Pre-Release Software so as to further refine and modify the product before it is generally released.
1.2 “Cloud9” refers to Cloud9 IDE, Inc, registered Delaware corporation with
principal place of business 1663 McAllister Street #B, San Francisco, CA 94115,
United States.
C. Licensee has expressed an interest in licensing a copy of the Pre-Release Software in advance of its general release in order to evaluate the Pre-Release Software for its own purposes and to assist Vendor in refining and modifying the Pre-Release Software so that it becomes more useful for its intended market ("Beta Test").
2. Accepting this license agreement
2.1 In order to use the SDK, you must first agree to this License Agreement. You
may not use the SDK if you do not accept this License Agreement.
D. In exchange for early access to the Pre-Release Software, Licensee agrees to serve as a Beta Test site for the Pre-Release Software and to provide Vendor with its comments, criticisms, suggestions, and evaluations with respect to the Pre-Release Software during the Beta Test period.
2.2 You agree to be bound by the terms of this SDK License by installing,
copying, downloading, accessing or otherwise using the SDK.
NOW, THEREFORE, the parties hereby agree as follows:
2.3 You may not use the SDK and may not accept the License Agreement if you are
a person barred from receiving the SDK under the laws of the United States or
other countries including the country in which you are resident or from which
you use the SDK.
1. LICENSE GRANT
2.4 If you are agreeing to be bound by this License Agreement on behalf of your
employer or other entity, you represent and warrant that you have full legal
authority to bind your employer or such entity to this License Agreement. If you
do not have the requisite authority, you may not accept the License Agreement or
use the SDK on behalf of your employer or other entity.
Vendor grants to Licensee, during the term of this Agreement, a temporary, non-exclusive license to use an executable version of the Pre-Release Software and its related documentation, for evaluation purposes. Licensee may make copies of the Pre-Release Software for back-up purposes only, provided that Licensee reproduces Vendor's copyright and other proprietary rights notices on all such copies. This license does not include any rights to disclose, sublicense, or otherwise transfer the Pre-Release Software, related documentation, or other proprietary information of Vendor.
3. The Cloud9 SDK
3.1 Cloud9 grants to you a non-exclusive, non-commercial, non-transferable,
personal license to do the following, all subject to the terms of this license:
2. BETA TEST
Copy and modify any SDK source code, and include such copies and modifications
in software that you create (“Derived Software”), and include SDK object
code in Derived Software;
Use SDK source code, SDK object code, and Derived Software for your own
personal, noncommercial use;
Distribute Derived Software and SDK documentation to others, provided that any
distribution is for noncommercial purposes only, is without charge or fee or
consideration of any kind, and that every recipient of the distribution agree to
and is bound by the terms of this SDK License.
3.2 You agree that Cloud9 or third parties own all legal right, title and
interest in and to the SDK, including any Intellectual Property Rights that
subsist in the SDK. "Intellectual Property Rights" means any and all rights
under patent law, copyright law, trade secret law, trademark law, and any and
all other proprietary rights. Cloud9 reserves all rights not expressly granted
to you.
3.3 You may not use the SDK for any purpose not expressly permitted by this
License Agreement. You do not have the right to:
Reverse engineer or in any other way attempt to reproduce the operation of the
code in the SDK, or defeat or circumvent any security features of any code in
the SDK;
Use anything in the SDK or any Derived Software for any commercial purpose,
including without limitation for provision of programming, hosting, or any other
services for others;
Distribute anything in the SDK or any Derived Software to any other party that
is not bound by the terms of this SDK License;
Make any copies of anything in the SDK without including all copyright, license,
and other legal notices with the copy;
Transfer the SDK, this SDK License, or any part thereof, to any other party. Any
attempt at such a transfer is void.
3.4 Use, reproduction and distribution of components of the SDK licensed under a
separate license agreement are governed solely by the terms of that separate
license agreement and not this License Agreement.
3.5 You agree that the form and nature of the SDK that Cloud9 provides may
change without prior notice to you and that future versions of the SDK may be
incompatible with applications developed on previous versions of the SDK. You
agree that Cloud9 may stop (permanently or temporarily) providing the SDK (or
any features within the SDK) to you or to users generally at Cloud9's sole
discretion, without prior notice to you.
3.6 Nothing in this License Agreement gives you a right to use any of Cloud9's
trade names, trademarks, service marks, logos, domain names, or other
distinctive brand features.
3.7 You agree that you will not remove, obscure, or alter any proprietary rights
notices (including copyright and trademark notices) that may be affixed to or
contained within the SDK.
4. Privacy and Information
4.1 In order to continually innovate and improve the SDK, Cloud9 may collect
certain usage statistics from the software including but not limited to a unique
identifier, associated IP address, version number of the software, and
information on which tools and/or services in the SDK are being used and how
they are being used. Before any of this information is collected, the SDK will
notify you and seek your consent. If you withhold consent, the information will
not be collected.
4.2 The data collected is examined in the aggregate to improve the SDK and is
maintained in accordance with Cloud9's Privacy Policy.
5. Your developer credentials
5.1 You agree that you are responsible for maintaining the confidentiality of
any developer credentials that may be issued to you by Cloud9 or which you may
choose yourself and that you will be solely responsible for all applications
that are developed under your developer credentials.
6. Third party applications
6.1 If you use the SDK to run applications developed by a third party or that
access data, content or resources provided by a third party, you agree that
Cloud9 is not responsible for those applications, data, content, or resources.
You understand that all data, content or resources which you may access through
such third party applications are the sole responsibility of the person from
which they originated and that Cloud9 is not liable for any loss or damage that
you may experience as a result of the use or access of any of those third party
applications, data, content, or resources.
6.2 You should be aware the data, content, and resources presented to you
through such a third party application may be protected by intellectual property
rights which are owned by the providers (or by other persons or companies on
their behalf). You may not modify, rent, lease, loan, sell, distribute or create
derivative works based on these data, content, or resources (either in whole or
in part) unless you have been specifically given permission to do so by the
relevant owners.
6.3 You acknowledge that your use of such third party applications, data,
content, or resources may be subject to separate terms between you and the
relevant third party. In that case, this License Agreement does not affect your
legal relationship with these third parties.
7. Termination of this license agreement
7.1 This License Agreement will continue to apply until terminated by either you
or Cloud9 as set out below.
7.2 If you want to terminate this License Agreement, you may do so by ceasing
your use of the SDK and any relevant developer credentials.
7.3 Cloud9 may at any time, terminate this License Agreement with you if:
a. you do not abide by the provisions of this License Agreement; or
b. at any time upon 72 hours notice to you; or
c. at any time upon post of a notice of termination to Cloud9’s website. In
such event, you must destroy all copies of the SDK and any Derived Software.
Termination of this SDK License shall terminate your rights and all obligations
of Cloud9 under this SDK License, but the remaining provisions shall survive
termination.
8. DISCLAIMER OF WARRANTIES
8.1 THE ENTIRE RISK ARISING OUT OF USE OR PERFORMANCE OF THE SDK AND ANY DERIVED
SOFTWARE REMAINS WITH YOU, THE USER. CLOUD9 EXPRESSLY DISCLAIMS (I) ANY WARRANTY
FOR THE SDK AND ANY DERIVED SOFTWARE, AND (II) ANY COMMON LAW DUTIES WITH REGARD
TO SDK AND ANY DERIVED SOFTWARE, INCLUDING DUTIES OF LACK OF NEGLIGENCE AND LACK
OF WORKMANLIKE EFFORT.
8.2 THE SDK AND ANY INFORMATION AVAILABLE IN CONNECTION THEREWITH ARE PROVIDED
ON AN "AS IS" AND "AS AVAILABLE" BASIS, "WITH ALL FAULTS" AND WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, THE
IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
NON-INFRINGEMENT.
8.3 ANY WARRANTY AGAINST INFRINGEMENT THAT MAY BE PROVIDED IN SECTION 2-312(3)
OF THE UNIFORM COMMERCIAL CODE AND/OR IN ANY OTHER COMPARABLE STATE STATUTE IS
EXPRESSLY DISCLAIMED. ALSO, THERE IS NO WARRANTY OF TITLE, INTERFERENCE WITH
YOUR ENJOYMENT, OR AUTHORITY IN CONNECTION WITH THE SDK OR ANY DERIVED SOFTWARE
OR INFORMATION AVAILABLE IN CONNECTION THEREWITH. THIS SECTION WILL APPLY TO THE
MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW.
9. LIMITATION OF LIABILITY AND EXCLUSIVE REMEDY
9.1 NEITHER CLOUD9, ITS LICENSORS, NOR THEIR AFFILIATES SHALL BE LIABLE IN ANY
WAY FOR LOSS OR DAMAGE OF ANY KIND RESULTING FROM THE USE OR INABILITY TO USE
THE SDK OR ANY DERIVED SOFTWARE INCLUDING, BUT NOT LIMITED TO, LOSS OF GOODWILL,
WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL
DAMAGES OR LOSSES.
9.2 IN NO EVENT WILL CLOUD9 BE LIABLE FOR ANY INDIRECT, INCIDENTAL,
CONSEQUENTIAL, SPECIAL, PUNITIVE, EXEMPLARY DAMAGES, OR ANY OTHER DAMAGES
ARISING OUT OF OR IN ANY WAY CONNECTED WITH THE SDK, ANY DERIVED SOFTWARE, ANY
INFORMATION AVAILABLE IN CONNECTION THEREWITH, OR THE DELAY OR INABILITY TO USE
THE SDK, ANY DERIVED SOFTWARE, OR ANY INFORMATION, EVEN IN THE EVENT OF FAULT,
TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY, BREACH OF CONTRACT, OR BREACH OF
ANY WARRANTY AND EVEN IF CLOUD9 HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
THESE LIMITATIONS AND EXCLUSIONS REGARDING DAMAGES APPLY EVEN IF ANY REMEDY
FAILS. YOU ACKNOWLEDGE AND AGREE THAT YOUR SOLE AND EXCLUSIVE REMEDY FOR ANY
DISPUTE WITH CLOUD9 WITH REGARD TO THE SDK IS TO DISCONTINUE USE OF THE SDK AND
ANY DERIVED SOFTWARE. BECAUSE SOME STATES OR JURISDICTIONS DO NOT ALLOW THE
EXCLUSION OR THE LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL
DAMAGES, IN SUCH STATES OR JURISDICTIONS, CLOUD9, ITS LICENSORS, AND THEIR
AFFILIATES LIABILITY SHALL BE LIMITED TO THE FULL EXTENT PERMITTED BY LAW.
10. Indemnification
10.1 You agree to defend, indemnify and hold harmless Cloud9, its licensors and
their affiliates from all liabilities, claims and expenses, including attorneys'
fees, that arise from or in connection with breach of this Agreement, use of the
SDK or any Derived Software, including, but not limited to, the creation,
distribution, promotion and use of any Derived Software. Cloud9 reserves the
right to assume the exclusive defense and control of any matter subject to
indemnification by you.
11. Changes to the license agreement
11.1 Cloud9 may make changes to the License Agreement as it distributes new
versions of the SDK. When these changes are made, Cloud9 will make a new version
of the License Agreement available on the website where the SDK is made
available.
12. Applicable law, jurisdiction
12.1 This License Agreement, and your relationship with Cloud9 under this
License Agreement, shall be governed by the laws of the State of California
without regard to its conflict of laws provisions. You and Cloud9 agree to
submit to the exclusive jurisdiction of the courts located within the county of
Santa Clara, California to resolve any legal matter arising from this License
Agreement. Notwithstanding this, you agree that Cloud9 shall still be allowed to
apply for injunctive remedies.
13. General legal terms
13.1 This SDK License sets forth all rights for the user of the SDK and is the
entire agreement between the parties. This SDK License supersedes any other
communications with respect to the SDK. You agree that this SDK License is not
intended to confer and does not confer any rights or remedies upon any person
other than the parties to this SDK License. No provision hereof shall be deemed
waived unless such waiver shall be in writing and signed by Cloud9. If any
provision of this SDK License is held invalid or unenforceable, the remainder of
this SDK License shall continue in full force and effect, and such provision
shall be reformed only to the extent necessary to make it valid and enforceable.
The parties confirm that it is their wish that this Agreement has been written
in the English language only (or an equivalent type of urgent legal relief) in
any jurisdiction.
13.2 EXPORT RESTRICTIONS. YOU ACKNOWLEDGE THAT THE SDK IS OF U.S. ORIGIN. YOU
AGREE TO COMPLY WITH ALL APPLICABLE INTERNATIONAL AND NATIONAL LAWS THAT APPLY
TO THESE PRODUCTS, INCLUDING THE U.S. EXPORT ADMINISTRATION REGULATIONS, AS WELL
AS END-USER, END-USE AND DESTINATION RESTRICTIONS BY U.S. AND OTHER GOVERNMENTS.
Licensee understands and acknowledges that (i) it is participating in Vendor's Beta Test for the Pre-Release Software, (ii) it is receiving a preliminary version of the Pre-Release Software, and (iii) the Pre-Release Software may not operate properly, may not perform all functions for which it is intended or represented, and may not operate error-free. Licensee agrees to use the Pre-Release Software primarily for purposes of evaluation, agrees to provide Vendor with its comments, criticisms, and suggestions for changes with respect to the Pre-Release Software, and agrees to help Vendor identify any and all errors or malfunctions in the operation of the Software.

216
README.md
View File

@ -1,47 +1,39 @@
Cloud9 3.0 SDK for Plugin Development
=======================================
Cloud9 3.0
==========
This is the core repository for the Cloud9 v3 SDK. The SDK allows you to run a version of Cloud9 that allows you to develop plugins and create a custom IDE based on Cloud9.
#### Project Status: *ALPHA*
During the alpha stage, expect many things to break, not work or simply fail.
#### Creating Plugins ####
The best and easiest way to create plugins is on c9.io. Please check out this tutorial for how to [get started writing plugins.](http://cloud9-sdk.readme.io/v0.1/docs/getting-started)
We also have a tutorial for how to get started working on the core plugins. [Check out that tutorial here.](http://cloud9-sdk.readme.io/v0.1/docs/contributing-to-existing-packages)
The new VFS based Cloud9.
#### Documentation ####
We have several documentation resources for you:
Find the documentation at http://docs.c9.io:8080/.
<table>
<tr><th>SDK documentation</th><td>http://cloud9-sdk.readme.io/v0.1/docs</td></tr>
<tr><th>API documentation</th><td>http://docs.c9.io/api</td></tr>
<tr><th>User documentation</th><td>http://docs.c9.io</td></tr>
</table>
The docs are protected by a username and password:
Please joing the mailinglist to get support or give support to the growing community of plugin developers:
https://groups.google.com/forum/#!forum/cloud9-sdk
username: c9v3
password: r3v0l4t10naRy
#### Installation ####
Follow these steps to install the SDK:
Installing newclient is super simple.
git clone git@github.com:c9/core.git c9sdk
cd c9sdk
scripts/install-sdk.sh
git clone git@github.com:ajaxorg/newclient.git
cd newclient
npm install
To update the SDK to the latest version run:
Installing dependencies is easy as well.
git pull origin master
scripts/install-sdk.sh
curl https://raw.github.com/c9/install/master/install.sh | bash
#### Starting Cloud9 ####
Installing the node-webkit based newclient has more steps:
Start the Cloud9 as follows:
1. Run `scripts/setup-local-dev` to download our own fork of node-webkit and create `Cloud9-dev` app in `build` folder.
2. Set up an alias called 'c9nw' for newclient, e.g. using
alias c9nw=\`pwd\`/build/Cloud9-dev.app/Contents/MacOS/node-webkit
#### Starting the standalone ####
For most development purposes it's recommended to use the lightweight
standalone version. It can be started as follows:
node server.js
@ -56,25 +48,169 @@ The following options can be used:
--port Port
--debug Turn debugging on
--listen IP address of the server
--workspacetype The workspace type to use
--readonly Run in read only mode
--packed Whether to use the packed version.
--auth Basic Auth username:password
--collab Whether to enable collab.
--no-cache Don't use the cached version of CSS
Now visit [http://localhost:8181/ide.html](http://localhost:8181/ide.html) to load Cloud9.
#### Starting the hosted version ####
#### Contributing ####
Starting the hosted version is a bit more involved.
We actively encourage and support contributions. We accept pull requests to the core as well as to any of the open source plugins and libraries that we maintain under the c9 organization on GitHub.
1. Add to your /etc/hosts the line:
Feel free to fork and improve/enhance the Cloud9 SDK and the open source plugins in any way you want. Then please open a pull request. For more information on our contributing guidelines, see our contributing guide: http://cloud9-sdk.readme.io/v0.1/docs/contributing-to-cloud9
```
127.0.0.1 c9.dev vfs.c9.dev ide.c9.dev api.c9.dev preview.c9.dev
```
To protect the interests of the Cloud9 contributors and users we require contributors to sign a Contributors License Agreement (CLA) before we pull the changes into the main repository. Our CLA is the simplest of agreements, requiring that the contributions you make to an ajax.org project are only those you're allowed to make. This helps us significantly reduce future legal risk for everyone involved. It is easy, helps everyone, takes ten minutes, and only needs to be completed once. There are two versions of the agreement:
2. You should have your **c9** folder next to your **newclient** folder (because the `legacy` role will expect so).
1. [The Individual CLA](https://docs.google.com/a/c9.io/forms/d/1MfmfrxqD_PNlNsuK0lC2KSelRLxGLGfh_wEcG0ijVvo/viewform): use this version if you're working on the Cloud9 SDK or open source plugins in your spare time, or can clearly claim ownership of copyright in what you'll be submitting.
2. [The Corporate CLA](https://docs.google.com/a/c9.io/forms/d/1vFejn4111GdnCNuQ6BfnJDaxdsUEMD4KCo1ayovAfu0/viewform): have your corporate lawyer review and submit this if your company is going to be contributing to the Cloud9 SDK and/or open source plugins.
3. Start non-touched roles in a process and the in-dev roles in another process (to easily restart more often) - (note that a process can play multiple roles at once).
If you want to contribute to the Cloud9 SDK and/or open source plugins please go to the online form, fill it out and submit it.
`./server.js legacy redis proxy`
`./server.js ide api vfs preview`
Optionally, you can use the scripts/launch script to launch these processes for you. It will also make sure they are kept alive, and kills any rogue legacy processes as needed.
4. Set yourself as alpha user in your local redis db:
`cd ../c9`
`bin/cli.sh infraredis`
`HMSET u/uid alpha true`
(OR easier: change that [line](https://github.com/c9/newclient/blob/master/plugins/c9.ide.server/user_filter.js#L7) to `return true;`)
6. Login to the old c9 at [https://c9.dev](https://c9.dev)
7. Open your workspace with prefix: `ide.c9.dev` prefix instead of `c9.dev` (in oldclient): e.g. [https://ide.c9.dev/username/workspacename](https://ide.c9.dev/username/workspacename)
#### Starting node webkit version ####
Run `scripts/setup-local-dev` to install node-webkit and create Cloud9-dev app in build folder.
it will create build/cloud9-dev.app, which can run either with double click or `build/Cloud9-dev.app/Contents/MacOS/node-webkit`
(If node-webkit is installed and the nw command is the alias for node-webkit. `nw local` works too, but it have problems with native menus on mac)
The following flags are available:
--wait Wait with starting everything. Type start(); in the console to start.
--devel Loads packed files from the server, useful if something is deleted, and you need to rebuild.
--unpacked Run with unpacked files. This is handy for debugging.
--no-worker Run without the worker (runs all the worker process in the main thread).
You can also open via bin/c9 (though c9 needs to be packaged and installed for this to work properly)
bin/c9 server.js
#### Building the local version ####
Run the following command to build a .app file for OSX:
make local
This will create a "Cloud9.app" in the build/output directory. Furthermore there are these build steps
make local-static Build the static files for the local version
make local-build Build the packages for the local version
make local-update Build an update package for the local version
make local-install Install the local version in ~/Applications
make local-installer Build the OSX installer pkg and puts it in output/c9.pkg
#### Run the update service ####
To run the update service run:
node node configs/update-service.js
This will provide the rest API that the local version connects to to requests updates.
#### Load full UI in the browser ####
[http://localhost:8181/ide.html](http://localhost:8181/ide.html)
The plugin configuration for development mode is in configs/client-default.js.
To start the full UI in development mode use the following url:
[http://localhost:8181/ide.html?devel=1](http://localhost:8181/ide.html?devel=1)
The plugin configuration for development mode is in configs/client-devel.js.
#### Running Tests ####
In the following example the server name is localhost. Change this to your server name or ip address.
Running all tests:
[http://localhost:8181/static/test.html](http://localhost:8181/static/test.html)
Running one specific test (in this case of the ace plugin):
[http://localhost:8181/static/test.html?plugins/c9.ace/ace_test.js](http://localhost:8181/static/test.html?plugins/c9.ace/ace_test.js)
Running multiple tests:
[http://localhost:8181/static/test.html?plugins/c9.ace/ace_test.js&plugins/c9.ace.gotoline/gotoline_test.js](http://localhost:8181/static/test.html?plugins/c9.ace/ace_test.js&plugins/c9.ace.gotoline/gotoline_test.js)
Keeping the UI after the test ran
[http://localhost:8181/static/test.html?plugins/c9.ace/ace_test.js&remain=1](http://localhost:8181/static/test.html?plugins/c9.ace/ace_test.js&remain=1)
note: you may need to install coffee-script for all tests to pass (sudo npm install -g coffee-script)
#### Committing back to SubTree repositories
Newclient uses git subtree as a way to manage the underlying repositories that are managed by us.
To commit back to those repositories keep in mind that commits should not cross repository boundaries.
Split up your commits per sub repo. The sub repos are all in the node_modules folder.
To pull from a repo use the following command:
git fetch <name> master
git subtree pull --prefix node_modules/<name> <name> master --squash
To push back to a repo use the following command:
git subtree push --prefix=node_modules/<name> <name> <branch_name>
For instance:
git subtree push --prefix=node_modules/ace ace fix/multi-cursor-weirdness
For more info see: [http://blogs.atlassian.com/2013/05/alternatives-to-git-submodule-git-subtree/](http://blogs.atlassian.com/2013/05/alternatives-to-git-submodule-git-subtree/)
#### Installing a new version of git using nix
Older versions of git don't have the subtree command. You can use nix to install the latest version of git:
scripts/install-git-subtree.sh
#### Deploy to alpha.c9.io ####
Deploy to alpha.c9.io (every server, GCE and AWS) is done automatically by Jenkins CI server as soon
as there is a merge in master *and* every test passes.
To force a deploy:
1. ssh ubunutu@salt.c9.io
2. sudo salt 'newclient*-prod' state.highstate
3. wait to see the result in the output
To force the deploy of a specific commit, tag or branch you need to modify the file **/srv/salt/prodenv/newclientrepo.sls**
and change the rev parameter to the desired one:
newclient_git:
git.latest:
- require:
- file: '{{ pillar['home'] }}/.ssh/id_rsa_deploy'
- file: '{{ pillar['home'] }}/.ssh/config'
- target: {{ pillar['home'] }}/newclient
- runas: {{ pillar['user'] }}
- rev: master
To deploy the vfs:
sudo salt 'vfs*-prod' state.highstate
Happy coding, Cloud9

7
bin/c9
View File

@ -9,8 +9,8 @@ require("amd-loader");
var verbose = process.argv.indexOf("--verbose") + 1
|| process.argv.indexOf("-v") + 1;
architect.resolveConfig(require("../configs/cli.js")(),
__dirname + "/../plugins", function (err, config) {
architect.resolveConfig(require("../configs/cli.js"),
__dirname + "/..", function (err, config) {
if (err) throw err.message;
var cli;
@ -25,5 +25,8 @@ architect.resolveConfig(require("../configs/cli.js")(),
if (!plugin.name)
plugin.name = name;
if (verbose)
console.log("Loading module " + name);
});
});

View File

@ -100,7 +100,7 @@ console.log('Client Plugins:');
});
console.log('CLI Plugins:');
plugins = require('./configs/cli')().concat('plugins/c9.login.client/bootstrap')
plugins = require('./configs/cli').concat('plugins/c9.login.client/bootstrap')
copy.dirs('$SOURCE', '$APPDIR', pluginDirs(plugins), {
exclude: /^mock$/,
});
@ -122,7 +122,7 @@ console.log('Node Modules:');
});
copy.dirs('$SOURCE', '$APPDIR', deps, {
include: null,
exclude: /^(mock|tests?|examples?|samples|Readme.*|build|dist|LICENSE|\\.(idea|grunt|jshintrc|npmignore|gitignore|travis.yml))\$|_test\\.js/i
exclude: /^(mock|tests?|examples?|samples|Readme.*|build|dist|\.(idea|grunt|jshintrc|npmignore|gitignore|travis.yml))$/i
});
});
@ -160,7 +160,7 @@ if [ "$COMPRESS" ]; then
if [ "$OBFUSCATE" ]; then
OPTS="{ obfuscate: true }"
else
OPTS="{}"
OPTS=""
fi
node -e "require('architect-build/compress_folder')('$APPDIR', '$OPTS')"
fi

View File

@ -1,75 +1,39 @@
module.exports = function(options) {
var EventEmitter = require("events").EventEmitter;
var PID = process.env.C9_PID || 526;
var APIHOST = process.env.C9_APIHOST || "api.c9.io"; // "api.c9.io";
var APIURL = APIHOST.indexOf("localhost") > -1
? "http://" + APIHOST
: "https://" + APIHOST;
var AUTHURL = APIHOST.indexOf("localhost") > -1
? "http://" + APIHOST
: "https://" + APIHOST.replace(/api\./, "");
return [
"./c9.core/ext",
module.exports = [
"./plugins/c9.core/ext",
{
packagePath: "./c9.fs/fs",
packagePath: "./plugins/c9.fs/fs",
baseProc: process.cwd(),
cli: true
},
{
packagePath: "./c9.fs/net"
packagePath: "./plugins/c9.fs/net"
},
{
packagePath: "./c9.fs/proc",
packagePath: "./plugins/c9.fs/proc",
baseProc: process.cwd()
},
"./c9.vfs.client/vfs.cli",
"./c9.cli/cli",
"./plugins/c9.vfs.client/vfs.cli",
"./plugins/c9.cli/cli",
{
packagePath: "./c9.cli/auth.bootstrap",
authUrl: AUTHURL
},
{
packagePath: "./c9.cli.publish/publish",
projectId: PID,
apiHost: APIHOST
},
{
packagePath: "./c9.ide.auth/auth",
accessToken: "token",
ideBaseUrl: "",
apiUrl: APIURL
// userId: process.env.C9_USER
},
{
packagePath: "./c9.core/api",
apiUrl: APIURL,
projectId: PID
},
{
packagePath: "./c9.core/http-node"
// debug: !options.packed
},
{
packagePath: "./c9.cli.bridge/bridge-client",
packagePath: "./plugins/c9.cli.bridge/bridge-client",
port: 17123
},
// "./c9.cli.mount/mount",
// "./plugins/c9.cli.mount/mount",
{
packagePath: "./c9.cli.open/open",
packagePath: "./plugins/c9.cli.open/open",
platform: process.platform
},
{
packagePath: "./c9.cli.open/restart",
packagePath: "./plugins/c9.cli.open/restart",
platform: process.platform
},
// "./c9.cli.sync/sync",
//"./c9.ide.keys/commands",
// "./plugins/c9.cli.sync/sync",
//"./plugins/c9.ide.keys/commands",
{
consumes: [],
provides: ["settings", "workspace", "cli_commands", "c9"],
provides: ["settings", "http", "workspace", "cli_commands", "c9", "auth"],
setup: function(options, imports, register) {
register(null, {
// @todo share with ace min
@ -152,6 +116,4 @@ return [
}
];
};
if (!module.parent) require("../server")([__filename].concat(process.argv.slice(2)));

View File

@ -0,0 +1,158 @@
var join = require("path").join;
module.exports = function(options) {
var config = require("./client-default")(options);
return module.exports.makeLocal(config, options);
};
module.exports.makeLocal = function(config, options) {
var c9Ws = options.remoteWorkspace; // true when opening c9 workspace as local
var root = options.workspaceDir;
var nodeBin = options.nodeBin || ["node"];
var settingDir = options.settingDir || options.installPath;
if (!c9Ws) {
// Local version
options.local = true;
options.projectName = root.substr(root.lastIndexOf("/") + 1);
options.debug = 2;
options.env = "local";
}
for (var i = config.length - 1; i >= 0; i--) {
// if (config[i].packagePath == "plugins/c9.cli.bridge/bridge")
// config[i].port = 55556;
if (config[i].packagePath == "plugins/c9.ide.welcome/welcome" && !c9Ws) {
config[i].intro =
"Welcome to your brand new Cloud9. Use this welcome screen "
+ "to tweak the look &amp; feel of the Cloud9 user interface. "
+ "If you prefer a more advanced IDE experience, you can choose "
+ "to change the layout below. "
+ "\n\n"
+ "On the right you can find videos and documentation for Cloud9 "
+ "IDE. Happy Coding!";
}
// else if (config[i].packagePath == "plugins/c9.ide.login/login") {
// config.splice(i, 1);
// }
else if (config[i].packagePath == "plugins/c9.ide.run/run" && !c9Ws) {
config[i].runnerPath = join(settingDir, "/runners");
}
else if (config[i].packagePath == "plugins/c9.ide.ui/menus") {
config[i].autoInit = false;
}
else if (config[i].packagePath == "plugins/c9.ide.save/autosave") {
config[i].slowChangeTimeout = 500;
}
else if (config[i].packagePath == "plugins/c9.ide.run.build/build" && !c9Ws) {
config[i].builderPath = join(settingDir, "/builders");
}
else if (config[i].packagePath == "plugins/c9.ide.editors/metadata" && !c9Ws) {
config[i].path = join(settingDir, "/metadata");
config[i].changeCheckInterval = 2000;
}
else if (config[i].packagePath == "plugins/c9.ide.feedback/feedback") {
config[i].screenshotSupport = false;
}
// else if (config[i].packagePath == "plugins/c9.ide.feedback/feedback") {
// config[i] = {
// packagePath : "plugins/c9.ide.help/help",
// staticPrefix : options.staticPrefix + "/plugins/c9.ide.help"
// };
// }
else if (config[i].packagePath == "plugins/c9.core/c9") {
config[i].local = true;
}
else if (config[i].packagePath == "plugins/c9.ide.clipboard/html5")
config[i].packagePath = "plugins/c9.ide.local/clipboard";
else if (config[i].packagePath == "plugins/c9.ide.configuration/configure")
config[i].pathFromFavorite = true;
else if (config[i].packagePath == "plugins/c9.core/settings" && !c9Ws) {
// todo: Don't show console when opening a file?
// config[i].template = ;
config[i].projectConfigPath = join(settingDir, "");
config[i].userConfigPath = join(settingDir, "");
config[i].stateConfigPath = join(settingDir, "");
} else if (config[i].packagePath == "plugins/c9.ide.log/log" && !c9Ws) {
config[i].source = "desktop";
} else if (config[i].packagePath == "plugins/c9.ide.info/info" && c9Ws) {
config[i].packagePath = "plugins/c9.ide.local/info";
} else if (config[i].packagePath == "plugins/c9.ide.ui/menus" && c9Ws) {
config[i].autoInit = false;
} else if (config[i].packagePath == "plugins/c9.ide.tree/tree") {
config[i].defaultExpanded = !config.hosted;
}
}
// Add local modules
var includes = [{
packagePath: "plugins/c9.ide.local/local",
options: options,
}, {
packagePath: "plugins/c9.ide.local/windowframe",
staticPrefix: options.staticPrefix + "/plugins/c9.ide.local"
}, {
packagePath: "plugins/c9.ide.local/update",
host: options.update && options.update.host || "localhost", // "update.c9.io",
port: options.update && options.update.port || "8888", // "443"
path: options.update && options.update.path,
protocol: options.update && options.update.protocol,
installPath: options.correctedInstallPath,
bashBin: options.bashBin,
nodeBin: nodeBin
}, {
packagePath: "plugins/c9.ide.local/projectmanager"
}, {
packagePath: "plugins/c9.ide.local/open"
}, {
packagePath: "plugins/c9.ide.local/nativemenus"
}, !c9Ws && {
packagePath: "plugins/c9.ide.local/info",
installPath: options.correctedInstallPath,
settingDir: settingDir,
cookie: options.user.cookie,
user: {
id: options.user.id,
name: options.user.name,
fullname: options.user.fullname,
email: options.user.email,
pubkey: options.user.pubkey
},
project: {
id: options.project.id,
name: options.project.name,
contents: options.project.contents,
descr: options.project.descr
}
}].filter(Boolean);
var excludes = c9Ws ? {} : {
"plugins/c9.ide.newresource/open": true,
"plugins/c9.ide.info/info": true,
// "plugins/c9.ide.login/login": true,
"plugins/c9.ide.collab/connect": true,
"plugins/c9.ide.collab/collab": true,
"plugins/c9.ide.collab/collabpanel": true,
"plugins/c9.ide.collab/workspace": true,
"plugins/c9.ide.collab/util": true,
"plugins/c9.ide.collab/ot/document": true,
"plugins/c9.ide.collab/cursor_layer": true,
"plugins/c9.ide.collab/author_layer": true,
"plugins/c9.ide.collab/timeslider/timeslider": true,
"plugins/c9.ide.notifications/notifications": true,
"plugins/c9.ide.collab/members/members_panel": true,
"plugins/c9.ide.collab/share/share": true,
"plugins/c9.ide.collab/members/members": true,
"plugins/c9.ide.collab/chat/chat": true,
"plugins/c9.ide.feedback/nps": true,
"plugins/c9.ide.download/download": true
};
config = config.concat(includes).filter(function (p) {
return !excludes[p] && !excludes[p.packagePath];
});
return config;
};

View File

@ -14,7 +14,6 @@ module.exports = function(options) {
var collab = options.collab;
var packaging = options.packaging;
var staticPrefix = options.staticPrefix;
var ssh = options.ssh;
var nodeBin = options.nodeBin || ["node"];
var nodePath = options.nodePath || "";
@ -28,6 +27,11 @@ module.exports = function(options) {
// allow extend code access only to C9-deveoped plugins
var extendToken = options.extendToken || "token";
// if you want to actually use any of these settings in the client, add them to
// configs/ide.js under the c9.ide.server/configs plugin configuration
var segmentIoOptions = options.analytics && options.analytics.segmentio || {};
var treasureDataOptions = options.analytics && options.analytics.treasureData || {};
var plugins = [
// C9
{
@ -37,7 +41,6 @@ module.exports = function(options) {
version: options.manifest.version + " (" + options.manifest.revision + ")",
debug: debug,
workspaceId: options.workspaceId,
workspaceDir: workspaceDir,
name: options.workspaceName,
readonly: options.readonly,
isAdmin: options.isAdmin,
@ -70,24 +73,23 @@ module.exports = function(options) {
// baseUrl: options.apiUrl
// },
"plugins/c9.core/util",
// Logging, Metrics, Monitoring, Testing
{
packagePath: "plugins/c9.ide.plugins/loader",
plugins: options.plugins || []
packagePath: "plugins/c9.ide.log/log",
devel: devel,
source: "web"
},
"plugins/c9.ide.log/duration",
"plugins/c9.ide.analytics/cookie",
{
packagePath: "plugins/c9.ide.plugins/installer",
updates: options.pluginUpdates || []
},
{
packagePath: "plugins/c9.ide.plugins/manager",
staticPrefix: staticPrefix + "/plugins/c9.ide.plugins"
},
{
packagePath: "plugins/c9.ide.plugins/debug"
},
{
packagePath: "plugins/c9.ide.plugins/market"
packagePath: "plugins/c9.ide.analytics/analytics",
secret: segmentIoOptions.secret,
flushAt: segmentIoOptions.flushAt,
integrations: segmentIoOptions.integrations,
tdWriteKey: treasureDataOptions.tdWriteKey,
tdDb: treasureDataOptions.tdDb
},
"plugins/c9.ide.analytics/user_activity",
// VFS
"plugins/c9.vfs.client/vfs.ping",
@ -97,7 +99,6 @@ module.exports = function(options) {
debug: debug,
installPath: options.installPath,
dashboardUrl: options.dashboardUrl,
accountUrl: options.accountUrl
},
{
packagePath: "plugins/c9.vfs.client/endpoint",
@ -107,6 +108,15 @@ module.exports = function(options) {
servers: options.vfsServers,
updateServers: hosted
},
{
packagePath: "plugins/c9.ide.performancestats/stats",
interval: 30 * 60 * 1000,
ssh: false,
},
{
packagePath: "plugins/c9.ide.restore/restore",
ideBaseUrl: options.ideBaseUrl
},
{
packagePath: "plugins/c9.ide.auth/auth",
accessToken: options.accessToken || "token",
@ -211,7 +221,8 @@ module.exports = function(options) {
// UI
{
packagePath: "plugins/c9.ide.ui/ui",
staticPrefix: staticPrefix + "/plugins/c9.ide.ui"
staticPrefix: staticPrefix + "/plugins/c9.ide.ui",
packedThemes: options.packedThemes,
},
"plugins/c9.ide.ui/anims",
"plugins/c9.ide.ui/tooltip",
@ -284,14 +295,11 @@ module.exports = function(options) {
"plugins/c9.ide.language/jumptodef",
"plugins/c9.ide.language/worker_util_helper",
"plugins/c9.ide.language.generic/generic",
"plugins/c9.ide.language.javascript/javascript",
"plugins/c9.ide.language.css/css",
"plugins/c9.ide.language.html/html",
"plugins/c9.ide.language.javascript/javascript",
"plugins/c9.ide.language.javascript.immediate/immediate",
"plugins/c9.ide.language.javascript.infer/jsinfer",
"plugins/c9.ide.language.javascript.tern/tern",
"plugins/c9.ide.language.javascript.tern/architect_resolver",
"plugins/c9.ide.language.javascript.eslint/eslint",
{
packagePath: "plugins/c9.ide.language.jsonalyzer/jsonalyzer",
extendToken: extendToken,
@ -302,6 +310,7 @@ module.exports = function(options) {
useSend: !collab && (options.local || options.standalone),
maxServerCallInterval: 2000
},
"plugins/c9.ide.language.jsonalyzer/architect_resolver",
// Run
{
@ -313,6 +322,7 @@ module.exports = function(options) {
installPath: options.correctedInstallPath,
local: options.local
},
"plugins/c9.ide.run/run_analytics",
{
packagePath: "plugins/c9.ide.run/gui",
staticPrefix: staticPrefix + "/plugins/c9.ide.layout.classic",
@ -425,6 +435,7 @@ module.exports = function(options) {
sshfsBin: options.mount.sshfsBin,
fusermountBin: options.mount.fusermountBin
},
"plugins/c9.ide.download/download",
{
packagePath: "plugins/c9.ide.upload/dragdrop",
treeAsPane: options.local
@ -460,6 +471,53 @@ module.exports = function(options) {
"plugins/c9.ide.panels/panel",
"plugins/c9.ide.panels/area",
"plugins/c9.ide.installer/installer_mock",
// {
// packagePath: "plugins/c9.ide.installer/installer",
// installScript: "https://raw.githubusercontent.com/c9/install/master/install.sh",
// homeDir: options.homeDir
// },
// Deploy
// {
// packagePath : "plugins/c9.ide.deploy/deploy",
// staticPrefix : staticPrefix + "/plugins/c9.ide.deploy"
// },
// "plugins/c9.ide.deploy/instance",
// "plugins/c9.ide.deploy/target",
// {
// packagePath : "plugins/c9.ide.deploy.mongolab/mongolab",
// staticPrefix : staticPrefix + "/plugins/c9.ide.deploy.mongolab/images"
// },
// {
// packagePath : "plugins/c9.ide.deploy.heroku/heroku",
// staticPrefix : staticPrefix + "/plugins/c9.ide.deploy.heroku/images"
// },
// {
// packagePath : "plugins/c9.ide.deploy.heroku/libheroku",
// basePath : workspaceDir,
// heroku : options.heroku,
// git : options.git
// },
// {
// packagePath : "plugins/c9.ide.deploy.openshift/openshift",
// staticPrefix : staticPrefix + "/plugins/c9.ide.deploy.openshift/images",
// rhc : options.rhc
// },
// {
// packagePath : "plugins/c9.ide.deploy.openshift/libopenshift",
// basePath : workspaceDir,
// git : options.git,
// rhc : options.rhc
// },
// {
// packagePath : "plugins/c9.ide.deploy.gae/gae",
// staticPrefix : staticPrefix + "/plugins/c9.ide.deploy.gae/images"
// },
// {
// packagePath : "plugins/c9.ide.deploy.gae/libgae",
// basePath : workspaceDir,
// git : options.git,
// },
// Previewer
{
@ -520,8 +578,7 @@ module.exports = function(options) {
id: options.project.id,
name: options.project.name,
contents: options.project.contents,
descr: options.project.descr,
remote: options.project.remote
descr: options.project.descr
}
},
{
@ -550,9 +607,22 @@ module.exports = function(options) {
packagePath: "plugins/c9.ide.help/help",
staticPrefix: staticPrefix + "/plugins/c9.ide.help"
},
// {
// packagePath: "plugins/c9.ide.feedback/feedback",
// staticPrefix: staticPrefix + "/plugins/c9.ide.feedback",
// baseurl: options.ideBaseUrl,
// userSnapApiKey: options.feedback.userSnapApiKey,
// screenshotSupport: true
// },
{
packagePath: "plugins/c9.ide.configuration/configure"
},
{
packagePath: "plugins/c9.ide.feedback/nps",
standalone: options.standalone,
local: options.local
},
"plugins/c9.ide.feedback/jobs",
"plugins/c9.ide.save/save",
"plugins/c9.ide.recentfiles/recentfiles",
{
@ -590,14 +660,41 @@ module.exports = function(options) {
basePath: workspaceDir,
local: options.local
},
{
packagePath: "plugins/c9.ide.login/login",
staticPrefix: staticPrefix + "/plugins/c9.ide.login",
ideBaseUrl: options.ideBaseUrl,
dashboardUrl: options.dashboardUrl,
local: options.local
},
{
packagePath: "plugins/c9.ide.pubsub/pubsub-client",
extendToken: extendToken
},
// {
// packagePath: "plugins/c9.dashboard.new/dashboard",
// staticPrefix: staticPrefix + "/plugins/c9.dashboard.new"
// }
// Sauce Labs
{
packagePath: "plugins/c9.ide.collab/notifications/bubble",
staticPrefix: staticPrefix + "/plugins/c9.ide.collab/notifications"
packagePath: "plugins/saucelabs.preview/preview",
staticPrefix: staticPrefix + "/plugins/saucelabs.preview",
bashBin: options.bashBin
},
"plugins/c9.ide.hackhands/hackhands",
{
packagePath: "plugins/saucelabs.preview/sauce_connect",
installPath: options.sauceConnectPath || options.correctedInstallPath,
assumeConnected: hosted || (options.saucelabs && options.saucelabs.assumeConnected),
eagerConnect: options.local
},
{
packagePath: "plugins/saucelabs.preview/auth",
account: options.saucelabs && options.saucelabs.account,
serverURL: options.saucelabs && options.saucelabs.serverURL,
bashBin: options.bashBin
}
];
if (packaging || !devel) {
@ -616,6 +713,13 @@ module.exports = function(options) {
});
}
if (packaging || hosted) {
plugins.push({
packagePath: "plugins/c9.ide.quota/quota",
workspaceDir: workspaceDir
});
}
// Collab
if (packaging || !collab) {
plugins.push(
@ -662,6 +766,10 @@ module.exports = function(options) {
hosted: hosted,
isAdmin: options.isAdmin
},
{
packagePath: "plugins/c9.ide.collab/notifications/bubble",
staticPrefix: staticPrefix + "/plugins/c9.ide.collab/notifications"
},
"plugins/c9.ide.collab/members/members_panel",
{
packagePath: "plugins/c9.ide.collab/share/share",
@ -675,15 +783,10 @@ module.exports = function(options) {
{
packagePath: "plugins/c9.ide.collab/chat/chat",
staticPrefix: staticPrefix + "/plugins/c9.ide.collab/chat"
});
}
}
);
// }
}
return plugins;
};

View File

@ -1,7 +1,7 @@
module.exports = function(options, optimist) {
var plugins = require("./standalone")(options, optimist);
options.inProcessLocalFs = true;
options.inProcessLocalfs = true;
plugins.forEach(function(p) {
if (p.packagePath)

View File

@ -29,9 +29,6 @@ module.exports = function(config, optimist) {
.boolean("packed")
.default("packed", config.packed)
.alias("a", "auth")
.boolean("hosted")
.describe("hosted", "Use default config of the hosted version")
.default("hosted", false)
.describe("auth", "Basic Auth username:password")
.default("auth", ":")
.describe("collab", "Whether to enable collab.")
@ -75,9 +72,6 @@ module.exports = function(config, optimist) {
var workspaceType = argv.workspacetype || null;
if (argv.hosted)
config.client_config = "default-hosted";
config.workspaceDir = baseProc;
config.settingDir = argv["setting-path"];
config.projectName = path.basename(baseProc);
@ -199,13 +193,8 @@ module.exports = function(config, optimist) {
}
];
if (config.collab && !config.mode && !config.local) {
try {
var addApi = require("./api.standalone").addApi;
} catch(e) {}
if (addApi) {
plugins = addApi(plugins, config);
}
if (config.collab && !config.mode) {
plugins = require("./api.standalone").addApi(plugins, config);
}
return plugins;

View File

@ -1,4 +1,4 @@
Cloud9 IDE Coding Style
ajax.org Coding Style
=====================
Goals

333
local/npm-shrinkwrap.json generated Normal file
View File

@ -0,0 +1,333 @@
{
"name": "Cloud9Dev",
"version": "0.0.1",
"dependencies": {
"amd-loader": {
"version": "0.0.5",
"from": "amd-loader@~0.0.5"
},
"optimist": {
"version": "0.6.0",
"from": "optimist@",
"dependencies": {
"minimist": {
"version": "0.0.5",
"from": "minimist@~0.0.1"
}
}
},
"netutil": {
"version": "0.0.1",
"from": "netutil@"
},
"formidable": {
"version": "1.0.14",
"from": "formidable@"
},
"node-uuid": {
"version": "1.4.1",
"from": "node-uuid@"
},
"connect": {
"version": "2.8.8",
"from": "connect@~2.8.0",
"dependencies": {
"cookie-signature": {
"version": "1.0.1",
"from": "cookie-signature@1.0.1"
},
"buffer-crc32": {
"version": "0.2.1",
"from": "buffer-crc32@0.2.1"
},
"cookie": {
"version": "0.1.0",
"from": "cookie@0.1.0"
},
"bytes": {
"version": "0.2.0",
"from": "bytes@0.2.0"
},
"pause": {
"version": "0.0.1",
"from": "pause@0.0.1"
},
"uid2": {
"version": "0.0.2",
"from": "uid2@0.0.2"
},
"debug": {
"version": "0.7.4",
"from": "debug@*"
},
"methods": {
"version": "0.0.1",
"from": "methods@0.0.1"
}
}
},
"http-error": {
"version": "0.0.1",
"from": "http-error@"
},
"async": {
"version": "0.2.9",
"from": "async@"
},
"ejs": {
"version": "0.8.5",
"from": "ejs@"
},
"email-validator": {
"version": "0.1.2",
"from": "email-validator@"
},
"engine.io": {
"version": "0.6.3",
"from": "engine.io@~0.6.3",
"dependencies": {
"debug": {
"version": "0.6.0",
"from": "debug@0.6.0"
},
"base64id": {
"version": "0.1.0",
"from": "base64id@0.1.0"
}
}
},
"engine.io-client": {
"version": "0.6.3",
"from": "engine.io-client@~0.6.3",
"dependencies": {
"xmlhttprequest": {
"version": "1.5.0",
"from": "xmlhttprequest@1.5.0"
},
"emitter": {
"version": "1.0.0",
"from": "http://github.com/component/emitter/archive/1.0.0.tar.gz",
"resolved": "http://github.com/component/emitter/archive/1.0.0.tar.gz"
},
"indexof": {
"version": "0.0.1",
"from": "indexof@0.0.1"
},
"debug": {
"version": "0.7.2",
"from": "debug@0.7.2"
}
}
},
"msgpack-js-browser": {
"version": "0.1.4",
"from": "msgpack-js-browser@"
},
"msgpack-js": {
"version": "0.1.5",
"from": "msgpack-js@~0.1.0"
},
"simple-mime": {
"version": "0.0.8",
"from": "simple-mime@"
},
"mkdirp": {
"version": "0.3.5",
"from": "mkdirp@"
},
"through": {
"version": "2.2.0",
"from": "through@2.2.0",
"resolved": "https://registry.npmjs.org/through/-/through-2.2.0.tgz"
},
"less": {
"version": "1.5.1",
"from": "less@",
"dependencies": {
"clean-css": {
"version": "2.0.2",
"from": "clean-css@2.0.x",
"dependencies": {
"commander": {
"version": "2.0.0",
"from": "commander@2.0.x"
}
}
}
}
},
"send": {
"version": "0.1.4",
"from": "send@",
"dependencies": {
"debug": {
"version": "0.7.4",
"from": "debug@*"
},
"range-parser": {
"version": "0.0.4",
"from": "range-parser@0.0.4"
}
}
},
"tmp": {
"version": "0.0.23",
"from": "tmp@",
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.23.tgz"
},
"rusha": {
"version": "0.7.2",
"from": "rusha@"
},
"simplefunc": {
"version": "0.0.2",
"from": "simplefunc@"
},
"isbinaryfile": {
"version": "0.1.9",
"from": "isbinaryfile@0.1.9",
"resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-0.1.9.tgz"
},
"minimatch": {
"version": "0.2.11",
"from": "minimatch@0.2.11",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.11.tgz",
"dependencies": {
"lru-cache": {
"version": "2.5.0",
"from": "lru-cache@2"
},
"sigmund": {
"version": "1.0.0",
"from": "sigmund@~1.0.0"
}
}
},
"nak": {
"version": "0.2.21"
},
"architect": {
"version": "0.1.11"
},
"architect-build": {
"version": "0.1.0"
},
"connect-architect": {
"version": "0.2.0"
},
"frontdoor": {
"version": "0.0.1"
},
"vfs-nodefs-adapter": {
"version": "0.3.0"
},
"vfs-http-adapter": {
"version": "0.2.3"
},
"vfs-local": {
"version": "0.3.13"
},
"vfs-socket": {
"version": "0.3.13"
},
"kaefer": {
"version": "0.1.0"
},
"c9": {
"version": "0.1.0"
},
"request": {
"version": "2.12.0",
"from": "request@~2.12.0",
"dependencies": {
"form-data": {
"version": "0.0.3",
"from": "form-data",
"dependencies": {
"combined-stream": {
"version": "0.0.3",
"from": "combined-stream@0.0.3",
"dependencies": {
"delayed-stream": {
"version": "0.0.5",
"from": "delayed-stream@0.0.5"
}
}
},
"async": {
"version": "0.1.9",
"from": "async@0.1.9"
}
}
}
}
},
"uglify-js": {
"version": "2.2.5",
"from": "uglify-js@2.2.5",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.2.5.tgz",
"dependencies": {
"optimist": {
"version": "0.3.7",
"from": "optimist@~0.3.5",
"resolved": "https://registry.npmjs.org/optimist/-/optimist-0.3.7.tgz"
}
}
},
"connect-flash": {
"version": "0.1.1",
"from": "connect-flash@~0.1.0"
},
"engine.io-parser": {
"version": "0.3.0",
"from": "engine.io-parser@0.3.0"
},
"fresh": {
"version": "0.2.0",
"from": "fresh@0.2.0"
},
"mime": {
"version": "1.2.11",
"from": "mime@1.2.11"
},
"qs": {
"version": "0.6.5",
"from": "qs@0.6.5"
},
"wordwrap": {
"version": "0.0.2",
"from": "wordwrap@0.0.2"
},
"smith": {
"version": "0.1.22"
},
"source-map": {
"version": "0.1.31",
"from": "source-map@0.1.31",
"dependencies": {
"amdefine": {
"version": "0.1.0",
"from": "amdefine@>=0.0.4"
}
}
},
"ws": {
"version": "0.4.25",
"from": "ws@0.4.25",
"dependencies": {
"commander": {
"version": "0.6.1",
"from": "commander@~0.6.1"
},
"tinycolor": {
"version": "0.0.1",
"from": "tinycolor@0.x"
},
"options": {
"version": "0.0.5",
"from": "options@latest"
}
}
}
}
}

1
node_modules/ace/.gitignore generated vendored
View File

@ -2,7 +2,6 @@
.DS_Store
*.swp
*.tmp
*~
# Project files that should not be in the repo
.*

View File

@ -120,7 +120,6 @@ function demo() {
function changeComments(data) {
return (data
.replace("doc/site/images/ace-logo.png", "demo/kitchen-sink/ace-logo.png")
.replace(/<!\-\-DEVEL[\d\D]*?DEVEL\-\->/g, "")
.replace(/PACKAGE\-\->|<!\-\-PACKAGE/g, "")
.replace(/\/\*DEVEL[\d\D]*?DEVEL\*\//g, "")

View File

@ -31,15 +31,13 @@
define(function(require, exports, module) {
var dom = require("ace/lib/dom");
var Range = require("ace/range").Range;
// allow easy access to ace in console, but not in ace code which uses strict
function isStrict() {
try { return !arguments.callee.caller.caller.caller}
catch(e){ return true }
}
function warn() {
var s = (new Error()).stack || "";
s = s.split("\n");
if (s[1] == "Error") s.shift(); // remove error description on chrome
s.shift(); // remove warn
s.shift(); // remove the getter
s = s.join("\n");
// allow easy access to ace in console, but not in ace code
if (!/at Object.InjectedScript.|@debugger eval|snippets:\/{3}/.test(s)) {
if (isStrict()) {
console.error("trying to access to global variable");
}
}
@ -93,58 +91,53 @@ exports.addGlobals = function() {
window.EditSession = require("ace/edit_session").EditSession;
window.MockRenderer = require("ace/test/mockrenderer").MockRenderer;
window.EventEmitter = require("ace/lib/event_emitter").EventEmitter;
window.getSelection = getSelection;
window.setSelection = setSelection;
window.testSelection = testSelection;
};
function getSelection(editor) {
var data = editor.multiSelect.toJSON();
if (!data.length) data = [data];
data = data.map(function(x) {
var a, c;
if (x.isBackwards) {
a = x.end;
c = x.start;
} else {
c = x.end;
a = x.start;
}
return Range.comparePoints(a, c)
? [a.row, a.column, c.row, c.column]
: [a.row, a.column];
});
return data.length > 1 ? data : data[0];
}
function setSelection(editor, data) {
if (typeof data[0] == "number")
data = [data];
editor.selection.fromJSON(data.map(function(x) {
var start = {row: x[0], column: x[1]};
var end = x.length == 2 ? start : {row: x[2], column: x[3]};
var isBackwards = Range.comparePoints(start, end) > 0;
return isBackwards ? {
start: end,
end: start,
isBackwards: true
} : {
start: start,
end: end,
isBackwards: true
};
}));
}
function testSelection(editor, data) {
assert.equal(getSelection(editor) + "", data + "");
}
exports.recordTestCase = function() {
exports.addGlobals();
var editor = window.editor;
var testcase = window.testcase = [];
var assert;
function getSelection(editor) {
var data = editor.multiSelect.toJSON();
if (!data.length) data = [data];
data = data.map(function(x) {
var a, c;
if (x.isBackwards) {
a = x.end;
c = x.start;
} else {
c = x.end;
a = x.start;
}
return Range.comparePoints(a, c)
? [a.row, a.column, c.row, c.column]
: [a.row, a.column];
});
return data.length > 1 ? data : data[0];
}
function setSelection(editor, data) {
if (typeof data[0] == "number")
data = [data];
editor.selection.fromJSON(data.map(function(x) {
var start = {row: x[0], column: x[1]};
var end = x.length == 2 ? start : {row: x[2], column: x[3]};
var isBackwards = Range.comparePoints(start, end) > 0;
return isBackwards ? {
start: end,
end: start,
isBackwards: true
} : {
start: start,
end: end,
isBackwards: true
};
}));
}
function testSelection(editor, data) {
assert.equal(getSelection(editor) + "", data + "");
}
testcase.push({
type: "setValue",
data: editor.getValue()

View File

@ -86,12 +86,9 @@ var ownSource = {
/* filled from require*/
};
var hugeDocs = require.toUrl ? {
var hugeDocs = {
"build/src/ace.js": "",
"build/src-min/ace.js": ""
} : {
"src/ace.js": "",
"src-min/ace.js": ""
};
modelist.modes.forEach(function(m) {
@ -169,44 +166,13 @@ function loadDoc(name, callback) {
});
}
function saveDoc(name, callback) {
var doc = fileCache[name] || name;
if (!doc || !doc.session)
return callback("Unknown document: " + name);
var path = doc.path;
var parts = path.split("/");
if (parts[0] == "docs")
path = "demo/kitchen-sink/" + path;
else if (parts[0] == "ace")
path = "lib/" + path;
upload(path, doc.session.getValue(), callback);
}
function upload(url, data, callback) {
url = net.qualifyURL(url);
if (!/https?:/.test(url))
return callback(new Error("Unsupported url scheme"));
var xhr = new XMLHttpRequest();
xhr.open("PUT", url, true);
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
callback(!/^2../.test(xhr.status));
}
};
xhr.send(data);
};
module.exports = {
fileCache: fileCache,
docs: sort(prepareDocList(docs)),
ownSource: prepareDocList(ownSource),
hugeDocs: prepareDocList(hugeDocs),
initDoc: initDoc,
loadDoc: loadDoc,
saveDoc: saveDoc,
loadDoc: loadDoc
};
module.exports.all = {
"Mode Examples": module.exports.docs,

View File

@ -1,171 +0,0 @@
%abc-2.1
H:This file contains some example English tunes
% note that the comments (like this one) are to highlight usages
% and would not normally be included in such detail
O:England % the origin of all tunes is England
X:1 % tune no 1
T:Dusty Miller, The % title
T:Binny's Jig % an alternative title
C:Trad. % traditional
R:DH % double hornpipe
M:3/4 % meter
K:G % key
B>cd BAG|FA Ac BA|B>cd BAG|DG GB AG:|
Bdd gfg|aA Ac BA|Bdd gfa|gG GB AG:|
BG G/2G/2G BG|FA Ac BA|BG G/2G/2G BG|DG GB AG:|
W:Hey, the dusty miller, and his dusty coat;
W:He will win a shilling, or he spend a groat.
W:Dusty was the coat, dusty was the colour;
W:Dusty was the kiss, that I got frae the miller.
X:2
T:Old Sir Simon the King
C:Trad.
S:Offord MSS % from Offord manuscript
N:see also Playford % reference note
M:9/8
R:SJ % slip jig
N:originally in C % transcription note
K:G
D|GFG GAG G2D|GFG GAG F2D|EFE EFE EFG|A2G F2E D2:|
D|GAG GAB d2D|GAG GAB c2D|[1 EFE EFE EFG|[A2G] F2E D2:|\ % no line-break in score
M:12/8 % change of meter
[2 E2E EFE E2E EFG|\ % no line-break in score
M:9/8 % change of meter
A2G F2E D2|]
X:3
T:William and Nancy
T:New Mown Hay
T:Legacy, The
C:Trad.
O:England; Gloucs; Bledington % place of origin
B:Sussex Tune Book % can be found in these books
B:Mally's Cotswold Morris vol.1 2
D:Morris On % can be heard on this record
P:(AB)2(AC)2A % play the parts in this order
M:6/8
K:G
[P:A] D|"G"G2G GBd|"C"e2e "G"dBG|"D7"A2d "G"BAG|"C"E2"D7"F "G"G2:|
[P:B] d|"G"e2d B2d|"C"gfe "G"d2d| "G"e2d B2d|"C"gfe "D7"d2c|
"G"B2B Bcd|"C"e2e "G"dBG|"D7"A2d "G"BAG|"C"E2"D7"F "G"G2:|
% changes of meter, using inline fields
[T:Slows][M:4/4][L:1/4][P:C]"G"d2|"C"e2 "G"d2|B2 d2|"Em"gf "A7"e2|"D7"d2 "G"d2|\
"C"e2 "G"d2|[M:3/8][L:1/8] "G"B2 d |[M:6/8] "C"gfe "D7"d2c|
"G"B2B Bcd|"C"e2e "G"dBG|"D7"A2d "G"BAG|"C"E2"D7"F "G"G2:|
X:4
T:South Downs Jig
R:jig
S:Robert Harbron
M:6/8
L:1/8
K:G
|: d | dcA G3 | EFG AFE | DEF GAB | cde d2d |
dcA G3 | EFG AFE | DEF GAB | cAF G2 :|
B | Bcd e2c | d2B c2A | Bcd e2c | [M:9/8]d2B c2B A3 |
[M:6/8]DGF E3 | cBA FED | DEF GAB |1 cAF G2 :|2 cAF G3 |]
X:5
T:Atholl Brose
% in this example, which reproduces Highland Bagpipe gracing,
% the large number of grace notes mean that it is more convenient to be specific about
% score line-breaks (using the $ symbol), rather than using code line breaks to indicate them
I:linebreak $
K:D
{gcd}c<{e}A {gAGAG}A2 {gef}e>A {gAGAG}Ad|
{gcd}c<{e}A {gAGAG}A>e {ag}a>f {gef}e>d|
{gcd}c<{e}A {gAGAG}A2 {gef}e>A {gAGAG}Ad|
{g}c/d/e {g}G>{d}B {gf}gG {dc}d>B:|$
{g}c<e {gf}g>e {ag}a>e {gf}g>e|
{g}c<e {gf}g>e {ag}a2 {GdG}a>d|
{g}c<e {gf}g>e {ag}a>e {gf}g>f|
{gef}e>d {gf}g>d {gBd}B<{e}G {dc}d>B|
{g}c<e {gf}g>e {ag}a>e {gf}g>e|
{g}c<e {gf}g>e {ag}a2 {GdG}ad|
{g}c<{GdG}e {gf}ga {f}g>e {g}f>d|
{g}e/f/g {Gdc}d>c {gBd}B<{e}G {dc}d2|]
X:6
T:Untitled Reel
C:Trad.
K:D
eg|a2ab ageg|agbg agef|g2g2 fgag|f2d2 d2:|\
ed|cecA B2ed|cAcA E2ed|cecA B2ed|c2A2 A2:|
K:G
AB|cdec BcdB|ABAF GFE2|cdec BcdB|c2A2 A2:|
X:7
T:Kitchen Girl
C:Trad.
K:D
[c4a4] [B4g4]|efed c2cd|e2f2 gaba|g2e2 e2fg|
a4 g4|efed cdef|g2d2 efed|c2A2 A4:|
K:G
ABcA BAGB|ABAG EDEG|A2AB c2d2|e3f edcB|ABcA BAGB|
ABAG EGAB|cBAc BAG2|A4 A4:|
%abc-2.1
%%pagewidth 21cm
%%pageheight 29.7cm
%%topspace 0.5cm
%%topmargin 1cm
%%botmargin 0cm
%%leftmargin 1cm
%%rightmargin 1cm
%%titlespace 0cm
%%titlefont Times-Bold 32
%%subtitlefont Times-Bold 24
%%composerfont Times 16
%%vocalfont Times-Roman 14
%%staffsep 60pt
%%sysstaffsep 20pt
%%musicspace 1cm
%%vocalspace 5pt
%%measurenb 0
%%barsperstaff 5
%%scale 0.7
X: 1
T: Canzonetta a tre voci
C: Claudio Monteverdi (1567-1643)
M: C
L: 1/4
Q: "Andante mosso" 1/4 = 110
%%score [1 2 3]
V: 1 clef=treble name="Soprano"sname="A"
V: 2 clef=treble name="Alto" sname="T"
V: 3 clef=bass middle=d name="Tenor" sname="B"
%%MIDI program 1 75 % recorder
%%MIDI program 2 75
%%MIDI program 3 75
K: Eb
% 1 - 4
[V: 1] |:z4 |z4 |f2ec |_ddcc |
w: Son que-sti~i cre-spi cri-ni~e
w: Que-sti son gli~oc-chi che mi-
[V: 2] |:c2BG|AAGc|(F/G/A/B/)c=A|B2AA |
w: Son que-sti~i cre-spi cri-ni~e que - - - - sto~il vi-so e
w: Que-sti son~gli oc-chi che mi-ran - - - - do fi-so mi-
[V: 3] |:z4 |f2ec|_ddcf |(B/c/_d/e/)ff|
w: Son que-sti~i cre-spi cri-ni~e que - - - - sto~il
w: Que-sti son~gli oc-chi che mi-ran - - - - do
% 5 - 9
[V: 1] cAB2 |cAAA |c3B|G2!fermata!Gz ::e4|
w: que-sto~il vi-so ond' io ri-man-go~uc-ci-so. Deh,
w: ran-do fi-so, tut-to re-stai con-qui-so.
[V: 2] AAG2 |AFFF |A3F|=E2!fermata!Ez::c4|
w: que-sto~il vi-so ond' io ri-man-go~uc-ci-so. Deh,
w: ran-do fi-so tut-to re-stai con-qui-so.
[V: 3] (ag/f/e2)|A_ddd|A3B|c2!fermata!cz ::A4|
w: vi - - - so ond' io ti-man-go~uc-ci-so. Deh,
w: fi - - - so tut-to re-stai con-qui-so.
% 10 - 15
[V: 1] f_dec |B2c2|zAGF |\
w: dim-me-lo ben mi-o, che que-sto\
=EFG2 |1F2z2:|2F8|] % more notes
w: sol de-si-o_. % more lyrics
[V: 2] ABGA |G2AA|GF=EF |(GF3/2=E//D//E)|1F2z2:|2F8|]
w: dim-me-lo ben mi-o, che que-sto sol de-si - - - - o_.
[V: 3] _dBc>d|e2AF|=EFc_d|c4 |1F2z2:|2F8|]
w: dim-me-lo ben mi-o, che que-sto sol de-si-o_.

View File

@ -1,52 +0,0 @@
/* Mask Syntax Demo */
div > ' Test ~[name]';
define :userProfile {
header {
h4 > @title;
button.close;
}
}
:userProfile {
@title > ' Hello ~[: username.toUpperCase()]'
}
style {
html, body {
background: url('name.png') 0 0 no-repeat;
}
}
button {
event click (e) {
this.textContent = `name ${e.clientX} !`;
}
}
md > """
- div
- span
Hello
[one](http://google.com)
""";
header .foo > 'Heading'
button .baz x-signal='click: test' disabled > "
Hello,
world
\"Buddy\"
"
var a = {
name: `name ${window.innerWidth}`
};
span .foo > "~[bind: a.name]"

View File

@ -20,7 +20,7 @@ class Range
end
end
{:id => ?", :key => "value"}
{:id => 34, :key => "value"}
herDocs = [<<'FOO', <<BAR, <<-BAZ, <<-`EXEC`] #comment

View File

@ -53,16 +53,16 @@ require("ace/commands/default_commands").commands.push({
return;
}
var rowCount = 10;
var rowCount = 10;
var w = {
row: row,
// rowCount: rowCount,
fixedWidth: true,
el: dom.createElement("div"),
editor: inlineEditor
editor: editor
};
var el = w.el;
el.appendChild(inlineEditor.container);
el.appendChild(inlineEditor.container);
if (!editor.session.widgetManager) {
editor.session.widgetManager = new LineWidgets(editor.session);

52
node_modules/ace/index.html generated vendored
View File

@ -196,7 +196,8 @@ console.log(addResult);
<p><span class="expand_arrow">&gt;</span> <a href="https://github.com/ajaxorg/ace/tree/master/lib/ace/theme" target="_blank">See all themes</a></p>
<h2>Setting the Programming Language Mode</h2>
<p>By default, the editor supports plain text mode. All other language modes are available as separate modules, loaded on demand like this:</p>
<pre><code class="javascript">editor.getSession().setMode("ace/mode/javascript");</code></pre>
<pre><code class="javascript">editor.getSession().setMode("ace/mode/javascript");
</code></pre>
<!--h2>One Editor, Multiple Sessions</h2>
<p>Ace keeps everything about the state of the editor (selection, scroll position, etc.)
in <code class="javascript">editor.session</code>. This means you can grab the
@ -794,10 +795,10 @@ if (match) {
<a href="http://plnkr.co/edit/">Plunker</a>
</li>
<li>
<img src="https://raw.githubusercontent.com/dart-lang/chromedeveditor/master/ide/web/images/icon_128.png"
style="left: 0px;top: -15px;width: 100px;" />
<a href="https://github.com/dart-lang/chromedeveditor">Chrome Dev Editor</a>
</li>
<img src="doc/site/images/ac-logo.png"
style="left: 4px; top: 25px;" />
<a href="http://www.applicationcraft.com/">Application Craft</a>
</li>
<li>
<img src="doc/site/images/sassmeister-logo.png"
style="left: 10px;top: -5px;width: 80px;" />
@ -837,7 +838,7 @@ if (match) {
<a href="http://habitat.inkling.com">Inkling Habitat</a>
</li>
<li style="width: 248px;">
<img src="http://codecombat.com/images/pages/base/logo.png" style="left: 0px; top: 1px; width: 248px">
<img src="http://codecombat.com/images/pages/base/logo.png" style="left: 48px; top: 10px;">
<a href="http://codecombat.com">Code Combat</a>
</li>
<!--seems to be down <li>
@ -968,11 +969,6 @@ if (match) {
<div class="text-logo" style="margin-left:-17px;font-family:'Henny Penny',cursive;">ChocolateJs</div>
<a href="https://chocolatejs.org">Chocolatejs</a>
</li>
<li>
<img src="doc/site/images/ac-logo.png"
style="left: 4px; top: 25px;" />
<a href="http://www.applicationcraft.com/">Application Craft</a>
</li>
<li>
<img src="http://playir.com/common/icon_playir.png"
style="left: 11px; width: 96px;top: -17px;">
@ -982,6 +978,10 @@ if (match) {
<div class="text-logo" style="font-size: 23px;">Runnable</div>
<a href="http://runnable.com">Runnable</a>
</li>
<li>
<div class="text-logo" style="font-size: 22px;margin-left: -5px;">DocsCamp</div>
<a href="http://docscamp.com/">DocsCamp</a>
</li>
<li>
<img src="http://joshnuss.github.io/mruby-web-irb/images/favicon.png"
style="left: 4px; width: 90px;top: -17px;">
@ -1025,7 +1025,7 @@ if (match) {
<a href="http://iknode.com/">iKnode</a>
</li>
<li title="Online conference and code review tool">
<div style="width: 90px; left: 10px; top: 0px;background:rgb(24,73,92);color: white;position: absolute;
<div style="width: 90px; left: 5px; top: 0px;background:rgb(24,73,92);color: white;position: absolute;
font-size: 68px;text-align: center;font-weight: bold;font-family: inherit;line-height: normal;">sT</div>
<a href="http://sourcetalk.net/">SourceTalk</a>
</li>
@ -1257,30 +1257,14 @@ if (match) {
background-position: 19px;"></div>
<a href="http://apiary.io/">Apiary</a>
</li>
<li>
<img src="https://dirigible.hana.ondemand.com/dirigible/web/welcome/img/logo/dirigible-logo.png" style="width: 80px; left: 10px; top: 10px;">
<a href="https://dirigible.io/">Dirigible</a>
</li>
<li>
<img src="http://exist-db.org/exist/apps/eXide/resources/images/logo.png" style="width: 120px; left: -10px; top: 15px;">
<a href="http://exist-db.org">ExistDB</a>
</li>
<li>
<img src="https://jscalc.io/img/icons/jscalc_full_bleed_24.svg" style="width: 90px; left: 5px; top: -10px;">
<a href="https://jscalc.io/">JSCalc</a>
</li>
<li>
<img src="http://tworld-ai.com/imgs/web-app/rob_face.png" style="width: 90px; left: 5px; top: -10px;">
<a href="http://tworld-ai.com/imgs/web-app/rob_face.png">T-World</a>
</li>
<li>
<img src="https://www.gestixi.com/assets/img/icons/gestixi-64.png" style="width: 90px; left: 5px; top: 20px;">
<a href="https://www.gestixi.com/">GestiXi</a>
</li>
<li>
<div class="text-logo">Clicpilot</div>
<a href="http://www.clicpilot.com/">clicpilot</a>
</li>
<li>
<div class="text-logo" style="font-size:22px;text-shadow:none;margin-top:13px">Code-Fight.Club</div>
<a href="http://code-fight.club">Code-Fight.Club</a>
</li>
<li>
<a href="https://cloud.formcycle.de/formcycle/fd2/">Formcycle</a>
@ -1341,8 +1325,8 @@ if (match) {
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/js/bootstrap.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/js/bootstrap.min.js"></script>
<script src="./doc/template/resources/javascripts/bbq.js"></script>
<script src="./api/resources/javascripts/ux.js"></script>
<script src="./doc/site/js/main.js"></script>

4
node_modules/ace/kitchen-sink.html generated vendored
View File

@ -258,9 +258,7 @@
<a href="http://ace.c9.io">
<img id="ace-logo" src="doc/site/images/ace-logo.png" style="width: 134px;margin: 46px 0px 4px 66px;">
</a>
<div><a target="_test" href="./lib/ace/test/tests.html"
style="color: whitesmoke; text-align: left; padding: 1em;">tests</a>
</div>
</div>
</div>
</div>

4
node_modules/ace/lib/ace/anchor.js generated vendored
View File

@ -120,8 +120,8 @@ var Anchor = exports.Anchor = function(doc, row, column) {
var deltaIsInsert = delta.action == "insert";
var deltaRowShift = (deltaIsInsert ? 1 : -1) * (delta.end.row - delta.start.row);
var deltaColShift = (deltaIsInsert ? 1 : -1) * (delta.end.column - delta.start.column);
var deltaStart = delta.start;
var deltaEnd = deltaIsInsert ? deltaStart : delta.end; // Collapse insert range.
var deltaStart = delta.start;
var deltaEnd = deltaIsInsert ? deltaStart : delta.end; // Collapse insert range.
// DELTA AFTER POINT: No change needed.
if ($pointsInOrder(point, deltaStart, moveIfEqual)) {

View File

@ -40,10 +40,8 @@ var dom = require("./lib/dom");
var snippetManager = require("./snippets").snippetManager;
var Autocomplete = function() {
this.autoInsert = false;
this.autoInsert = true;
this.autoSelect = true;
this.exactMatch = false;
this.gatherCompletionsId = 0;
this.keyboardHandler = new HashHandler();
this.keyboardHandler.bindKeys(this.commands);
@ -55,11 +53,12 @@ var Autocomplete = function() {
this.changeTimer = lang.delayedCall(function() {
this.updateCompletions(true);
}.bind(this));
this.tooltipTimer = lang.delayedCall(this.updateDocTooltip.bind(this), 50);
};
(function() {
this.gatherCompletionsId = 0;
this.$init = function() {
this.popup = new AcePopup(document.body || document.documentElement);
@ -73,7 +72,7 @@ var Autocomplete = function() {
this.popup.on("changeHoverMarker", this.tooltipTimer.bind(null, null));
return this.popup;
};
this.getPopup = function() {
return this.popup || this.$init();
};
@ -84,8 +83,6 @@ var Autocomplete = function() {
this.popup.setData(this.completions.filtered);
editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
var renderer = editor.renderer;
this.popup.setRow(this.autoSelect ? 0 : -1);
if (!keepPopupPosition) {
@ -117,10 +114,11 @@ var Autocomplete = function() {
this.changeTimer.cancel();
this.hideDocTooltip();
this.gatherCompletionsId += 1;
if (this.popup && this.popup.isOpen)
if (this.popup && this.popup.isOpen) {
this.gatherCompletionsId += 1;
this.popup.hide();
}
if (this.base)
this.base.detach();
this.activated = false;
@ -143,7 +141,7 @@ var Autocomplete = function() {
// on IE preventDefault doesn't stop scrollbar from being focussed
var el = document.activeElement;
var text = this.editor.textInput.getElement()
if (el != text && el.parentNode != this.popup.container
if (el != text && el.parentNode != this.popup.container
&& el != this.tooltipNode && e.relatedTarget != this.tooltipNode
&& e.relatedTarget != text
) {
@ -229,7 +227,7 @@ var Autocomplete = function() {
this.base = session.doc.createAnchor(pos.row, pos.column - prefix.length);
this.base.$insertRight = true;
var matches = [];
var total = editor.completers.length;
editor.completers.forEach(function(completer, i) {
@ -262,6 +260,7 @@ var Autocomplete = function() {
editor.completer = this;
}
editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
editor.on("changeSelection", this.changeListener);
editor.on("blur", this.blurListener);
editor.on("mousedown", this.mousedownListener);
@ -298,7 +297,7 @@ var Autocomplete = function() {
var prefix = results.prefix;
var matches = results && results.matches;
if (!matches || !matches.length)
return detachIfFinished();
@ -307,10 +306,6 @@ var Autocomplete = function() {
return;
this.completions = new FilteredList(matches);
if (this.exactMatch)
this.completions.exactMatch = true;
this.completions.setFilter(prefix);
var filtered = this.completions.filtered;
@ -333,7 +328,7 @@ var Autocomplete = function() {
this.cancelContextMenu = function() {
this.editor.$mouseHandler.cancelContextMenu();
};
this.updateDocTooltip = function() {
var popup = this.popup;
var all = popup.data;
@ -348,14 +343,14 @@ var Autocomplete = function() {
});
if (!doc)
doc = selected;
if (typeof doc == "string")
doc = {docText: doc}
if (!doc || !(doc.docHTML || doc.docText))
return this.hideDocTooltip();
this.showDocTooltip(doc);
};
this.showDocTooltip = function(item) {
if (!this.tooltipNode) {
this.tooltipNode = dom.createElement("div");
@ -365,21 +360,21 @@ var Autocomplete = function() {
this.tooltipNode.tabIndex = -1;
this.tooltipNode.onblur = this.blurListener.bind(this);
}
var tooltipNode = this.tooltipNode;
if (item.docHTML) {
tooltipNode.innerHTML = item.docHTML;
} else if (item.docText) {
tooltipNode.textContent = item.docText;
}
if (!tooltipNode.parentNode)
document.body.appendChild(tooltipNode);
document.body.appendChild(tooltipNode);
var popup = this.popup;
var rect = popup.container.getBoundingClientRect();
tooltipNode.style.top = popup.container.style.top;
tooltipNode.style.bottom = popup.container.style.bottom;
if (window.innerWidth - rect.right < 320) {
tooltipNode.style.right = window.innerWidth - rect.left + "px";
tooltipNode.style.left = "";
@ -389,7 +384,7 @@ var Autocomplete = function() {
}
tooltipNode.style.display = "block";
};
this.hideDocTooltip = function() {
this.tooltipTimer.cancel();
if (!this.tooltipNode) return;
@ -397,7 +392,7 @@ var Autocomplete = function() {
if (!this.editor.isFocused() && document.activeElement == el)
this.editor.focus();
this.tooltipNode = null;
if (el.parentNode)
if (el.parentNode)
el.parentNode.removeChild(el);
};
@ -408,10 +403,10 @@ Autocomplete.startCommand = {
exec: function(editor) {
if (!editor.completer)
editor.completer = new Autocomplete();
editor.completer.autoInsert = false;
editor.completer.autoInsert =
editor.completer.autoSelect = true;
editor.completer.showPopup(editor);
// prevent ctrl-space opening context menu on firefox on mac
// needed for firefox on mac
editor.completer.cancelContextMenu();
},
bindKey: "Ctrl-Space|Ctrl-Shift-Space|Alt-Space"
@ -421,7 +416,6 @@ var FilteredList = function(array, filterText, mutateData) {
this.all = array;
this.filtered = array;
this.filterText = filterText || "";
this.exactMatch = false;
};
(function(){
this.setFilter = function(str) {
@ -458,29 +452,23 @@ var FilteredList = function(array, filterText, mutateData) {
var matchMask = 0;
var penalty = 0;
var index, distance;
if (this.exactMatch) {
if (needle !== caption.substr(0, needle.length))
// caption char iteration is faster in Chrome but slower in Firefox, so lets use indexOf
for (var j = 0; j < needle.length; j++) {
// TODO add penalty on case mismatch
var i1 = caption.indexOf(lower[j], lastIndex + 1);
var i2 = caption.indexOf(upper[j], lastIndex + 1);
index = (i1 >= 0) ? ((i2 < 0 || i1 < i2) ? i1 : i2) : i2;
if (index < 0)
continue loop;
}else{
// caption char iteration is faster in Chrome but slower in Firefox, so lets use indexOf
for (var j = 0; j < needle.length; j++) {
// TODO add penalty on case mismatch
var i1 = caption.indexOf(lower[j], lastIndex + 1);
var i2 = caption.indexOf(upper[j], lastIndex + 1);
index = (i1 >= 0) ? ((i2 < 0 || i1 < i2) ? i1 : i2) : i2;
if (index < 0)
continue loop;
distance = index - lastIndex - 1;
if (distance > 0) {
// first char mismatch should be more sensitive
if (lastIndex === -1)
penalty += 10;
penalty += distance;
}
matchMask = matchMask | (1 << index);
lastIndex = index;
distance = index - lastIndex - 1;
if (distance > 0) {
// first char mismatch should be more sensitive
if (lastIndex === -1)
penalty += 10;
penalty += distance;
}
matchMask = matchMask | (1 << index);
lastIndex = index;
}
item.matchMask = matchMask;
item.exactMatch = penalty ? 0 : 1;

View File

@ -97,28 +97,24 @@ exports.commands = [{
name: "fold",
bindKey: bindKey("Alt-L|Ctrl-F1", "Command-Alt-L|Command-F1"),
exec: function(editor) { editor.session.toggleFold(false); },
multiSelectAction: "forEach",
scrollIntoView: "center",
readOnly: true
}, {
name: "unfold",
bindKey: bindKey("Alt-Shift-L|Ctrl-Shift-F1", "Command-Alt-Shift-L|Command-Shift-F1"),
exec: function(editor) { editor.session.toggleFold(true); },
multiSelectAction: "forEach",
scrollIntoView: "center",
readOnly: true
}, {
name: "toggleFoldWidget",
bindKey: bindKey("F2", "F2"),
exec: function(editor) { editor.session.toggleFoldWidget(); },
multiSelectAction: "forEach",
scrollIntoView: "center",
readOnly: true
}, {
name: "toggleParentFoldWidget",
bindKey: bindKey("Alt-F2", "Alt-F2"),
exec: function(editor) { editor.session.toggleFoldWidget(true); },
multiSelectAction: "forEach",
scrollIntoView: "center",
readOnly: true
}, {
@ -419,7 +415,7 @@ exports.commands = [{
readOnly: true
}, {
name: "passKeysToBrowser",
bindKey: bindKey(null, null),
bindKey: bindKey("null", "null"),
exec: function() {},
passEvent: true,
readOnly: true

105
node_modules/ace/lib/ace/config.js generated vendored
View File

@ -34,9 +34,7 @@ define(function(require, exports, module) {
var lang = require("./lib/lang");
var oop = require("./lib/oop");
var net = require("./lib/net");
var AppConfig = require("./lib/app_config").AppConfig;
module.exports = exports = new AppConfig();
var EventEmitter = require("./lib/event_emitter").EventEmitter;
var global = (function() {
return this;
@ -71,6 +69,8 @@ exports.all = function() {
};
// module loading
oop.implement(exports, EventEmitter);
exports.moduleUrl = function(name, component) {
if (options.$moduleUrls[name])
return options.$moduleUrls[name];
@ -142,6 +142,7 @@ exports.loadModule = function(moduleName, onLoad) {
net.loadScript(exports.moduleUrl(moduleName, moduleType), afterLoad);
};
// initialization
function init(packaged) {
options.packaged = packaged || require.packaged || module.packaged || (global.define && define.packaged);
@ -199,4 +200,102 @@ function deHyphenate(str) {
return str.replace(/-(.)/g, function(m, m1) { return m1.toUpperCase(); });
}
var optionsProvider = {
setOptions: function(optList) {
Object.keys(optList).forEach(function(key) {
this.setOption(key, optList[key]);
}, this);
},
getOptions: function(optionNames) {
var result = {};
if (!optionNames) {
optionNames = Object.keys(this.$options);
} else if (!Array.isArray(optionNames)) {
result = optionNames;
optionNames = Object.keys(result);
}
optionNames.forEach(function(key) {
result[key] = this.getOption(key);
}, this);
return result;
},
setOption: function(name, value) {
if (this["$" + name] === value)
return;
var opt = this.$options[name];
if (!opt) {
if (typeof console != "undefined" && console.warn)
console.warn('misspelled option "' + name + '"');
return undefined;
}
if (opt.forwardTo)
return this[opt.forwardTo] && this[opt.forwardTo].setOption(name, value);
if (!opt.handlesSet)
this["$" + name] = value;
if (opt && opt.set)
opt.set.call(this, value);
},
getOption: function(name) {
var opt = this.$options[name];
if (!opt) {
if (typeof console != "undefined" && console.warn)
console.warn('misspelled option "' + name + '"');
return undefined;
}
if (opt.forwardTo)
return this[opt.forwardTo] && this[opt.forwardTo].getOption(name);
return opt && opt.get ? opt.get.call(this) : this["$" + name];
}
};
var defaultOptions = {};
/*
* option {name, value, initialValue, setterName, set, get }
*/
exports.defineOptions = function(obj, path, options) {
if (!obj.$options)
defaultOptions[path] = obj.$options = {};
Object.keys(options).forEach(function(key) {
var opt = options[key];
if (typeof opt == "string")
opt = {forwardTo: opt};
opt.name || (opt.name = key);
obj.$options[opt.name] = opt;
if ("initialValue" in opt)
obj["$" + opt.name] = opt.initialValue;
});
// implement option provider interface
oop.implement(obj, optionsProvider);
return this;
};
exports.resetOptions = function(obj) {
Object.keys(obj.$options).forEach(function(key) {
var opt = obj.$options[key];
if ("value" in opt)
obj.setOption(key, opt.value);
});
};
exports.setDefaultValue = function(path, name, value) {
var opts = defaultOptions[path] || (defaultOptions[path] = {});
if (opts[name]) {
if (opts.forwardTo)
exports.setDefaultValue(opts.forwardTo, name, value);
else
opts[name].value = value;
}
};
exports.setDefaultValues = function(path, optionHash) {
Object.keys(optionHash).forEach(function(key) {
exports.setDefaultValue(path, key, optionHash[key]);
});
};
});

View File

@ -117,19 +117,12 @@ module.exports = {
assert.equal(o.getOption("initialValue"), 8);
o.setOption("initialValue", 7);
assert.equal(o.getOption("opt2"), 7);
config.setDefaultValues("test_object", {
opt1: 1,
forwarded: 2
});
config.resetOptions(o);
assert.equal(o.getOption("opt1"), 1);
assert.equal(o.getOption("forwarded"), 2);
}
};
});
if (typeof module !== "undefined" && module === require.main) {
require("asyncjs").test.testcase(module.exports).exec();
require("asyncjs").test.testcase(module.exports).exec()
}

View File

@ -198,9 +198,7 @@
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
border-left: 2px solid;
/* workaround for smooth cursor repaintng whole screen in chrome */
transform: translatez(0);
border-left: 2px solid
}
.ace_slim-cursors .ace_cursor {

18
node_modules/ace/lib/ace/document.js generated vendored
View File

@ -570,13 +570,12 @@ var Document = function(textOrLines) {
this.applyDelta = function(delta, doNotValidate) {
var isInsert = delta.action == "insert";
// An empty range is a NOOP.
if (isInsert ? delta.lines.length <= 1 && !delta.lines[0]
: !Range.comparePoints(delta.start, delta.end)) {
if (isInsert ? !delta.lines.length
: !Range.comparePoints(delta.start, delta.end))
return;
}
if (isInsert && delta.lines.length > 20000)
this.$splitAndapplyLargeDelta(delta, 20000);
if (isInsert && delta.lines.length > 0xF000)
this.$splitAndapplyLargeDelta(delta, 0xF000);
// Apply.
applyDelta(this.$lines, delta, doNotValidate);
@ -586,8 +585,8 @@ var Document = function(textOrLines) {
this.$splitAndapplyLargeDelta = function(delta, MAX) {
// Split large insert deltas. This is necessary because:
// 1. We need to support splicing delta lines into the document via $lines.splice.apply(...)
// 2. fn.apply() doesn't work for a large number of params. The smallest threshold is on chrome 40 ~42000.
// we use 20000 to leave some space for actual stack
// 2. fn.apply() doesn't work for a large number of params. The smallest threshold is on safari 0xFFFF.
// we use 0xF000 to leave some space for actual stack
//
// To Do: Ideally we'd be consistent and also split 'delete' deltas. We don't do this now, because delete
// delta handling is too slow. If we make delete delta handling faster we can split all large deltas
@ -624,9 +623,10 @@ var Document = function(textOrLines) {
* @param {Object} delta A delta object (can include "insert" and "remove" actions)
**/
this.revertDelta = function(delta) {
var range = Range.fromPoints(delta.start, delta.end);
this.applyDelta({
start: this.clonePos(delta.start),
end: this.clonePos(delta.end),
start: range.start,
end: range.end,
action: (delta.action == "insert" ? "remove" : "insert"),
lines: delta.lines.slice()
});

View File

@ -298,16 +298,6 @@ module.exports = {
assert.equal(doc.$lines.length, 1);
},
"test: ignore empty delta": function() {
var doc = new Document("");
doc.on("change", function() {
throw "should ignore empty delta";
})
doc.insert({row: 0, column: 0}, "");
doc.insert({row: 1, column: 1}, "");
doc.remove({start: {row: 1, column: 1}, end: {row: 1, column: 1}});
},
"test: inserting huge delta": function() {
var doc = new Document("");
var val = "";
@ -326,6 +316,7 @@ module.exports = {
assert.equal(doc.getValue(), "\na" + val + "b");
}
}
};
});

View File

@ -892,17 +892,17 @@ var EditSession = function(text, mode) {
config.loadModule(["mode", path], function(m) {
if (this.$modeId !== path)
return cb && cb();
if (this.$modes[path] && !options) {
this.$onChangeMode(this.$modes[path]);
} else if (m && m.Mode) {
if (this.$modes[path] && !options)
return this.$onChangeMode(this.$modes[path]);
if (m && m.Mode) {
m = new m.Mode(options);
if (!options) {
this.$modes[path] = m;
m.$id = path;
}
this.$onChangeMode(m);
cb && cb();
}
cb && cb();
}.bind(this));
// set mode to text until loading is finished
@ -968,7 +968,10 @@ var EditSession = function(text, mode) {
try {
this.$worker = this.$mode.createWorker(this);
} catch (e) {
config.warn("Could not load worker", e);
if (typeof console == "object") {
console.log("Could not load worker");
console.log(e);
}
this.$worker = null;
}
};
@ -1585,11 +1588,13 @@ var EditSession = function(text, mode) {
**/
this.setWrapLimitRange = function(min, max) {
if (this.$wrapLimitRange.min !== min || this.$wrapLimitRange.max !== max) {
this.$wrapLimitRange = { min: min, max: max };
this.$wrapLimitRange = {
min: min,
max: max
};
this.$modified = true;
// This will force a recalculation of the wrap limit
if (this.$useWrapMode)
this._signal("changeWrapMode");
this._signal("changeWrapMode");
}
};
@ -2481,7 +2486,6 @@ config.defineOptions(EditSession.prototype, "session", {
if (this.$wrap == value)
return;
this.$wrap = value;
if (!value) {
this.setUseWrapMode(false);
} else {
@ -2489,6 +2493,7 @@ config.defineOptions(EditSession.prototype, "session", {
this.setWrapLimitRange(col, col);
this.setUseWrapMode(true);
}
this.$wrap = value;
},
get: function() {
if (this.getUseWrapMode()) {

View File

@ -794,7 +794,7 @@ function Folding() {
this.foldAll(startRow, endRow, options.all ? 10000 : 0);
} else if (options.children) {
endRow = range ? range.end.row : this.getLength();
this.foldAll(row + 1, endRow, options.all ? 10000 : 0);
this.foldAll(row + 1, range.end.row, options.all ? 10000 : 0);
} else if (range) {
if (options.all)
range.collapseChildren = 10000;

22
node_modules/ace/lib/ace/editor.js generated vendored
View File

@ -159,12 +159,8 @@ var Editor = function(renderer, session) {
return this.curOp = null;
this._signal("beforeEndOperation");
var command = this.curOp.command;
var scrollIntoView = command && command.scrollIntoView;
if (scrollIntoView) {
switch (scrollIntoView) {
case "center-animate":
scrollIntoView = "animate";
/* fall through */
if (command && command.scrollIntoView) {
switch (command.scrollIntoView) {
case "center":
this.renderer.scrollCursorIntoView(null, 0.5);
break;
@ -182,7 +178,7 @@ var Editor = function(renderer, session) {
default:
break;
}
if (scrollIntoView == "animate")
if (command.scrollIntoView == "animate")
this.renderer.animateScrolling(this.curOp.scrollTop);
}
@ -537,18 +533,12 @@ var Editor = function(renderer, session) {
var iterator = new TokenIterator(self.session, pos.row, pos.column);
var token = iterator.getCurrentToken();
if (!token || !/\b(?:tag-open|tag-name)/.test(token.type)) {
if (!token || token.type.indexOf('tag-name') === -1) {
session.removeMarker(session.$tagHighlight);
session.$tagHighlight = null;
return;
}
if (token.type.indexOf("tag-open") != -1) {
token = iterator.stepForward();
if (!token)
return;
}
var tag = token.value;
var depth = 0;
var prevToken = iterator.stepBackward();
@ -1281,7 +1271,7 @@ var Editor = function(renderer, session) {
};
/**
* Removes the current selection or one character.
* Removes words of text from the editor. A "word" is defined as a string of characters bookended by whitespace.
* @param {String} dir The direction of the deletion to occur, either "left" or "right"
*
**/

View File

@ -62,7 +62,7 @@ function findAnnotations(session, row, dir) {
if (i < 0)
i = -i - 1;
if (i >= annotations.length)
if (i >= annotations.length - 1)
i = dir > 0 ? 0 : annotations.length - 1;
else if (i === 0 && dir < 0)
i = annotations.length - 1;

View File

@ -140,7 +140,7 @@ var loadSnippetFile = function(id) {
function getCompletionPrefix(editor) {
var pos = editor.getCursorPosition();
var line = editor.session.getLine(pos.row);
var prefix;
var prefix = util.retrievePrecedingIdentifier(line, pos.column);
// Try to find custom prefixes on the completers
editor.completers.forEach(function(completer) {
if (completer.identifierRegexps) {
@ -150,7 +150,7 @@ function getCompletionPrefix(editor) {
});
}
});
return prefix || util.retrievePrecedingIdentifier(line, pos.column);
return prefix;
}
var doLiveAutocomplete = function(e) {
@ -158,6 +158,8 @@ var doLiveAutocomplete = function(e) {
var text = e.args || "";
var hasCompleter = editor.completer && editor.completer.activated;
// We don't want to autocomplete with no prefix
if (e.command.name === "backspace") {
if (hasCompleter && !getCompletionPrefix(editor))
@ -172,6 +174,7 @@ var doLiveAutocomplete = function(e) {
editor.completer = new Autocomplete();
}
// Disable autoInsert
editor.completer.autoSelect = false;
editor.completer.autoInsert = false;
editor.completer.showPopup(editor);
}

View File

@ -43,7 +43,6 @@ Mode.prototype.supportsFile = function(filename) {
// todo firstlinematch
var supportedModes = {
ABAP: ["abap"],
ABC: ["abc"],
ActionScript:["as"],
ADA: ["ada|adb"],
Apache_Conf: ["^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd"],
@ -110,7 +109,6 @@ var supportedModes = {
Lucene: ["lucene"],
Makefile: ["^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make"],
Markdown: ["md|markdown"],
Mask: ["mask"],
MATLAB: ["matlab"],
MEL: ["mel"],
MUSHCode: ["mc|mush"],

View File

@ -87,12 +87,9 @@ MultiHashHandler.prototype = HashHandler.prototype;
}
};
this.bindKey = function(key, command, position) {
if (typeof key == "object") {
if (position == undefined)
position = key.position;
this.bindKey = function(key, command, asDefault) {
if (typeof key == "object")
key = key[this.platform];
}
if (!key)
return;
if (typeof command == "function")
@ -113,15 +110,11 @@ MultiHashHandler.prototype = HashHandler.prototype;
}
var binding = this.parseKeys(keyPart);
var id = KEY_MODS[binding.hashId] + binding.key;
this._addCommandToBinding(chain + id, command, position);
this._addCommandToBinding(chain + id, command, asDefault);
}, this);
};
function getPosition(command) {
return typeof command == "object" && command.bindKey
&& command.bindKey.position || 0;
}
this._addCommandToBinding = function(keyId, command, position) {
this._addCommandToBinding = function(keyId, command, asDefault) {
var ckb = this.commandKeyBinding, i;
if (!command) {
delete ckb[keyId];
@ -133,21 +126,11 @@ MultiHashHandler.prototype = HashHandler.prototype;
} else if ((i = ckb[keyId].indexOf(command)) != -1) {
ckb[keyId].splice(i, 1);
}
if (typeof position != "number") {
if (position || command.isDefault)
position = -100;
else
position = getPosition(command);
}
var commands = ckb[keyId];
for (i = 0; i < commands.length; i++) {
var other = commands[i];
var otherPos = getPosition(other);
if (otherPos > position)
break;
}
commands.splice(i, 0, command);
if (asDefault || command.isDefault)
ckb[keyId].unshift(command);
else
ckb[keyId].push(command);
}
};

View File

@ -45,10 +45,10 @@ var TextInput = function(parentNode, host) {
if (useragent.isTouchPad)
text.setAttribute("x-palm-disable-auto-cap", true);
text.setAttribute("wrap", "off");
text.setAttribute("autocorrect", "off");
text.setAttribute("autocapitalize", "off");
text.setAttribute("spellcheck", false);
text.wrap = "off";
text.autocorrect = "off";
text.autocapitalize = "off";
text.spellcheck = false;
text.style.opacity = "0";
if (useragent.isOldIE) text.style.top = "-100px";
@ -83,9 +83,7 @@ var TextInput = function(parentNode, host) {
text.style.position = "";
}, 0);
};
this.blur = function() {
text.blur();
};
this.blur = function() { text.blur(); };
this.isFocused = function() {
return isFocused;
};
@ -104,11 +102,6 @@ var TextInput = function(parentNode, host) {
function resetSelection(isEmpty) {
if (inComposition)
return;
// this prevents infinite recursion on safari 8
// see https://github.com/ajaxorg/ace/issues/2114
inComposition = true;
if (inputHandler) {
selectionStart = 0;
selectionEnd = isEmpty ? 0 : text.value.length - 1;
@ -120,8 +113,6 @@ var TextInput = function(parentNode, host) {
try {
text.setSelectionRange(selectionStart, selectionEnd);
} catch(e){}
inComposition = false;
}
function resetValue() {
@ -486,7 +477,7 @@ var TextInput = function(parentNode, host) {
this.onContextMenuClose = onContextMenuClose;
var closeTimeout;
function onContextMenuClose() {
clearTimeout(closeTimeout);
clearTimeout(closeTimeout)
closeTimeout = setTimeout(function () {
if (tempStyle) {
text.style.cssText = tempStyle;

View File

@ -62,30 +62,28 @@
define(function(require, exports, module) {
'use strict';
function log() {
/* function log() {
var d = "";
function format(p) {
if (typeof p != "object")
return p + "";
return p + ""
if ("line" in p) {
return p.line + ":" + p.ch;
return p.line + ":" + p.ch
}
if ("anchor" in p) {
return format(p.anchor) + "->" + format(p.head);
return format(p.anchor) + "->" + format(p.head)
}
if (Array.isArray(p))
return "[" + p.map(function(x) {
return format(x);
}) + "]";
return JSON.stringify(p);
return "[" + p.map(function(x) {return format(x)})+"]"
return JSON.stringify(p)
}
for (var i = 0; i < arguments.length; i++) {
var p = arguments[i];
var f = format(p);
d += f + " ";
var p = arguments[i]
var f = format(p)
d+= f+" "
}
console.log(d);
}
console.log(d)
} */
var Range = require("../range").Range;
var EventEmitter = require("../lib/event_emitter").EventEmitter;
var dom = require("../lib/dom");
@ -96,7 +94,6 @@ define(function(require, exports, module) {
var useragent = require("../lib/useragent");
var SearchHighlight = require("../search_highlight").SearchHighlight;
var multiSelectCommands = require("../commands/multi_select_commands");
var TextModeTokenRe = require("ace/mode/text").Mode.prototype.tokenRe;
require("../multi_select");
var CodeMirror = function(ace) {
@ -160,11 +157,6 @@ define(function(require, exports, module) {
CodeMirror.signal = function(o, name, e) { return o._signal(name, e) };
CodeMirror.on = event.addListener;
CodeMirror.off = event.removeListener;
CodeMirror.isWordChar = function(ch) {
TextModeTokenRe.lastIndex = 0;
return TextModeTokenRe.test(ch);
};
(function() {
oop.implement(CodeMirror.prototype, EventEmitter);
@ -257,7 +249,6 @@ define(function(require, exports, module) {
}
if (!this.ace.inVirtualSelectionMode)
this.ace.exitMultiSelectMode();
this.ace.session.unfold({row: line, column: ch});
this.ace.selection.moveTo(line, ch);
};
this.getCursor = function(p) {
@ -385,19 +376,13 @@ define(function(require, exports, module) {
sel.moveCursorBy(0, increment);
}
};
this.findPosV = function(start, amount, unit, goalColumn) {
if (unit == 'page') {
var renderer = this.ace.renderer;
var config = renderer.layerConfig;
amount = amount * Math.floor(config.height / config.lineHeight);
unit = 'line';
}
this.findPosV = function(start, amaount, unit, goalColumn) {
if (unit == 'line') {
var screenPos = this.ace.session.documentToScreenPosition(start.line, start.ch);
if (goalColumn != null)
screenPos.column = goalColumn;
screenPos.row += amount;
// not what codemirror does but vim mode needs only this
screenPos.row += amaount;
// not what codemirror does but vim mode needs only it
screenPos.row = Math.min(Math.max(0, screenPos.row), this.ace.session.getScreenLength() - 1);
var pos = this.ace.session.screenToDocumentPosition(screenPos.row, screenPos.column);
return toCmPos(pos);
@ -483,18 +468,8 @@ define(function(require, exports, module) {
};
this.scrollInfo = function() { return 0; };
this.scrollIntoView = function(pos, margin) {
if (pos) {
var renderer = this.ace.renderer;
var acePos = toAcePos(pos);
renderer.session.unfold(acePos);
renderer.session.selection.moveToPosition(acePos);
renderer.scrollCursorIntoView(acePos, 0.5, {
top: margin,
bottom: margin
});
if (this.ace.curOp)
this.ace.curOp.command.scrollIntoView = "animate";
}
if (pos)
this.ace.renderer.scrollCursorIntoView(toAcePos(pos), null, margin);
};
this.getLine = function(row) { return this.ace.session.getLine(row) };
this.getRange = function(s, e) {
@ -584,7 +559,7 @@ define(function(require, exports, module) {
highlight.session.on("changeEditor", highlight.destroy);
highlight.session.on("change", highlight.updateOnChange);
}
var re = new RegExp(o.query.source, "gm" + (o.query.ignoreCase ? "i" : ""));
var re = new RegExp(o.query.source, "gmi");
this.$searchHighlight = o.highlight = highlight;
this.$searchHighlight.setRegexp(re);
this.ace.renderer.updateBackMarkers();
@ -805,15 +780,15 @@ dom.importCssString(".normal-mode .ace_cursor{\
me.focus();
CodeMirror.off(inp, "keyup", onKeyup);
ace.cmdLine.container.removeEventListener("keydown", onKeyDown, true);
CodeMirror.off(inp, "keyup", onKeyDown);
CodeMirror.off(inp, "blur", onBlur);
callback(getVal());
ace.cmdLine.setValue("");
}
}
var ace = this.ace;
var cm = this;
var prefix = template;
if (prefix == ":")
return;
@ -832,27 +807,23 @@ dom.importCssString(".normal-mode .ace_cursor{\
}
var inp = ace.cmdLine.textInput.getElement();
var onKeyup = function(e) {
cm.operation(function() {
options.onKeyUp(e, getVal(), close);
if (!ace.cmdLine.getValue())
close();
});
options.onKeyUp(e, getVal(), close);
if (!ace.cmdLine.getValue())
close();
};
var onKeyDown = function(e) {
cm.operation(function() {
var val = getVal();
if (options && options.onKeyDown && options.onKeyDown(e, val, close)) { return; }
if (e.keyCode == 27 || (options.closeOnEnter !== false && e.keyCode == 13)) {
CodeMirror.e_stop(e);
close();
}
if (e.keyCode == 13) callback(val);
});
var val = getVal();
if (options && options.onKeyDown && options.onKeyDown(e, val, close)) { return; }
if (e.keyCode == 27 || (options.closeOnEnter !== false && e.keyCode == 13)) {
CodeMirror.e_stop(e);
close();
}
if (e.keyCode == 13) callback(val);
};
var onBlur = close;
if (options.onKeyUp)
CodeMirror.on(inp, "keyup", onKeyup);
ace.cmdLine.container.addEventListener("keydown", onKeyDown, true);
CodeMirror.on(inp, "keyup", onKeyDown);
if (options.closeOnBlur !== false)
CodeMirror.on(inp, "blur", onBlur);
@ -889,11 +860,11 @@ dom.importCssString(".normal-mode .ace_cursor{\
{ keys: '<Up>', type: 'keyToKey', toKeys: 'k' },
{ keys: '<Down>', type: 'keyToKey', toKeys: 'j' },
{ keys: '<Space>', type: 'keyToKey', toKeys: 'l' },
{ keys: '<BS>', type: 'keyToKey', toKeys: 'h', context: 'normal'},
{ keys: '<BS>', type: 'keyToKey', toKeys: 'h' },
{ keys: '<C-Space>', type: 'keyToKey', toKeys: 'W' },
{ keys: '<C-BS>', type: 'keyToKey', toKeys: 'B', context: 'normal' },
{ keys: '<C-BS>', type: 'keyToKey', toKeys: 'B' },
{ keys: '<S-Space>', type: 'keyToKey', toKeys: 'w' },
{ keys: '<S-BS>', type: 'keyToKey', toKeys: 'b', context: 'normal' },
{ keys: '<S-BS>', type: 'keyToKey', toKeys: 'b' },
{ keys: '<C-n>', type: 'keyToKey', toKeys: 'j' },
{ keys: '<C-p>', type: 'keyToKey', toKeys: 'k' },
{ keys: '<C-[>', type: 'keyToKey', toKeys: '<Esc>' },
@ -1041,7 +1012,55 @@ dom.importCssString(".normal-mode .ace_cursor{\
var Pos = CodeMirror.Pos;
var modifierCodes = [16, 17, 18, 91];
var specialKey = {Enter:'CR',Backspace:'BS',Delete:'Del'};
var mac = /Mac/.test(navigator.platform);
var Vim = function() { return vimApi; } //{
function lookupKey(e) {
var keyCode = e.keyCode;
if (modifierCodes.indexOf(keyCode) != -1) { return; }
var hasModifier = e.ctrlKey || e.metaKey;
var key = CodeMirror.keyNames[keyCode];
key = specialKey[key] || key;
var name = '';
if (e.ctrlKey) { name += 'C-'; }
if (e.altKey) { name += 'A-'; }
if (mac && e.metaKey || (!hasModifier && e.shiftKey) && key.length < 2) {
// Shift key bindings can only specified for special characters.
return;
} else if (e.shiftKey && !/^[A-Za-z]$/.test(key)) {
name += 'S-';
}
if (key.length == 1) { key = key.toLowerCase(); }
name += key;
if (name.length > 1) { name = '<' + name + '>'; }
return name;
}
// Keys with modifiers are handled using keydown due to limitations of
// keypress event.
function handleKeyDown(cm, e) {
var name = lookupKey(e);
if (!name) { return; }
CodeMirror.signal(cm, 'vim-keypress', name);
if (CodeMirror.Vim.handleKey(cm, name, 'user')) {
CodeMirror.e_stop(e);
}
}
// Keys without modifiers are handled using keypress to work best with
// non-standard keyboard layouts.
function handleKeyPress(cm, e) {
var code = e.charCode || e.keyCode;
if (e.ctrlKey || e.metaKey || e.altKey ||
e.shiftKey && code < 32) { return; }
var name = String.fromCharCode(code);
CodeMirror.signal(cm, 'vim-keypress', name);
if (CodeMirror.Vim.handleKey(cm, name, 'user')) {
CodeMirror.e_stop(e);
}
}
function enterVimMode(cm) {
cm.setOption('disableInput', true);
cm.setOption('showCursorWhenSelecting', false);
@ -1049,6 +1068,8 @@ dom.importCssString(".normal-mode .ace_cursor{\
cm.on('cursorActivity', onCursorActivity);
maybeInitVimState(cm);
CodeMirror.on(cm.getInputField(), 'paste', getOnPasteFn(cm));
cm.on('keypress', handleKeyPress);
cm.on('keydown', handleKeyDown);
}
function leaveVimMode(cm) {
@ -1056,6 +1077,8 @@ dom.importCssString(".normal-mode .ace_cursor{\
cm.off('cursorActivity', onCursorActivity);
CodeMirror.off(cm.getInputField(), 'paste', getOnPasteFn(cm));
cm.state.vim = null;
cm.off('keypress', handleKeyPress);
cm.off('keydown', handleKeyDown);
}
function detachVimMap(cm, next) {
@ -1080,60 +1103,6 @@ dom.importCssString(".normal-mode .ace_cursor{\
else if (!val && prev != CodeMirror.Init && /^vim/.test(cm.getOption("keyMap")))
cm.setOption("keyMap", "default");
});
function cmKey(key, cm) {
if (!cm) { return undefined; }
var vimKey = cmKeyToVimKey(key);
if (!vimKey) {
return false;
}
var cmd = CodeMirror.Vim.findKey(cm, vimKey);
if (typeof cmd == 'function') {
CodeMirror.signal(cm, 'vim-keypress', vimKey);
}
return cmd;
}
var modifiers = {'Shift': 'S', 'Ctrl': 'C', 'Alt': 'A', 'Cmd': 'D', 'Mod': 'A'};
var specialKeys = {Enter:'CR',Backspace:'BS',Delete:'Del'};
function cmKeyToVimKey(key) {
if (key.charAt(0) == '\'') {
// Keypress character binding of format "'a'"
return key.charAt(1);
}
var pieces = key.split('-');
if (/-$/.test(key)) {
// If the - key was typed, split will result in 2 extra empty strings
// in the array. Replace them with 1 '-'.
pieces.splice(-2, 2, '-');
}
var lastPiece = pieces[pieces.length - 1];
if (pieces.length == 1 && pieces[0].length == 1) {
// No-modifier bindings use literal character bindings above. Skip.
return false;
} else if (pieces.length == 2 && pieces[0] == 'Shift' && lastPiece.length == 1) {
// Ignore Shift+char bindings as they should be handled by literal character.
return false;
}
var hasCharacter = false;
for (var i = 0; i < pieces.length; i++) {
var piece = pieces[i];
if (piece in modifiers) { pieces[i] = modifiers[piece]; }
else { hasCharacter = true; }
if (piece in specialKeys) { pieces[i] = specialKeys[piece]; }
}
if (!hasCharacter) {
// Vim does not support modifier only keys.
return false;
}
// TODO: Current bindings expect the character to be lower case, but
// it looks like vim key notation uses upper case.
if (isUpperCase(lastPiece)) {
pieces[pieces.length - 1] = lastPiece.toLowerCase();
}
return '<' + pieces.join('-') + '>';
}
function getOnPasteFn(cm) {
var vim = cm.state.vim;
if (!vim.onPasteFn) {
@ -1148,9 +1117,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
}
var numberRegex = /[\d]/;
var wordRegexp = [{test: CodeMirror.isWordChar}, {test: function(ch) {
return !CodeMirror.isWordChar(ch) && !/\s/.test(ch);
}}], bigWordRegexp = [(/\S/)];
var wordRegexp = [(/\w/), (/[^\w\s]/)], bigWordRegexp = [(/\S/)];
function makeKeyRange(start, size) {
var keys = [];
for (var i = start; i < start + size; i++) {
@ -1455,23 +1422,9 @@ dom.importCssString(".normal-mode .ace_cursor{\
exCommands[name]=func;
exCommandDispatcher.commandMap_[prefix]={name:name, shortName:prefix, type:'api'};
},
handleKey: function (cm, key, origin) {
var command = this.findKey(cm, key, origin);
if (typeof command === 'function') {
return command();
}
},
/**
* This is the outermost function called by CodeMirror, after keys have
* been mapped to their Vim equivalents.
*
* Finds a command based on the key (and cached keys if there is a
* multi-key sequence). Returns `undefined` if no key is matched, a noop
* function if a partial match is found (multi-key), and a function to
* execute the bound command if a a key is matched. The function always
* returns true.
*/
findKey: function(cm, key, origin) {
// This is the outermost function called by CodeMirror, after keys have
// been mapped to their Vim equivalents.
handleKey: function(cm, key, origin) {
var vim = maybeInitVimState(cm);
function handleMacroRecording() {
var macroModeState = vimGlobalState.macroModeState;
@ -1537,7 +1490,13 @@ dom.importCssString(".normal-mode .ace_cursor{\
cm.replaceRange('', offsetCursor(here, 0, -(keys.length - 1)), here, '+input');
}
clearInputState(cm);
return match.command;
var command = match.command;
if (command.type == 'keyToKey') {
doKeyToKey(command.toKeys);
} else {
commandDispatcher.processCommand(cm, vim, command);
}
return true;
}
function handleKeyNonInsertMode() {
@ -1555,44 +1514,31 @@ dom.importCssString(".normal-mode .ace_cursor{\
else if (match.type == 'partial') { return true; }
vim.inputState.keyBuffer = '';
var command = match.command;
var keysMatcher = /^(\d*)(.*)$/.exec(keys);
if (keysMatcher[1] && keysMatcher[1] != '0') {
vim.inputState.pushRepeatDigit(keysMatcher[1]);
}
return match.command;
if (command.type == 'keyToKey') {
doKeyToKey(command.toKeys);
} else {
commandDispatcher.processCommand(cm, vim, command);
}
return true;
}
var command;
if (vim.insertMode) { command = handleKeyInsertMode(); }
else { command = handleKeyNonInsertMode(); }
if (command === false) {
return undefined;
} else if (command === true) {
// TODO: Look into using CodeMirror's multi-key handling.
// Return no-op since we are caching the key. Counts as handled, but
// don't want act on it just yet.
return function() {};
} else {
return function() {
return cm.operation(function() {
cm.curOp.isVimOp = true;
try {
if (command.type == 'keyToKey') {
doKeyToKey(command.toKeys);
} else {
commandDispatcher.processCommand(cm, vim, command);
}
} catch (e) {
// clear VIM state in case it's in a bad state.
cm.state.vim = undefined;
maybeInitVimState(cm);
console['log'](e);
throw e;
}
return true;
});
};
}
return cm.operation(function() {
cm.curOp.isVimOp = true;
try {
if (vim.insertMode) { return handleKeyInsertMode(); }
else { return handleKeyNonInsertMode(); }
} catch (e) {
// clear VIM state in case it's in a bad state.
cm.state.vim = undefined;
maybeInitVimState(cm);
throw e;
}
});
},
handleEx: function(cm, input) {
exCommandDispatcher.processCommand(cm, input);
@ -1937,9 +1883,6 @@ dom.importCssString(".normal-mode .ace_cursor{\
var promptPrefix = (forward) ? '/' : '?';
var originalQuery = getSearchState(cm).getQuery();
var originalScrollPos = cm.getScrollInfo();
originalScrollPos.cursor = cm.getCursor();
if (getSearchState(cm).clearHighlight) // ace patch clear highlight after n
getSearchState(cm).clearHighlight();
function handleQuery(query, ignoreCase, smartCase) {
vimGlobalState.searchHistoryController.pushInput(query);
vimGlobalState.searchHistoryController.reset();
@ -1954,16 +1897,10 @@ dom.importCssString(".normal-mode .ace_cursor{\
motion: 'findNext',
motionArgs: { forward: true, toJumplist: command.searchArgs.toJumplist }
});
getSearchState(cm).clearHighlight = function clear() {
cm.off("cursorActivity", clear);
clearSearchHighlight(cm);
};
cm.on("cursorActivity", getSearchState(cm).clearHighlight);
}
function onPromptClose(query) {
cm.scrollTo(originalScrollPos.left, originalScrollPos.top);
cm.setCursor(originalScrollPos.cursor); // ace patch TODO find a way to record motion without calling handleQuery
handleQuery(query, false /** ignoreCase */, false /** smartCase */); // ace patch TODO make smartcase an option
// cm.scrollTo(originalScrollPos.left, originalScrollPos.top);
handleQuery(query, true /** ignoreCase */, true /** smartCase */);
var macroModeState = vimGlobalState.macroModeState;
if (macroModeState.isRecording) {
logSearchQuery(macroModeState, query);
@ -1983,17 +1920,15 @@ dom.importCssString(".normal-mode .ace_cursor{\
var parsedQuery;
try {
parsedQuery = updateSearchQuery(cm, query,
false /** ignoreCase */, false /** smartCase */);
true /** ignoreCase */, true /** smartCase */);
} catch (e) {
// Swallow bad regexes for incremental search.
}
if (parsedQuery) {
cm.scrollIntoView(findNext(cm, !forward, parsedQuery, undefined, originalScrollPos.cursor), 30);
cm.scrollIntoView(findNext(cm, !forward, parsedQuery), 30);
} else {
cm.scrollIntoView(originalScrollPos.cursor);
clearSearchHighlight(cm);
cm.scrollTo(originalScrollPos.left, originalScrollPos.top);
cm.ace.curOp.command.scrollIntoView = "animate";
}
}
function onPromptKeyDown(e, query, close) {
@ -2002,12 +1937,11 @@ dom.importCssString(".normal-mode .ace_cursor{\
vimGlobalState.searchHistoryController.pushInput(query);
vimGlobalState.searchHistoryController.reset();
updateSearchQuery(cm, originalQuery);
clearSearchHighlight(cm);
cm.scrollTo(originalScrollPos.left, originalScrollPos.top);
cm.scrollIntoView(originalScrollPos.cursor);
CodeMirror.e_stop(e);
close();
cm.focus();
clearSearchHighlight(cm);
}
}
switch (command.searchArgs.querySrc) {
@ -2145,8 +2079,6 @@ dom.importCssString(".normal-mode .ace_cursor{\
return;
}
if (motionArgs.toJumplist) {
if (!operator)
cm.ace.curOp.command.scrollIntoView = "center-animate"; // ace patch
var jumpList = vimGlobalState.jumpList;
// if the current motion is # or *, use cachedCursor
var cachedCursor = jumpList.cachedCursor;
@ -2168,9 +2100,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
newHead = copyCursor(origHead);
}
if (vim.visualMode) {
if (!(vim.visualBlock && newHead.ch === Infinity)) {
newHead = clipCursorToContent(cm, newHead, vim.visualBlock);
}
newHead = clipCursorToContent(cm, newHead, true);
if (newAnchor) {
newAnchor = clipCursorToContent(cm, newAnchor, true);
}
@ -2430,15 +2360,6 @@ dom.importCssString(".normal-mode .ace_cursor{\
(line > last && cur.line == last)) {
return;
}
// /ace patch
var fold = cm.ace.session.getFoldAt(line, endCh);
if (fold) {
if (motionArgs.forward)
line = fold.end.row + 1;
else
line = fold.start.row - 1;
}
// /ace patche
if (motionArgs.toFirstChar){
endCh=findFirstNonWhiteSpaceCharacter(cm.getLine(line));
vim.lastHPos = endCh;
@ -2584,7 +2505,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
return Pos(lineNum,
findFirstNonWhiteSpaceCharacter(cm.getLine(lineNum)));
},
textObjectManipulation: function(cm, head, motionArgs, vim) {
textObjectManipulation: function(cm, head, motionArgs) {
// TODO: lots of possible exceptions that can be thrown here. Try da(
// outside of a () block.
@ -2624,14 +2545,6 @@ dom.importCssString(".normal-mode .ace_cursor{\
false /** bigWord */);
} else if (character === 'p') {
tmp = findParagraph(cm, head, motionArgs.repeat, 0, inclusive);
motionArgs.linewise = true;
if (vim.visualMode) {
if (!vim.visualLine) { vim.visualLine = true; }
} else {
var operatorArgs = vim.inputState.operatorArgs;
if (operatorArgs) { operatorArgs.linewise = true; }
tmp.end.line--;
}
} else {
// No text object defined for this, don't move.
return null;
@ -2824,7 +2737,6 @@ dom.importCssString(".normal-mode .ace_cursor{\
var markPos = mark ? mark.find() : undefined;
markPos = markPos ? markPos : cm.getCursor();
cm.setCursor(markPos);
cm.ace.curOp.command.scrollIntoView = "center-animate"; // ace patch
},
scroll: function(cm, actionArgs, vim) {
if (vim.visualMode) {
@ -4145,7 +4057,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
var min = cm.firstLine();
var max = cm.lastLine();
var start, end, i = line;
function isEmpty(i) { return !/\S/.test(cm.getLine(i)); }
function isEmpty(i) { return !cm.getLine(i) }
function isBoundary(i, dir, any) {
if (any) { return isEmpty(i) != isEmpty(i + dir); }
return !isEmpty(i) && isEmpty(i + dir);
@ -4153,13 +4065,13 @@ dom.importCssString(".normal-mode .ace_cursor{\
if (dir) {
while (min <= i && i <= max && repeat > 0) {
if (isBoundary(i, dir)) { repeat--; }
i += dir;
i += dir;
}
return new Pos(i, 0);
}
// select whole paragraph
var vim = cm.state.vim;
if (vim.visualLine && isBoundary(line, 1, true)) {
if (vim.visualMode && isBoundary(line, 1, true)) {
var anchor = vim.sel.anchor;
if (isBoundary(anchor.line, -1, true)) {
if (!inclusive || anchor.line != line) {
@ -4167,27 +4079,29 @@ dom.importCssString(".normal-mode .ace_cursor{\
}
}
}
var startState = isEmpty(line);
var startLineEmpty = isEmpty(line);
for (i = line; i <= max && repeat; i++) {
if (isBoundary(i, 1, true)) {
if (!inclusive || isEmpty(i) != startState) {
if (!inclusive || isEmpty(i) != startLineEmpty) {
repeat--;
}
}
}
end = new Pos(i, 0);
// select boundary before paragraph for the last one
if (i > max && !startState) { startState = true; }
else { inclusive = false; }
if (i > max && !startLineEmpty) {
startLineEmpty = true;
} else {
inclusive = false;
}
for (i = line; i > min; i--) {
if (!inclusive || isEmpty(i) == startState || i == line) {
if (!inclusive || isEmpty(i) == startLineEmpty || i == line) {
if (isBoundary(i, -1, true)) { break; }
}
}
start = new Pos(i, 0);
return { start: start, end: end };
}
// TODO: perhaps this finagling of start and end positions belonds
// in codmirror/replaceRange?
function selectCompanionObject(cm, head, symb, inclusive) {
@ -4323,7 +4237,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
function dialog(cm, template, shortText, onClose, options) {
if (cm.openDialog) {
cm.openDialog(template, onClose, { bottom: true, value: options.value,
onKeyDown: options.onKeyDown, onKeyUp: options.onKeyUp, closeOnBlur: false });
onKeyDown: options.onKeyDown, onKeyUp: options.onKeyUp });
}
else {
onClose(prompt(shortText, ''));
@ -4591,10 +4505,10 @@ dom.importCssString(".normal-mode .ace_cursor{\
getSearchState(cm).setOverlay(overlay);
}
}
function findNext(cm, prev, query, repeat, startPos) {
function findNext(cm, prev, query, repeat) {
if (repeat === undefined) { repeat = 1; }
return cm.operation(function() {
var pos = startPos || cm.getCursor();
var pos = cm.getCursor();
var cursor = cm.getSearchCursor(query, pos);
for (var i = 0; i < repeat; i++) {
var found = cursor.find(prev);
@ -5383,8 +5297,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
CodeMirror.keyMap.vim = {
attach: attachVimMap,
detach: detachVimMap,
call: cmKey
detach: detachVimMap
};
function exitInsertMode(cm) {
@ -5457,16 +5370,20 @@ dom.importCssString(".normal-mode .ace_cursor{\
},
fallthrough: ['default'],
attach: attachVimMap,
detach: detachVimMap,
call: cmKey
detach: detachVimMap
};
CodeMirror.keyMap['await-second'] = {
fallthrough: ['vim-insert'],
attach: attachVimMap,
detach: detachVimMap
};
CodeMirror.keyMap['vim-replace'] = {
'Backspace': 'goCharLeft',
fallthrough: ['vim-insert'],
attach: attachVimMap,
detach: detachVimMap,
call: cmKey
detach: detachVimMap
};
function executeMacroRegister(cm, vim, macroModeState, registerName) {
@ -5732,7 +5649,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
Vim = CodeMirror.Vim;
var specialKey = {'return':'CR',backspace:'BS','delete':'Del',esc:'Esc',
specialKey = {'return':'CR',backspace:'BS','delete':'Del',esc:'Esc',
left:'Left',right:'Right',up:'Up',down:'Down',space: 'Space',
home:'Home',end:'End',pageup:'PageUp',pagedown:'PageDown', enter: 'CR'
};
@ -5750,7 +5667,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
if (name.length > 1) { name = '<' + name + '>'; }
return name;
}
var handleKey = Vim.handleKey.bind(Vim);
var handleKey = Vim.handleKey
Vim.handleKey = function(cm, key, origin) {
return cm.operation(function() {
return handleKey(cm, key, origin);
@ -5854,6 +5771,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
});
return {command: "null", passEvent: true};
}
return {command: coreCommands.stop};
} else if (!vim.insertMode) {
if (useragent.isMac && this.handleMacRepeat(data, hashId, key)) {
hashId = -1;
@ -6028,10 +5946,10 @@ dom.importCssString(".normal-mode .ace_cursor{\
{ keys: 'zf', type: 'action', action: 'fold', actionArgs: { open: true, all: true } },
{ keys: 'zd', type: 'action', action: 'fold', actionArgs: { open: true, all: true } },
{ keys: '<C-A-k>', type: 'action', action: 'aceCommand', actionArgs: { name: "addCursorAbove" } },
{ keys: '<C-A-j>', type: 'action', action: 'aceCommand', actionArgs: { name: "addCursorBelow" } },
{ keys: '<C-A-S-k>', type: 'action', action: 'aceCommand', actionArgs: { name: "addCursorAboveSkipCurrent" } },
{ keys: '<C-A-S-j>', type: 'action', action: 'aceCommand', actionArgs: { name: "addCursorBelowSkipCurrent" } },
{ keys: '<C-A-j>', type: 'action', action: 'aceCommand', actionArgs: { name: "addCursorAbove" } },
{ keys: '<C-A-k>', type: 'action', action: 'aceCommand', actionArgs: { name: "addCursorBelow" } },
{ keys: '<C-A-S-j>', type: 'action', action: 'aceCommand', actionArgs: { name: "addCursorAboveSkipCurrent" } },
{ keys: '<C-A-S-k>', type: 'action', action: 'aceCommand', actionArgs: { name: "addCursorBelowSkipCurrent" } },
{ keys: '<C-A-h>', type: 'action', action: 'aceCommand', actionArgs: { name: "selectMoreBefore" } },
{ keys: '<C-A-l>', type: 'action', action: 'aceCommand', actionArgs: { name: "selectMoreAfter" } },
{ keys: '<C-A-S-h>', type: 'action', action: 'aceCommand', actionArgs: { name: "selectNextBefore" } },
@ -6059,7 +5977,6 @@ dom.importCssString(".normal-mode .ace_cursor{\
exports.handler.defaultKeymap = defaultKeymap;
exports.handler.actions = actions;
exports.Vim = Vim;
Vim.map("Y", "yy");
});

View File

@ -13,7 +13,7 @@ var JavaScriptMode = require("./../mode/javascript").Mode;
var VirtualRenderer = require("./../virtual_renderer").VirtualRenderer;
var assert = require("./../test/assertions");
var keys = require("./../lib/keys");
var vim = require("./vim");
var vim = require("./vim2");
var el = document.createElement("div");
el.style.position = "fixed";
@ -72,9 +72,6 @@ function test(name, fn) {
exports["test " + name] = fn;
}
vim.CodeMirror.Vim.unmap("Y");
// cm.setBookmark({ch: 5, line: 0})
// cm.setBookmark({ch: 4, line: 0})
@ -592,80 +589,6 @@ testVim('{', function(cm, vim, helpers) {
helpers.doKeys('6', '{');
helpers.assertCursorAt(0, 0);
}, { value: 'a\n\nb\nc\n\nd' });
testVim('paragraph motions', function(cm, vim, helpers) {
cm.setCursor(10, 0);
helpers.doKeys('{');
helpers.assertCursorAt(4, 0);
helpers.doKeys('{');
helpers.assertCursorAt(0, 0);
helpers.doKeys('2', '}');
helpers.assertCursorAt(7, 0);
helpers.doKeys('2', '}');
helpers.assertCursorAt(16, 0);
cm.setCursor(9, 0);
helpers.doKeys('}');
helpers.assertCursorAt(14, 0);
cm.setCursor(6, 0);
helpers.doKeys('}');
helpers.assertCursorAt(7, 0);
// ip inside empty space
cm.setCursor(10, 0);
helpers.doKeys('v', 'i', 'p');
eqPos(Pos(7, 0), cm.getCursor('anchor'));
eqPos(Pos(12, 0), cm.getCursor('head'));
helpers.doKeys('i', 'p');
eqPos(Pos(7, 0), cm.getCursor('anchor'));
eqPos(Pos(13, 1), cm.getCursor('head'));
helpers.doKeys('2', 'i', 'p');
eqPos(Pos(7, 0), cm.getCursor('anchor'));
eqPos(Pos(16, 1), cm.getCursor('head'));
// should switch to visualLine mode
cm.setCursor(14, 0);
helpers.doKeys('<Esc>', 'v', 'i', 'p');
helpers.assertCursorAt(14, 0);
cm.setCursor(14, 0);
helpers.doKeys('<Esc>', 'V', 'i', 'p');
eqPos(Pos(16, 1), cm.getCursor('head'));
// ap inside empty space
cm.setCursor(10, 0);
helpers.doKeys('<Esc>', 'v', 'a', 'p');
eqPos(Pos(7, 0), cm.getCursor('anchor'));
eqPos(Pos(13, 1), cm.getCursor('head'));
helpers.doKeys('a', 'p');
eqPos(Pos(7, 0), cm.getCursor('anchor'));
eqPos(Pos(16, 1), cm.getCursor('head'));
cm.setCursor(13, 0);
helpers.doKeys('v', 'a', 'p');
eqPos(Pos(13, 0), cm.getCursor('anchor'));
eqPos(Pos(14, 0), cm.getCursor('head'));
cm.setCursor(16, 0);
helpers.doKeys('v', 'a', 'p');
eqPos(Pos(14, 0), cm.getCursor('anchor'));
eqPos(Pos(16, 1), cm.getCursor('head'));
cm.setCursor(0, 0);
helpers.doKeys('v', 'a', 'p');
eqPos(Pos(0, 0), cm.getCursor('anchor'));
eqPos(Pos(4, 0), cm.getCursor('head'));
cm.setCursor(0, 0);
helpers.doKeys('d', 'i', 'p');
var register = helpers.getRegisterController().getRegister();
eq('a\na\n', register.toString());
is(register.linewise);
helpers.doKeys('3', 'j', 'p');
helpers.doKeys('y', 'i', 'p');
is(register.linewise);
eq('b\na\na\nc\n', register.toString());
}, { value: 'a\na\n\n\n\nb\nc\n\n\n\n\n\n\nd\n\ne\nf' });
// Operator tests
testVim('dl', function(cm, vim, helpers) {
@ -1062,36 +985,32 @@ testVim('cc_multiply_repeat', function(cm, vim, helpers) {
is(register.linewise);
eq('vim-insert', cm.getOption('keyMap'));
});
testVim('cc_should_not_append_to_document', function(cm, vim, helpers) {
testVim('cc_append', function(cm, vim, helpers) {
var expectedLineCount = cm.lineCount();
cm.setCursor(cm.lastLine(), 0);
helpers.doKeys('c', 'c');
eq(expectedLineCount, cm.lineCount());
});
function fillArray(val, times) {
var arr = [];
for (var i = 0; i < times; i++) {
arr.push(val);
}
return arr;
}
testVim('c_visual_block', function(cm, vim, helpers) {
cm.setCursor(0, 1);
helpers.doKeys('<C-v>', '2', 'j', 'l', 'l', 'l', 'c');
var replacement = fillArray('hello', 3);
var replacement = new Array(cm.listSelections().length+1).join('hello ').split(' ');
replacement.pop();
cm.replaceSelections(replacement);
eq('1hello\n5hello\nahellofg', cm.getValue());
helpers.doKeys('<Esc>');
cm.setCursor(2, 3);
helpers.doKeys('<C-v>', '2', 'k', 'h', 'C');
replacement = fillArray('world', 3);
replacement = new Array(cm.listSelections().length+1).join('world ').split(' ');
replacement.pop();
cm.replaceSelections(replacement);
eq('1hworld\n5hworld\nahworld', cm.getValue());
}, {value: '1234\n5678\nabcdefg'});
testVim('c_visual_block_replay', function(cm, vim, helpers) {
cm.setCursor(0, 1);
helpers.doKeys('<C-v>', '2', 'j', 'l', 'c');
var replacement = fillArray('fo', 3);
var replacement = new Array(cm.listSelections().length+1).join('fo ').split(' ');
replacement.pop();
cm.replaceSelections(replacement);
eq('1fo4\n5fo8\nafodefg', cm.getValue());
helpers.doKeys('<Esc>');
@ -1100,17 +1019,6 @@ testVim('c_visual_block_replay', function(cm, vim, helpers) {
eq('foo4\nfoo8\nfoodefg', cm.getValue());
}, {value: '1234\n5678\nabcdefg'});
testVim('d_visual_block', function(cm, vim, helpers) {
cm.setCursor(0, 1);
helpers.doKeys('<C-v>', '2', 'j', 'l', 'l', 'l', 'd');
eq('1\n5\nafg', cm.getValue());
}, {value: '1234\n5678\nabcdefg'});
testVim('D_visual_block', function(cm, vim, helpers) {
cm.setCursor(0, 1);
helpers.doKeys('<C-v>', '2', 'j', 'l', 'D');
eq('1\n5\na', cm.getValue());
}, {value: '1234\n5678\nabcdefg'});
// Swapcase commands edit in place and do not modify registers.
testVim('g~w_repeat', function(cm, vim, helpers) {
// Assert that dw does delete newline if it should go to the next line, and
@ -1134,7 +1042,7 @@ testVim('g~g~', function(cm, vim, helpers) {
var register = helpers.getRegisterController().getRegister();
eq('', register.toString());
is(!register.linewise);
eqPos(curStart, cm.getCursor());
eqPos({line: curStart.line, ch:0}, cm.getCursor());
}, { value: ' word1\nword2\nword3\nword4\nword5\nword6' });
testVim('gu_and_gU', function(cm, vim, helpers) {
var curStart = makeCursor(0, 7);
@ -1442,7 +1350,7 @@ testVim('a_eol', function(cm, vim, helpers) {
helpers.assertCursorAt(0, lines[0].length);
eq('vim-insert', cm.getOption('keyMap'));
});
testVim('A_endOfSelectedArea', function(cm, vim, helpers) {
testVim('a_endOfSelectedArea', function(cm, vim, helpers) {
cm.setCursor(0, 0);
helpers.doKeys('v', 'j', 'l');
helpers.doKeys('A');
@ -1905,49 +1813,6 @@ testVim('visual', function(cm, vim, helpers) {
helpers.doKeys('d');
eq('15', cm.getValue());
}, { value: '12345' });
testVim('visual_yank', function(cm, vim, helpers) {
helpers.doKeys('v', '3', 'l', 'y');
helpers.assertCursorAt(0, 0);
helpers.doKeys('p');
eq('aa te test for yank', cm.getValue());
}, { value: 'a test for yank' })
testVim('visual_w', function(cm, vim, helpers) {
helpers.doKeys('v', 'w');
eq(cm.getSelection(), 'motion t');
}, { value: 'motion test'});
testVim('visual_initial_selection', function(cm, vim, helpers) {
cm.setCursor(0, 1);
helpers.doKeys('v');
cm.getSelection('n');
}, { value: 'init'});
testVim('visual_crossover_left', function(cm, vim, helpers) {
cm.setCursor(0, 2);
helpers.doKeys('v', 'l', 'h', 'h');
cm.getSelection('ro');
}, { value: 'cross'});
testVim('visual_crossover_left', function(cm, vim, helpers) {
cm.setCursor(0, 2);
helpers.doKeys('v', 'h', 'l', 'l');
cm.getSelection('os');
}, { value: 'cross'});
testVim('visual_crossover_up', function(cm, vim, helpers) {
cm.setCursor(3, 2);
helpers.doKeys('v', 'j', 'k', 'k');
eqPos(Pos(2, 2), cm.getCursor('head'));
eqPos(Pos(3, 3), cm.getCursor('anchor'));
helpers.doKeys('k');
eqPos(Pos(1, 2), cm.getCursor('head'));
eqPos(Pos(3, 3), cm.getCursor('anchor'));
}, { value: 'cross\ncross\ncross\ncross\ncross\n'});
testVim('visual_crossover_down', function(cm, vim, helpers) {
cm.setCursor(1, 2);
helpers.doKeys('v', 'k', 'j', 'j');
eqPos(Pos(2, 3), cm.getCursor('head'));
eqPos(Pos(1, 2), cm.getCursor('anchor'));
helpers.doKeys('j');
eqPos(Pos(3, 3), cm.getCursor('head'));
eqPos(Pos(1, 2), cm.getCursor('anchor'));
}, { value: 'cross\ncross\ncross\ncross\ncross\n'});
testVim('visual_exit', function(cm, vim, helpers) {
helpers.doKeys('<C-v>', 'l', 'j', 'j', '<Esc>');
eqPos(cm.getCursor('anchor'), cm.getCursor('head'));
@ -1957,31 +1822,20 @@ testVim('visual_line', function(cm, vim, helpers) {
helpers.doKeys('l', 'V', 'l', 'j', 'j', 'd');
eq(' 4\n 5', cm.getValue());
}, { value: ' 1\n 2\n 3\n 4\n 5' });
testVim('visual_block_move_to_eol', function(cm, vim, helpers) {
// moveToEol should move all block cursors to end of line
cm.setCursor(0, 0);
helpers.doKeys('<C-v>', 'G', '$');
var selections = cm.getSelections().join();
console.log(selections);
eq("123,45,6", selections);
}, {value: '123\n45\n6'});
testVim('visual_block_different_line_lengths', function(cm, vim, helpers) {
testVim('visual_block', function(cm, vim, helpers) {
// test the block selection with lines of different length
// i.e. extending the selection
// till the end of the longest line.
helpers.doKeys('<C-v>', 'l', 'j', 'j', '6', 'l', 'd');
helpers.doKeys('d', 'd', 'd', 'd');
eq('', cm.getValue());
}, {value: '1234\n5678\nabcdefg'});
testVim('visual_block_truncate_on_short_line', function(cm, vim, helpers) {
// check for left side selection in case
// of moving up to a shorter line.
cm.replaceRange('', cm.getCursor());
cm.replaceRange('hello world\n{\nthis is\nsparta!', cm.getCursor());
cm.setCursor(3, 4);
helpers.doKeys('<C-v>', 'l', 'k', 'k', 'd');
eq('hello world\n{\ntis\nsa!', cm.getValue());
}, {value: 'hello world\n{\nthis is\nsparta!'});
testVim('visual_block_corners', function(cm, vim, helpers) {
cm.replaceRange('12345\n67891\nabcde', {line: 0, ch: 0}, {line: cm.lastLine(), ch: 6});
cm.setCursor(1, 2);
helpers.doKeys('<C-v>', '2', 'l', 'k');
// circle around the anchor
@ -1997,8 +1851,6 @@ testVim('visual_block_corners', function(cm, vim, helpers) {
helpers.doKeys('4', 'l');
selections = cm.getSelections();
eq('891cde', selections.join(''));
}, {value: '12345\n67891\nabcde'});
testVim('visual_block_mode_switch', function(cm, vim, helpers) {
// switch between visual modes
cm.setCursor(1, 1);
// blockwise to characterwise visual
@ -2013,7 +1865,7 @@ testVim('visual_block_mode_switch', function(cm, vim, helpers) {
helpers.doKeys('V');
selections = cm.getSelections();
eq('67891\nabcde', selections.join(''));
}, {value: '12345\n67891\nabcde'});
}, {value: '1234\n5678\nabcdefg'});
testVim('visual_block_crossing_short_line', function(cm, vim, helpers) {
// visual block with long and short lines
cm.setCursor(0, 3);
@ -2093,15 +1945,12 @@ testVim('reselect_visual_block', function(cm, vim, helpers) {
helpers.doKeys('<C-v>', 'k', 'h', '<C-v>');
cm.setCursor(2, 1);
helpers.doKeys('v', 'l', 'g', 'v');
eqPos(Pos(1, 2), vim.sel.anchor);
eqPos(Pos(0, 1), vim.sel.head);
helpers.assertCursorAt(0, 1);
// Ensure selection is done with visual block mode rather than one
// continuous range.
eq(cm.getSelections().join(''), '23oo')
helpers.doKeys('g', 'v');
eqPos(Pos(2, 1), vim.sel.anchor);
eqPos(Pos(2, 2), vim.sel.head);
helpers.doKeys('<Esc>');
helpers.assertCursorAt(2, 3);
// Ensure selection of deleted range
cm.setCursor(1, 1);
helpers.doKeys('v', '<C-v>', 'j', 'd', 'g', 'v');
@ -2135,14 +1984,11 @@ testVim('o_visual', function(cm, vim, helpers) {
testVim('o_visual_block', function(cm, vim, helpers) {
cm.setCursor(0, 1);
helpers.doKeys('<C-v>','3','j','l','l', 'o');
eqPos(Pos(3, 3), vim.sel.anchor);
eqPos(Pos(0, 1), vim.sel.head);
helpers.assertCursorAt(0, 1);
helpers.doKeys('O');
eqPos(Pos(3, 1), vim.sel.anchor);
eqPos(Pos(0, 3), vim.sel.head);
helpers.assertCursorAt(0, 4);
helpers.doKeys('o');
eqPos(Pos(0, 3), vim.sel.anchor);
eqPos(Pos(3, 1), vim.sel.head);
helpers.assertCursorAt(3, 1);
}, { value: 'abcd\nefgh\nijkl\nmnop'});
testVim('changeCase_visual', function(cm, vim, helpers) {
cm.setCursor(0, 0);
@ -2177,9 +2023,7 @@ testVim('changeCase_visual_block', function(cm, vim, helpers) {
}, { value: 'abcdef\nghijkl\nmnopq\nfoo'});
testVim('visual_paste', function(cm, vim, helpers) {
cm.setCursor(0, 0);
helpers.doKeys('v', 'l', 'l', 'y');
helpers.assertCursorAt(0, 0);
helpers.doKeys('3', 'l', 'j', 'v', 'l', 'p');
helpers.doKeys('v', 'l', 'l', 'y', 'j', 'v', 'l', 'p');
helpers.assertCursorAt(1, 5);
eq('this is a\nunithitest for visual paste', cm.getValue());
cm.setCursor(0, 0);

View File

@ -32,15 +32,15 @@ define(function(require, exports, module) {
"use strict";
var dom = require("../lib/dom");
var isIE8;
var IE8;
var Cursor = function(parentEl) {
this.element = dom.createElement("div");
this.element.className = "ace_layer ace_cursor-layer";
parentEl.appendChild(this.element);
if (isIE8 === undefined)
isIE8 = !("opacity" in this.element.style);
if (IE8 === undefined)
IE8 = "opacity" in this.element;
this.isVisible = false;
this.isBlinking = true;
@ -50,9 +50,7 @@ var Cursor = function(parentEl) {
this.cursors = [];
this.cursor = this.addCursor();
dom.addCssClass(this.element, "ace_hidden-cursors");
this.$updateCursors = (isIE8
? this.$updateVisibility
: this.$updateOpacity).bind(this);
this.$updateCursors = this.$updateVisibility.bind(this);
};
(function() {
@ -93,11 +91,13 @@ var Cursor = function(parentEl) {
};
this.setSmoothBlinking = function(smoothBlinking) {
if (smoothBlinking != this.smoothBlinking && !isIE8) {
if (smoothBlinking != this.smoothBlinking && !IE8) {
this.smoothBlinking = smoothBlinking;
dom.setCssClass(this.element, "ace_smooth-blinking", smoothBlinking);
this.$updateCursors(true);
this.$updateCursors = (this.$updateOpacity).bind(this);
this.$updateCursors = (smoothBlinking
? this.$updateOpacity
: this.$updateVisibility).bind(this);
this.restartTimer();
}
};

View File

@ -92,9 +92,9 @@ var FontMetrics = exports.FontMetrics = function(parentEl, interval) {
this.$setMeasureNodeStyles = function(style, isRoot) {
style.width = style.height = "auto";
style.left = style.top = "0px";
style.left = style.top = "-100px";
style.visibility = "hidden";
style.position = "absolute";
style.position = "fixed";
style.whiteSpace = "pre";
if (useragent.isIE < 8) {

View File

@ -1,157 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
"no use strict";
var oop = require("./oop");
var EventEmitter = require("./event_emitter").EventEmitter;
var optionsProvider = {
setOptions: function(optList) {
Object.keys(optList).forEach(function(key) {
this.setOption(key, optList[key]);
}, this);
},
getOptions: function(optionNames) {
var result = {};
if (!optionNames) {
optionNames = Object.keys(this.$options);
} else if (!Array.isArray(optionNames)) {
result = optionNames;
optionNames = Object.keys(result);
}
optionNames.forEach(function(key) {
result[key] = this.getOption(key);
}, this);
return result;
},
setOption: function(name, value) {
if (this["$" + name] === value)
return;
var opt = this.$options[name];
if (!opt) {
return warn('misspelled option "' + name + '"');
}
if (opt.forwardTo)
return this[opt.forwardTo] && this[opt.forwardTo].setOption(name, value);
if (!opt.handlesSet)
this["$" + name] = value;
if (opt && opt.set)
opt.set.call(this, value);
},
getOption: function(name) {
var opt = this.$options[name];
if (!opt) {
return warn('misspelled option "' + name + '"');
}
if (opt.forwardTo)
return this[opt.forwardTo] && this[opt.forwardTo].getOption(name);
return opt && opt.get ? opt.get.call(this) : this["$" + name];
}
};
function warn(message) {
if (typeof console != "undefined" && console.warn)
console.warn.apply(console, arguments);
}
function reportError(msg, data) {
var e = new Error(msg);
e.data = data;
if (typeof console == "object" && console.error)
console.error(e);
setTimeout(function() { throw e; });
}
var AppConfig = function() {
this.$defaultOptions = {};
};
(function() {
// module loading
oop.implement(this, EventEmitter);
/*
* option {name, value, initialValue, setterName, set, get }
*/
this.defineOptions = function(obj, path, options) {
if (!obj.$options)
this.$defaultOptions[path] = obj.$options = {};
Object.keys(options).forEach(function(key) {
var opt = options[key];
if (typeof opt == "string")
opt = {forwardTo: opt};
opt.name || (opt.name = key);
obj.$options[opt.name] = opt;
if ("initialValue" in opt)
obj["$" + opt.name] = opt.initialValue;
});
// implement option provider interface
oop.implement(obj, optionsProvider);
return this;
};
this.resetOptions = function(obj) {
Object.keys(obj.$options).forEach(function(key) {
var opt = obj.$options[key];
if ("value" in opt)
obj.setOption(key, opt.value);
});
};
this.setDefaultValue = function(path, name, value) {
var opts = this.$defaultOptions[path] || (this.$defaultOptions[path] = {});
if (opts[name]) {
if (opts.forwardTo)
this.setDefaultValue(opts.forwardTo, name, value);
else
opts[name].value = value;
}
};
this.setDefaultValues = function(path, optionHash) {
Object.keys(optionHash).forEach(function(key) {
this.setDefaultValue(path, key, optionHash[key]);
}, this);
};
this.warn = warn;
this.reportError = reportError;
}).call(AppConfig.prototype);
exports.AppConfig = AppConfig;
});

View File

@ -31,6 +31,9 @@
define(function(require, exports, module) {
"use strict";
if (typeof document == "undefined")
return;
var XHTML_NS = "http://www.w3.org/1999/xhtml";
exports.getDocumentHead = function(doc) {
@ -172,10 +175,6 @@ exports.getInnerHeight = function(element) {
);
};
if (typeof document == "undefined")
return;
if (window.pageYOffset !== undefined) {
exports.getPageScrollTop = function() {
return window.pageYOffset;

View File

@ -253,6 +253,20 @@ function normalizeCommandKeys(callback, e, keyCode) {
}
if (keyCode in keys.MODIFIER_KEYS) {
switch (keys.MODIFIER_KEYS[keyCode]) {
case "Alt":
hashId = 2;
break;
case "Shift":
hashId = 4;
break;
case "Ctrl":
hashId = 1;
break;
default:
hashId = 8;
break;
}
keyCode = -1;
}

View File

@ -146,7 +146,7 @@ var Keys = (function() {
})();
ret.KEY_MODS[0] = "";
ret.KEY_MODS[-1] = "input-";
ret.KEY_MODS[-1] = "input";
return ret;
})();

View File

@ -13,7 +13,7 @@
[1, +1, -1, 12_345, 0.000_1,
_, 3_1, 1_2, 1_.0, 0._1];
{:id => ?", :key => "value", anotherKey: [x, y?]}
{:id => 34, :key => "value"}
=begin
=end

File diff suppressed because it is too large Load Diff

View File

@ -137,12 +137,7 @@
"start",
["text"," "],
["keyword","#if"],
["text"," "],
["identifier","VERBOSE"],
["text"," "],
["keyword.operator",">="],
["text"," "],
["constant.numeric","2"]
["constant.other"," VERBOSE >= 2"]
],[
"start",
["text"," "],

View File

@ -1,302 +0,0 @@
[[
"start",
["comment","/* Mask Syntax Demo */"]
],[
"start"
],[
"start",
["keyword.support.constant.language","div"],
["text"," "],
["paren.lparen",">"],
["text"," "],
["string.start","'"],
["string"," Test "],
["paren.lparen.markup.italic","~["],
["identifier","name"],
["paren.rparen.markup.italic","]"],
["string.end","'"],
["paren.rparen",";"]
],[
"start"
],[
"start",
["keyword","define"],
["text"," :"],
["support.variable.class","userProfile"],
["text"," "],
["paren.lparen","{"]
],[
"start",
["text","\t"],
["keyword.support.constant.language","header"],
["text"," "],
["paren.lparen","{"]
],[
"start",
["text","\t\t"],
["keyword.support.constant.language","h4"],
["text"," "],
["paren.lparen",">"],
["text"," "],
["support.function.markup.bold","@title"],
["paren.lparen",";"]
],[
"start",
["text","\t\t"],
["keyword.support.constant.language","button"],
["support.variable.class",".close"],
["paren.lparen",";"]
],[
"start",
["text","\t"],
["paren.rparen","}"]
],[
"start",
["paren.rparen","}"]
],[
"start"
],[
"start",
["support.function.markup.bold",":userProfile"],
["text"," "],
["paren.lparen","{"]
],[
"start",
["text","\t"],
["support.function.markup.bold","@title"],
["text"," "],
["paren.lparen",">"],
["text"," "],
["string.start","'"],
["string"," Hello "],
["paren.lparen.markup.italic","~["],
["keyword.control.markup.italic",":"],
["text"," "],
["identifier","username"],
["punctuation.operator","."],
["support.function","toUpperCase"],
["paren.lparen","("],
["paren.rparen",")"],
["paren.rparen.markup.italic","]"],
["string.end","'"]
],[
"start",
["paren.rparen","}"]
],[
"start"
],[
["paren.lparen52","constant.language40"],
["constant.language","style"],
["text"," "],
["paren.lparen","{"]
],[
["css-block-ruleset","paren.lparen52","paren.lparen52","constant.language40"],
["text"," "],
["constant","html"],
["text",", "],
["constant","body"],
["text"," "],
["paren.lparen","{"]
],[
["css-block-ruleset","paren.lparen52","paren.lparen52","constant.language40"],
["text"," "],
["support.type","background"],
["text",": "],
["support.function","url("],
["string","'name.png'"],
["support.function",")"],
["text"," "],
["constant.numeric","0"],
["text"," "],
["constant.numeric","0"],
["text"," "],
["support.constant","no-repeat"],
["text",";"]
],[
["paren.lparen52","constant.language40"],
["text"," "],
["paren.rparen","}"]
],[
["#tmp","css-block-end","paren.lparen52","constant.language40"],
["paren.rparen","}"]
],[
["#tmp","start","paren.lparen52","constant.language40"]
],[
["#tmp","start","paren.lparen52","constant.language40"],
["keyword.support.constant.language","button"],
["text"," "],
["paren.lparen","{"]
],[
["paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"],
["text","\t"],
["constant.language","event"],
["text"," "],
["support.variable.class","click"],
["text"," "],
["paren.lparen","("],
["identifier","e"],
["paren.rparen",")"],
["text"," "],
["paren.lparen","{"]
],[
["#tmp","js-block-start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"],
["text","\t "],
["variable.language","this"],
["punctuation.operator","."],
["identifier","textContent"],
["text"," "],
["keyword.operator","="],
["text"," "],
["string.quasi.start","`"],
["string.quasi","name "],
["paren.quasi.start","${"],
["identifier","e"],
["punctuation.operator","."],
["identifier","clientX"],
["paren.quasi.end","}"],
["string.quasi"," !"],
["string.quasi.end","`"],
["punctuation.operator",";"]
],[
["#tmp","js-block-end","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"],
["text","\t"],
["paren.rparen","}"]
],[
["#tmp","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"],
["paren.rparen","}"]
],[
["#tmp","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"]
],[
["paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"],
["constant.language","md"],
["text"," "],
["paren.lparen",">"],
["text"," "],
["paren.lparen","\"\"\""]
],[
["#tmp","md-multiline-allowBlock","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"]
],[
["#tmp","md-multiline-listblock","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"],
["markup.list","- "],
["list","div"]
],[
["#tmp","md-multiline-listblock","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"],
["markup.list","- "],
["list","span"]
],[
["#tmp","md-multiline-listblock","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"],
["list"," "]
],[
["#tmp","md-multiline-listblock","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"],
["list","Hello"]
],[
["#tmp","md-multiline-start","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"]
],[
["#tmp","md-multiline-start","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"],
["text","["],
["string","one"],
["text","]("],
["markup.underline","http://google.com"],
["text",")"]
],[
["#tmp","md-multiline-allowBlock","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"]
],[
["#tmp","start","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"],
["paren.rparen","\"\"\";"]
],[
["#tmp","start","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"]
],[
["#tmp","start","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"]
],[
["#tmp","start","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"],
["keyword.support.constant.language","header"],
["text"," "],
["support.variable.class",".foo"],
["text"," "],
["paren.lparen",">"],
["text"," "],
["string.start","'"],
["string","Heading"],
["string.end","'"]
],[
["#tmp","start","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"]
],[
["string.start2","start","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"],
["keyword.support.constant.language","button"],
["text"," "],
["support.variable.class",".baz"],
["text"," "],
["support.variable.class.markup.bold","x-signal"],
["keyword.operator","="],
["string.start","'"],
["string","click: test"],
["string.end","'"],
["text"," "],
["support.variable.class","disabled"],
["text"," "],
["paren.lparen",">"],
["text"," "],
["string.start","\""]
],[
["string.start2","start","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"],
["string","\tHello,"]
],[
["string.start2","start","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"],
["string","\tworld "]
],[
["string.start2","start","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"],
["string","\t"],
["string.escape","\\\""],
["string","Buddy"],
["string.escape","\\\""]
],[
["#tmp","start","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"],
["string.end","\""]
],[
["#tmp","start","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"]
],[
["#tmp","js-statement-start","start","js-statement-no_regex","constant.language53","start","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"],
["constant.language","var"],
["text"," "],
["identifier","a"],
["text"," "],
["keyword.operator","="],
["text"," "],
["paren","{"]
],[
["#tmp","js-statement-no_regex","start","js-statement-no_regex","constant.language53","start","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"],
["text"," "],
["identifier","name"],
["punctuation.operator",":"],
["text"," "],
["string.quasi.start","`"],
["string.quasi","name "],
["paren.quasi.start","${"],
["variable.language","window"],
["punctuation.operator","."],
["support.constant","innerWidth"],
["paren.rparen","}"],
["string.quasi.end","`"]
],[
["#tmp","start","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"],
["paren.rparen","};"]
],[
["#tmp","start","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"]
],[
["#tmp","start","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"],
["keyword.support.constant.language","span"],
["text"," "],
["support.variable.class",".foo"],
["text"," "],
["paren.lparen",">"],
["text"," "],
["string.start","\""],
["paren.lparen.markup.italic","~["],
["keyword.control.markup.italic","bind:"],
["text"," "],
["identifier","a"],
["punctuation.operator","."],
["identifier","name"],
["paren.rparen.markup.italic","]"],
["string.end","\""]
]]

View File

@ -727,8 +727,7 @@
],[
"start",
["keyword","#ifndef"],
["text"," "],
["constant.language.objc","Nil"]
["constant.other"," Nil"]
],[
"start",
["keyword","#define"],

View File

@ -139,7 +139,7 @@
["text"," "],
["punctuation.separator.key-value","=>"],
["text"," "],
["string.character","?\""],
["constant.numeric","34"],
["text",", "],
["constant.other.symbol.ruby",":key"],
["text"," "],
@ -148,15 +148,7 @@
["string.start","\""],
["string","value"],
["string.end","\""],
["text",", "],
["identifier","anotherKey"],
["text",": "],
["paren.lparen","["],
["identifier","x"],
["text",", "],
["identifier","y"],
["text","?"],
["paren.rparen","]}"]
["paren.rparen","}"]
],[
"start"
],[

View File

@ -126,7 +126,7 @@ var AbapHighlightRules = function() {
{token : "string", regex : "`", next : "start"},
{defaultToken : "string"}
]
};
}
};
oop.inherits(AbapHighlightRules, TextHighlightRules);

58
node_modules/ace/lib/ace/mode/abc.js generated vendored
View File

@ -1,58 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2012, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
/*
THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
*/
define(function (require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextMode = require("./text").Mode;
var ABCHighlightRules = require("./abc_highlight_rules").ABCHighlightRules;
// TODO: pick appropriate fold mode
var FoldMode = require("./folding/cstyle").FoldMode;
var Mode = function () {
this.HighlightRules = ABCHighlightRules;
this.foldingRules = new FoldMode();
};
oop.inherits(Mode, TextMode);
(function () {
// this.lineCommentStart = ""%.*"";
// this.blockComment = {start: ""/*"", end: ""*/""};
// Extra logic goes here.
this.$id = "ace/mode/abc"
}).call(Mode.prototype);
exports.Mode = Mode;
});

View File

@ -1,114 +0,0 @@
/* This file was partially autogenerated from https://github.com/jimhawkridge/SublimeABC
Modifications
- more classes to express the abc semantic
- added syntax highlighting for Zupfnoter conventions (https://github.com/bwl21/zupfnoter)
- separate note pitch and note duration - even if it looks the same
***********************************************************************************************/
define(function (require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var ABCHighlightRules = function () {
// regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used
this.$rules = {
start: [
{
token: ['zupfnoter.information.comment.line.percentage', 'information.keyword', 'in formation.keyword.embedded'],
regex: '(%%%%)(hn\\.[a-z]*)(.*)',
comment: 'Instruction Comment'
},
{
token: ['information.comment.line.percentage', 'information.keyword.embedded'],
regex: '(%%)(.*)',
comment: 'Instruction Comment'
},
{
token: 'comment.line.percentage',
regex: '%.*',
comment: 'Comments'
},
{
token: 'barline.keyword.operator',
regex: '[\\[:]*[|:][|\\]:]*(?:\\[?[0-9]+)?|\\[[0-9]+',
comment: 'Bar lines'
},
{
token: ['information.keyword.embedded', 'information.argument.string.unquoted'],
regex: '(\\[[A-Za-z]:)([^\\]]*\\])',
comment: 'embedded Header lines'
},
{
token: ['information.keyword', 'information.argument.string.unquoted'],
regex: '^([A-Za-z]:)([^%\\\\]*)',
comment: 'Header lines'
},
{
token: ['text', 'entity.name.function', 'string.unquoted', 'text'],
regex: '(\\[)([A-Z]:)(.*?)(\\])',
comment: 'Inline fields'
},
{
token: ['accent.constant.language', 'pitch.constant.numeric', 'duration.constant.numeric'],
regex: '([\\^=_]*)([A-Ga-gz][,\']*)([0-9]*/*[><0-9]*)',
comment: 'Notes'
},
{
token: 'zupfnoter.jumptarget.string.quoted',
regex: '[\\"!]\\^\\:.*?[\\"!]',
comment: 'Zupfnoter jumptarget'
}, {
token: 'zupfnoter.goto.string.quoted',
regex: '[\\"!]\\^\\@.*?[\\"!]',
comment: 'Zupfnoter goto'
},
{
token: 'zupfnoter.annotation.string.quoted',
regex: '[\\"!]\\^\\!.*?[\\"!]',
comment: 'Zupfnoter annoation'
},
{
token: 'zupfnoter.annotationref.string.quoted',
regex: '[\\"!]\\^\\#.*?[\\"!]',
comment: 'Zupfnoter annotation reference'
},
{
token: 'chordname.string.quoted',
regex: '[\\"!]\\^.*?[\\"!]',
comment: 'abc chord'
},
{
token: 'string.quoted',
regex: '[\\"!].*?[\\"!]',
comment: 'abc annotation'
}
]
};
// this.embedRules(JsonHighlightRules, "json-")
this.normalizeRules();
};
ABCHighlightRules.metaData = {
fileTypes: ['abc'],
name: 'ABC',
scopeName: 'text.abcnotation'
};
oop.inherits(ABCHighlightRules, TextHighlightRules);
exports.ABCHighlightRules = ABCHighlightRules;
});

View File

@ -53,6 +53,9 @@ var testRanges = function(str) {
};
module.exports = {
name: "ACE multi_select.js",
"test: cstyle": function() {
function testValue(line) {
assert.equal(editor.getValue(), Array(4).join(line + "\n"));
@ -120,15 +123,6 @@ module.exports = {
assert.equal(editor.getValue(), "{")
exec("insertstring", 1, "\n");
assert.equal(editor.getValue(), "{\n \n}")
editor.setValue("");
exec("insertstring", 1, "(");
exec("insertstring", 1, '"');
exec("insertstring", 1, '"');
assert.equal(editor.getValue(), '("")');
exec("backspace", 1);
exec("insertstring", 1, '"');
assert.equal(editor.getValue(), '("")');
}
};

View File

@ -277,8 +277,6 @@ var CstyleBehaviour = function() {
} else {
if (stringBefore && !stringAfter)
return null; // wrap string with different quote
if (stringBefore && stringAfter)
return null; // do not pair quotes inside strings
var wordRe = session.$mode.tokenRe;
wordRe.lastIndex = 0;
var isWordBefore = wordRe.test(leftChar);
@ -314,8 +312,8 @@ var CstyleBehaviour = function() {
};
CstyleBehaviour.isSaneInsertion = function(editor, session) {
var cursor = editor.getCursorPosition();
CstyleBehaviour.isSaneInsertion = function(editor, session, cursor) {
cursor = cursor || editor.getCursorPosition();
var iterator = new TokenIterator(session, cursor.row, cursor.column);
// Don't insert in the middle of a keyword/identifier/lexical

View File

@ -84,11 +84,11 @@ var c_cppHighlightRules = function() {
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b"
}, {
token : "keyword", // pre-compiler directives
regex : "#\\s*(?:include|import|pragma|line|define|undef)\\b",
regex : "#\\s*(?:include|import|pragma|line|define|undef|if|ifdef|else|elif|ifndef)\\b",
next : "directive"
}, {
token : "keyword", // special case pre-compiler directive
regex : "#\\s*(?:endif|if|ifdef|else|elif|ifndef)\\b"
regex : "(?:#\\s*endif)\\b"
}, {
token : "support.function.C99.c",
regex : cFunctions

View File

@ -116,11 +116,11 @@ oop.inherits(Mode, TextMode);
var worker = new WorkerClient(["ace"], "ace/mode/coffee_worker", "Worker");
worker.attachToDocument(session.getDocument());
worker.on("annotate", function(e) {
session.setAnnotations(e.data);
worker.on("error", function(e) {
session.setAnnotations([e.data]);
});
worker.on("terminate", function() {
worker.on("ok", function(e) {
session.clearAnnotations();
});

View File

@ -49,13 +49,13 @@ oop.inherits(Worker, Mirror);
this.onUpdate = function() {
var value = this.doc.getValue();
var errors = [];
try {
coffee.parse(value).compile();
} catch(e) {
var loc = e.location;
if (loc) {
errors.push({
this.sender.emit("error", {
row: loc.first_line,
column: loc.first_column,
endRow: loc.last_line,
@ -64,8 +64,9 @@ oop.inherits(Worker, Mirror);
type: "error"
});
}
return;
}
this.sender.emit("annotate", errors);
this.sender.emit("ok");
};
}).call(Worker.prototype);

View File

@ -81,7 +81,7 @@ oop.inherits(Mode, TextMode);
var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
worker.attachToDocument(session.getDocument());
worker.on("annotate", function(e) {
worker.on("csslint", function(e) {
session.setAnnotations(e.data);
});

View File

@ -80,11 +80,11 @@ oop.inherits(Worker, Mirror);
this.onUpdate = function() {
var value = this.doc.getValue();
if (!value)
return this.sender.emit("annotate", []);
return this.sender.emit("csslint", []);
var infoRules = this.infoRules;
var result = CSSLint.verify(value, this.ruleset);
this.sender.emit("annotate", result.messages.map(function(msg) {
this.sender.emit("csslint", result.messages.map(function(msg) {
return {
row: msg.line - 1,
column: msg.col - 1,

View File

@ -13,8 +13,8 @@ var DartHighlightRules = function() {
var constantLanguage = "true|false|null";
var variableLanguage = "this|super";
var keywordControl = "try|catch|finally|throw|rethrow|assert|break|case|continue|default|do|else|for|if|in|return|switch|while|new|deferred|async|await";
var keywordDeclaration = "abstract|class|extends|external|factory|implements|get|native|operator|set|typedef|with|enum";
var keywordControl = "try|catch|finally|throw|rethrow|assert|break|case|continue|default|do|else|for|if|in|return|switch|while|new";
var keywordDeclaration = "abstract|class|extends|external|factory|implements|get|native|operator|set|typedef|with";
var storageModifier = "static|final|const";
var storageType = "void|bool|num|int|double|dynamic|var|String";

View File

@ -39,7 +39,7 @@ var EiffelHighlightRules = function() {
"class|convert|create|debug|deferred|detachable|do|else|elseif|end|" +
"ensure|expanded|export|external|feature|from|frozen|if|inherit|" +
"inspect|invariant|like|local|loop|not|note|obsolete|old|once|" +
"Precursor|redefine|rename|require|rescue|retry|select|separate|" +
"Precursor|redefine|rename|require|rescue|retry|select|separate|" +
"some|then|undefine|until|variant|when";
var operatorKeywords = "and|implies|or|xor";
@ -58,44 +58,45 @@ var EiffelHighlightRules = function() {
"keyword": keywords
}, "identifier", true);
var simpleString = /(?:[^"%\b\f\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_*[\da-fA-F])*|0[cC][0-7](?:_*[0-7])*|0[bB][01](?:_*[01])*|\d(?:_*\d)*)\/)+?/;
this.$rules = {
"start": [{
token : "string.quoted.other", // Aligned-verbatim-strings (verbatim option not supported)
token : "comment.line.double-dash",
regex : /--.*$/
}, {
token : "string.quoted.double",
regex : /"(?:%"|[^%])*?"/
}, {
token : "string.quoted.other", // "[ ]" aligned verbatim string
regex : /"\[/,
next: "aligned_verbatim_string"
}, {
token : "string.quoted.other", // Non-aligned-verbatim-strings (verbatim option not supported)
token : "string.quoted.other", // "{ }" non-aligned verbatim string
regex : /"\{/,
next: "non-aligned_verbatim_string"
}, {
token : "string.quoted.double",
regex : /"(?:[^%\b\f\n\r\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_*[\da-fA-F])*|0[cC][0-7](?:_*[0-7])*|0[bB][01](?:_*[01])*|\d(?:_*\d)*)\/)*?"/
}, {
token : "comment.line.double-dash",
regex : /--.*/
}, {
token : "constant.character",
regex : /'(?:[^%\b\f\n\r\t\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_*[\da-fA-F])*|0[cC][0-7](?:_*[0-7])*|0[bB][01](?:_*[01])*|\d(?:_*\d)*)\/)'/
regex : /'(?:%%|%T|%R|%N|%F|%'|[^%])'/
}, {
token : "constant.numeric", // hexa | octal | bin
regex : /\b0(?:[xX][\da-fA-F](?:_*[\da-fA-F])*|[cC][0-7](?:_*[0-7])*|[bB][01](?:_*[01])*)\b/
token : "constant.numeric", // real
regex : /(?:\d(?:_?\d)*\.|\.\d)(?:\d*[eE][+-]?\d+)?\b/
}, {
token : "constant.numeric",
regex : /(?:\d(?:_*\d)*)?\.(?:(?:\d(?:_*\d)*)?[eE][+-]?)?\d(?:_*\d)*|\d(?:_*\d)*\.?/
token : "constant.numeric", // integer
regex : /\d(?:_?\d)*\b/
}, {
token : "paren.lparen",
regex : /[\[({]|<<|\|\(/
token : "constant.numeric", // hex
regex : /0[xX][a-fA-F\d](?:_?[a-fA-F\d])*\b/
}, {
token : "paren.rparen",
regex : /[\])}]|>>|\|\)/
}, {
token : "keyword.operator", // punctuation
regex : /:=|->|\.(?=\w)|[;,:?]/
token : "constant.numeric", // octal
regex : /0[cC][0-7](?:_?[0-7])*\b/
},{
token : "constant.numeric", // bin
regex : /0[bB][01](?:_?[01])*\b/
}, {
token : "keyword.operator",
regex : /\\\\|\|\.\.\||\.\.|\/[~\/]?|[><\/]=?|[-+*^=~]/
regex : /\+|\-|\*|\/|\\\\|\/\/|\^|~|\/~|<|>|<=|>=|\/=|=|:=|\|\.\.\||\.\./
}, {
token : "keyword.operator", // punctuation
regex : /\.|:|,|;\b/
}, {
token : function (v) {
var result = keywordMapper (v);
@ -105,27 +106,33 @@ var EiffelHighlightRules = function() {
return result;
},
regex : /[a-zA-Z][a-zA-Z\d_]*\b/
}, {
token : "paren.lparen",
regex : /[\[({]/
}, {
token : "paren.rparen",
regex : /[\])}]/
}, {
token : "text",
regex : /\s+/
}
],
"aligned_verbatim_string" : [{
token : "string",
token : "string", // closing multi-line comment
regex : /]"/,
next : "start"
}, {
token : "string",
regex : simpleString
token : "string", // comment spanning whole line
regex : /[^(?:\]")]+/
}
],
"non-aligned_verbatim_string" : [{
token : "string.quoted.other",
token : "string.quoted.other", // closing multi-line comment
regex : /}"/,
next : "start"
}, {
token : "string.quoted.other",
regex : simpleString
token : "string.quoted.other", // comment spanning whole line
regex : /[^(?:\}")]+/
}
]};
};

View File

@ -110,8 +110,8 @@ oop.inherits(FoldMode, CFoldMode);
var maxRow = session.getLength();
var startRow = row;
var re = /^\s*#(end)?region\b/;
var depth = 1;
var re = /^\s*#(end)?region\b/
var depth = 1
while (++row < maxRow) {
line = session.getLine(row);
var m = re.exec(line);
@ -128,7 +128,8 @@ oop.inherits(FoldMode, CFoldMode);
var endRow = row;
if (endRow > startRow) {
return new Range(startRow, startColumn, endRow, line.length);
var endColumn = line.search(/\S/);
return new Range(startRow, startColumn, endRow, endColumn);
}
};

View File

@ -48,51 +48,12 @@ var FoldMode = exports.FoldMode = function(commentRegex) {
oop.inherits(FoldMode, BaseFoldMode);
(function() {
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
//prevent naming conflict with any modes that inherit from cstyle and override this (like csharp)
this._getFoldWidgetBase = this.getFoldWidget;
/**
* Gets fold widget with some non-standard extras:
*
* @example lineCommentRegionStart
* //#region [optional description]
*
* @example blockCommentRegionStart
* /*#region [optional description] *[/]
*
* @example tripleStarFoldingSection
* /*** this folds even though 1 line because it has 3 stars ***[/]
*/
this.getFoldWidget = function(session, foldStyle, row) {
var line = session.getLine(row);
if (this.singleLineBlockCommentRe.test(line)) {
// No widget for single line block comment unless region or triple star
if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
return "";
}
var fw = this._getFoldWidgetBase(session, foldStyle, row);
if (!fw && this.startRegionRe.test(line))
return "start"; // lineCommentRegionStart
return fw;
};
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
var line = session.getLine(row);
if (this.startRegionRe.test(line))
return this.getCommentRegionBlock(session, line, row);
var match = line.match(this.foldingStartMarker);
if (match) {
var i = match.index;
@ -157,29 +118,6 @@ oop.inherits(FoldMode, BaseFoldMode);
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
};
this.getCommentRegionBlock = function(session, line, row) {
var startColumn = line.search(/\s*$/);
var maxRow = session.getLength();
var startRow = row;
var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
var depth = 1;
while (++row < maxRow) {
line = session.getLine(row);
var m = re.exec(line);
if (!m) continue;
if (m[1]) depth--;
else depth++;
if (!depth) break;
}
var endRow = row;
if (endRow > startRow) {
return new Range(startRow, startColumn, endRow, line.length);
}
};
}).call(FoldMode.prototype);

View File

@ -59,8 +59,8 @@ module.exports = {
assert.equal(session.getFoldWidget(3), "end");
assert.equal(session.getFoldWidget(4), "end");
assert.range(session.getFoldWidgetRange(0), 0, 31, 4, 0);
assert.range(session.getFoldWidgetRange(4), 0, 31, 4, 0);
assert.range(session.getFoldWidgetRange(0), 0, 8, 4, 0);
assert.range(session.getFoldWidgetRange(4), 0, 8, 4, 0);
assert.range(session.getFoldWidgetRange(1), 1, 16, 3, 0);
assert.range(session.getFoldWidgetRange(3), 1, 16, 3, 0);
@ -85,8 +85,8 @@ module.exports = {
assert.equal(session.getFoldWidget(3), "end");
assert.equal(session.getFoldWidget(4), "end");
assert.range(session.getFoldWidgetRange(0), 0, 23, 4, 0);
assert.range(session.getFoldWidgetRange(4), 0, 23, 4, 0);
assert.range(session.getFoldWidgetRange(0), 0, 7, 4, 0);
assert.range(session.getFoldWidgetRange(4), 0, 7, 4, 0);
assert.range(session.getFoldWidgetRange(1), 1, 17, 3, 4);
assert.range(session.getFoldWidgetRange(3), 1, 17, 3, 4);

View File

@ -217,8 +217,6 @@ function is(token, type) {
row: row,
column: firstTag.start.column + firstTag.tagName.length + 2
};
if (firstTag.start.row == firstTag.end.row)
start.column = firstTag.end.column;
while (tag = this._readTagForward(iterator)) {
if (tag.selfClosing) {
if (!stack.length) {
@ -260,8 +258,6 @@ function is(token, type) {
this._pop(stack, tag);
if (stack.length == 0) {
tag.start.column += tag.tagName.length + 2;
if (tag.start.row == tag.end.row && tag.start.column < tag.end.column)
tag.start.column = tag.end.column;
return Range.fromPoints(tag.start, end);
}
}

View File

@ -55,9 +55,9 @@ var HaskellHighlightRules = function() {
{ token: 'constant.language.empty-list.haskell',
regex: '\\[\\]' },
{ token: 'keyword.other.haskell',
regex: '\\bmodule\\b',
regex: 'module',
push:
[ { token: 'keyword.other.haskell', regex: '\\bwhere\\b', next: 'pop' },
[ { token: 'keyword.other.haskell', regex: 'where', next: 'pop' },
{ include: '#module_name' },
{ include: '#module_exports' },
{ token: 'invalid', regex: '[a-z]+' },

View File

@ -98,7 +98,7 @@ oop.inherits(Mode, TextMode);
var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
worker.attachToDocument(session.getDocument());
worker.on("annotate", function(results) {
worker.on("jslint", function(results) {
session.setAnnotations(results.data);
});

File diff suppressed because it is too large Load Diff

View File

@ -116,10 +116,12 @@ oop.inherits(JavaScriptWorker, Mirror);
this.onUpdate = function() {
var value = this.doc.getValue();
value = value.replace(/^#!.*\n/, "\n");
if (!value)
return this.sender.emit("annotate", []);
if (!value) {
this.sender.emit("jslint", []);
return;
}
var errors = [];
// jshint reports many false errors
// report them as error only if code is actually invalid
var maxErrorLevel = this.isValidJS(value) ? "warning" : "error";
@ -177,7 +179,7 @@ oop.inherits(JavaScriptWorker, Mirror);
}
// console.log("lint time: " + (new Date() - start));
this.sender.emit("annotate", errors);
this.sender.emit("jslint", errors);
};
}).call(JavaScriptWorker.prototype);

View File

@ -74,11 +74,11 @@ oop.inherits(Mode, TextMode);
var worker = new WorkerClient(["ace"], "ace/mode/json_worker", "JsonWorker");
worker.attachToDocument(session.getDocument());
worker.on("annotate", function(e) {
session.setAnnotations(e.data);
worker.on("error", function(e) {
session.setAnnotations([e.data]);
});
worker.on("terminate", function() {
worker.on("ok", function() {
session.clearAnnotations();
});

View File

@ -46,20 +46,21 @@ oop.inherits(JsonWorker, Mirror);
this.onUpdate = function() {
var value = this.doc.getValue();
var errors = [];
try {
if (value)
parse(value);
} catch (e) {
var pos = this.doc.indexToPosition(e.at-1);
errors.push({
this.sender.emit("error", {
row: pos.row,
column: pos.column,
text: e.message,
type: "error"
});
return;
}
this.sender.emit("annotate", errors);
this.sender.emit("ok");
};
}).call(JsonWorker.prototype);

View File

@ -58,7 +58,7 @@ module.exports = {
worker.setValue("{}");
worker.deferredUpdate.call();
assert.equal(this.sender.events[0][1].length, 0);
assert.equal(this.sender.events[0][0], "ok");
},
"test check for syntax error": function() {
@ -71,12 +71,11 @@ module.exports = {
worker.deferredUpdate.call();
var event = this.sender.events[0];
assert.equal(event[0], "annotate");
assert.equal(event[1].length, 1);
assert.equal(event[1][0].type, "error");
assert.equal(event[1][0].text, "Bad string");
assert.equal(event[1][0].row, 1);
assert.equal(event[1][0].column, 0);
assert.equal(event[0], "error");
assert.equal(event[1].type, "error");
assert.equal(event[1].text, "Bad string");
assert.equal(event[1].row, 1);
assert.equal(event[1].column, 0);
},
@ -86,11 +85,11 @@ module.exports = {
worker.deferredUpdate.call();
var event = this.sender.events[0];
assert.equal(event[0], "annotate");
assert.equal(event[1][0].type, "error");
assert.equal(event[1][0].text, "Unexpected 'x'");
assert.equal(event[1][0].row, 0);
assert.equal(event[1][0].column, 0);
assert.equal(event[0], "error");
assert.equal(event[1].type, "error");
assert.equal(event[1].text, "Unexpected 'x'");
assert.equal(event[1].row, 0);
assert.equal(event[1].column, 0);
}
};

View File

@ -19,7 +19,7 @@ var LatexHighlightRules = function() {
}, {
// A label
token : ["keyword","lparen", "variable.parameter", "rparen"],
regex : "(\\\\(?:label|v?ref|cite(?:[^{]*)))(?:({)([^}]*)(}))?"
regex : "(\\\\label)(?:({)([^}]*)(}))?"
}, {
// A block
token : ["storage.type", "lparen", "variable.parameter", "rparen"],

View File

@ -52,7 +52,8 @@ define(function(require, exports, module){
}(require('../mode/text').Mode));
keywordend = '(?![$\\w]|-[A-Za-z]|\\s*:(?![:=]))';
stringfill = {
defaultToken: 'string'
token: 'string',
regex: '.+'
};
LiveScriptMode.Rules = {
start: [
@ -145,7 +146,7 @@ define(function(require, exports, module){
next: 'key'
}, {
token: 'keyword.operator',
regex: '[\\^!|&%+\\-]+'
regex: '\\S+'
}, {
token: 'text',
regex: '\\s+'
@ -163,7 +164,8 @@ define(function(require, exports, module){
token: 'comment.regex',
regex: '\\s+(?:#.*)?'
}, {
defaultToken: 'string.regex'
token: 'string.regex',
regex: '\\S+'
}
],
key: [
@ -176,7 +178,7 @@ define(function(require, exports, module){
next: 'start'
}, {
token: 'text',
regex: '',
regex: '.',
next: 'start'
}
],
@ -186,7 +188,8 @@ define(function(require, exports, module){
regex: '.*?\\*/',
next: 'start'
}, {
defaultToken: 'comment.doc'
token: 'comment.doc',
regex: '.+'
}
],
qdoc: [

View File

@ -148,11 +148,11 @@ oop.inherits(Mode, TextMode);
var worker = new WorkerClient(["ace"], "ace/mode/lua_worker", "Worker");
worker.attachToDocument(session.getDocument());
worker.on("annotate", function(e) {
session.setAnnotations(e.data);
worker.on("error", function(e) {
session.setAnnotations([e.data]);
});
worker.on("terminate", function() {
worker.on("ok", function(e) {
session.clearAnnotations();
});

View File

@ -46,23 +46,24 @@ oop.inherits(Worker, Mirror);
this.onUpdate = function() {
var value = this.doc.getValue();
var errors = [];
// var t=Date.now()
// var t=Date.now()
try {
luaparse.parse(value);
} catch(e) {
if (e instanceof SyntaxError) {
errors.push({
row: e.line - 1,
column: e.column,
text: e.message,
type: "error"
});
this.sender.emit("error", {
row: e.line - 1,
column: e.column,
text: e.message,
type: "error"
});
}
// console.log( t-Date.now())
return;
}
// console.log( t-Date.now())
this.sender.emit("annotate", errors);
// console.log( t-Date.now())
this.sender.emit("ok");
};
}).call(Worker.prototype);

View File

@ -1,84 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2014, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextMode = require("./text").Mode;
var MaskHighlightRules = require("./mask_highlight_rules").MaskHighlightRules;
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
var CssBehaviour = require("./behaviour/css").CssBehaviour;
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() {
this.HighlightRules = MaskHighlightRules;
this.$outdent = new MatchingBraceOutdent();
this.$behaviour = new CssBehaviour();
this.foldingRules = new CStyleFoldMode();
};
oop.inherits(Mode, TextMode);
(function() {
this.lineCommentStart = "//";
this.blockComment = {start: "/*", end: "*/"};
this.getNextLineIndent = function(state, line, tab) {
var indent = this.$getIndent(line);
// ignore braces in comments
var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
if (tokens.length && tokens[tokens.length-1].type == "comment") {
return indent;
}
var match = line.match(/^.*\{\s*$/);
if (match) {
indent += tab;
}
return indent;
};
this.checkOutdent = function(state, line, input) {
return this.$outdent.checkOutdent(line, input);
};
this.autoOutdent = function(state, doc, row) {
this.$outdent.autoOutdent(doc, row);
};
this.$id = "ace/mode/mask";
}).call(Mode.prototype);
exports.Mode = Mode;
});

View File

@ -1,309 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2014, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
"use strict";
exports.MaskHighlightRules = MaskHighlightRules;
var oop = require("../lib/oop");
var lang = require("../lib/lang");
var TextRules = require("./text_highlight_rules").TextHighlightRules;
var JSRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
var CssRules = require("./css_highlight_rules").CssHighlightRules;
var MDRules = require("./markdown_highlight_rules").MarkdownHighlightRules;
var HTMLRules = require("./html_highlight_rules").HtmlHighlightRules;
var token_TAG = "keyword.support.constant.language",
token_COMPO = "support.function.markup.bold",
token_KEYWORD = "keyword",
token_LANG = "constant.language",
token_UTIL = "keyword.control.markup.italic",
token_ATTR = "support.variable.class",
token_PUNKT = "keyword.operator",
token_ITALIC = "markup.italic",
token_BOLD = "markup.bold",
token_LPARE = "paren.lparen",
token_RPARE = "paren.rparen";
var const_FUNCTIONS,
const_KEYWORDS,
const_CONST,
const_TAGS;
(function(){
const_FUNCTIONS = lang.arrayToMap(
("log").split("|")
);
const_CONST = lang.arrayToMap(
(":dualbind|:bind|:import|slot|event|style|html|markdown|md").split("|")
);
const_KEYWORDS = lang.arrayToMap(
("debugger|define|var|if|each|for|of|else|switch|case|with|visible|+if|+each|+for|+switch|+with|+visible|include|import").split("|")
);
const_TAGS = lang.arrayToMap(
("a|abbr|acronym|address|applet|area|article|aside|audio|b|base|basefont|bdo|" +
"big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|" +
"command|datalist|dd|del|details|dfn|dir|div|dl|dt|em|embed|fieldset|" +
"figcaption|figure|font|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|" +
"header|hgroup|hr|html|i|iframe|img|input|ins|keygen|kbd|label|legend|li|" +
"link|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|" +
"option|output|p|param|pre|progress|q|rp|rt|ruby|s|samp|script|section|select|" +
"small|source|span|strike|strong|style|sub|summary|sup|table|tbody|td|" +
"textarea|tfoot|th|thead|time|title|tr|tt|u|ul|var|video|wbr|xmp").split("|")
);
}());
function MaskHighlightRules () {
this.$rules = {
"start" : [
Token("comment", "\\/\\/.*$"),
Token("comment", "\\/\\*", [
Token("comment", ".*?\\*\\/", "start"),
Token("comment", ".+")
]),
Blocks.string("'''"),
Blocks.string('"""'),
Blocks.string('"'),
Blocks.string("'"),
Blocks.syntax(/(markdown|md)\b/, "md-multiline", "multiline"),
Blocks.syntax(/html\b/, "html-multiline", "multiline"),
Blocks.syntax(/(slot|event)\b/, "js-block", "block"),
Blocks.syntax(/style\b/, "css-block", "block"),
Blocks.syntax(/var\b/, "js-statement", "attr"),
Blocks.tag(),
Token(token_LPARE, "[[({>]"),
Token(token_RPARE, "[\\])};]", "start"),
{
caseInsensitive: true
}
]
};
var rules = this;
addJavaScript("interpolation", /\]/, token_RPARE + "." + token_ITALIC);
addJavaScript("statement", /\)|}|;/);
addJavaScript("block", /\}/);
addCss();
addMarkdown();
addHtml();
function addJavaScript(name, escape, closeType) {
var prfx = "js-" + name + "-",
rootTokens = name === "block" ? ["start"] : ["start", "no_regex"];
add(
JSRules
, prfx
, escape
, rootTokens
, closeType
);
}
function addCss() {
add(CssRules, "css-block-", /\}/);
}
function addMarkdown() {
add(MDRules, "md-multiline-", /("""|''')/, []);
}
function addHtml() {
add(HTMLRules, "html-multiline-", /("""|''')/);
}
function add(Rules, strPrfx, rgxEnd, rootTokens, closeType) {
var next = "pop";
var tokens = rootTokens || [ "start" ];
if (tokens.length === 0) {
tokens = null;
}
if (/block|multiline/.test(strPrfx)) {
next = strPrfx + "end";
rules.$rules[next] = [
Token("empty", "", "start")
];
}
rules.embedRules(
Rules
, strPrfx
, [ Token(closeType || token_RPARE, rgxEnd, next) ]
, tokens
, tokens == null ? true : false
);
}
this.normalizeRules();
}
oop.inherits(MaskHighlightRules, TextRules);
var Blocks = {
string: function(str, next){
var token = Token(
"string.start"
, str
, [
Token(token_LPARE + "." + token_ITALIC, /~\[/, Blocks.interpolation()),
Token("string.end", str, "pop"),
{
defaultToken: "string"
}
]
, next
);
if (str.length === 1){
var escaped = Token("string.escape", "\\\\" + str);
token.push.unshift(escaped);
}
return token;
},
interpolation: function(){
return [
Token(token_UTIL, /\s*\w*\s*:/),
"js-interpolation-start"
];
},
tagHead: function (rgx) {
return Token(token_ATTR, rgx, [
Token(token_ATTR, /[\w\-_]+/),
Token(token_LPARE + "." + token_ITALIC, /~\[/, Blocks.interpolation()),
Blocks.goUp()
]);
},
tag: function () {
return {
token: 'tag',
onMatch : function(value) {
if (void 0 !== const_KEYWORDS[value])
return token_KEYWORD;
if (void 0 !== const_CONST[value])
return token_LANG;
if (void 0 !== const_FUNCTIONS[value])
return "support.function";
if (void 0 !== const_TAGS[value.toLowerCase()])
return token_TAG;
return token_COMPO;
},
regex : /([@\w\-_:+]+)|((^|\s)(?=\s*(\.|#)))/,
push: [
Blocks.tagHead(/\./) ,
Blocks.tagHead(/\#/) ,
Blocks.expression(),
Blocks.attribute(),
Token(token_LPARE, /[;>{]/, "pop")
]
};
},
syntax: function(rgx, next, type){
return {
token: token_LANG,
regex : rgx,
push: ({
"attr": [
next + "-start",
Token(token_PUNKT, /;/, "start")
],
"multiline": [
Blocks.tagHead(/\./) ,
Blocks.tagHead(/\#/) ,
Blocks.attribute(),
Blocks.expression(),
Token(token_LPARE, /[>\{]/),
Token(token_PUNKT, /;/, "start"),
Token(token_LPARE, /'''|"""/, [ next + "-start" ])
],
"block": [
Blocks.tagHead(/\./) ,
Blocks.tagHead(/\#/) ,
Blocks.attribute(),
Blocks.expression(),
Token(token_LPARE, /\{/, [ next + "-start" ])
]
})[type]
};
},
attribute: function(){
return Token(function(value){
return /^x\-/.test(value)
? token_ATTR + "." + token_BOLD
: token_ATTR;
}, /[\w_-]+/, [
Token(token_PUNKT, /\s*=\s*/, [
Blocks.string('"'),
Blocks.string("'"),
Blocks.word(),
Blocks.goUp()
]),
Blocks.goUp()
]);
},
expression: function(){
return Token(token_LPARE, /\(/, [ "js-statement-start" ]);
},
word: function(){
return Token("string", /[\w-_]+/);
},
goUp: function(){
return Token("text", "", "pop");
},
goStart: function(){
return Token("text", "", "start");
}
};
function Token(token, rgx, mix) {
var push, next, onMatch;
if (arguments.length === 4) {
push = mix;
next = arguments[3];
}
else if (typeof mix === "string") {
next = mix;
}
else {
push = mix;
}
if (typeof token === "function") {
onMatch = token;
token = "empty";
}
return {
token: token,
regex: rgx,
push: push,
next: next,
onMatch: onMatch
};
}
});

View File

@ -143,11 +143,11 @@ oop.inherits(Mode, HtmlMode);
if (this.inlinePhp)
worker.call("setOptions", [{inline: true}]);
worker.on("annotate", function(e) {
worker.on("error", function(e) {
session.setAnnotations(e.data);
});
worker.on("terminate", function() {
worker.on("ok", function() {
session.clearAnnotations();
});

View File

@ -69,7 +69,11 @@ oop.inherits(PhpWorker, Mirror);
// console.log("lint time: " + (new Date() - start));
this.sender.emit("annotate", errors);
if (errors.length) {
this.sender.emit("error", errors);
} else {
this.sender.emit("ok");
}
};
}).call(PhpWorker.prototype);

View File

@ -288,9 +288,6 @@ var RubyHighlightRules = function() {
return stack[0];
return currentState;
}
}, {
token : "string.character",
regex : "\\B\\?."
}, {
token : "keyword.operator",
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"

View File

@ -104,7 +104,7 @@ var ShHighlightRules = function() {
token : "keyword.operator"
}, {
stateName: "heredoc",
regex : "(<<-?)(\\s*)(['\"`]?)([\\w\\-]+)(['\"`]?)",
regex : "(<<)(\\s*)(['\"`]?)([\\w\\-]+)(['\"`]?)",
onMatch : function(value, currentState, stack) {
var next = value[2] == '-' ? "indentedHeredoc" : "heredoc";
var tokens = value.split(this.splitRegex);

22
node_modules/ace/lib/ace/mode/xml.js generated vendored
View File

@ -37,12 +37,11 @@ var TextMode = require("./text").Mode;
var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
var XmlFoldMode = require("./folding/xml").FoldMode;
var WorkerClient = require("../worker/worker_client").WorkerClient;
var Mode = function() {
this.HighlightRules = XmlHighlightRules;
this.$behaviour = new XmlBehaviour();
this.foldingRules = new XmlFoldMode();
this.HighlightRules = XmlHighlightRules;
this.$behaviour = new XmlBehaviour();
this.foldingRules = new XmlFoldMode();
};
oop.inherits(Mode, TextMode);
@ -53,21 +52,6 @@ oop.inherits(Mode, TextMode);
this.blockComment = {start: "<!--", end: "-->"};
this.createWorker = function(session) {
var worker = new WorkerClient(["ace"], "ace/mode/xml_worker", "Worker");
worker.attachToDocument(session.getDocument());
worker.on("error", function(e) {
session.setAnnotations(e.data);
});
worker.on("terminate", function() {
session.clearAnnotations();
});
return worker;
};
this.$id = "ace/mode/xml";
}).call(Mode.prototype);

View File

@ -1,260 +0,0 @@
define(function(require, exports, module) {
'use strict';
var XMLReader = require('./sax'),
DOMImplementation = require('./dom');
function DOMParser(options){
this.options = options ||{locator:{}};
}
DOMParser.prototype.parseFromString = function(source,mimeType){
var options = this.options;
var sax = new XMLReader();
var domBuilder = options.domBuilder || new DOMHandler();//contentHandler and LexicalHandler
var errorHandler = options.errorHandler;
var locator = options.locator;
var defaultNSMap = options.xmlns||{};
var entityMap = {'lt':'<','gt':'>','amp':'&','quot':'"','apos':"'"}
if(locator){
domBuilder.setDocumentLocator(locator)
}
sax.errorHandler = buildErrorHandler(errorHandler,domBuilder,locator);
sax.domBuilder = options.domBuilder || domBuilder;
if(/\/x?html?$/.test(mimeType)){
entityMap.nbsp = '\xa0';
entityMap.copy = '\xa9';
defaultNSMap['']= 'http://www.w3.org/1999/xhtml';
}
if(source){
sax.parse(source,defaultNSMap,entityMap);
}else{
sax.errorHandler.error("invalid document source");
}
return domBuilder.document;
}
function buildErrorHandler(errorImpl,domBuilder,locator){
if(!errorImpl){
if(domBuilder instanceof DOMHandler){
return domBuilder;
}
errorImpl = domBuilder ;
}
var errorHandler = {}
var isCallback = errorImpl instanceof Function;
locator = locator||{}
function build(key){
var fn = errorImpl[key];
if(!fn){
if(isCallback){
fn = errorImpl.length == 2?function(msg){errorImpl(key,msg)}:errorImpl;
}else{
var i=arguments.length;
while(--i){
if(fn = errorImpl[arguments[i]]){
break;
}
}
}
}
errorHandler[key] = fn && function(msg){
fn(msg+_locator(locator), msg, locator);
}||function(){};
}
build('warning','warn');
build('error','warn','warning');
build('fatalError','warn','warning','error');
return errorHandler;
}
/**
* +ContentHandler+ErrorHandler
* +LexicalHandler+EntityResolver2
* -DeclHandler-DTDHandler
*
* DefaultHandler:EntityResolver, DTDHandler, ContentHandler, ErrorHandler
* DefaultHandler2:DefaultHandler,LexicalHandler, DeclHandler, EntityResolver2
* @link http://www.saxproject.org/apidoc/org/xml/sax/helpers/DefaultHandler.html
*/
function DOMHandler() {
this.cdata = false;
}
function position(locator,node){
node.lineNumber = locator.lineNumber;
node.columnNumber = locator.columnNumber;
}
/**
* @see org.xml.sax.ContentHandler#startDocument
* @link http://www.saxproject.org/apidoc/org/xml/sax/ContentHandler.html
*/
DOMHandler.prototype = {
startDocument : function() {
this.document = new DOMImplementation().createDocument(null, null, null);
if (this.locator) {
this.document.documentURI = this.locator.systemId;
}
},
startElement:function(namespaceURI, localName, qName, attrs) {
var doc = this.document;
var el = doc.createElementNS(namespaceURI, qName||localName);
var len = attrs.length;
appendElement(this, el);
this.currentElement = el;
this.locator && position(this.locator,el)
for (var i = 0 ; i < len; i++) {
var namespaceURI = attrs.getURI(i);
var value = attrs.getValue(i);
var qName = attrs.getQName(i);
var attr = doc.createAttributeNS(namespaceURI, qName);
if( attr.getOffset){
position(attr.getOffset(1),attr)
}
attr.value = attr.nodeValue = value;
el.setAttributeNode(attr)
}
},
endElement:function(namespaceURI, localName, qName) {
var current = this.currentElement
var tagName = current.tagName;
this.currentElement = current.parentNode;
},
startPrefixMapping:function(prefix, uri) {
},
endPrefixMapping:function(prefix) {
},
processingInstruction:function(target, data) {
var ins = this.document.createProcessingInstruction(target, data);
this.locator && position(this.locator,ins)
appendElement(this, ins);
},
ignorableWhitespace:function(ch, start, length) {
},
characters:function(chars, start, length) {
chars = _toString.apply(this,arguments)
//console.log(chars)
if(this.currentElement && chars){
if (this.cdata) {
var charNode = this.document.createCDATASection(chars);
this.currentElement.appendChild(charNode);
} else {
var charNode = this.document.createTextNode(chars);
this.currentElement.appendChild(charNode);
}
this.locator && position(this.locator,charNode)
}
},
skippedEntity:function(name) {
},
endDocument:function() {
this.document.normalize();
},
setDocumentLocator:function (locator) {
if(this.locator = locator){// && !('lineNumber' in locator)){
locator.lineNumber = 0;
}
},
//LexicalHandler
comment:function(chars, start, length) {
chars = _toString.apply(this,arguments)
var comm = this.document.createComment(chars);
this.locator && position(this.locator,comm)
appendElement(this, comm);
},
startCDATA:function() {
//used in characters() methods
this.cdata = true;
},
endCDATA:function() {
this.cdata = false;
},
startDTD:function(name, publicId, systemId) {
var impl = this.document.implementation;
if (impl && impl.createDocumentType) {
var dt = impl.createDocumentType(name, publicId, systemId);
this.locator && position(this.locator,dt)
appendElement(this, dt);
}
},
/**
* @see org.xml.sax.ErrorHandler
* @link http://www.saxproject.org/apidoc/org/xml/sax/ErrorHandler.html
*/
warning:function(error) {
console.warn(error,_locator(this.locator));
},
error:function(error) {
console.error(error,_locator(this.locator));
},
fatalError:function(error) {
console.error(error,_locator(this.locator));
throw error;
}
}
function _locator(l){
if(l){
return '\n@'+(l.systemId ||'')+'#[line:'+l.lineNumber+',col:'+l.columnNumber+']'
}
}
function _toString(chars,start,length){
if(typeof chars == 'string'){
return chars.substr(start,length)
}else{//java sax connect width xmldom on rhino(what about: "? && !(chars instanceof String)")
if(chars.length >= start+length || start){
return new java.lang.String(chars,start,length)+'';
}
return chars;
}
}
/*
* @link http://www.saxproject.org/apidoc/org/xml/sax/ext/LexicalHandler.html
* used method of org.xml.sax.ext.LexicalHandler:
* #comment(chars, start, length)
* #startCDATA()
* #endCDATA()
* #startDTD(name, publicId, systemId)
*
*
* IGNORED method of org.xml.sax.ext.LexicalHandler:
* #endDTD()
* #startEntity(name)
* #endEntity(name)
*
*
* @link http://www.saxproject.org/apidoc/org/xml/sax/ext/DeclHandler.html
* IGNORED method of org.xml.sax.ext.DeclHandler
* #attributeDecl(eName, aName, type, mode, value)
* #elementDecl(name, model)
* #externalEntityDecl(name, publicId, systemId)
* #internalEntityDecl(name, value)
* @link http://www.saxproject.org/apidoc/org/xml/sax/ext/EntityResolver2.html
* IGNORED method of org.xml.sax.EntityResolver2
* #resolveEntity(String name,String publicId,String baseURI,String systemId)
* #resolveEntity(publicId, systemId)
* #getExternalSubset(name, baseURI)
* @link http://www.saxproject.org/apidoc/org/xml/sax/DTDHandler.html
* IGNORED method of org.xml.sax.DTDHandler
* #notationDecl(name, publicId, systemId) {};
* #unparsedEntityDecl(name, publicId, systemId, notationName) {};
*/
"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(key){
DOMHandler.prototype[key] = function(){return null}
})
/* Private static helpers treated below as private instance methods, so don't need to add these to the public API; we might use a Relator to also get rid of non-standard public properties */
function appendElement (hander,node) {
if (!hander.currentElement) {
hander.document.appendChild(node);
} else {
hander.currentElement.appendChild(node);
}
}//appendChild and setAttributeNS are preformance key
return {
DOMParser: DOMParser
};
});

File diff suppressed because it is too large Load Diff

View File

@ -1,592 +0,0 @@
define(function(require, exports, module) {
//[4] NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
//[4a] NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]
//[5] Name ::= NameStartChar (NameChar)*
var nameStartChar = /[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]///\u10000-\uEFFFF
var nameChar = new RegExp("[\\-\\.0-9"+nameStartChar.source.slice(1,-1)+"\u00B7\u0300-\u036F\\ux203F-\u2040]");
var tagNamePattern = new RegExp('^'+nameStartChar.source+nameChar.source+'*(?:\:'+nameStartChar.source+nameChar.source+'*)?$');
//var tagNamePattern = /^[a-zA-Z_][\w\-\.]*(?:\:[a-zA-Z_][\w\-\.]*)?$/
//var handlers = 'resolveEntity,getExternalSubset,characters,endDocument,endElement,endPrefixMapping,ignorableWhitespace,processingInstruction,setDocumentLocator,skippedEntity,startDocument,startElement,startPrefixMapping,notationDecl,unparsedEntityDecl,error,fatalError,warning,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,comment,endCDATA,endDTD,endEntity,startCDATA,startDTD,startEntity'.split(',')
//S_TAG, S_ATTR, S_EQ, S_V
//S_ATTR_S, S_E, S_S, S_C
var S_TAG = 0;//tag name offerring
var S_ATTR = 1;//attr name offerring
var S_ATTR_S=2;//attr name end and space offer
var S_EQ = 3;//=space?
var S_V = 4;//attr value(no quot value only)
var S_E = 5;//attr value end and no space(quot end)
var S_S = 6;//(attr value end || tag end ) && (space offer)
var S_C = 7;//closed el<el />
function XMLReader(){
}
XMLReader.prototype = {
parse:function(source,defaultNSMap,entityMap){
var domBuilder = this.domBuilder;
domBuilder.startDocument();
_copy(defaultNSMap ,defaultNSMap = {})
parse(source,defaultNSMap,entityMap,
domBuilder,this.errorHandler);
domBuilder.endDocument();
}
}
function parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){
function fixedFromCharCode(code) {
// String.prototype.fromCharCode does not supports
// > 2 bytes unicode chars directly
if (code > 0xffff) {
code -= 0x10000;
var surrogate1 = 0xd800 + (code >> 10)
, surrogate2 = 0xdc00 + (code & 0x3ff);
return String.fromCharCode(surrogate1, surrogate2);
} else {
return String.fromCharCode(code);
}
}
function entityReplacer(a){
var k = a.slice(1,-1);
if(k in entityMap){
return entityMap[k];
}else if(k.charAt(0) === '#'){
return fixedFromCharCode(parseInt(k.substr(1).replace('x','0x')))
}else{
errorHandler.error('entity not found:'+a);
return a;
}
}
function appendText(end){//has some bugs
var xt = source.substring(start,end).replace(/&#?\w+;/g,entityReplacer);
locator&&position(start);
domBuilder.characters(xt,0,end-start);
start = end
}
function position(start,m){
while(start>=endPos && (m = linePattern.exec(source))){
startPos = m.index;
endPos = startPos + m[0].length;
locator.lineNumber++;
//console.log('line++:',locator,startPos,endPos)
}
locator.columnNumber = start-startPos+1;
}
var startPos = 0;
var endPos = 0;
var linePattern = /.+(?:\r\n?|\n)|.*$/g
var locator = domBuilder.locator;
var parseStack = [{currentNSMap:defaultNSMapCopy}]
var closeMap = {};
var start = 0;
while(true){
var i = source.indexOf('<',start);
if(i<0){
if(!source.substr(start).match(/^\s*$/)){
var doc = domBuilder.document;
var text = doc.createTextNode(source.substr(start));
doc.appendChild(text);
domBuilder.currentElement = text;
}
return;
}
if(i>start){
appendText(i);
}
switch(source.charAt(i+1)){
case '/':
var end = source.indexOf('>',i+3);
var tagName = source.substring(i+2,end);
var config;
if (parseStack.length > 1) {
config = parseStack.pop();
} else {
errorHandler.fatalError("end tag name not found for: "+tagName);
break;
}
var localNSMap = config.localNSMap;
if(config.tagName != tagName){
errorHandler.fatalError("end tag name: " + tagName + " does not match the current start tagName: "+config.tagName );
}
domBuilder.endElement(config.uri,config.localName,tagName);
if(localNSMap){
for(var prefix in localNSMap){
domBuilder.endPrefixMapping(prefix) ;
}
}
end++;
break;
// end elment
case '?':// <?...?>
locator&&position(i);
end = parseInstruction(source,i,domBuilder);
break;
case '!':// <!doctype,<![CDATA,<!--
locator&&position(i);
end = parseDCC(source,i,domBuilder,errorHandler);
break;
default:
try{
locator&&position(i);
var el = new ElementAttributes();
//elStartEnd
var end = parseElementStartPart(source,i,el,entityReplacer,errorHandler);
var len = el.length;
//position fixed
if(len && locator){
var backup = copyLocator(locator,{});
for(var i = 0;i<len;i++){
var a = el[i];
position(a.offset);
a.offset = copyLocator(locator,{});
}
copyLocator(backup,locator);
}
if(!el.closed && fixSelfClosed(source,end,el.tagName,closeMap)){
el.closed = true;
if(!entityMap.nbsp){
errorHandler.warning('unclosed xml attribute');
}
}
appendElement(el,domBuilder,parseStack);
if(el.uri === 'http://www.w3.org/1999/xhtml' && !el.closed){
end = parseHtmlSpecialContent(source,end,el.tagName,entityReplacer,domBuilder)
}else{
end++;
}
}catch(e){
errorHandler.error('element parse error: '+e);
end = -1;
}
}
if(end<0){
//TODO: 这里有可能sax回退,有位置错误风险
appendText(i+1);
}else{
start = end;
}
}
}
function copyLocator(f,t){
t.lineNumber = f.lineNumber;
t.columnNumber = f.columnNumber;
return t;
}
/**
* @see #appendElement(source,elStartEnd,el,selfClosed,entityReplacer,domBuilder,parseStack);
* @return end of the elementStartPart(end of elementEndPart for selfClosed el)
*/
function parseElementStartPart(source,start,el,entityReplacer,errorHandler){
var attrName;
var value;
var p = ++start;
var s = S_TAG;//status
while(true){
var c = source.charAt(p);
switch(c){
case '=':
if(s === S_ATTR){//attrName
attrName = source.slice(start,p);
s = S_EQ;
}else if(s === S_ATTR_S){
s = S_EQ;
}else{
//fatalError: equal must after attrName or space after attrName
throw new Error('attribute equal must after attrName');
}
break;
case '\'':
case '"':
if(s === S_EQ){//equal
start = p+1;
p = source.indexOf(c,start)
if(p>0){
value = source.slice(start,p).replace(/&#?\w+;/g,entityReplacer);
el.add(attrName,value,start-1);
s = S_E;
}else{
//fatalError: no end quot match
throw new Error('attribute value no end \''+c+'\' match');
}
}else if(s == S_V){
value = source.slice(start,p).replace(/&#?\w+;/g,entityReplacer);
//console.log(attrName,value,start,p)
el.add(attrName,value,start);
//console.dir(el)
errorHandler.warning('attribute "'+attrName+'" missed start quot('+c+')!!');
start = p+1;
s = S_E
}else{
//fatalError: no equal before
throw new Error('attribute value must after "="');
}
break;
case '/':
switch(s){
case S_TAG:
el.setTagName(source.slice(start,p));
case S_E:
case S_S:
case S_C:
s = S_C;
el.closed = true;
case S_V:
case S_ATTR:
case S_ATTR_S:
break;
//case S_EQ:
default:
throw new Error("attribute invalid close char('/')")
}
break;
case ''://end document
//throw new Error('unexpected end of input')
errorHandler.error('unexpected end of input');
case '>':
switch(s){
case S_TAG:
el.setTagName(source.slice(start,p));
case S_E:
case S_S:
case S_C:
break;//normal
case S_V://Compatible state
case S_ATTR:
value = source.slice(start,p);
if(value.slice(-1) === '/'){
el.closed = true;
value = value.slice(0,-1)
}
case S_ATTR_S:
if(s === S_ATTR_S){
value = attrName;
}
if(s == S_V){
errorHandler.warning('attribute "'+value+'" missed quot(")!!');
el.add(attrName,value.replace(/&#?\w+;/g,entityReplacer),start)
}else{
errorHandler.warning('attribute "'+value+'" missed value!! "'+value+'" instead!!')
el.add(value,value,start)
}
break;
case S_EQ:
throw new Error('attribute value missed!!');
}
// console.log(tagName,tagNamePattern,tagNamePattern.test(tagName))
return p;
/*xml space '\x20' | #x9 | #xD | #xA; */
case '\u0080':
c = ' ';
default:
if(c<= ' '){//space
switch(s){
case S_TAG:
el.setTagName(source.slice(start,p));//tagName
s = S_S;
break;
case S_ATTR:
attrName = source.slice(start,p)
s = S_ATTR_S;
break;
case S_V:
var value = source.slice(start,p).replace(/&#?\w+;/g,entityReplacer);
errorHandler.warning('attribute "'+value+'" missed quot(")!!');
el.add(attrName,value,start)
case S_E:
s = S_S;
break;
//case S_S:
//case S_EQ:
//case S_ATTR_S:
// void();break;
//case S_C:
//ignore warning
}
}else{//not space
//S_TAG, S_ATTR, S_EQ, S_V
//S_ATTR_S, S_E, S_S, S_C
switch(s){
//case S_TAG:void();break;
//case S_ATTR:void();break;
//case S_V:void();break;
case S_ATTR_S:
errorHandler.warning('attribute "'+attrName+'" missed value!! "'+attrName+'" instead!!')
el.add(attrName,attrName,start);
start = p;
s = S_ATTR;
break;
case S_E:
errorHandler.warning('attribute space is required"'+attrName+'"!!')
case S_S:
s = S_ATTR;
start = p;
break;
case S_EQ:
s = S_V;
start = p;
break;
case S_C:
throw new Error("elements closed character '/' and '>' must be connected to");
}
}
}
p++;
}
}
/**
* @return end of the elementStartPart(end of elementEndPart for selfClosed el)
*/
function appendElement(el,domBuilder,parseStack){
var tagName = el.tagName;
var localNSMap = null;
var currentNSMap = parseStack[parseStack.length-1].currentNSMap;
var i = el.length;
while(i--){
var a = el[i];
var qName = a.qName;
var value = a.value;
var nsp = qName.indexOf(':');
if(nsp>0){
var prefix = a.prefix = qName.slice(0,nsp);
var localName = qName.slice(nsp+1);
var nsPrefix = prefix === 'xmlns' && localName
}else{
localName = qName;
prefix = null
nsPrefix = qName === 'xmlns' && ''
}
//can not set prefix,because prefix !== ''
a.localName = localName ;
//prefix == null for no ns prefix attribute
if(nsPrefix !== false){//hack!!
if(localNSMap == null){
localNSMap = {}
//console.log(currentNSMap,0)
_copy(currentNSMap,currentNSMap={})
//console.log(currentNSMap,1)
}
currentNSMap[nsPrefix] = localNSMap[nsPrefix] = value;
a.uri = 'http://www.w3.org/2000/xmlns/'
domBuilder.startPrefixMapping(nsPrefix, value)
}
}
var i = el.length;
while(i--){
a = el[i];
var prefix = a.prefix;
if(prefix){//no prefix attribute has no namespace
if(prefix === 'xml'){
a.uri = 'http://www.w3.org/XML/1998/namespace';
}if(prefix !== 'xmlns'){
a.uri = currentNSMap[prefix]
//{console.log('###'+a.qName,domBuilder.locator.systemId+'',currentNSMap,a.uri)}
}
}
}
var nsp = tagName.indexOf(':');
if(nsp>0){
prefix = el.prefix = tagName.slice(0,nsp);
localName = el.localName = tagName.slice(nsp+1);
}else{
prefix = null;//important!!
localName = el.localName = tagName;
}
//no prefix element has default namespace
var ns = el.uri = currentNSMap[prefix || ''];
domBuilder.startElement(ns,localName,tagName,el);
//endPrefixMapping and startPrefixMapping have not any help for dom builder
//localNSMap = null
if(el.closed){
domBuilder.endElement(ns,localName,tagName);
if(localNSMap){
for(prefix in localNSMap){
domBuilder.endPrefixMapping(prefix)
}
}
}else{
el.currentNSMap = currentNSMap;
el.localNSMap = localNSMap;
parseStack.push(el);
}
}
function parseHtmlSpecialContent(source,elStartEnd,tagName,entityReplacer,domBuilder){
if(/^(?:script|textarea)$/i.test(tagName)){
var elEndStart = source.indexOf('</'+tagName+'>',elStartEnd);
var text = source.substring(elStartEnd+1,elEndStart);
if(/[&<]/.test(text)){
if(/^script$/i.test(tagName)){
//if(!/\]\]>/.test(text)){
//lexHandler.startCDATA();
domBuilder.characters(text,0,text.length);
//lexHandler.endCDATA();
return elEndStart;
//}
}//}else{//text area
text = text.replace(/&#?\w+;/g,entityReplacer);
domBuilder.characters(text,0,text.length);
return elEndStart;
//}
}
}
return elStartEnd+1;
}
function fixSelfClosed(source,elStartEnd,tagName,closeMap){
//if(tagName in closeMap){
var pos = closeMap[tagName];
if(pos == null){
//console.log(tagName)
pos = closeMap[tagName] = source.lastIndexOf('</'+tagName+'>')
}
return pos<elStartEnd;
//}
}
function _copy(source,target){
for(var n in source){target[n] = source[n]}
}
function parseDCC(source,start,domBuilder,errorHandler){//sure start with '<!'
var next= source.charAt(start+2)
switch(next){
case '-':
if(source.charAt(start + 3) === '-'){
var end = source.indexOf('-->',start+4);
//append comment source.substring(4,end)//<!--
if(end>start){
domBuilder.comment(source,start+4,end-start-4);
return end+3;
}else{
errorHandler.error("Unclosed comment");
return -1;
}
}else{
//error
return -1;
}
default:
if(source.substr(start+3,6) == 'CDATA['){
var end = source.indexOf(']]>',start+9);
domBuilder.startCDATA();
domBuilder.characters(source,start+9,end-start-9);
domBuilder.endCDATA()
return end+3;
}
//<!DOCTYPE
//startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
var matchs = split(source,start);
var len = matchs.length;
if(len>1 && /!doctype/i.test(matchs[0][0])){
var name = matchs[1][0];
var pubid = len>3 && /^public$/i.test(matchs[2][0]) && matchs[3][0]
var sysid = len>4 && matchs[4][0];
var lastMatch = matchs[len-1]
domBuilder.startDTD(name,pubid && pubid.replace(/^(['"])(.*?)\1$/,'$2'),
sysid && sysid.replace(/^(['"])(.*?)\1$/,'$2'));
domBuilder.endDTD();
return lastMatch.index+lastMatch[0].length
}
}
return -1;
}
function parseInstruction(source,start,domBuilder){
var end = source.indexOf('?>',start);
if(end){
var match = source.substring(start,end).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);
if(match){
var len = match[0].length;
domBuilder.processingInstruction(match[1], match[2]) ;
return end+2;
}else{//error
return -1;
}
}
return -1;
}
/**
* @param source
*/
function ElementAttributes(source){
}
ElementAttributes.prototype = {
setTagName:function(tagName){
if(!tagNamePattern.test(tagName)){
throw new Error('invalid tagName:'+tagName)
}
this.tagName = tagName
},
add:function(qName,value,offset){
if(!tagNamePattern.test(qName)){
throw new Error('invalid attribute:'+qName)
}
this[this.length++] = {qName:qName,value:value,offset:offset}
},
length:0,
getLocalName:function(i){return this[i].localName},
getOffset:function(i){return this[i].offset},
getQName:function(i){return this[i].qName},
getURI:function(i){return this[i].uri},
getValue:function(i){return this[i].value}
// ,getIndex:function(uri, localName)){
// if(localName){
//
// }else{
// var qName = uri
// }
// },
// getValue:function(){return this.getValue(this.getIndex.apply(this,arguments))},
// getType:function(uri,localName){}
// getType:function(i){},
}
function _set_proto_(thiz,parent){
thiz.__proto__ = parent;
return thiz;
}
if(!(_set_proto_({},_set_proto_.prototype) instanceof _set_proto_)){
_set_proto_ = function(thiz,parent){
function p(){};
p.prototype = parent;
p = new p();
for(parent in thiz){
p[parent] = thiz[parent];
}
return p;
}
}
function split(source,start){
var match;
var buf = [];
var reg = /'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;
reg.lastIndex = start;
reg.exec(source);//skip <
while(match = reg.exec(source)){
buf.push(match);
if(match[1])return buf;
}
}
return XMLReader;
});

View File

@ -1,92 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var lang = require("../lib/lang");
var Mirror = require("../worker/mirror").Mirror;
var DOMParser = require("./xml/dom-parser").DOMParser;
var Worker = exports.Worker = function(sender) {
Mirror.call(this, sender);
this.setTimeout(400);
this.context = null;
};
oop.inherits(Worker, Mirror);
(function() {
this.setOptions = function(options) {
this.context = options.context;
};
this.onUpdate = function() {
var value = this.doc.getValue();
if (!value)
return;
var parser = new DOMParser();
var errors = [];
parser.options.errorHandler = {
fatalError: function(fullMsg, errorMsg, locator) {
errors.push({
row: locator.lineNumber,
column: locator.columnNumber,
text: errorMsg,
type: "error"
});
},
error: function(fullMsg, errorMsg, locator) {
errors.push({
row: locator.lineNumber,
column: locator.columnNumber,
text: errorMsg,
type: "error"
});
},
warning: function(fullMsg, errorMsg, locator) {
errors.push({
row: locator.lineNumber,
column: locator.columnNumber,
text: errorMsg,
type: "warning"
});
}
};
parser.parseFromString(value);
this.sender.emit("error", errors);
};
}).call(Worker.prototype);
});

4
node_modules/ace/lib/ace/mode/xquery/modules.js generated vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
define(function(require, exports, module) {
module.exports = (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({
1:[function(require,module,exports){
module.exports = (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({
1:[function(_dereq_,module,exports){
'use strict';
var init = function(that, code, message, pos, type){
@ -43,11 +43,11 @@ exports.StaticWarning = StaticWarning.prototype.constructor = function(code, mes
};
},
{}],
2:[function(require,module,exports){
2:[function(_dereq_,module,exports){
'use strict';
var TreeOps = require('../tree_ops').TreeOps;
var Errors = require('./errors');
var TreeOps = _dereq_('../tree_ops').TreeOps;
var Errors = _dereq_('./errors');
var StaticWarning = Errors.StaticWarning;
//
@ -216,7 +216,7 @@ exports.FunctionCallHandler = function(translator, sctx, node, arity){
*/
},
{"../tree_ops":11,"./errors":1}],
3:[function(require,module,exports){
3:[function(_dereq_,module,exports){
'use strict';
/**
@ -276,17 +276,17 @@ exports.getSchemaBuiltinTypes = function(){
};
},
{}],
4:[function(require,module,exports){
4:[function(_dereq_,module,exports){
exports.StaticContext = function (parent, pos) {
'use strict';
var TreeOps = require('../tree_ops').TreeOps;
var TreeOps = _dereq_('../tree_ops').TreeOps;
var Errors = require('./errors');
var Errors = _dereq_('./errors');
var StaticError = Errors.StaticError;
var StaticWarning = Errors.StaticWarning;
var getSchemaBuiltinTypes = require('./schema_built-in_types').getSchemaBuiltinTypes;
var getSchemaBuiltinTypes = _dereq_('./schema_built-in_types').getSchemaBuiltinTypes;
var emptyPos = { sl:0, sc: 0, el: 0, ec: 0 };
var namespaces = {};
@ -725,17 +725,17 @@ exports.StaticContext = function (parent, pos) {
},
{"../tree_ops":11,"./errors":1,"./schema_built-in_types":3}],
5:[function(require,module,exports){
5:[function(_dereq_,module,exports){
exports.Translator = function(rootStcx, ast){
'use strict';
var Errors = require('./errors');
var Errors = _dereq_('./errors');
var StaticError = Errors.StaticError;
var StaticWarning = Errors.StaticWarning;
var TreeOps = require('../tree_ops').TreeOps;
var StaticContext = require('./static_context').StaticContext;
var Handlers = require('./handlers');
var TreeOps = _dereq_('../tree_ops').TreeOps;
var StaticContext = _dereq_('./static_context').StaticContext;
var Handlers = _dereq_('./handlers');
var get = function(node, path){
var result = [];
@ -1178,7 +1178,7 @@ exports.Translator = function(rootStcx, ast){
pushSctx(node.pos);
quantifiedDecls.push(0);
this.visitChildren(node);
for(var i=1; i <= quantifiedDecls[quantifiedDecls.length - 1]; i++) {
for(var i=1; i <= quantifiedDecls[clauses.length - 1]; i++) {
popSctx(node.pos);
}
quantifiedDecls.pop();
@ -1305,10 +1305,10 @@ exports.Translator = function(rootStcx, ast){
},
{"../tree_ops":11,"./errors":1,"./handlers":2,"./static_context":4}],
6:[function(require,module,exports){
6:[function(_dereq_,module,exports){
'use strict';
var TreeOps = require('../tree_ops').TreeOps;
var TreeOps = _dereq_('../tree_ops').TreeOps;
var ID_REGEX = /[a-zA-Z_0-9\$]/;
@ -1561,7 +1561,7 @@ exports.complete = function(source, ast, rootSctx, pos){
},
{"../tree_ops":11}],
7:[function(require,module,exports){
7:[function(_dereq_,module,exports){
exports.StyleChecker = function (ast, source) {
'use strict';
@ -1690,7 +1690,7 @@ exports.StyleChecker = function (ast, source) {
};
},
{}],
8:[function(require,module,exports){
8:[function(_dereq_,module,exports){
exports.JSONParseTreeHandler = function (code) {
'use strict';
@ -1856,7 +1856,7 @@ exports.JSONParseTreeHandler = function (code) {
};
},
{}],
9:[function(require,module,exports){
9:[function(_dereq_,module,exports){
// This file was generated on Thu Jul 24, 2014 15:00 (UTC+01) by REx v5.30 which is Copyright (c) 1979-2014 by Gunther Rademacher <grd@gmx.net>
// REx command line: JSONiqParser.ebnf -ll 2 -backtrack -tree -javascript -a xqlint
@ -44140,7 +44140,7 @@ JSONiqParser.TOKEN =
},
{}],
10:[function(require,module,exports){
10:[function(_dereq_,module,exports){
// This file was generated on Thu Jul 24, 2014 15:00 (UTC+01) by REx v5.30 which is Copyright (c) 1979-2014 by Gunther Rademacher <grd@gmx.net>
// REx command line: XQueryParser.ebnf -ll 2 -backtrack -tree -javascript -a xqlint
@ -78693,7 +78693,7 @@ XQueryParser.TOKEN =
},
{}],
11:[function(require,module,exports){
11:[function(_dereq_,module,exports){
'use strict';
exports.TreeOps = {
@ -78786,18 +78786,18 @@ exports.TreeOps = {
};
},
{}],
12:[function(require,module,exports){
12:[function(_dereq_,module,exports){
'use strict';
var JSONiqParser = require('./parsers/JSONiqParser').JSONiqParser;
var XQueryParser = require('./parsers/XQueryParser').XQueryParser;
var JSONParseTreeHandler = require('./parsers/JSONParseTreeHandler').JSONParseTreeHandler;
var Translator = require('./compiler/translator').Translator;
var StyleChecker = require('./formatter/style_checker').StyleChecker;
var completer = require('../lib/completion/completer');
var JSONiqParser = _dereq_('./parsers/JSONiqParser').JSONiqParser;
var XQueryParser = _dereq_('./parsers/XQueryParser').XQueryParser;
var JSONParseTreeHandler = _dereq_('./parsers/JSONParseTreeHandler').JSONParseTreeHandler;
var Translator = _dereq_('./compiler/translator').Translator;
var StyleChecker = _dereq_('./formatter/style_checker').StyleChecker;
var completer = _dereq_('../lib/completion/completer');
var createStaticContext = exports.createStaticContext = function(){
var StaticContext = require('./compiler/static_context').StaticContext;
var StaticContext = _dereq_('./compiler/static_context').StaticContext;
return new StaticContext();
};
@ -78906,6 +78906,7 @@ exports.XQLint = function (source, opts) {
};
},
{"../lib/completion/completer":6,"./compiler/static_context":4,"./compiler/translator":5,"./formatter/style_checker":7,"./parsers/JSONParseTreeHandler":8,"./parsers/JSONiqParser":9,"./parsers/XQueryParser":10}]},{},[12])(12)
{"../lib/completion/completer":6,"./compiler/static_context":4,"./compiler/translator":5,"./formatter/style_checker":7,"./parsers/JSONParseTreeHandler":8,"./parsers/JSONiqParser":9,"./parsers/XQueryParser":10}]},{},[12])
(12)
});

View File

@ -35,6 +35,7 @@ var oop = require("../lib/oop");
var Mirror = require("../worker/mirror").Mirror;
var XQLintLib = require("./xquery/xqlint");
var XQLint = XQLintLib.XQLint;
var Modules = require("./xquery/modules").Modules;
var getModuleResolverFromModules = function(modules){
return function(uri){
@ -67,8 +68,8 @@ var XQueryWorker = exports.XQueryWorker = function(sender) {
this.opts = {
styleCheck: false
};
//this.availableModuleNamespaces = Object.keys(Modules);
//this.moduleResolver; = getModuleResolverFromModules(Modules);
this.availableModuleNamespaces = Object.keys(Modules);
this.moduleResolver = getModuleResolverFromModules(Modules);
var that = this;
this.sender.on("complete", function(e){
@ -104,7 +105,7 @@ oop.inherits(XQueryWorker, Mirror);
}
var opts = {
styleCheck: this.styleCheck,
staticContext: sctx
staticContext: sctx,
};
this.xqlint = new XQLint(value, opts);
this.sender.emit("markers", this.xqlint.getMarkers());

View File

@ -3,7 +3,7 @@
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
@ -14,7 +14,7 @@
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@ -46,15 +46,13 @@ var MouseHandler = function(editor) {
new DefaultHandlers(this);
new DefaultGutterHandler(this);
new DragdropHandler(this);
var focusEditor = function(e) {
// because we have to call event.preventDefault() any window on ie and iframes
// on other browsers do not get focus, so we have to call window.focus() here
if (!document.hasFocus || !document.hasFocus())
window.focus();
// if (!editor.isFocused() && editor.textInput)
// editor.textInput.moveToMouse(e);
editor.focus();
};
var mouseTarget = editor.renderer.getMouseEventTarget();
event.addListener(mouseTarget, "click", this.onMouseEvent.bind(this, "click"));
event.addListener(mouseTarget, "mousemove", this.onMouseMove.bind(this, "mousemove"));
@ -64,7 +62,7 @@ var MouseHandler = function(editor) {
event.addMultiMouseDownListener(editor.renderer.scrollBarH.inner, [400, 300, 250], this, "onMouseEvent");
if (useragent.isIE) {
event.addListener(editor.renderer.scrollBarV.element, "mousedown", focusEditor);
event.addListener(editor.renderer.scrollBarH.element, "mousedown", focusEditor);
event.addListener(editor.renderer.scrollBarH.element, "mousemove", focusEditor);
}
}
event.addMouseWheelListener(editor.container, this.onMouseWheel.bind(this, "mousewheel"));
@ -85,12 +83,12 @@ var MouseHandler = function(editor) {
editor.on("mousemove", function(e){
if (_self.state || _self.$dragDelay || !_self.$dragEnabled)
return;
var character = editor.renderer.screenToTextCoordinates(e.x, e.y);
var char = editor.renderer.screenToTextCoordinates(e.x, e.y);
var range = editor.session.selection.getRange();
var renderer = editor.renderer;
if (!range.isEmpty() && range.insideStart(character.row, character.column)) {
if (!range.isEmpty() && range.insideStart(char.row, char.column)) {
renderer.setCursorStyle("default");
} else {
renderer.setCursorStyle("");

View File

@ -552,8 +552,7 @@ var Editor = require("./editor").Editor;
var pos = anchor == this.multiSelect.anchor
? range.cursor == range.start ? range.end : range.start
: range.cursor;
if (pos.row != anchor.row
|| this.session.$clipPositionToDocument(pos.row, pos.column).column != anchor.column)
if (!isSamePoint(this.session.$clipPositionToDocument(pos.row, pos.column), anchor))
this.multiSelect.toSingleRange(this.multiSelect.toOrientedRange());
}
};

View File

@ -213,7 +213,7 @@ module.exports = {
editor = new Editor(new MockRenderer());
editor.setValue("l1\nl2\nl3\nl4", -1);
setSelection(editor, [[0,2],[1,2],[2,2],[3,2]]);
setSelection(editor, [[1,2],[2,2],[3,2]]);
exec("copylinesdown");
assert.equal(editor.getValue(),"l1\nl1\nl2\nl2\nl3\nl3\nl4\nl4");
@ -229,15 +229,15 @@ module.exports = {
exec("copylinesdown");
exec("copylinesup");
assert.equal(editor.getValue(),"l1\nl1\nl1\nl1\nl2\nl2\nl2\nl2\nl3\nl3\nl3\nl3\nl4\nl4\nl4\nl4");
testSelection(editor, [[2,2],[2,0,2,1],[6,0,6,1],[10,0,10,1],[14,0,14,1]]);
testSelection(editor, [[10,2],[2,2],[2,0,2,1],[6,0,6,1],[10,0,10,1],[14,0,14,1]]);
exec("movelinesdown", 12);
assert.equal(editor.getValue(),"l1\nl1\nl1\nl2\nl2\nl2\nl3\nl3\nl3\nl4\nl4\nl4\nl1\nl2\nl3\nl4");
testSelection(editor, [[12,2],[12,0,12,1],[13,0,13,1],[14,0,14,1],[15,0,15,1]]);
testSelection(editor, [[14,2],[12,2],[12,0,12,1],[13,0,13,1],[14,0,14,1],[15,0,15,1]]);
exec("movelinesup", 12);
assert.equal(editor.getValue(),"l1\nl2\nl3\nl4\nl1\nl1\nl1\nl2\nl2\nl2\nl3\nl3\nl3\nl4\nl4\nl4");
testSelection(editor, [[0,2],[0,0,0,1],[1,0,1,1],[2,0,2,1],[3,0,3,1]]);
testSelection(editor, [[2,2],[0,2],[0,0,0,1],[1,0,1,1],[2,0,2,1],[3,0,3,1]]);
},
"test multiselect fromJSON/toJSON": function() {

View File

@ -43,7 +43,6 @@ var assert = require("./test/assertions");
var JavaScriptMode = require("./mode/javascript").Mode;
var PlaceHolder = require("./placeholder").PlaceHolder;
var UndoManager = require("./undomanager").UndoManager;
require("./multi_select")
module.exports = {
@ -90,7 +89,7 @@ module.exports = {
editor.insert('v');
assert.equal(session.doc.getValue(), "var v$a = 10;\nconsole.log(v$a, v$a);");
next();
}, 20);
}, 10);
},
"test: detaching placeholder" : function() {

View File

@ -1,7 +0,0 @@
define(function(require, exports, module) {
"use strict";
exports.snippetText = require("../requirejs/text!./abc.snippets");
exports.scope = "abc";
});

View File

@ -1,31 +0,0 @@
snippet zupfnoter.print
%%%%hn.print {"startpos": ${1:pos_y}, "t":"${2:title}", "v":[${3:voices}], "s":[[${4:syncvoices}1,2]], "f":[${5:flowlines}], "sf":[${6:subflowlines}], "j":[${7:jumplines}]}
snippet zupfnoter.note
%%%%hn.note {"pos": [${1:pos_x},${2:pos_y}], "text": "${3:text}", "style": "${4:style}"}
snippet zupfnoter.annotation
%%%%hn.annotation {"id": "${1:id}", "pos": [${2:pos}], "text": "${3:text}"}
snippet zupfnoter.lyrics
%%%%hn.lyrics {"pos": [${1:x_pos},${2:y_pos}]}
snippet zupfnoter.legend
%%%%hn.legend {"pos": [${1:x_pos},${2:y_pos}]}
snippet zupfnoter.target
"^:${1:target}"
snippet zupfnoter.goto
"^@${1:target}@${2:distance}"
snippet zupfnoter.annotationref
"^#${1:target}"
snippet zupfnoter.annotation
"^!${1:text}@${2:x_offset},${3:y_offset}"

Some files were not shown because too many files have changed in this diff Show More