summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--script-beta/brave/work.lua2
-rw-r--r--script-beta/jsonrpc.lua1
-rw-r--r--script-beta/parser/calcline.lua5
-rw-r--r--script-beta/parser/lines.lua1
-rw-r--r--script-beta/provider/provider.lua3
5 files changed, 7 insertions, 5 deletions
diff --git a/script-beta/brave/work.lua b/script-beta/brave/work.lua
index fe86807f..bee159d6 100644
--- a/script-beta/brave/work.lua
+++ b/script-beta/brave/work.lua
@@ -1,11 +1,11 @@
local brave = require 'brave.brave'
-local jsonrpc = require 'jsonrpc'
local parser = require 'parser'
local fs = require 'bee.filesystem'
local furi = require 'file-uri'
local util = require 'utility'
brave.on('loadProto', function ()
+ local jsonrpc = require 'jsonrpc'
while true do
local proto = jsonrpc.decode(io.read, log.error)
--log.debug('loaded proto', proto.method)
diff --git a/script-beta/jsonrpc.lua b/script-beta/jsonrpc.lua
index 46039f48..4dda6fb0 100644
--- a/script-beta/jsonrpc.lua
+++ b/script-beta/jsonrpc.lua
@@ -1,6 +1,7 @@
local json = require 'json'
local pcall = pcall
local tonumber = tonumber
+local log = require 'brave.log'
_ENV = nil
diff --git a/script-beta/parser/calcline.lua b/script-beta/parser/calcline.lua
index 26f475d9..2e944167 100644
--- a/script-beta/parser/calcline.lua
+++ b/script-beta/parser/calcline.lua
@@ -1,4 +1,5 @@
-local m = require 'lpeglabel'
+local m = require 'lpeglabel'
+local util = require 'utility'
local row
local fl
@@ -19,7 +20,7 @@ local function rowcol_utf8(str, n)
row = 1
fl = 1
ROWCOL:match(str:sub(1, n))
- return row, utf8.len(str, fl, n)
+ return row, util.utf8Len(str, fl, n)
end
local function position(str, _row, _col)
diff --git a/script-beta/parser/lines.lua b/script-beta/parser/lines.lua
index c7961d13..ee6b4f41 100644
--- a/script-beta/parser/lines.lua
+++ b/script-beta/parser/lines.lua
@@ -1,5 +1,4 @@
local m = require 'lpeglabel'
-local utf8Len = utf8.len
_ENV = nil
diff --git a/script-beta/provider/provider.lua b/script-beta/provider/provider.lua
index e4ba8e5c..656ff278 100644
--- a/script-beta/provider/provider.lua
+++ b/script-beta/provider/provider.lua
@@ -12,6 +12,7 @@ local markdown = require 'provider.markdown'
local client = require 'provider.client'
local furi = require 'file-uri'
local pub = require 'pub'
+local fs = require 'bee.filesystem'
local function updateConfig()
local configs = proto.awaitRequest('workspace/configuration', {
@@ -134,7 +135,7 @@ proto.on('workspace/didChangeWatchedFiles', function (params)
files.setText(uri, pub.awaitTask('loadFile', uri))
else
local path = furi.decode(uri)
- local filename = path:filename():string()
+ local filename = fs.path(path):filename():string()
-- 排除类文件发生更改需要重新扫描
if files.eq(filename, '.gitignore')
or files.eq(filename, '.gitmodules') then