Skip to content

Commit

Permalink
Add autocompletion support (source-academy#501)
Browse files Browse the repository at this point in the history
* Add loose parser

* Add documentation

- Add python script to parse jsdoc html to json
- Export documentation
- Add styles for autocompletion

* Finish autocomplete (#3)

* Add traversal call to index
* Finish autocomplete
* Use upstream loose parser
* Minor refactor
Co-authored-by: Cara Leong <[email protected]>

* Regenerate docs

* Add tests for autocomplete feature (#4)

* Fix empty array bug

* Add simple tests

* Fix for loop declaration bug

* More tests

* Fixed lint errors

Co-authored-by: Shaowei Chen <[email protected]>

* Add documentation for concurrent source 3

Co-authored-by: Cara Leong <[email protected]>
Co-authored-by: martin-henz <[email protected]>
  • Loading branch information
3 people authored Apr 7, 2020
1 parent 8ce53ab commit 9cf2ef4
Show file tree
Hide file tree
Showing 24 changed files with 3,927 additions and 127 deletions.
8 changes: 5 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,13 @@ in the library sources. The libraries are in repository ``cadet-frontend``, whic
is assumed to be located in ``../cadet-frontend``, from the root of this repo.
The command
``yarn jsdoc``
makes the documentation available in folder
makes the documentation available in folder and updates the jsons for documentation displayed in the `cadet-frontend`.
``doc/jsdoc/libraries/``.
The script `jsdoc` provides an installation command to deploy the documentation via `scp` on a server:
``yarn jsdoc install``

To update documentation displayed in autocomplete on the frontend, `js-slang` version needs to be bumped and `cadet-frontend` needs to be updated to use the new version. To add additional source versions or external libraries, the `targets` specified in `updateAutocompleteDocs.py` as well as the exported object in `src/editors/ace/docTooltip` need to be updated.

Testing
-------

Expand All @@ -99,7 +101,7 @@ Error messages

To enable verbose messages, have the statement ``"enable verbose";`` as the first line of your code.

There are two main kinds of error messages: those that occur at runtime and those that occur at parse time.
There are two main kinds of error messages: those that occur at runtime and those that occur at parse time.
The first can be found in interpreter-errors.ts, while the second can be found in rules/.

Each error subclass will have explain() and elaborate(). Displaying the error will always cause the first to be
Expand All @@ -120,5 +122,5 @@ A common issue when developing modifications to js-slang is how to test it using
$ cd js-slang
$ yarn build
$ cp -r dist ../cadet-frontend/node_modules/js-slang
Then start frontend and the new js-slang will be used.
8 changes: 6 additions & 2 deletions docs/jsdoc/templates/template/tmpl/container.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,9 @@
<h3 class="subsection-title">Constants</h3> <!-- changed from >Members< by MH -->

<?js members.forEach(function(p) { ?>
<?js= self.partial('members.tmpl', p) ?>
<div class="constant-entry">
<?js= self.partial('members.tmpl', p) ?>
</div>
<?js }); ?>
<?js } ?>

Expand All @@ -156,7 +158,9 @@
<h3 class="subsection-title">Functions</h3> <!-- changed by MH on 1/7/2019, was Methods -->

<?js methods.forEach(function(m) { ?>
<?js= self.partial('method.tmpl', m) ?>
<div class="function-entry">
<?js= self.partial('method.tmpl', m) ?>
</div>
<?js }); ?>
<?js } ?>

Expand Down
14 changes: 10 additions & 4 deletions docs/source/CONCURRENCY/global.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ <h2></h2>
<h3 class="subsection-title">Functions</h3> <!-- changed by MH on 1/7/2019, was Methods -->



<div class="function-entry">




Expand Down Expand Up @@ -260,8 +261,10 @@ <h5>Returns:</h5>



</div>


<div class="function-entry">




Expand Down Expand Up @@ -420,8 +423,10 @@ <h5>Returns:</h5>



</div>


<div class="function-entry">




Expand Down Expand Up @@ -578,6 +583,7 @@ <h5>Returns:</h5>



</div>



Expand All @@ -602,7 +608,7 @@ <h3>Predeclared names</h3><ul><li><a href="global.html#clear">clear</a></li><li>
<footer>
generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.5.5</a> from
<a href="https://github.com/source-academy/js-slang">Github repository js-slang</a>
on Sun Mar 29 2020 14:25:23 GMT+0800 (Singapore Standard Time)
on Tue Apr 07 2020 00:43:01 GMT+0800 (Singapore Standard Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion docs/source/CONCURRENCY/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ <h3>Predeclared names</h3><ul><li><a href="global.html#clear">clear</a></li><li>
<footer>
generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.5.5</a> from
<a href="https://github.com/source-academy/js-slang">Github repository js-slang</a>
on Sun Mar 29 2020 14:25:23 GMT+0800 (Singapore Standard Time)
on Tue Apr 07 2020 00:43:01 GMT+0800 (Singapore Standard Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
Loading

0 comments on commit 9cf2ef4

Please sign in to comment.