ternjs / tern_for_sublime

Sublime Text package adding Tern support
MIT License
803 stars 54 forks source link

Enabling doc_comment breaks completions for class methods #172

Open rubikonx9 opened 6 years ago

rubikonx9 commented 6 years ago

My ~/.tern-project:

{                                                                                                                                                                                                                  
    "ecmaVersion": 6,
    "libs": [
        "ecmascript"
    ],
    "plugins": {
        "commonjs":         {},
        "complete_strings": {},
        "doc_comment":      null,
        "node":             {},
        "node_resolve":     {}
    }
}

My sublime tern config:

{
    "tern_output_style":             "tooltip",
    "tern_argument_hints":           true,
    "tern_argument_completion":      true,
    "tern_inhibit_word_completions": true
}

Consider the following code:

// x.js

class X {
    /**
     * Ctor
     *
     * @return {void} Nothing
     */
    constructor() {
        this.e = 1;
    }

    /**
     * Test
     *
     * @param  {int} a Number
     *
     * @return {int}   Returned number
     */
    x(a) {
        return 2 * a;
    }
}

module.exports = X;

And

#!/usr/bin/env node

// y.js

const X = require("x");

x = new X();

If doc_comment plugin is disabled, the completions work correctly. If I enable it (either by setting "doc_comment": {} or by removing it completely), however, the completions stop working for x variable. They still work correctly for static functions, classes, and so on; just not for classes' member functions.

There are no errors in the console, and I'm not quite sure how to debug it. I'm using an up-to-date Arch Linux and ST nightly build 3142.

I'm not quite sure if this is tern or tern_for_sublime issue, but I haven't used tern outside of sublime at all.