Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tern_for_vim does not work for Node React+Three.js Project #192

Open
yiakwy opened this issue Dec 25, 2017 · 1 comment
Open

tern_for_vim does not work for Node React+Three.js Project #192

yiakwy opened this issue Dec 25, 2017 · 1 comment

Comments

@yiakwy
Copy link

yiakwy commented Dec 25, 2017

Here is my project hierarchy

.
├── assets
├── dist
├── node_modules
├── package-lock.json
├── package.json
├── setup.sh
├── src
└── webpack.config.js

I have a local standard .tern-project file in the root

{
  "libs": [ "browser", "ecma6" ],
  "plugins": {
    "node": {},
    "complete_strings": {},
    "es_modules": {}
  }
}

And now I am writing a three.js project

import * as THREE from "three"
import OrbitControls from "three/examples/js/controls/OrbitControls.js"
import SETTINGS from "settings.yaml"
import * as React from "react"

class Renderer {
	constructor() {
		this.renderer = new THREE.WebGLRenderer()
		this.scene = new THREE.Scene()
		this.camera = new THREE.PerspectiveCamera(
			SETTINGS.camera.NORMAL.Angle_View,
			window.innerWidth / window.innerHeight, // aspect
			SETTINGS.camera.NORMAL.NEAR,
			SETTINGS.camera.NORMAL.FAR

It seems that completer plugin cannot see the file "settings.yaml" residing in "src/" and cannot complete when I type THREE. But it works good with react.

It cannot complete any file when I try to import.

All the dependencies in package.jason are valid and I can work well with python and C.

So I have no idea why this happened.

@yiakwy
Copy link
Author

yiakwy commented Jan 2, 2018

Hi @marijnh, I played with logs files from output of YcmDebugInfo . I got something from them :

(1) ERROR 1

/Users/lei.wang1/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/tern_runtime/node_modules/tern/plugin/doc_comment.js:95
        var proto = node.objType.getProp("prototype").getObjType()
                                 ^

TypeError: Cannot read property 'getProp' of undefined
    at Class (/Users/lei.wang1/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/tern_runtime/node_modules/tern/plugin/doc_comment.js:95:34)
    at c (/Users/lei.wang1/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/tern_runtime/node_modules/acorn/dist/walk.js:30:16)
    at Object.base.ClassDeclaration.base.ClassExpression (/Users/lei.wang1/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/tern_runtime/node_modules/acorn/dist/walk.js:336:80)
    at c (/Users/lei.wang1/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/tern_runtime/node_modules/acorn/dist/walk.js:29:15)
    at Object.skipThrough (/Users/lei.wang1/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/tern_runtime/node_modules/acorn/dist/walk.js:162:37)
    at c (/Users/lei.wang1/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/tern_runtime/node_modules/acorn/dist/walk.js:29:15)
    at Object.base.ThrowStatement.base.SpreadElement (/Users/lei.wang1/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/tern_runtime/node_modules/acorn/dist/walk.js:201:35)
    at c (/Users/lei.wang1/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/tern_runtime/node_modules/acorn/dist/walk.js:29:15)
    at Object.skipThrough (/Users/lei.wang1/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/tern_runtime/node_modules/acorn/dist/walk.js:162:37)
    at c (/Users/lei.wang1/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/tern_runtime/node_modules/acorn/dist/walk.js:29:15)

(2) ERROR 2

2018-01-02 18:45:33,277 - ERROR - No semantic completer exists for filetypes: [u'nerdtree']
Traceback (most recent call last):
  File "/Users/lei.wang1/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/handlers.py", line 238, in DebugInfo
    request_data ).DebugInfo( request_data )
  File "/Users/lei.wang1/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/handlers.py", line 285, in _GetCompleterForRequestData
    return _server_state.GetFiletypeCompleter( request_data[ 'filetypes' ] )
  File "/Users/lei.wang1/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/server_state.py", line 89, in GetFiletypeCompleter
    current_filetypes ) )
ValueError: No semantic completer exists for filetypes: [u'nerdtree']

Something that I hope can help you :

  1. I used webpack, and I used alias pattern {module_name} -> src/{module_name}
  2. react works well
  3. I install all packages locally using my generated file (automatically execute npm with either --save-dev or --save)
  4. completer does not work when "import", i.e.: complete module names

I also reported bugs to YCM project

@yiakwy yiakwy changed the title tern_for_vim does not work for Node React Project tern_for_vim does not work for Node React+Three.js Project Jan 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant