nvim-orgmode / nvim-orgmode/orgmode

Updating tree-sitter grammar ... aborting startup on Windows

Open
#1,170 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Lua
Stars
3.9k
Forks
190
Avg merge
2d 13h
Merged PRs (30d)
7

Description

Describe the bug

When orgmode tries to update grammar on start-up/calling Org install_tree_sitter_grammar.
on nvim start-up:

Updating tree-sitter grammar...  
vim.schedule callback: [orgmode] Failed to move generated tree-sitter parser to runtime folder: Acesso negado.  
stack traceback:  
[C]: in function 'error'  
...site\pack\core\opt\orgmode/lua/orgmode/utils/promise.lua:378: in function 'install_grammar'  
...vim-data\site\pack\core\opt\orgmode/lua/orgmode/init.lua:157: in function 'setup'  
C:\Users\Juice\AppData\Local\nvim/plugins/org.lua:6: in function 'config'  
C:\Users\Juice\AppData\Local\nvim/lua/pack.lua:44: in function 'add'  
C:\Users\Juice\AppData\Local\nvim/lua/pack.lua:91: in function <C:\Users\Juice\AppData\Local\nvim/lua/pack.lua:91>  

when call install_tree_sitter_grammar:

Updating tree-sitter grammar...  
Lua :command callback: [orgmode] Failed to move generated tree-sitter parser to runtime folder: Acesso negado.  
stack traceback:  
[C]: in function 'error'  
...site\pack\core\opt\orgmode/lua/orgmode/utils/promise.lua:378: in function 'install_grammar'  
...ta\site\pack\core\opt\orgmode/lua/orgmode/org/global.lua:66: in function <...ta\site\pack\core\opt\orgmode/lua/orgmode/org/global.lua:65>
checkhealth

==============================================================================
orgmode: 1 ⚠️ 1 ❌

Orgmode ~

  • ❌ ERROR Treesitter grammar is out of date. Run :Org install_treesitter_grammar to update it.
  • ✅ OK Setup called
  • ✅ OK org_agenda_files configured
  • ✅ OK org_default_notes_file configured
  • ⚠️ WARNING shellslash is not set. This might cause issues with file paths in links. Set vim.opt.shellslash = true in your configuration.
Steps to reproduce

On windows:

  1. run nvim
  2. Updating tree-sitter grammar... message appears
  3. it fails after some seconds
Expected behavior

Update the tree-sitter grammar and run normally

Emacs functionality

No response

Minimal init.lua

-- init.lua --------------------------------------------------------------------
-- startup -----------------------------
local start_time = vim.uv.hrtime()
package.path = package.path .. ";" .. vim.fn.stdpath("data") .. "/?.lua"

require("options")
kmap    = require("keymaps")
usercmd = require("usercmd")
autocmd = require("autocmd")
color   = require("colors")

-- load plugins ------------------------
pack = require("pack")
pack.load()

-- init config --
kmap.load()
usercmd.load()
autocmd.load()
color.load()

-- init plugins ------------------------
require("plugin.fterm").setup()     -- floating terminal
require("plugin.scratch").setup()   -- floating lua scratch buffer
require("plugin.bufline").setup()   -- custom buffer line on status line
require("plugin.notebuffer").setup()    -- notes manager

-- print startup time ------------------
vim.notify(string.format("Neovim loaded in %.4fms",((vim.uv.hrtime() - start_time)/1e6)), vim.log.levels.INFO, {title = "Welcome again!"})


Screenshots and recordings
Image Image
nvim-orgmode version

commit f32a06d4b5399dad8bf0478c772bf6c513f02dcf

OS / Distro

Windows 11

Neovim version/commit

NVIM v0.12.0 Build type: Release LuaJIT 2.1.1774638290

Additional context
  1. i tried this temporary fix on Org.setup:
function Org.setup(opts)
  opts = opts or {}
  local config = require('orgmode.config'):extend(opts)
  -- FIX --
  pcall( function() config:install_grammar() end )
  -- FIX --
  instance = Org:new()
  instance.setup_called = true
  vim.defer_fn(function()
    if config.notifications.enabled and #vim.api.nvim_list_uis() > 0 then
      Org.files:load():next(vim.schedule_wrap(function()
        instance.notifications = require('orgmode.notifications')
          :new({
            files = Org.files,
          })
          :start_timer()
      end))
    end
    config:setup_mappings('global')
  end, 1)
  return instance
end

it still fails to update the grammar, but at least it initializes without error

  1. obs: Acesso negado means Denied access (portuguese, windows error)

  2. for what i checked, it is related to trying to delete/update the org.so parser file while it's being used

  3. this may have something with nvim-treesitter, as i don't remember of having this error before installing it

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in lua/orgmode/utils/promise.lua at install_grammar, then trace its callers in lua/orgmode/init.lua and lua/orgmode/org/global.lua. Reproduce the startup or :Org install_treesitter_grammar failure on Windows and inspect the parser move or replacement step. Done means the grammar updates without an access-denied error and checkhealth reports it is current.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
operating-systems, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.