Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
- id: lua-language-server-check
language: lua
name: lua language server check
description: >
use lua language server to check lua files
entry: lua-language-server
types:
- lua
args:
- --check
- .
1 change: 1 addition & 0 deletions lua
16 changes: 16 additions & 0 deletions lua-language-server
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env lua
local f = '%q'
local args = {
'bee',
debug.getinfo(1).source:match("@?(.*/)[^/]+/") .. 'main.lua',
}
for _, v in ipairs(arg) do
table.insert(args, f:format(v))
end
local isok, reason, ret = os.execute(table.concat(args, ' '))
if type(isok) == type(0) then
ret = isok
end
if ret ~= 0 then
os.exit(1)
end
39 changes: 39 additions & 0 deletions lua-language-server-scm-1.rockspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
local git_ref = '3.15.1'
local modrev = 'scm'
local specrev = '1'

rockspec_format = '3.0'
package = 'lua-language-server'
version = modrev .. '-' .. specrev

local repo_url = 'https://github.com/LuaLS/lua-language-server'

description = {
summary = 'A language server that offers Lua language support - programmed in Lua',
detailed =
[[The Lua language server provides various language features for Lua to make development easier and faster. With nearly a million installs in Visual Studio Code, it is the most popular extension for Lua language support.]],
labels = { 'lua', 'language-server', 'lpeg', 'hacktoberfest', 'lsp', 'lsp-server', 'lpeglabel' },
homepage = repo_url,
license = 'MIT'
}

source = {
url = repo_url .. '/archive/' .. git_ref .. '.zip',
dir = package .. '-' .. git_ref,
}

dependencies = { 'lpeglabel', 'EmmyLuaCodeStyle', 'bee.lua' }

build = {
type = 'builtin',
copy_directories = { 'meta', 'locale' },
install = {
bin = {
[package] = package,
},
conf = {
['../main.lua'] = 'main.lua',
['../debugger.lua'] = 'debugger.lua',
},
}
}
11 changes: 6 additions & 5 deletions script/cli/check.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ local function logFileForThread(threadId)
return LOGPATH .. '/check-partial-' .. threadId .. '.json'
end

local function buildArgs(exe, numThreads, threadId, format, quiet)
local args = {exe}
local function buildArgs(minIndex, numThreads, threadId, format, quiet)
local args = {}
local skipNext = false
for i = 1, #arg do
for i = minIndex, #arg do
local arg = arg[i]
-- --check needs to be transformed into --check_worker
if arg:lower():match('^%-%-check$') or arg:lower():match('^%-%-check=') then
Expand Down Expand Up @@ -56,9 +56,10 @@ function export.runCLI()
exe = arg[minIndex]
minIndex = minIndex - 1
end
minIndex = minIndex + 1
-- TODO: is this necessary? got it from the shell.lua helper in bee.lua tests
if platform.os == 'windows' and not exe:match('%.[eE][xX][eE]$') then
exe = exe..'.exe'
arg[minIndex] = exe..'.exe'
end

if not QUIET and numThreads > 1 then
Expand All @@ -67,7 +68,7 @@ function export.runCLI()

local procs = {}
for i = 1, numThreads do
local process, err = subprocess.spawn({buildArgs(exe, numThreads, i, CHECK_FORMAT, QUIET)})
local process, err = subprocess.spawn({buildArgs(minIndex, numThreads, i, CHECK_FORMAT, QUIET)})
if err then
print(err)
end
Expand Down
Loading