Skip to content

Formula Editor #75

Closed
Closed

Description

@wojciechczerniak

Description

⚠️ WIP

Editor with syntax highlighting. Can use #2 for providing more details for the end user.

Features

Reference cells via click during formula editing
Visible traceability of cells within a formula
Formula auto-complete
See a cell’s underlying formula without having to click into it (formula bar)

Links:

https://sap.github.io/chevrotain/docs/guide/syntactic_content_assist.html#introduction

Activity

  1. added
    Feature
    on Dec 10, 2019
  2. marek-baranowski commented on Jan 25, 2020

    @marek-baranowski

    Hi @wojciechczerniak,

    FYI. I'm an early adopter :)

    How is it going with this feature? Have you made the choice about the underlying rich text editor?

    I'm trying to implement it too. So far I was using https://microsoft.github.io/monaco-editor/index.html because of its great support for autocomplete (GSheets-like, with arguments list and documentation). However, it's very heavy and requires a service worker, which feels like an overkill for this use case.

    I will probably choose one of those:

    Wondering about your solution, could you share your experience?

    Best,
    Marek

  3. wojciechczerniak commented on Jan 25, 2020

    @wojciechczerniak
    ContributorAuthor

    Hi!

    Great to have you here.

    We're not going to use any of them. As you noticed, those packages are heavy and overkill for this use case. Those editors have their own AST parsers and lexer, IMO totally useless for us. Everything we need is already in HyperFormula engine. Chevrotain already provides us with AST and we will use it for syntax highlighting and suggesting docs that are based on our meta-data format. When we add point&click, named expression, expanded docs and i18n features to the mix I don't think any of them would meet our needs and the more advanced features of stand-alone code editors will stand in our way.

  4. marek-baranowski commented on Jan 25, 2020

    @marek-baranowski

    Thx for answer.

    My gut feeling is that it might be hard to accomplish with input / textarea, like syntax highlighting for instance. The best fit would be div with contenteditable=true, but from what I remember it's very buggy and those rich text editors try to make it usable :) maybe this could work: https://github.com/lovasoa/react-contenteditable

  5. wojciechczerniak commented on Jan 25, 2020

    @wojciechczerniak
    ContributorAuthor

    You're right, some work will be needed to do it right. But IMO working around assumptions made by those full flagged editors would take the same effort or more.

    Thanks for the link. Will look into it

  6. marek-baranowski commented on Jan 26, 2020

    @marek-baranowski

    In the meantime I've discovered a couple other libs that deal with contenteditable and are pretty lightweight (~2KB), like http://jakiestfu.github.io/Medium.js/docs or https://yabwe.github.io/medium-editor.

    I ended up with Codemirror 6, its parser and autocomplete are great, lezer outputs pretty accurate tokens based on the input and with high tolerance to syntax errors. 40KB gzipped but I can live with that for now :)

  7. marek-baranowski commented on Jan 26, 2020

    @marek-baranowski

    I will share the code once it's complete.

  8. added
    Verified
    on Jun 23, 2020
  9. wojciechczerniak commented on Jul 13, 2020

    @wojciechczerniak
    ContributorAuthor

    Just cleaning up. Formula Editor is a UI component. It doesn't belong here. Will be created separately, outside of the HF repo.

    Ref: handsontable/handsontable#6466

  10. removed this from the Next milestone on Sep 10, 2020
  11. BrianHung commented on Jun 25, 2023

    @BrianHung
    Contributor

    @marek-baranowski Hi, would it be possible to share the autocomplete code? I'm about to also use codemirror 6 for a hyperformula cell editor with autocomplete support.

  12. scrapeable commented on Dec 20, 2023

    @scrapeable

    Does this feature exist?

  13. sequba commented on Dec 21, 2023

    @sequba
    Contributor

    Hi, @scrapeable!

    As @wojciechczerniak said:

    Formula Editor is a UI component. It doesn't belong here.

    HyperFormula is a headless library without a GUI. It's the responsibility of the UI app to provide a way for the end user to enter formulas.

  14. added a commit that references this issue on Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureVerified

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions