mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
(core) For autocomplete suggestions in formulas, add links to suggestions we have documentation for.
Summary: This is a hacky solution that unfortunately relies on internal workings of ACE autocomplete popups. I don't see a less hacky one if we stick with ACE autocomplete. Test Plan: Added a test case for links to test/nbrowser/Formulas.ts Reviewers: paulfitz Reviewed By: paulfitz Differential Revision: https://phab.getgrist.com/D2610
This commit is contained in:
parent
45d2d5f897
commit
9d6637458e
@ -78,6 +78,8 @@ class AutocompleteContext(object):
|
|||||||
if completion:
|
if completion:
|
||||||
# For methods (eg ".lookupOne"), use the original result as funcname (eg "Foo.lookupOne").
|
# For methods (eg ".lookupOne"), use the original result as funcname (eg "Foo.lookupOne").
|
||||||
if dot >= 0:
|
if dot >= 0:
|
||||||
|
varname = funcname[:dot]
|
||||||
|
funcname = self._lowercase.get(varname, varname) + key
|
||||||
completion = completion._replace(funcname=funcname)
|
completion = completion._replace(funcname=funcname)
|
||||||
return tuple(completion)
|
return tuple(completion)
|
||||||
|
|
||||||
|
@ -111,6 +111,11 @@ class TestCompletion(test_engine.EngineTestCase):
|
|||||||
('Address.lookupRecords', '(colName=<value>, ...)', True),
|
('Address.lookupRecords', '(colName=<value>, ...)', True),
|
||||||
])
|
])
|
||||||
|
|
||||||
|
self.assertEqual(self.engine.autocomplete("address.look", "Students"), [
|
||||||
|
('Address.lookupOne', '(colName=<value>, ...)', True),
|
||||||
|
('Address.lookupRecords', '(colName=<value>, ...)', True),
|
||||||
|
])
|
||||||
|
|
||||||
def test_suggest_column_type_methods(self):
|
def test_suggest_column_type_methods(self):
|
||||||
# Should treat columns as correct types.
|
# Should treat columns as correct types.
|
||||||
self.assertGreaterEqual(set(self.engine.autocomplete("$firstName.", "Students")),
|
self.assertGreaterEqual(set(self.engine.autocomplete("$firstName.", "Students")),
|
||||||
|
Loading…
Reference in New Issue
Block a user