When lua function loadfile(filename) return loadstring(vim.fn.readfile(filename, 'B')) end is defined, calling :lua print(require'nvim-treesitter.utils'.get_package_path()) (this is currently the workaround recommended for windows users with non-ASCII names: https://github.com/neovim/neovim/issues/18122) returns
ocal api = vim.api
local fn = vim.fn
local luv = vim.loop
local M = {}
--- ... and so on
So it appears that debug.getInfo(1, "S") is not adding the @filename
source: If the function was defined in a string, then source is that string. If the function was defined in a file, then source starts with a '@' followed by the file name.
To Reproduce
Run neovim with: nvim --cmd "lua function loadfile(filename) return loadstring(vim.fn.readfile(filename, 'B')) end"
call :TSInstall
Expected behavior
Installation shoud work
Output of :checkhealth nvim-treesitter
nvim-treesitter: require("nvim-treesitter.health").check()
========================================================================
## Installation
- OK: `tree-sitter` found 0.20.7 (parser generator, only needed for :TSInstallFromGrammar)
- OK: `node` found v14.21.0 (only needed for :TSInstallFromGrammar)
- OK: `git` executable found.
- OK: `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
Version: Apple clang version 14.0.0 (clang-1400.0.29.202)
- OK: Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI.
## OS Info:
{
machine = "x86_64",
release = "22.2.0",
sysname = "Darwin",
version = "Darwin Kernel Version 22.2.0: Fri Nov 11 02:08:47 PST 2022; root:xnu-8792.61.2~4/RELEASE_X86_64"
}
## Parser/Features H L F I J
- c ✓ ✓ ✓ ✓ ✓
- help ✓ . . . ✓
- scala ✓ . ✓ . ✓
- vim x ✓ ✓ . ✓
- lua x ✓ ✓ ✓ ✓
Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections
+) multiple parsers found, only one will be used
x) errors found in the query, try to run :TSUpdate {lang}
## The following errors have been detected:
- ERROR: vim(highlights): [string "local a = vim.api..."]:219: query: invalid node type at position 2765 for language vim
vim(highlights) is concatenated from the following files:
| [ERROR]:"/Users/jocosta/.local/share/nvim/plugged/nvim-treesitter/queries/vim/highlights.scm", failed to load: [string "local a = vim.api..."]:219: query: invalid node type at position 2765 for language vim
- ERROR: lua(highlights): [string "local a = vim.api..."]:219: query: invalid node type at position 1141 for language lua
lua(highlights) is concatenated from the following files:
| [ERROR]:"/Users/jocosta/.local/share/nvim/plugged/nvim-treesitter/queries/lua/highlights.scm", failed to load: [string "local a = vim.api..."]:219: query: invalid node type at position 1141 for language lua
Output of nvim --version
NVIM v0.8.3
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by brew@Ventura
Features: +acl +iconv +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/local/Cellar/neovim/0.8.3/share/nvim"
Run :checkhealth for more info
Additional context
While I didn't detect this problem on a windows machine, I had the workaround applied anyway. I imagine there's no easy fix for Windows users who need this workaround for other plugins.
Describe the bug
When
lua function loadfile(filename) return loadstring(vim.fn.readfile(filename, 'B')) end
is defined, calling:lua print(require'nvim-treesitter.utils'.get_package_path())
(this is currently the workaround recommended for windows users with non-ASCII names: https://github.com/neovim/neovim/issues/18122) returnsSo it appears that
debug.getInfo(1, "S")
is not adding the@filename
From: https://pgl.yoyo.org/luai/i/lua_Debug
To Reproduce
:TSInstall
Expected behavior
Installation shoud work
Output of
:checkhealth nvim-treesitter
Output of
nvim --version
Additional context
While I didn't detect this problem on a windows machine, I had the workaround applied anyway. I imagine there's no easy fix for Windows users who need this workaround for other plugins.