Giter Club home page Giter Club logo

Comments (8)

lxbzmy avatar lxbzmy commented on May 12, 2024

I confirmed it, tern-closure cannot work with tern 0.11.

from tern-closure.

lxbzmy avatar lxbzmy commented on May 12, 2024

Tern's plugin interface has been changed sine 0.11.
We can do some patch to compatible new interface.

//from complete_strings.js
function complete(file, query) {
    var pos = tern.resolvePos(file, query.end);
    var lit = infer.findExpressionAround(file.ast, null, pos, file.scope, "Literal");
    if (!lit || typeof lit.node.value != "string") return;
    var before = lit.node.value.slice(0, pos - lit.node.start - 1);
    var matches = [], seen = infer.cx().parent._completeStrings.seen;
    for (var str in seen) if (str.length > before.length && str.indexOf(before) == 0) {
      if (query.types || query.docs || query.urls || query.origins) {
        var rec = {name: JSON.stringify(str), displayName: str};
        matches.push(rec);
        if (query.types) rec.type = "string";
        if (query.origins) rec.origin = seen[str];
      } else {
        matches.push(JSON.stringify(str));
      }
    }
    if (matches.length) return {
      start: tern.outputPos(query, file, lit.node.start),
      end: tern.outputPos(query, file, pos + (file.text.charAt(pos) == file.text.charAt(lit.node.start) ? 1 : 0)),
      isProperty: false,
      completions: matches
    };
  }

from tern-closure.

angelozerr avatar angelozerr commented on May 12, 2024

See #39, it seems working for me.

from tern-closure.

jgiles avatar jgiles commented on May 12, 2024

Yep, I believe this - I've been out of the game for a while (apologies). I now have some good reasons to get going again, so expect more regular updates.

from tern-closure.

jgiles avatar jgiles commented on May 12, 2024

Merged the above pull request, and updated the Closure side so the tests were passing.

I am going to manually test a bit more thoroughly before closing this issue.

from tern-closure.

pstjvn avatar pstjvn commented on May 12, 2024

If installing from github it now works. npm however still downloads the tagged older version with tern requirement set to 0.7.0

from tern-closure.

bfricka avatar bfricka commented on May 12, 2024

+1 Need to tag and push new npm version

Edit: Also, this isn't working for tern 0.15.0... I'll try to look into it later, but currently have to npm i [email protected] to make it work.

from tern-closure.

exclipy avatar exclipy commented on May 12, 2024

+1; would appreciate it if the current version of tern-closure in npm works with the current version of tern.

from tern-closure.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.