GithubHelp home page GithubHelp logo

tern_for_vim's Introduction

ternjs

tern_for_vim's People

Contributors

actionshrimp avatar arian avatar bausmeier avatar castor4bit avatar danihodovic avatar dmitrivereshchagin avatar egalpin avatar fvictorio avatar gilligan avatar harish2704 avatar hushicai avatar jackfranklin avatar jason0x43 avatar keith avatar maple-leaf avatar marekkalnik avatar marijnh avatar othree avatar rhysd avatar sebnyberg avatar sethyuan avatar sloria avatar snj33v avatar svvac avatar tony avatar wsdjeg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tern_for_vim's Issues

tern errors on exit - doesn't seem to kill node procs?

Sometimes when I quit vim I get (on the command line from where vim was run)

Exception TypeError: "'NoneType' object is not callable" in <bound method Project.__del__ of <__main__.Project object at 0x101018c50>> ignored

And if I look at my process manager I see node processes still running, even after I ctrl-c from that message.

Also, sometimes when I quit vim (with :qa, the whole shebang just hangs and I have to force quit it.

Add doc/tags to .gitignore

You may add doc/tags to .gitignore to avoid git status change (if tern_for_vim plugin is installed as submodule in a git configuration) when the doc tags are created, for instance, with the command :helptags ~/vimfiles/bundle/tern_for_vim/doc/.

can tern lookup symbols across different files

It looks like that tern can't jump to the symbol definition correctly across different files. for example, i have below two files, on line 2 of foo.js, I can't jump to bar1 definition which is bar.js file. but on line 3 of foo.js, i can correctly jump to foo2 definition. Is this the restriction of Tern? Thanks.
foo.js
function foo1(){
var a = bar1(); //line 2
foo2();//line3
}
function foo2(){
console.log('foo 2 running');
}
and
bar.js
function bar1(){
return 10;
}

delays when switching windows

I don't have a reproducible case yet - posting as a reminder: sometimes switching windows is delayed. Last time I saw this, I suspected the logic in tern_sendBufferIfDirty, because it kept happening for freshly opened, unmodified source.

'tuple' object has no attribute 'open'

Tern and tfv have been terrific, but without explanation, Tern now seems unable to find refs and definitions any more, instead printing the error message above. (Which appears to
be pythony in nature.)

I can't seem to get it working again. Any suggestion?

Warning: 'as' will become a reserved keyword in Python 2.6

With the current master and the latest installation of Vim from MacPorts, following is thrown:

Error detected while processing /Users/ain/.vim/bundle/tern_for_vim/autoload/tern.vim: line 405:
:185: Warning: 'as' will become a reserved keyword in Python 2.6
File "", line 185
except Exception as e:
^
SyntaxError: invalid syntax

error appears when :Terndoc runs

Hi
I installed this plugin ( also node.js and npm) with no problem,but when i run :Ternxxx command, error ocurrs like this:
ternerr

is there any misconfigration?

Crashes when opening .js file

Dutifully installed the plugin in Vundle, then ran the npm install. I was able to get the server up and running without a problem using the binary. Every time I open or save a file with a .js suffix, vim literally implodes:

"app/scripts/app.js" 13L, 260CTraceback (most recent call last):
File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 563, in
main()
File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 545, in main
known_paths = addusersitepackages(known_paths)
File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 278, in addusersitepackages
user_site = getusersitepackages()
File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 253, in getusersitepackages
user_base = getuserbase() # this will also set USER_BASE
File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 243, in getuserbase
USER_BASE = get_config_var('userbase')
File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", line 472, in get_config_var
return get_config_vars().get(name)
File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", line 405, in get_config_vars
import re
File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/re.py", line 105, in
import sre_compile
File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sre_compile.py", line 14, in
import sre_parse
File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sre_parse.py", line 17, in
from sre_constants import *
File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sre_constants.py", line 18, in
from _sre import MAXREPEAT
ImportError: cannot import name MAXREPEAT
wizardwerdna:b2js werdna

cmp_to_key error on opening js file

hi
i`m starting using ternjs for my view side javascript (for jqgrid) and
i need to use ternjs for vim.

so i`ve installed tern for vim but it give me a error like below when i open a js file

/root/.vim/bundle/tern_for_vim/autoload/tern.vim error
line 380
Traceback(most recent call last):
File "", line 3, in
ImportError : cannot import name cmp_to_key

and code assist doesnt work neither.
function tern#Compelete error
line 2 :
Traceback(most recent call last)

first i`ve installed nodejs and nvm.
and npm install ... and added 4 lines below to ~/.vimrc file

autocmd FileType javascript set omnifunc=tern#Complete
execute pathogen#infect()
syntax on
filetype plugin indent on

and added json file below to directory like this

WebContent/
.tern-project
js/
jqgrid.js <-- the file i opened with vim

{
"libs": [
"browser",
"jquery"
],
"plugins": {
"node": {}
}
}

what did i do something wrong??

please let me know. i really need this.

and if there is a easy guide of ternjs installation for new ppl like me
that will be greate thoguh

Give a way to configure the timeout in the .vimrc file

See this comment: 21912a8#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

.tern-project is not loaded?

My project layout is similar to Tern project.

myproject/.tern-project
myproject/lib

{
    "libs": [
    ],

    "plugins": {
        "node": {}
    }
}

If I load a js file in lib, omni complete doesn't work; if I move .tern-project to lib, it works nice.

Any hint?

TernRename Fails with non-ascii token

When there are non-ascii tokens(for example in string) in code, tern fails.

screen shot 2014-04-10 at 13 43 47

For example, in the code above, when the variable non_ascii is renamed, Python echoes error like:

  File "<string>", line 1, in <module>
  File "<string>", line 397, in tern_rename
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/
lib/python2.7/json/__init__.py", line 243, in dumps
    return _default_encoder.encode(obj)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/
lib/python2.7/json/encoder.py", line 207, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/
lib/python2.7/json/encoder.py", line 270, in iterencode
    return _iterencode(o, 0)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xe3 in position 7: invalid c
ontinuation byte

I think this may be caused by Python's support for Unicode text :(

Even worse is that sometimes no error is echoed but some other tokens are eaten silently (and perhaps perniciously)!
Like this:
Before:
screen shot 2014-04-10 at 13 49 59
After:
screen shot 2014-04-10 at 13 50 13

I understand it is undesirable to mix non-ascii in code, but it usually is ineluctable...

LookupArgumentHints() doesn't show in insert mode

I'm having problems getting the arguments hints to show up during insert mode. I set g:tern_show_argument_hints to "on_hold" and it works just fine in normal mode but I see no output on the command line during insert mode.

As a test if tern#LookupArgumentHints() is in fact called during insert mode I added an 'echomsg "test"' just before the 'python tern_lookupType()' call in tern.vim and I do see the output when I check :messages.

I also changed the 'echo' inside tern_echoWrap into an 'echomsg' for testing and again it shows up in :messages also during insert mode but i just don't see it in the command line.

I am a bit lost. Can anyone think of a conflicting configuration on my end ? Does this actually work for others at all ?

TernRename fails

var f = function () {
    var pointless = 10;
    pointless += 1;
    return pointless;
};
f();

Trying to rename pointless (via :TernRename with cursor on pointless) yields :

Traceback (most recent call last):
File "", line 1, in
File "", line 343, in tern_rename
IndexError: no such buffer

.tern-port file

Hi!

I have seen task about it in sublime ternjs/tern_for_sublime#5
but I can not find how I can pass "tern_arguments": ["--no-port-file"] in vim that did not create .tern-port file.

Thanks!

urlopen error: cannot find node server

Tern_for_vim works finely before. But now I find completion does not work. And every time I call TernDef, error messages are echoed in cmd area. "<urlopen error [Errno 2] No such file or directory>"
BTW, I didn't change any configuration. and it suddenly broke down :(

Maybe this is caused by failure to find correct server path. Tern_for_vim create new a node process every time I press key in insert mode or call tern method.

ps axu | grep node
28859 0.0 0.0 0 0 pts/1 Z+ 11:57 0:00 [node]
30146 0.0 0.0 0 0 pts/1 Z+ 11:58 0:00 [node]
30327 0.0 0.0 0 0 pts/1 Z+ 11:59 0:00 [node]
30335 0.0 0.0 0 0 pts/1 Z+ 11:59 0:00 [node]
30337 0.0 0.0 0 0 pts/1 Z+ 11:59 0:00 [node]
30339 0.0 0.0 0 0 pts/1 Z+ 11:59 0:00 [node]
30370 0.0 0.0 0 0 pts/1 Z+ 11:59 0:00 [node]
30372 0.0 0.0 0 0 pts/1 Z+ 11:59 0:00 [node]
30374 0.0 0.0 0 0 pts/1 Z+ 11:59 0:00 [node]

I have no idea what actually happened here. I try my best to present problem. Hope this will help you.

Valid rename operation fails when executed after session was loaded

I use this session plugin to manage vim sessions. I don't know whether the failure is really the tern plugin or the session plugin. The problem is as follows:

If I edit the test.js file (content below) with vim test.js the TernRename command will work fine. See logs of tern server. No vim error occurs and the variable was renamed.

If I load a session which also has test.js as a buffer loaded, the same operation fails:

new name? kpisssTraceback (most recent call last):
  File "<string>", line 1, in <module>
  File "<string>", line 348, in tern_rename
IndexError: Zeilennummer außerhalb des zulässigen Bereichs
Betätigen Sie die EINGABETASTE oder geben Sie einen Befehl ein

Translated last 2 lines:

IndexError: Line number out of valid range
Hit return key or type command in

See logs of tern server for second run. They look pretty similar.

My test file looks like this:

Ext.define('GRF.lib.chart.AxisChart', {
    extend:'GRF.lib.chart.Chart',
    renderYAxisTicks:function () {
        var precisionCalculator;

        precisionCalculator = this.getPrecisionCalculator();

        var kpi = "foo";
        return kpi;
    }
});

How to debug large projects?

First off, thanks for this tool. This has massive potential.

So I set up a very small test project with only two files and a requirejs module and everything works fine. The commands work, omnicomplete works and when I run the tern server manually with the verbose option, I see a logical request and response returned. The installation worked.

However, when I try to use it in my main projects, which has a handful of files, lots of requirejs modules and 3rdparty libs like AngularJS, every command returns a "timed out" message, omnicomplete fails to match the pattern (even on things defined in the same file) and the tern server only shows the request, not a response (even with a timeout set to 60 seconds)

What are some strategies I can do to debug the issues here?

Autocompletion renderd buffer unusable (Stratch)

I was testing the plugin out the commands were running ok, and I tried the auto completion with the following code:

   it('...', function(){
       var m = new Foobar({ ... });

       expect(m.userId).toEqual('6815841748');
   });

then after the var = m bit I hit o (new line + insert mode) and type m.. It completed to m.userId automatically but the the buffer was converted into a [Scratch] - PRV and I couldn't edit it anymore - kept me giving the E523: Not allowed here.

And in the terminal (I had opened MacVim from there) there was this: Exception TypeError: "'NoneType' object is not callable" in <bound method Project.__del__ of <__main__.Project object at 0x110d22150>> ignored

Using MacVim. With neocomplcache plugin (maybe a conflict?)

Omni complete binding for macosx

I am working on a MacOSX I used the key binding mapped to C-space for calling omni complete for other file types like python. But just doing "inoremap "
doesn't cut it. I have to say inoremap which works. Because apparently pressing ctrl-space in my i-term app puts the null character.

Did you ever hear of this issue before. If yes is doing the above inoremap the best way?

really, really slow

There's about a four second delay after typing before ^n ^p will work, just completing from words in the file. It is not dependent on the size of the project. Happens with one file. Makes completion unusable.

During the delay it displays "-- ^X mode (" etc. After the delay it goes back to "-- INSERT --" and ^n and ^p work.

Are there options that affect this?

Moving through completion list doesn't update description in scratch buffer correctly

When moving up and down in the completion list, the description displayed in the scratch buffer doesn't update correctly.

$ vim --version | head -n 3
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jun  1 2014 10:47:35)
Included patches: 1-307
Compiled by Arch Linux

tern_for_vim@master

Steps to reproduce:

  • In a directory, make sure the following file exists:

.tern-project

{
  "plugins": {
    "node": { }
  }
}
  • Edit a new JavaScript file (say example.js) with Vim
  • Type global. and start omni completion, make sure the selection is on the first item: __dirname (str). Observe the following in the scratch buffer:
string
The name of the directory that the currently executing script resides in.

[Scratch] [Preview]
  • Move the selection one entry down (Tab, C-N, ...), so that it is now on: __filename (str). Observe the following in the scratch buffer (minor issue: are those @ characters supposed to be there?):
string
@                                                                                                   
@                                                                                                   
[Scratch] [Preview]
  • Move the selection down one entry, so that it is now on: clearInterval (fn). Observe the following in the scratch buffer (again those @ characters...):
fn(id: timers.Timer)
@                                                                                                   
@                                                                                                   
[Scratch] [Preview]
  • Move the selection up two items, so that it is again at __dirname (str). Observe the following in the scratch buffer:
string 
@                                                                                                   
@                                                                                                   
[Scratch] [Preview]
  • Note that now the description: The name of the directory that the currently executing script resides in. is missing.
  • Move the selection up once more (this should clear the completion at the curser), then down again, so that it is once again at __dirname (str). Observe that now the full description is shown correctly again in the scratch buffer:
string
The name of the directory that the currently executing script resides in.

[Scratch] [Preview]

not work omni compete.

I install with bundle, and npm install this plugin. But OmniCompleteion(c-x c-o) not work: pattern not found

if i use node_modules/tern/bin/tern --verbose i not have any massages

Getting "JSON parse error: Unexpected token &"

capture

I have installed it on my Mac (OSX Mavericks), and on my Linode (Ubuntu 12.04.3 LTS) and it's working wonderfully but I cannot seem to get it working on my Red Hat Enterprise Linux Server release 6.4 (Santiago).

The repo that works in two out of the three envs is my fork of emile.

Using Vundle to load. I ran npm install in .vim/bundle/tern_for_vim/.

My .vimrc just in case you need it.

Scratch window appears on completion

In an empty directory, editing a new file, doing

a = {foo: 5}
a.<tab>

causes a scratch buffer to open at the top in a vertical split, with contents

number

With vim 7.4, on ubuntu. Happens even when the only plugins are tern_for_vim and YouCompleteMe.

Tern throws a stack trace when jumping to matches in comments

When I do /varName and hit enter, then n, and the match is inside a comment, I see the tern server get unhappy:

Error: No expression at the given position.
    at exports.findQueryExpr (.vim/bundle/tern_for_vim/node_modules/tern/lib/tern.js:577:13)
    at Object.findTypeAt [as run] (.vim/bundle/tern_for_vim/node_modules/tern/lib/tern.js:582:16)
    at .vim/bundle/tern_for_vim/node_modules/tern/lib/tern.js:189:30
    at Object.exports.withContext (.vim/bundle/tern_for_vim/node_modules/tern/lib/infer.js:612:18)
    at .vim/bundle/tern_for_vim/node_modules/tern/lib/tern.js:186:13
    at analyzeAll (.vim/bundle/tern_for_vim/node_modules/tern/lib/tern.js:289:15)
    at doRequest (.vim/bundle/tern_for_vim/node_modules/tern/lib/tern.js:180:5)
    at Object.signal.mixin.request (.vim/bundle/tern_for_vim/node_modules/tern/lib/tern.js:124:7)
    at respond (.vim/bundle/tern_for_vim/node_modules/tern/bin/tern:179:10)
    at IncomingMessage.<anonymous> (.vim/bundle/tern_for_vim/node_modules/tern/bin/tern:145:32)
Response: 400 Error: No expression at the given position.

Errors on any command / startup

Traceback (most recent call last):
File "", line 1, in
File "", line 311, in tern_refs
File "", line 156, in tern_runCommand
File "", line 54, in tern_findServer
File "", line 32, in tern_projectDir
vim.error: invalid expression
Error detected while processing :
E121: Undefined variable: b:ternProjectDir
E15: Invalid expression: b:ternProjectDir

Auto-close the documentation window

It would be really handy if the documentation window would close itself when anything is pressed. It's pretty annoying to type <C-w>w:q every time after you've read the docs.

[Omni complete] Missing autocomplete for `Foo.`

When doing C-X, C-O in insert mode on the string Foo. with the cursor after the ., no types are suggested for types imported via eg the cjs plugins.

. should in this case be treated as show me any available properties, something which works perfectly with locally defined types.

var Foo = require('Foo');
Foo.

By typing out the property name, and executing :TernType, Tern is able to correctly infer the type, so the cjs plugin i working properly.

Any hints as to how to debug this? The plugin we use for loading required modules is close to the Node module, and is successfully resolving and passing back source for each requested module.

Vim 7.4: TypeError on exit

When I exit vim 7.4 I get on stderr this message:

    Exception TypeError: "'NoneType' object is not callable"

It think it is related to #27 issue.

It seems that The tern_killServer function reference does not exist on exit when python destroys all Project instances which are referenced by the tern_projects array.

According to Python __del__ docs (red warning http://docs.python.org/2/reference/datamodel.html#object.__del__ ) to fix the destruction order you need to add underscore to the the global var tern_projects. This way, _tern_projects objects are destroyed before tern_killServer function.

I have made the change locally and it seems to work flawless. Anyway, releasing external resources from del is not recommended because it is not guaranteed that __del__ methods are called for objects that still exist when the interpreter exits.

No definition found when issuing "TernDef" command

Hi All,
I installed this plugin as it's mentioned in the tutorial. (Using Vundle to load,running npm install in .vim/bundle/tern_for_vim/) and below is my .tern-project configuration file. but i got No definition error while running TernDef for a function inside a javascript file. Any ideas? Thanks in advance.
{
"libs": [
"browser",
"jquery",
"ecma5",
"underscore"
],
"plugins": {
"requirejs": {
"baseURL": "./",
"paths": {}
}
}
}

Installation: Error: No compatible version found: tern@'>=0.5.0-'

When trying to install the server on ubuntu I get the error
ERR! Error: When trying to install the server on ubuntu I get the error
ERR! Error: No compatible version found: tern@'>=0.5.0-'
ERR! Valid install targets:
ERR! ["0.1.0","0.2.0","0.3.0","0.4.0"]

full npm-debug file :

info it worked if it ends with ok
verbose cli [ 'node', '/usr/bin/npm', 'install' ]
info using [email protected]
info using [email protected]
verbose config file /home/mike/.npmrc
verbose config file /usr/etc/npmrc
verbose config file /usr/share/npm/npmrc
verbose caching /home/mike/.vim/bundle/tern_for_vim/package.json
verbose loadDefaults [email protected]
verbose readDependencies: using package.json deps
verbose where, deps [ '/home/mike/.vim/bundle/tern_for_vim', [ 'tern' ] ]
verbose from cache /home/mike/.vim/bundle/tern_for_vim/package.json
info preinstall [email protected]
verbose from cache /home/mike/.vim/bundle/tern_for_vim/package.json
verbose readDependencies: using package.json deps
verbose cache add [ 'tern@>=0.5', null ]
silly cache add: name, spec, args [ undefined, 'tern@>=0.5', [ 'tern@>=0.5', null ] ]
verbose parsed url { pathname: 'tern@', path: 'tern@', href: 'tern@' }
silly cache add: name, spec, args [ 'tern', '>=0.5', [ 'tern', '>=0.5' ] ]
verbose parsed url { pathname: '=0.5', path: '=0.5', href: '=0.5' }
verbose addNamed [ 'tern', '>=0.5' ]
verbose addNamed [ null, '>=0.5.0-' ]
silly name, range, hasData [ 'tern', '>=0.5.0-', false ]
verbose raw, before any munging tern
verbose url resolving [ 'https://registry.npmjs.org/', './tern' ]
verbose url resolved https://registry.npmjs.org/tern
verbose etag "4DDUS0EMSN1ZM3J0LD76SJFAY"
http GET https://registry.npmjs.org/tern
silly get cb [ 304, undefined ]
verbose etag tern from cache
silly name, range, hasData 2 [ 'tern', '>=0.5.0-', true ]
silly versions [ 'tern', [ '0.1.0', '0.2.0', '0.3.0', '0.4.0' ] ]
ERR! Error: No compatible version found: tern@'>=0.5.0-'
ERR! Valid install targets:
ERR! ["0.1.0","0.2.0","0.3.0","0.4.0"]
ERR! at installTargetsError (/usr/share/npm/lib/cache.js:488:10)
ERR! at next_ (/usr/share/npm/lib/cache.js:438:17)
ERR! at next (/usr/share/npm/lib/cache.js:415:44)
ERR! at /usr/share/npm/lib/cache.js:408:5
ERR! at saved (/usr/share/npm/lib/utils/npm-registry-client/get.js:147:7)
ERR! at Object.oncomplete (/usr/lib/nodejs/graceful-fs.js:230:7)
ERR! You may report this log at:
ERR! http://bugs.debian.org/npm
ERR! or use
ERR! reportbug --attach /home/mike/.vim/bundle/tern_for_vim/npm-debug.log npm
ERR!
ERR! System Linux 3.5.0-45-generic
ERR! command "node" "/usr/bin/npm" "install"
ERR! cwd /home/mike/.vim/bundle/tern_for_vim
ERR! node -v v0.6.12
ERR! npm -v 1.1.4
ERR! message No compatible version found: tern@'>=0.5.0-'
ERR! message Valid install targets:
ERR! message ["0.1.0","0.2.0","0.3.0","0.4.0"]
verbose exit [ 1, true ]
ERR! Valid install targets:
ERR! ["0.1.0","0.2.0","0.3.0","0.4.0"]

full npm-debug file :

info it worked if it ends with ok
verbose cli [ 'node', '/usr/bin/npm', 'install' ]
info using [email protected]
info using [email protected]
verbose config file /home/mike/.npmrc
verbose config file /usr/etc/npmrc
verbose config file /usr/share/npm/npmrc
verbose caching /home/mike/.vim/bundle/tern_for_vim/package.json
verbose loadDefaults [email protected]
verbose readDependencies: using package.json deps
verbose where, deps [ '/home/mike/.vim/bundle/tern_for_vim', [ 'tern' ] ]
verbose from cache /home/mike/.vim/bundle/tern_for_vim/package.json
info preinstall [email protected]
verbose from cache /home/mike/.vim/bundle/tern_for_vim/package.json
verbose readDependencies: using package.json deps
verbose cache add [ 'tern@>=0.5', null ]
silly cache add: name, spec, args [ undefined, 'tern@>=0.5', [ 'tern@>=0.5', null ] ]
verbose parsed url { pathname: 'tern@', path: 'tern@', href: 'tern@' }
silly cache add: name, spec, args [ 'tern', '>=0.5', [ 'tern', '>=0.5' ] ]
verbose parsed url { pathname: '=0.5', path: '=0.5', href: '=0.5' }
verbose addNamed [ 'tern', '>=0.5' ]
verbose addNamed [ null, '>=0.5.0-' ]
silly name, range, hasData [ 'tern', '>=0.5.0-', false ]
verbose raw, before any munging tern
verbose url resolving [ 'https://registry.npmjs.org/', './tern' ]
verbose url resolved https://registry.npmjs.org/tern
verbose etag "4DDUS0EMSN1ZM3J0LD76SJFAY"
http GET https://registry.npmjs.org/tern
silly get cb [ 304, undefined ]
verbose etag tern from cache
silly name, range, hasData 2 [ 'tern', '>=0.5.0-', true ]
silly versions [ 'tern', [ '0.1.0', '0.2.0', '0.3.0', '0.4.0' ] ]
ERR! Error: No compatible version found: tern@'>=0.5.0-'
ERR! Valid install targets:
ERR! ["0.1.0","0.2.0","0.3.0","0.4.0"]
ERR! at installTargetsError (/usr/share/npm/lib/cache.js:488:10)
ERR! at next_ (/usr/share/npm/lib/cache.js:438:17)
ERR! at next (/usr/share/npm/lib/cache.js:415:44)
ERR! at /usr/share/npm/lib/cache.js:408:5
ERR! at saved (/usr/share/npm/lib/utils/npm-registry-client/get.js:147:7)
ERR! at Object.oncomplete (/usr/lib/nodejs/graceful-fs.js:230:7)
ERR! You may report this log at:
ERR! http://bugs.debian.org/npm
ERR! or use
ERR! reportbug --attach /home/mike/.vim/bundle/tern_for_vim/npm-debug.log npm
ERR!
ERR! System Linux 3.5.0-45-generic
ERR! command "node" "/usr/bin/npm" "install"
ERR! cwd /home/mike/.vim/bundle/tern_for_vim
ERR! node -v v0.6.12
ERR! npm -v 1.1.4
ERR! message No compatible version found: tern@'>=0.5.0-'
ERR! message Valid install targets:
ERR! message ["0.1.0","0.2.0","0.3.0","0.4.0"]
verbose exit [ 1, true ]

Omnicomplete uses stale completion list

Problem: Omnicomplete after <identifier>. sometimes shows stale completions (from a previous omnicomplete).
Seen with:

$ vim --version | head -n 3
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jun  1 2014 10:47:35)
Included patches: 1-307
Compiled by Arch Linux

tern_for_vim@master

Steps to reproduce:

  • In an empty directory, do:
$ npm install cheerio
  • Create files with these contents:

.tern-project:

{
  "plugins": {
    "node": { }
  }
}

example.js:

cheerio = require('cheerio');

Now, edit the example.js file with Vim:

  • Add a line: cheerio. and start omni complete (C-X C-O) after the .. Observe the results are correct.
  • Without closing omni complete (i.e. don't hit Escape), hit Backspace a few times to remove cheerio. then type console. then start omnicomplete again. Observe the completion results are for cheerio., not for console..

key bindings do not get mapped

With let g:tern_map_keys = 1 set in my .vimrc file, the default mappings are not set for javascript files. I have confirmed that the autocmds are set with :au FileType, but the mappings do not exist.

Does not complete for node.js, or, how to set tern config globally?

I'd really love for tern to complete node.js symbols for me because I am seriously tired of having the node docs open in my browser.

I found that Tern has a node plugin, introduced here, but it seems like it's not enabled by tern_for_vim.

How to enable it? Even cooler would be only to enable it if the file is detected as a node.js script.

Edit: Looks like I need to use a .tern-project file to configure this. That will work but I wonder if this is is just too much of a pain. I am starting to write node scripts rather than writing shell scripts, and so they will literally start getting littered across my system, I would not be interested in having to also write little .tern-project files to support them as well. I would really prefer to be able to set a global setting (getting node completions in a browser js file is no big deal. the key is being able to get those completions)

Greater insights into errors in the server

There's currently little feedback when the server encounters an error, and is unable to return any data. This makes debugging issues only found when testing via real live code in the editor hard.

Set .ternproject

How can I set a .ternproject file path manually (I am sharing a vim configuration for multiple projects) ?

Cancel TernRename with escape

Hey,

Currently when you start a rename with :TernRename and decide not to by pressing escape, the variable is remove entirely.

TernDefSplit fails when path to file contains a space

\tsd

E172: Only one file name allowed: split +call cursor(101,10)
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "<string>", line 298, in tern_lookupDefinition
vim.error

The path to the file is something like "/home/sixsided/js/pie menu.js"

It looks like tern.vim:302 needs to quote the pathname.

Omnicompletion not working as expected

As quick preface, I am not sure if this is a bug -- I may simply be expecting something from tern/tern_fo_vim that it isn't meant to do (also this might not be specific to vim)

Anyway, I have a large javascript project where individual files create objects and attach them to a global namespace. Here is a simplistic example of the structure (in concatenated form, as it would be in a browser, but it works the same if each part is in separate files in vim+tern_for_vim):

// file1.js
window.Namespace = {};

// file2.js
(function (Namespace) {
    "use strict";

    var ObjectOne = function () {
        this.val1 = 10;
        this.f1 =  function (arg1, arg2) {
            return "something";
        };
        this.f2 = function () {
            return 5;
        };
        this.f3 = function () {
            return new Array();
        };
    };

    Namespace.ObjectOne = ObjectOne;
})(window.Namespace);

// file3.js
(function (Namespace) {
    "use strict";

    // make an ObjectOne
    var objOne = new Namespace.ObjectOne();

    // this works (outputs "something" to console)
    console.log(objOne.f1());

})(window.Namespace);

if run in a browser, this works as expected. However, tern's onmicompletion doesn't seem to be know about the properties (val1, f1, ...) of objectOne unless they are called within the file2.js function, and even then doesn't know any type information:

screen shot 2013-10-03 at 11 12 11 am

In the above example, I expect that val1 and f2 also appear as autocomletion options, and ideally also that those have type information.

Am I simply misunderstanding functionality, or is this a real issue? It seems like there might be some issue with introspecting the way I am doing namespaces.

not reading .tern_project

I just downloaded this plugin, it seems to be working after setting the omnifunc to tern#Complete. It looks like it isn't reading the .tern-project file.

Here is my project file:
{
"libs": [
"browser",
"jquery"
],
"plugins": {
"requirejs": {
"baseURL": "./",
"paths": {}
}
}
}

nvm, had en error in the project file. Sorry.

Autocompletion with multiple files

Hi! I stumbled into a small issue. I think I'm best off showing how to reproduce it:

file1.js:

function A() { this.num = 1; }

file2.js:

var instance = new A();

now at file1.js:

instance.

provides no completion options even though :TernDef finds correct declaration in file2.js, and from there :TernDef finds function A() correctly in file1.js. After I have restarted vim (and thus tern server) with "loadEagerly": "*.js" completion in file1.js works as supposed to. Without loadEagerly this doesn't happen even if I open both files.

After reloading, completion on instance works until I change function A(). After that autocompletion can't find changed contents of instance anymore, which, I think, is understandable since it's now a different object.

So what I'm basically asking is if there is some way to "refresh" all files in the project for tern? Only relation between these files is that they happen to be in the same folder, so no require()-magic or anything like that.

'NoneType' object is not iterable again!

I use tern and this plugin on my Ubuntu Linux.

When I have edited a new unnamed buffer and started completion,
I saw the error below:

Error occured calling omnifunction: tern#Complete
Vim(python):Traceback (most recent call last):
Traceback (most recent call last):
File "", line 1, in
File "", line 226, in tern_ensureCompletionCached
File "", line 164, in tern_runCommand
File "", line 122, in tern_fullBuffer
File "", line 111, in tern_relativeFile
TypeError: 'NoneType' object has no attribute 'getitem'

This error won't occur if editing a file once saved.
In the function tern_relativeFile(), python calls vim function 'expand'.
But this function does not work if you editing unnamed buffer.

Somehow this bug will not be occur in another environment(OSX),
though I installed the same .vimrc and plugins in all my PCs.

Command completion does not work in all cases.

The solution is to disable vim-nodejs-complete (another auto-complete vim plugin).

I just wanted to contribute my little solution in case others run into the same issue.

I also wanted to say I'm really happy you created this vim plugin. Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.