Closed fflorent closed 11 years ago
See this comment: https://github.com/marijnh/tern_for_vim/commit/21912a8954428721d9655f66f7134c30343b147d#commitcomment-3170219
FWIW (I don't know python and I am far from being an expert of vim), here is a patch I made:
diff --git a/autoload/tern.vim b/autoload/tern.vim index 37da607..354e315 100644 --- a/autoload/tern.vim +++ b/autoload/tern.vim @@ -14,7 +14,8 @@ def tern_displayError(err): def tern_makeRequest(port, doc): try: - req = urllib2.urlopen("http://localhost:" + str(port) + "/", json.dumps(doc), 1) + timeout = tern_serverTimeout() + req = urllib2.urlopen("http://localhost:" + str(port) + "/", json.dumps(doc), timeout) return json.loads(req.read()) except urllib2.HTTPError, error: tern_displayError(error.read()) @@ -346,6 +347,11 @@ def tern_rename(newName): tern_sendBuffer(external) vim.command("call setloclist(0," + json.dumps(changes) + ") | lopen") +def tern_serverTimeout(): + timeout = int(vim.eval("g:ternServerTimeout")) + if timeout: return timeout + return 1 + endpy if !exists('g:tern#command')
Florent
See attached patch. I used tern_request_timeout as variable name, and float instead int, since the Python interface takes any floating point number of seconds.
tern_request_timeout
float
int
See this comment: https://github.com/marijnh/tern_for_vim/commit/21912a8954428721d9655f66f7134c30343b147d#commitcomment-3170219
FWIW (I don't know python and I am far from being an expert of vim), here is a patch I made:
Florent