diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-04-06 20:36:39 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-04-06 20:36:39 +0800 |
commit | 9c51d20d0ac570e65920e030e78dd7d1759ecae3 (patch) | |
tree | dde78361e9786aa1eb9ba4245b4cac5349a1bd3f | |
parent | c78478e993df1c1a95ca3ae972e40238016ea796 (diff) | |
download | lua-language-server-9c51d20d0ac570e65920e030e78dd7d1759ecae3.zip |
pcall code_format
-rw-r--r-- | main.lua | 8 | ||||
-rw-r--r-- | script/provider/formatting.lua | 6 |
2 files changed, 13 insertions, 1 deletions
@@ -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/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' |