Coder Social home page Coder Social logo

[vim plugin] Bad Request about tern HOT 6 CLOSED

ternjs avatar ternjs commented on July 19, 2024
[vim plugin] Bad Request

from tern.

Comments (6)

marijnh avatar marijnh commented on July 19, 2024

The problem appears to be that the counter I'm using to detect changes (undotree()['seq_cur']) is only updated when insert mode is left. So if you make two requests in a single insert mode episode, the second won't notice that the buffer is changed and updated text should be sent.

Does any solution come to mind? Maybe always send when in insert mode, since the user is probably typing.

from tern.

marijnh avatar marijnh commented on July 19, 2024

Is there a way for a script to find out whether insert mode is active? I can't seem to find anything.

from tern.

clausreinke avatar clausreinke commented on July 19, 2024

In Vim, insert mode is only used for typing, otherwise the user would be in normal mode (modulo some people who insist on staying in insert mode to pretend that Vim is modeless...). While completing, insert mode is always active. But when I enter :TernType, I've left insert mode, so shouldn't tern receive updated content then?

You could use the InsertEnter/InsertLeave events to flag insert mode for scripting, if that helps.

from tern.

marijnh avatar marijnh commented on July 19, 2024

Attached patch should help. Somewhat awkward, but I guess we have to work with the tools that vim gives us.

from tern.

clausreinke avatar clausreinke commented on July 19, 2024

If you find the events awkward, you could simply add a keyword parameter indicating mode to tern_runCommand. The call in tern_ensureCompletionCached should be the only one from insert mode.

from tern.

garland avatar garland commented on July 19, 2024

Sent from my HTC Velocity 4G on the Next G network

----- Reply message -----
From: "Claus Reinke" [email protected]
To: "marijnh/tern" [email protected]
Subject: [tern] [vim plugin] Bad Request (#62)
Date: Wed, Apr 17, 2013 12:29 am
In Vim, insert mode is only used for typing, otherwise the user would be in normal mode (modulo some people who insist on staying in insert mode to pretend that Vim is modeless...). While completing, insert mode is always active. But when I enter :TernType, I've left insert mode, so shouldn't tern receive updated content then?

You could use the InsertEnter/InsertLeave events to flag insert mode for scripting, if that helps.


Reply to this email directly or view it on GitHub.

from tern.

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.