MCPcopy
hub / github.com/ternjs/tern_for_vim / tern_refs

Function tern_refs

script/tern.py:311–326  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

309 return os.path.join(tern_projectDir(), path)
310
311def tern_refs():
312 data = tern_runCommand("refs", fragments=False)
313 if data is None: return
314
315 refs = []
316 for ref in data["refs"]:
317 lnum = ref["start"]["line"] + 1
318 col = ref["start"]["ch"] + 1
319 filename = tern_projectFilePath(ref["file"])
320 name = data["name"]
321 text = vim.eval("getbufline('" + filename + "'," + str(lnum) + ")")
322 refs.append({"lnum": lnum,
323 "col": col,
324 "filename": filename,
325 "text": name + " (file not loaded)" if len(text)==0 else text[0]})
326 vim.command("call setloclist(0," + json.dumps(refs) + ") | lopen")
327
328# Copied here because Python 2.6 and lower don't have it built in, and
329# python 3.0 and higher don't support old-style cmp= args to the sort

Callers

nothing calls this directly

Calls 2

tern_runCommandFunction · 0.85
tern_projectFilePathFunction · 0.85

Tested by

no test coverage detected