mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Add 'value' to trigger formula autocomplete
Summary: API signature for autocomplete updated to add column ID, which is necessary for exposing correct types for 'value'. Test Plan: Unit tests. Reviewers: alexmojaki Reviewed By: alexmojaki Subscribers: jarek, alexmojaki Differential Revision: https://phab.getgrist.com/D2896
This commit is contained in:
@@ -1281,7 +1281,7 @@ class Engine(object):
|
||||
if not self._compute_stack:
|
||||
self._bring_lookups_up_to_date(doc_action)
|
||||
|
||||
def autocomplete(self, txt, table_id):
|
||||
def autocomplete(self, txt, table_id, column_id):
|
||||
"""
|
||||
Return a list of suggested completions of the python fragment supplied.
|
||||
"""
|
||||
@@ -1295,6 +1295,13 @@ class Engine(object):
|
||||
context = self._autocomplete_context.get_context()
|
||||
context['rec'] = table.sample_record
|
||||
|
||||
# Remove values from the context that need to be recomputed.
|
||||
context.pop('value', None)
|
||||
|
||||
column = table.get_column(column_id) if table.has_column(column_id) else None
|
||||
if column and not column.is_formula():
|
||||
context['value'] = column.sample_value()
|
||||
|
||||
completer = rlcompleter.Completer(context)
|
||||
results = []
|
||||
at = 0
|
||||
|
||||
Reference in New Issue
Block a user