MCPcopy
hub / github.com/SirVer/ultisnips / _update

Method _update

pythonx/UltiSnips/text_objects/python_code.py:265–292  ·  view source on GitHub ↗
(self, done, buf)

Source from the content-addressed store, hash-verified

263 super().__init__(parent, token.start, token.end, token.initial_text)
264
265 def _update(self, done, buf):
266 path = vim_helper.eval('expand("%")') or ""
267 ct = self.current_text
268 self._locals.update(
269 {
270 "t": _Tabs(self._parent),
271 "fn": Path(path).name,
272 "path": path,
273 "cur": ct,
274 "res": ct,
275 "snip": self._snip,
276 }
277 )
278 self._snip._reset(ct)
279
280 for code, compiled_code in zip(self._codes, self._compiled_codes, strict=True):
281 try:
282 exec(compiled_code, self._locals)
283 except Exception as exception:
284 exception.snippet_code = code
285 raise
286
287 rv = str(self._snip.rv if self._snip._rv_changed else self._locals["res"])
288
289 if ct != rv:
290 self.overwrite(buf, rv)
291 return False
292 return True

Callers

nothing calls this directly

Calls 3

_TabsClass · 0.85
_resetMethod · 0.80
overwriteMethod · 0.80

Tested by

no test coverage detected