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

Tags navigation does not work in es6 'import' and destructors #50

Open
alex-shamshurin opened this issue Feb 19, 2017 · 0 comments
Open

Comments

@alex-shamshurin
Copy link

I successfully installed jsctags, tern_for_vim and autocomplete now works and even code jumping via ctrl-] . But I have issues with navigation and jumping from 'import strings'.

Suppose I have these files:

types.js

export const LOGIN_REQUEST = "LOGIN_REQUEST"
export const LOGIN_SUCCESS = "LOGIN_SUCCESS"
export const LOGIN_FAILURE = "LOGIN_FAILURE"

export const LOGOUT_REQUEST = "LOGOUT_REQUEST"
export const LOGOUT_SUCCESS = "LOGOUT_SUCCESS"
export const LOGOUT_FAILURE = "LOGOUT_FAILURE"

export const OTHER = "OTHER"

actions.js

import * as types from './types.js’
//import {LOGIN_REQUEST} from './types.js'

function action(type, payload = {}) {
  return {type, ...payload}
}

export const login = {
  request: (login) => action(types.LOGIN_REQUEST, {login}),
  success: (login, response) => action(types.LOGIN_SUCCESS, {login, response}),
  failure: (login, error) => action(types.LOGIN_FAILURE, {login, error}),
}

export const logout = {
  request: (login) => action(types.LOGOUT_REQUEST, {login}),
  success: (login, response) => action(types.LOGOUT_SUCCESS, {login, response}),
  failure: (login, error) => action(types.LOGOUT_FAILURE, {login, error}),
}

Code jumping from from import * as types from '../types' do not work. But go to file via gf works. It just jumps to line beginning. The same is for import {LOGIN_REQUEST} from './types.js' - it does not work.

But code completion works for types works:

omni-works

Next files is index.js

import * as types from './types'
import * as actions from './actions'

const {login, logout, notexist_method} = actions

let new_var = login.wrong_method

index-js

Code jumping for two imports and for object destruction does not work too. It jumps to the beginning of word.

Also I would like syntastic plugin (works via eslint in my plugin) mark somehow that notexist_method is not valid object. And notexist_method also.

wrong-completion

notexist_method method must not be in auto completion list.

This is how IDEA works:
idea-great

So guys, how to achieve that? May syntastic linting is not related, but code navigation must work, because it uses 'tern'.

Here is my .tern-project file

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

And this is generated tag file (via vim-easytag)

!_TAG_FILE_SORTED	2	/0=unsorted, 1=sorted, 2=foldcase/
action	/Users/username/workspace/jsctags-issues/action.js	/action/;"	f	lineno:4	type:action.!ret function(?, ?)
actions	/Users/username/workspace/jsctags-issues/index.js	/actions/;"	v	lineno:2
error	/Users/username/workspace/jsctags-issues/action.js	/error/;"	v	lineno:11	namespace:login.failure
error	/Users/username/workspace/jsctags-issues/action.js	/error/;"	v	lineno:17	namespace:action.payload
error	/Users/username/workspace/jsctags-issues/action.js	/error/;"	v	lineno:17	namespace:logout.failure
failure	/Users/username/workspace/jsctags-issues/action.js	/failure/;"	f	lineno:11	namespace:login	type:action.!ret function(?, ?)
failure	/Users/username/workspace/jsctags-issues/action.js	/failure/;"	f	lineno:17	namespace:logout	type:action.!ret function(?, ?)
login	/Users/username/workspace/jsctags-issues/action.js	/login/;"	v	lineno:10	namespace:login.success
login	/Users/username/workspace/jsctags-issues/action.js	/login/;"	v	lineno:11	namespace:login.failure
login	/Users/username/workspace/jsctags-issues/action.js	/login/;"	v	lineno:15	namespace:logout.request
login	/Users/username/workspace/jsctags-issues/action.js	/login/;"	v	lineno:16	namespace:logout.success
login	/Users/username/workspace/jsctags-issues/action.js	/login/;"	v	lineno:17	namespace:action.payload
login	/Users/username/workspace/jsctags-issues/action.js	/login/;"	v	lineno:17	namespace:logout.failure
login	/Users/username/workspace/jsctags-issues/action.js	/login/;"	v	lineno:8
login	/Users/username/workspace/jsctags-issues/action.js	/login/;"	v	lineno:9	namespace:login.request
login	/Users/username/workspace/jsctags-issues/index.js	/login/;"	v	lineno:4
LOGIN_FAILURE	/Users/username/workspace/jsctags-issues/types.js	/LOGIN_FAILURE/;"	v	lineno:3	type:string
LOGIN_REQUEST	/Users/username/workspace/jsctags-issues/types.js	/LOGIN_REQUEST/;"	v	lineno:1	type:string
LOGIN_SUCCESS	/Users/username/workspace/jsctags-issues/types.js	/LOGIN_SUCCESS/;"	v	lineno:2	type:string
logout	/Users/username/workspace/jsctags-issues/action.js	/logout/;"	v	lineno:14
logout	/Users/username/workspace/jsctags-issues/index.js	/logout/;"	v	lineno:4
LOGOUT_FAILURE	/Users/username/workspace/jsctags-issues/types.js	/LOGOUT_FAILURE/;"	v	lineno:7	type:string
LOGOUT_REQUEST	/Users/username/workspace/jsctags-issues/types.js	/LOGOUT_REQUEST/;"	v	lineno:5	type:string
LOGOUT_SUCCESS	/Users/username/workspace/jsctags-issues/types.js	/LOGOUT_SUCCESS/;"	v	lineno:6	type:string
new_var	/Users/username/workspace/jsctags-issues/index.js	/new_var/;"	v	lineno:6
notexist_method	/Users/username/workspace/jsctags-issues/index.js	/notexist_method/;"	v	lineno:4
OTHER	/Users/username/workspace/jsctags-issues/types.js	/OTHER/;"	v	lineno:9	type:string
payload	/Users/username/workspace/jsctags-issues/action.js	/payload/;"	v	lineno:4	namespace:action
request	/Users/username/workspace/jsctags-issues/action.js	/request/;"	f	lineno:15	namespace:logout	type:action.!ret function(?)
request	/Users/username/workspace/jsctags-issues/action.js	/request/;"	f	lineno:9	namespace:login	type:action.!ret function(?)
response	/Users/username/workspace/jsctags-issues/action.js	/response/;"	v	lineno:10	namespace:login.success
response	/Users/username/workspace/jsctags-issues/action.js	/response/;"	v	lineno:16	namespace:action.payload
response	/Users/username/workspace/jsctags-issues/action.js	/response/;"	v	lineno:16	namespace:logout.success
success	/Users/username/workspace/jsctags-issues/action.js	/success/;"	f	lineno:10	namespace:login	type:action.!ret function(?, ?)
success	/Users/username/workspace/jsctags-issues/action.js	/success/;"	f	lineno:16	namespace:logout	type:action.!ret function(?, ?)
type	/Users/username/workspace/jsctags-issues/action.js	/type/;"	v	lineno:4	namespace:action
types	/Users/username/workspace/jsctags-issues/action.js	/types/;"	v	lineno:1
types	/Users/username/workspace/jsctags-issues/index.js	/types/;"	v	lineno:1

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