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

Using es_modules and node plugin together breaks jump to definition in some cases #601

Open
abose opened this issue Aug 7, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@abose
Copy link
Member

abose commented Aug 7, 2022

tracking tern issue:
ternjs/tern#1049

Hi,

When trying to enable both es_modules and node plugin together, jump to definition query wont work, but completions requests work if a file is imported without specifying .js extension as described below.

We have the following tern init code in Brackets:

ternOptions = {
        defs: env,
        async: true,
        getFile: getFile,
        plugins: {
            commonjs: true,
            requirejs: {},
            angular: true,
            complete_strings: true,
            doc_comment: true,
            doc_comments: true,
            es_modules: true,
            node: true,
            node_resolve: true
        }
    };

The issue can be recreated with three files below, fail.js, pass.js and list.js with contents below:

// fail.js
import {test} from "./list"

// pass.js
import {test} from "./list.js"

// list.js
export function test(){}

The problem:

  1. Jump to definition tern query will not work if we try to trigger it from line1: test in fail.js, but it will work from pass.js .
  2. However, completions requests pass for both cases to get code hints.
  3. The problem is not present if i only use es_modules plugin and not node plugin.

expected result

  1. Jump to definition query and completions query should behave the same. But having completions and definitions error tolerant would help with edits.
  2. Should behave consistently with both es_modules plugin and node plugin enabled.

Background reading done

https://stackoverflow.com/questions/55251956/how-does-javascript-import-find-the-module-without-an-extension

Thanks,
Arun.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

1 participant