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

Smarty Completions Update #3779

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/udl/skel/Smarty/pylib/lang_smarty.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"rdelim",
"section",
"sectionelse",
"string",
"strip",
"textformat"
]

Expand Down Expand Up @@ -235,13 +235,17 @@ def async_eval_at_trg(self, buf, trg, ctlr):
_re_assign_var = re.compile(r'\{assign\s+(?:[^}]+\s)?name=[\'"](?P<variable>\w+)[\'"]', re.M|re.U)
# Variable in form {... assign="..."
_re_assign_attr_var = re.compile(r'\{[^}]+\sassign=[\'"](?P<variable>\w+)[\'"]', re.M|re.U)
# Variable in form {foreach item="..."
_re_foreach_item_var = re.compile(r'\{foreach\s+(?:[^}]+\s)?item=[\'"](?P<variable>\w+)[\'"]', re.M|re.U)
# Variable in form {foreach key="..."
_re_foreach_key_var = re.compile(r'\{foreach\s+(?:[^}]+\s)?key=[\'"](?P<variable>\w+)[\'"]', re.M|re.U)
# Any variable used
_re_used_var = re.compile(r'{[^}]*(?P<variable>\$\w+)', re.M|re.U)
def _get_smarty_vars(self, buf):
""" Get Smarty variables from this file """
smarty_vars = ["$smarty"]
# Add any vars assigned in this file
for regex in [self._re_assign_var, self._re_assign_attr_var]:
for regex in [self._re_assign_var, self._re_assign_attr_var, self._re_foreach_item_var, self._re_foreach_key_var]:
for match in re.finditer(regex, buf.accessor.text):
groups = match.groupdict()
this_var = "$" + groups['variable']
Expand Down