Skip to content

Commit

Permalink
fix(completion): remove logic causing wrong text edits
Browse files Browse the repository at this point in the history
fixes #2762

after analysis in #2762 (comment)
  • Loading branch information
max397574 authored and sumneko committed Sep 10, 2024
1 parent e87d7d6 commit 7a1430b
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions script/core/completion/completion.lua
Original file line number Diff line number Diff line change
Expand Up @@ -457,19 +457,8 @@ local function checkFieldFromFieldToIndex(state, name, src, parent, word, startP
name = ('%q'):format(name)
end
local textEdit, additionalTextEdits
local startOffset = guide.positionToOffset(state, startPos)
local offset = guide.positionToOffset(state, position)
local wordStartOffset
if word == '' then
wordStartOffset = state.lua:match('()%S', startOffset + 1)
if wordStartOffset then
wordStartOffset = wordStartOffset - 1
else
wordStartOffset = offset
end
else
wordStartOffset = offset - #word
end
local wordStartOffset = offset - #word
local wordStartPos = guide.offsetToPosition(state, wordStartOffset)
local newText = ('[%s]'):format(name)
textEdit = {
Expand Down

0 comments on commit 7a1430b

Please sign in to comment.