()
| 124 | "text": tern_bufferSlice(vim.current.buffer, 0, len(vim.current.buffer))} |
| 125 | |
| 126 | def tern_bufferFragment(): |
| 127 | curRow, curCol = vim.current.window.cursor |
| 128 | line = curRow - 1 |
| 129 | buf = vim.current.buffer |
| 130 | minIndent = None |
| 131 | start = None |
| 132 | |
| 133 | for i in range(max(0, line - 50), line): |
| 134 | if not re.match(".*\\bfunction\\b", buf[i]): continue |
| 135 | indent = len(re.match("^\\s*", buf[i]).group(0)) |
| 136 | if minIndent is None or indent <= minIndent: |
| 137 | minIndent = indent |
| 138 | start = i |
| 139 | |
| 140 | if start is None: start = max(0, line - 50) |
| 141 | end = min(len(buf) - 1, line + 20) |
| 142 | return {"type": "part", |
| 143 | "name": tern_relativeFile(), |
| 144 | "text": tern_bufferSlice(buf, start, end), |
| 145 | "offsetLines": start} |
| 146 | |
| 147 | def tern_runCommand(query, pos=None, fragments=True): |
| 148 | if isinstance(query, str): query = {"type": query} |
no test coverage detected