summaryrefslogtreecommitdiff
path: root/script/parser/guide.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-06-27 20:46:58 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-06-27 20:46:58 +0800
commitf9b3b65445e86ae0e9c1026ea1fac44bf5d884da (patch)
tree7ab3d3c5c78bd35631c89ff067376675b7d736e6 /script/parser/guide.lua
parentd60ff4632d81d4357118f724b61ff5d0c6943ac5 (diff)
downloadlua-language-server-f9b3b65445e86ae0e9c1026ea1fac44bf5d884da.zip
#1240 use faster `isInString`
Diffstat (limited to 'script/parser/guide.lua')
-rw-r--r--script/parser/guide.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/script/parser/guide.lua b/script/parser/guide.lua
index a91a6f68..05827398 100644
--- a/script/parser/guide.lua
+++ b/script/parser/guide.lua
@@ -1231,6 +1231,15 @@ function m.isInString(ast, position)
end)
end
+function m.isInComment(ast, offset)
+ for _, com in ipairs(ast.state.comms) do
+ if offset >= com.start and offset <= com.finish then
+ return true
+ end
+ end
+ return false
+end
+
function m.isOOP(source)
if source.type == 'setmethod'
or source.type == 'getmethod' then