summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-04-08 03:51:09 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-04-08 03:51:09 +0800
commit5a8568991fe3d8570ec0d76dd7314d7f26b8b32b (patch)
tree8ed9929cde62a0c0fdbf0de1e98b956e360ad9ab
parent4035722624ac91b7dbd5e6a92837de238f077bc9 (diff)
parentfced86aa1bdf675cf0854116639848ca75241371 (diff)
downloadlua-language-server-5a8568991fe3d8570ec0d76dd7314d7f26b8b32b.zip
Merge branch 'master' into 3.0
-rw-r--r--.github/workflows/build.yml7
m---------3rd/EmmyLuaCodeStyle0
m---------3rd/bee.lua0
m---------3rd/love-api0
m---------3rd/lovr-api0
m---------3rd/luamake0
-rw-r--r--main.lua8
-rw-r--r--make.lua17
-rw-r--r--make/code_format.lua9
-rw-r--r--make/modules.cpp2
-rw-r--r--script/core/completion/postfix.lua5
-rw-r--r--script/proto/proto.lua3
-rw-r--r--script/provider/formatting.lua6
-rw-r--r--test/completion/common.lua6
14 files changed, 54 insertions, 9 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 31c8d7f8..5e953267 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -21,12 +21,19 @@ jobs:
matrix:
include:
- { os: ubuntu-18.04, target: linux, platform: linux-x64 }
+ - { os: ubuntu-18.04, target: linux, platform: linux-arm64 }
- { os: macos-11, target: darwin, platform: darwin-x64 }
- { os: macos-11, target: darwin, platform: darwin-arm64 }
- { os: windows-latest, target: windows, platform: win32-ia32 }
- { os: windows-latest, target: windows, platform: win32-x64 }
runs-on: ${{ matrix.os }}
steps:
+ - name: Install aarch64-linux-gnu
+ if: ${{ matrix.platform == 'linux-arm64' }}
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
+
- uses: actions/checkout@v2
with:
submodules: recursive
diff --git a/3rd/EmmyLuaCodeStyle b/3rd/EmmyLuaCodeStyle
-Subproject 108273ada6c0d6a888c5f5975339478f9ce32e8
+Subproject 5768f1423d818466f3bb92765a3aaead40b47c6
diff --git a/3rd/bee.lua b/3rd/bee.lua
-Subproject 159b7fa018a5e7287203b137545e7b43917c9ca
+Subproject 4e9581d553e9e5d475015f1373b0ab5294dea94
diff --git a/3rd/love-api b/3rd/love-api
-Subproject 200589b03b11f6ad8b7b2bd85436a1ee9da5613
+Subproject 82195e0796c52a882a3389b194a9262a2e10823
diff --git a/3rd/lovr-api b/3rd/lovr-api
-Subproject 3fd8d562935bccdba75d09b645039d4608a7e49
+Subproject d0d8e4e6e29b24edcc0ac7c3b7406225a9ec925
diff --git a/3rd/luamake b/3rd/luamake
-Subproject dc9f44da8cd2be09c4c715057e9784e17ada15b
+Subproject e03e3fbe5c8cdfdfb224a7942e32823454766ed
diff --git a/main.lua b/main.lua
index f61b0e32..e7bff185 100644
--- a/main.lua
+++ b/main.lua
@@ -68,6 +68,14 @@ log.info('LOGPATH:', LOGPATH)
log.info('METAPATH:', METAPATH)
log.info('VERSION:', version.getVersion())
+local stdRequire = require
+require = function (name)
+ if name == 'code_format' then
+ error('cannot found code_format')
+ end
+ return stdRequire(name)
+end
+
require 'tracy'
require 'cli'
diff --git a/make.lua b/make.lua
index d7d32acd..6a74809c 100644
--- a/make.lua
+++ b/make.lua
@@ -7,6 +7,8 @@ lm.bindir = "bin"
---@diagnostic disable-next-line: codestyle-check
lm.EXE_DIR = ""
+local includeCodeFormat = true
+
if platform.OS == 'macOS' then
if lm.platform == nil then
elseif lm.platform == "darwin-arm64" then
@@ -29,9 +31,7 @@ elseif platform.OS == 'Linux' then
if lm.platform == nil then
elseif lm.platform == "linux-x64" then
elseif lm.platform == "linux-arm64" then
- -- TODO: not implement
- lm.compiler = "clang"
- lm.target = "arm64-pc-linux-gnu"
+ lm.cc = 'aarch64-linux-gnu-gcc'
else
error "unknown platform"
end
@@ -50,7 +50,11 @@ lm:source_set 'lpeglabel' {
}
lm:executable "lua-language-server" {
- deps = { "lpeglabel", "source_bootstrap", "code_format" },
+ deps = {
+ "lpeglabel",
+ "source_bootstrap",
+ includeCodeFormat and "code_format" or nil,
+ },
includes = {
"3rd/bee.lua",
"3rd/bee.lua/3rd/lua",
@@ -61,6 +65,9 @@ lm:executable "lua-language-server" {
"make/lua-language-server.rc",
}
},
+ defines = {
+ includeCodeFormat and 'CODE_FORMAT' or nil,
+ },
linux = {
crt = "static",
}
@@ -116,7 +123,7 @@ local function targetPlatformArch()
return lm.platform:match "^[^-]*-(.*)$"
end
-local notest = platform.OS == 'macOS'
+local notest = (platform.OS == 'macOS' or platform.OS == 'Linux')
and targetPlatformArch() == "arm64"
and detectArch() == "x86_64"
diff --git a/make/code_format.lua b/make/code_format.lua
index 17007fdd..48e4c80f 100644
--- a/make/code_format.lua
+++ b/make/code_format.lua
@@ -22,6 +22,13 @@ lm:source_set 'code_format' {
},
macos = {
-- macosx10.12不支持完整的std filesystem,只好砍功能
- defines = "NOT_SURPPORT_FILE_SYSTEM",
+ defines = "NOT_SUPPORT_FILE_SYSTEM",
},
+ linux = {
+ defines = (function ()
+ if lm.platform == "linux-arm64" then
+ return "NOT_SUPPORT_FILE_SYSTEM"
+ end
+ end)()
+ }
}
diff --git a/make/modules.cpp b/make/modules.cpp
index 8fe065a8..802e6916 100644
--- a/make/modules.cpp
+++ b/make/modules.cpp
@@ -3,6 +3,8 @@
extern "C" int luaopen_lpeglabel (lua_State *L);
static ::bee::lua::callfunc _init(::bee::lua::register_module, "lpeglabel", luaopen_lpeglabel);
+#ifdef CODE_FORMAT
extern "C" int luaopen_code_format(lua_State *L);
static ::bee::lua::callfunc _init_code_format(::bee::lua::register_module, "code_format",
luaopen_code_format);
+#endif
diff --git a/script/core/completion/postfix.lua b/script/core/completion/postfix.lua
index 98bd0639..c5988ef6 100644
--- a/script/core/completion/postfix.lua
+++ b/script/core/completion/postfix.lua
@@ -297,11 +297,14 @@ local function checkPostFix(state, word, wordPosition, position, symbol, results
for i, action in ipairs(actions) do
if matchKey(word, action.key) then
action.data[1](state, source, function (newText)
+ local descText = newText:gsub('%$%{%d+:([^}]+)%}', function (val)
+ return val
+ end):gsub('%$%{?%d+%}?', '')
results[#results+1] = {
label = action.key,
kind = define.CompletionItemKind.Event,
description = markdown()
- : add('lua', newText)
+ : add('lua', descText)
: string(),
textEdit = {
start = wordPosition + #symbol,
diff --git a/script/proto/proto.lua b/script/proto/proto.lua
index d245ab65..024b17e5 100644
--- a/script/proto/proto.lua
+++ b/script/proto/proto.lua
@@ -132,7 +132,8 @@ local secretOption = {
process = function (item, path)
if path[1] == 'params'
and path[2] == 'textDocument'
- and path[3] == nil then
+ and path[3] == 'text'
+ and path[4] == nil then
return '"***"'
end
return item
diff --git a/script/provider/formatting.lua b/script/provider/formatting.lua
index f73b0dc0..73b6608d 100644
--- a/script/provider/formatting.lua
+++ b/script/provider/formatting.lua
@@ -1,4 +1,8 @@
-local codeFormat = require 'code_format'
+local suc, codeFormat = pcall(require, 'code_format')
+if not suc then
+ return
+end
+
local ws = require 'workspace'
local furi = require 'file-uri'
local fs = require 'bee.filesystem'
diff --git a/test/completion/common.lua b/test/completion/common.lua
index 4058e844..0d00ddf9 100644
--- a/test/completion/common.lua
+++ b/test/completion/common.lua
@@ -1936,6 +1936,12 @@ f(<??>)
function (${1:x}, ${2:y})\
\t$0\
end",
+ description = "\z
+```lua\
+function (x, y)\
+\t\
+end\
+```"
},
}