From 9c51d20d0ac570e65920e030e78dd7d1759ecae3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 6 Apr 2022 20:36:39 +0800 Subject: pcall code_format --- main.lua | 8 ++++++++ script/provider/formatting.lua | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) 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/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' -- cgit v1.2.3