summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-11-03 11:24:19 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-11-03 11:24:19 +0800
commitf1ced65b41bd764c9656a9523ddfd3d43aa2cfb1 (patch)
tree75d03477d30b4c6f9f0376aaa3ce265ec3a4a96e
parentaddc4a466252547b163ab37efd1344bfe0b48b9c (diff)
downloadlua-language-server-f1ced65b41bd764c9656a9523ddfd3d43aa2cfb1.zip
fix #780
-rw-r--r--changelog.md1
-rw-r--r--script/core/completion.lua3
-rw-r--r--test/completion/common.lua10
3 files changed, 13 insertions, 1 deletions
diff --git a/changelog.md b/changelog.md
index 2a57add2..8dee9bd0 100644
--- a/changelog.md
+++ b/changelog.md
@@ -15,6 +15,7 @@
* `CHG` skip huge files (>= 10 MB)
* `FIX` [#777](https://github.com/sumneko/lua-language-server/issues/777)
* `FIX` [#778](https://github.com/sumneko/lua-language-server/issues/778)
+* `FIX` [#780](https://github.com/sumneko/lua-language-server/issues/780)
## 2.4.7
`2021-10-27`
diff --git a/script/core/completion.lua b/script/core/completion.lua
index e30c9c91..21fd69bd 100644
--- a/script/core/completion.lua
+++ b/script/core/completion.lua
@@ -718,7 +718,8 @@ end
local function isInString(state, position)
return guide.eachSourceContain(state.ast, position, function (source)
- if source.type == 'string' then
+ if source.type == 'string'
+ and source.start < position then
return true
end
end)
diff --git a/test/completion/common.lua b/test/completion/common.lua
index 4cfd1872..73c6d7e6 100644
--- a/test/completion/common.lua
+++ b/test/completion/common.lua
@@ -2680,3 +2680,13 @@ end
kind = define.CompletionItemKind.Variable,
}
}
+
+TEST [[
+utf<??>'xxx'
+]]
+{
+ [1] = {
+ label = 'utf8',
+ kind = define.CompletionItemKind.Field,
+ }
+}