# Helpers in the code editor

**URL:** <https://talk.observablehq.com/t/helpers-in-the-code-editor/690>\
**Category:** Feedback\
**Created:** [April 28, 2018, 9:31pm UTC](https://talk.observablehq.com/t/helpers-in-the-code-editor/690 "2018-04-28T21:31:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![severo](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/severo/32/786_2.png) [@severo](https://talk.observablehq.com/u/severo)\
**Post date:** [April 28, 2018, 9:31pm UTC](https://talk.observablehq.com/t/helpers-in-the-code-editor/690/1 "2018-04-28T21:31:03Z")

</div>

Some improvements that would help a lot while editing cells code:

- recognize when a function from an imported library is correctly written, and highlight it like it’s currently done for keywords and notebook variables (for example with the same dark blue color): e.g. highlight `d3.geoAlbersUsa`
- when typing, propose autocomplete: `d3.geoAlbe` → `d3.geoAlbersUsa`
- link to the documentation, e.g. `d3.geoAlbersUsa` → [GitHub - d3/d3-geo: Geographic projections, spherical shapes and spherical trigonometry.](https://github.com/d3/d3-geo#geoAlbersUsa) (I don’t know how to include this nicely in the current interface)

---

<div class="post-metadata">

**Author:** ![jjimenez](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/jjimenez/32/237_2.png) [@jjimenez](https://talk.observablehq.com/u/jjimenez)\
**Post date:** [April 29, 2018, 5:15pm UTC](https://talk.observablehq.com/t/helpers-in-the-code-editor/690/2 "2018-04-29T17:15:51Z")

</div>

take a look at [New Feature: Code Completion (Shipped!)](https://talk.observablehq.com/t/new-feature-code-completion-shipped/385) for code completion. Does this cover your use case?

The link to documentation is an interesting idea, but finding the documentation for a required / imported library wouldn’t be trivial.

---

<div class="post-metadata">

**Author:** ![mbostock](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/mbostock/32/9_2.png) [@mbostock](https://talk.observablehq.com/u/mbostock)\
**Post date:** [April 29, 2018, 8:19pm UTC](https://talk.observablehq.com/t/helpers-in-the-code-editor/690/3 "2018-04-29T20:19:11Z")

</div>

Autocomplete for properties on imported (required) libraries should work already if you hit Tab, as shown here:

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/observablehq/original/1X/317dd6f259ff0ca8c2fa9d1190688bb9469b3986.png)

Syntax highlighting for object properties is an interesting idea. I think it might be tricky since objects can be dynamic, though, so we’d need to recompute syntax highlighting whenever referenced values change. (In contrast, autocomplete does an instantaneous sample of the defined properties when you hit Tab.)

I’d love integrated documentation. Tom commented on that here:

> [@Optional function arguments / cell annotations](https://talk.observablehq.com/t/optional-function-arguments-cell-annotations/509/2):
>
> Hi Kelley! Cool, so: Optional function arguments: yep! We originally included them in our function formatting, because we were essentially stringifying functions and being very liberal about what we showed, but the current formatting is much more conservative - it parses argument names and bails out if we see a =. The rationale there is that optional function arguments can have anything as a value - even a gigantic JavaScript expression - and we still need to figure out where to draw the lin…
