summaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
Diffstat (limited to 'server/src')
-rw-r--r--server/src/core/diagnostics.lua30
-rw-r--r--server/src/vm/source.lua4
2 files changed, 19 insertions, 15 deletions
diff --git a/server/src/core/diagnostics.lua b/server/src/core/diagnostics.lua
index 447fb224..5f2e03e1 100644
--- a/server/src/core/diagnostics.lua
+++ b/server/src/core/diagnostics.lua
@@ -102,8 +102,8 @@ local function isContainPos(obj, start, finish)
end
local function isInString(vm, start, finish)
- for _, source in ipairs(vm.results.strings) do
- if isContainPos(source, start, finish) then
+ for _, source in ipairs(vm.sources) do
+ if source:getType() == 'string' and isContainPos(source, start, finish) then
return true
end
end
@@ -269,20 +269,20 @@ return function (vm, lines, uri)
}
end)
-- 只有空格与制表符的行,以及后置空格
- --session:doDiagnostics(session.searchSpaces, 'trailing-space', function --(message)
- -- return {
- -- level = DiagnosticSeverity.Hint,
- -- message = message,
- -- }
- --end)
+ session:doDiagnostics(session.searchSpaces, 'trailing-space', function (message)
+ return {
+ level = DiagnosticSeverity.Hint,
+ message = message,
+ }
+ end)
-- 重定义局部变量
- --session:doDiagnostics(session.searchRedefinition, 'redefined-local', --function (key, related)
- -- return {
- -- level = DiagnosticSeverity.Information,
- -- message = lang.script('DIAG_REDEFINED_LOCAL', key),
- -- related = related,
- -- }
- --end)
+ session:doDiagnostics(session.searchRedefinition, 'redefined-local', function (key, related)
+ return {
+ level = DiagnosticSeverity.Information,
+ message = lang.script('DIAG_REDEFINED_LOCAL', key),
+ related = related,
+ }
+ end)
-- 以括号开始的一行(可能被误解析为了上一行的call)
--session:doDiagnostics(session.searchNewLineCall, 'newline-call', function ()
-- return {
diff --git a/server/src/vm/source.lua b/server/src/vm/source.lua
index 6685b95f..3006fdc9 100644
--- a/server/src/vm/source.lua
+++ b/server/src/vm/source.lua
@@ -70,6 +70,10 @@ function mt:getName()
return self[1]
end
+function mt:getType()
+ return self.type
+end
+
return function (source)
if source._hasInstant then
return false