-function! s:bracket_find(brs_allowable, line, offset)
- let possible = []
- for bracket in a:brs_allowable
- let found = stridx(a:line, bracket, a:offset)
- if found != -1 | let possible += [found] | endif
+# Python function call splitter
+# Maintainer: Sergey Matveev <stargrave@stargrave.org>
+# License: GNU General Public License version 3 of the License or later
+#
+# This plugin splits Python function call on several lines.
+#
+# def foobar(self, foo: str, bar: Some[thing, too]) -> None:
+# to
+# def foobar(
+# self,
+# foo: str,
+# bar: Some[thing, too],
+# ) -> None:
+#
+# foo(bar, baz)[0]
+# to
+# foo(
+# bar,
+# baz,
+# )[0]
+#
+# You can un-split it using :Undefsplit command on the line where
+# splitting starts.
+#
+# :Defsplit has optional argument specifying how many opening round
+# parenthesis must be skipped.
+# :Defsplit 1 on foo(baz(baz(...))) produces
+# foo(baz(
+# baz(...),
+# ))
+#
+# Also there is :Brsplit command behaving similarly, but it splits other
+# types of brackets: "{}", "[]".
+
+def BracketFind(brsAllowable: list<string>, line: string, offset: number): number
+ var possible: list<number>
+ var found: number
+ for bracket in brsAllowable
+ found = stridx(line, bracket, offset)
+ if found != -1 | possible += [found] | endif