Git Product home page Git Product logo

Comments (5)

dbarnett avatar dbarnett commented on May 18, 2024

It might depend on vim version. I was seeing it after some bootstrap.vim changes in bazelbuild/vim-bazel@905478a when I ran vroom locally, but NOT when I ran it via Travis CI, and also NOT when I ran neovim mode.

from vim-maktaba.

malcolmr avatar malcolmr commented on May 18, 2024

Looking at this today with @snu5mumr1k, it seems like a plausible fix might be:

  1. Move the definition of maktaba#Maktaba() up within autoload/maktaba.vim so that it's available immediately, before the call to maktaba#plugin#GetOrInstall(). This will require doing something like let s:maktaba = 0 at global scope first to make that variable defined, albeit with a temporary invalid value.
  2. Add something like maktaba#plugin#InternalInstallMaktaba(dir) for bootstrapping that does something like:
    let s:maktaba = maktaba#plugin#GetOrInstall(s:plugindir)
    return s:maktaba
    to overwrite the value of s:maktaba set in autoload/maktaba/plugin.vim by the call to maktaba#Maktaba() during its initial load.
  3. Call that new function inside autoload/maktaba.vim instead of the generic maktaba#plugin#GetOrInstall().

from vim-maktaba.

dbarnett avatar dbarnett commented on May 18, 2024

SG except that instead of using a temporary value of 0, we should probably use a minimal dict that we can hopefully update in-place, so that anything internal that does save the output of maktaba#Maktaba() in the meantime isn't permanently stuck with a dummy value.

from vim-maktaba.

malcolmr avatar malcolmr commented on May 18, 2024

I was actually thinking the other way around: using 0 means that it'll be completely obvious if anyone tries to use a partial/invalid value (which I don't think they do, fortunately).

However, you make a good point, as we could perhaps simplify this with just autoload/maktaba.vim looking like:

let s:maktaba = {}

""
" Returns a handle to the maktaba plugin object.
function! maktaba#Maktaba() abort
  return s:maktaba
endfunction

let s:plugindir =  expand('<sfile>:p:h:h')
if !exists('s:maktaba')
  call extend(s:maktaba, maktaba#plugin#GetOrInstall(s:plugindir))
  let s:maktaba.globals.installers = []
  let s:maktaba.globals.loghandlers = maktaba#reflist#Create()
endif

(entirely untested though)

from vim-maktaba.

dbarnett avatar dbarnett commented on May 18, 2024

You're right, there are cons either way. IIUC we can't actually guarantee the placeholder value never gets used the way the circular dependency works so I was looking to make it try hard to recover, but it's also possible it'll still fail and just be all the harder to troubleshoot. 🤷

Another possibility would be to change the maktaba#plugin file to move the s:maktaba setup inside functions and have them call maktaba#Maktaba() on demand.

from vim-maktaba.

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.