Skip to content

Enabling doc_comment breaks completions for class methods #172

@rubikonx9

Description

@rubikonx9

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions