summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-12-24 17:29:40 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-12-24 17:29:40 +0800
commit65aac0a4e58252a91394c7d249efa78182d63f2f (patch)
tree9debd9da10eb938300074e2cec05f43fb203616c
parentc34940df790c8e26ce6e37a076785e718e08f523 (diff)
downloadlua-language-server-65aac0a4e58252a91394c7d249efa78182d63f2f.zip
add tracy
-rw-r--r--.vscode/settings.json3
-rw-r--r--main.lua2
-rw-r--r--script/tracy.lua18
-rw-r--r--test.lua1
4 files changed, 23 insertions, 1 deletions
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 89305242..54ad1616 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -11,7 +11,8 @@
"ID",
"DEVELOP",
"DBGPORT",
- "DBGWAIT"
+ "DBGWAIT",
+ "tracy"
],
"Lua.diagnostics.disable": [
"close-non-object"
diff --git a/main.lua b/main.lua
index ad9da5b4..4e050f9d 100644
--- a/main.lua
+++ b/main.lua
@@ -14,6 +14,8 @@ log.init(ROOT, ROOT / 'log' / 'service.log')
log.info('Lua Lsp startup, root: ', ROOT)
log.debug('ROOT:', ROOT:string())
+require 'tracy' .disable()
+
xpcall(dofile, log.debug, rootPath .. '/debugger.lua')
local service = require 'service'
diff --git a/script/tracy.lua b/script/tracy.lua
new file mode 100644
index 00000000..a5f6d9b1
--- /dev/null
+++ b/script/tracy.lua
@@ -0,0 +1,18 @@
+local suc = pcall(require, 'luatracy')
+local originTracy = tracy
+
+local function enable()
+ tracy = originTracy
+end
+
+local function disable()
+ tracy = {
+ ZoneBeginN = function () end,
+ ZoneEnd = function () end,
+ }
+end
+
+return {
+ enable = enable,
+ disable = disable,
+}
diff --git a/test.lua b/test.lua
index ed8d8dfc..5563e550 100644
--- a/test.lua
+++ b/test.lua
@@ -18,6 +18,7 @@ log.debug('测试开始')
ac = {}
--dofile((ROOT / 'build_package.lua'):string())
+require 'tracy' .enable()
local function loadAllLibs()
assert(require 'bee.filesystem')