Detect the Lua project root using .luarc.json

This commit is contained in:
w0rp
2025-03-21 12:07:10 +00:00
parent bcd1a12949
commit 7f43666fb3
3 changed files with 25 additions and 0 deletions

View File

@@ -4,6 +4,7 @@
" Find project root for a Lua language server.
function! ale#lua#FindProjectRoot(buffer) abort
let l:possible_project_roots = [
\ '.luarc.json',
\ '.git',
\ bufname(a:buffer),
\]

View File

@@ -14,3 +14,8 @@ Execute(lua-language-server should be configurable):
AssertLinter 'billy', ale#Escape('billy')
AssertLSPConfig {'x': 'y'}
Execute(lua-language-server should detect the project root using .luarc.json):
call ale#test#SetFilename('../lua/dummy.lua')
AssertLSPProject ale#path#Simplify(g:dir . '/../lua')

19
test/lua/.luarc.json Normal file
View File

@@ -0,0 +1,19 @@
{
"$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json",
"diagnostics.globals": [
"vim",
"describe",
"it",
"before_each",
"after_each",
"setup",
"teardown",
"pending",
"assert"
],
"workspace.library": [
"../../lua"
],
"runtime.version": "LuaJIT",
"hint.enable": false
}