Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-completion in the "Narration" field in the Add popup #1535

Open
hyperglue opened this issue Jan 11, 2023 · 3 comments · May be fixed by #1888
Open

Auto-completion in the "Narration" field in the Add popup #1535

hyperglue opened this issue Jan 11, 2023 · 3 comments · May be fixed by #1888

Comments

@hyperglue
Copy link

hyperglue commented Jan 11, 2023

Hi,
is it possible to display suggestions when typing in the "Narration" field in the Add popup?
Like start typing #sal and it'd suggest #salary tag.
Auto-completion works on any other field but that one.
It'd especially useful on mobile, for now I'm forced to use the editor which can be problematic.

@hyperglue hyperglue changed the title Auto-completion in the "Narration" field in Add popup Auto-completion in the "Narration" field in the Add popup Jan 11, 2023
@yagebu
Copy link
Member

yagebu commented Jan 15, 2023

This would indeed be a useful feature. A PR would be very welcome :)

@hyperglue
Copy link
Author

I don't have too much experience with JavaScript or its frameworks, but I dug a little into a code yesterday and got two ideas for now:

  • modifying the "Narration" field to support auto-completion, I tried quickly changing this line from <input to <AutocompleteInput and it worked but only once, when clicking on the field. I'm not really sure what to modify to make auto-completion pop-up show every time when typing # or ^,
  • remove the "Narration" field and put the CodeMirror editor in its place, a little like it's done here. The editor already implements all we need, so I think it should work.

What do you think would be the best approach to implement this feature?

@yagebu
Copy link
Member

yagebu commented May 24, 2023

Since the CodeMirror editor expects to handle a full Beancount file, it wouldn't work for just the narration part without some further modifications. So the first option is probably more feasible - using <AutocompleteInput /> should work.

Maybe the input for the filter input in the top right could serve as an example as it supports completion of tags and links and also handles replacing the right part of the input on completion selection using the valueExtractor and valueSelector functions (https://github.com/beancount/fava/blob/main/frontend/src/sidebar/FilterForm.svelte).

dtrai2 added a commit to dtrai2/fava that referenced this issue May 28, 2024
@dtrai2 dtrai2 linked a pull request Nov 1, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants