diff options
Diffstat (limited to 'server-beta')
-rw-r--r-- | server-beta/src/core/diagnostics/ambiguity-1.lua | 1 | ||||
-rw-r--r-- | server-beta/src/core/diagnostics/init.lua | 7 | ||||
-rw-r--r-- | server-beta/src/core/diagnostics/undefined-global.lua | 6 | ||||
-rw-r--r-- | server-beta/src/provider/diagnostic.lua | 3 | ||||
-rw-r--r-- | server-beta/src/workspace/workspace.lua | 4 |
5 files changed, 17 insertions, 4 deletions
diff --git a/server-beta/src/core/diagnostics/ambiguity-1.lua b/server-beta/src/core/diagnostics/ambiguity-1.lua index 1ebb0d8a..37815fb5 100644 --- a/server-beta/src/core/diagnostics/ambiguity-1.lua +++ b/server-beta/src/core/diagnostics/ambiguity-1.lua @@ -57,7 +57,6 @@ return function (uri, callback) and second.type ~= 'unary' and not first.op and literalMap[second[1].type] - and not literalMap[second[2].type] then callback { start = source.start, diff --git a/server-beta/src/core/diagnostics/init.lua b/server-beta/src/core/diagnostics/init.lua index 2972694d..2724387d 100644 --- a/server-beta/src/core/diagnostics/init.lua +++ b/server-beta/src/core/diagnostics/init.lua @@ -1,6 +1,7 @@ local files = require 'files' local define = require 'proto.define' local config = require 'config' +local await = require 'await' local function check(uri, name, level, results) if config.config.diagnostics.disable[name] then @@ -8,11 +9,17 @@ local function check(uri, name, level, results) end level = config.config.diagnostics.severity[name] or level local severity = define.DiagnosticSeverity[level] + local clock = os.clock() require('core.diagnostics.' .. name)(uri, function (result) result.level = severity or result.level result.code = name results[#results+1] = result end, name) + local passed = os.clock() - clock + if passed >= 0.1 then + log.warn(('Diagnostics [%s] @ [%s] takes [%.3f] sec!'):format(name, uri, passed)) + await.delay() + end end return function (uri) diff --git a/server-beta/src/core/diagnostics/undefined-global.lua b/server-beta/src/core/diagnostics/undefined-global.lua index 8476df61..586a9955 100644 --- a/server-beta/src/core/diagnostics/undefined-global.lua +++ b/server-beta/src/core/diagnostics/undefined-global.lua @@ -44,14 +44,14 @@ return function (uri, callback) end if info.mode == 'get' and not hasSet[source] then local message - local otherVersion = library.other[key] - local customVersion = library.custom[key] + local otherVersion = library.other[skey] + local customVersion = library.custom[skey] if otherVersion then message = ('%s(%s)'):format(message, lang.script('DIAG_DEFINED_VERSION', table.concat(otherVersion, '/'), config.config.runtime.version)) elseif customVersion then message = ('%s(%s)'):format(message, lang.script('DIAG_DEFINED_CUSTOM', table.concat(customVersion, '/'))) else - message = lang.script('DIAG_UNDEF_GLOBAL', info.key) + message = lang.script('DIAG_UNDEF_GLOBAL', skey) end callback { start = source.start, diff --git a/server-beta/src/provider/diagnostic.lua b/server-beta/src/provider/diagnostic.lua index d7d4be1e..ba9f1caa 100644 --- a/server-beta/src/provider/diagnostic.lua +++ b/server-beta/src/provider/diagnostic.lua @@ -167,6 +167,7 @@ function m.refresh(uri) if myVersion ~= m.version then return end + local clock = os.clock() if uri then m.doDiagnostic(uri) end @@ -179,6 +180,8 @@ function m.refresh(uri) end end end + local passed = os.clock() - clock + log.info(('Finish diagnostics, takes [%.3f] sec.'):format(passed)) end) end diff --git a/server-beta/src/workspace/workspace.lua b/server-beta/src/workspace/workspace.lua index 67f4f875..b335c51a 100644 --- a/server-beta/src/workspace/workspace.lua +++ b/server-beta/src/workspace/workspace.lua @@ -18,6 +18,10 @@ function m.init(name, uri) m.name = name m.uri = uri m.path = furi.decode(uri) + log.info('Workspace inited: ', uri) + local logPath = ROOT / 'log' / (uri:gsub('[/:]+', '_') .. '.log') + log.info('Log path: ', logPath) + log.init(ROOT, logPath) end --- 创建排除文件匹配器 |