Fix #47
This commit is contained in:
@@ -109,11 +109,10 @@ entry.get_word = function(self)
|
||||
end
|
||||
elseif misc.safe(self.completion_item.insertText) then
|
||||
word = str.trim(self.completion_item.insertText)
|
||||
if self.completion_item.insertTextFormat == types.lsp.InsertTextFormat.Snippet then
|
||||
word = str.get_word(word)
|
||||
end
|
||||
else
|
||||
word = str.trim(self.completion_item.label)
|
||||
word = str.get_word(word, '')
|
||||
end
|
||||
return word
|
||||
end)
|
||||
|
||||
@@ -243,7 +243,6 @@ describe('entry', function()
|
||||
-- press g
|
||||
state.input('$')
|
||||
local e = entry.new(state.manual(), state.source(), {
|
||||
detail = '\\Nico_URLConf',
|
||||
kind = 6,
|
||||
label = '$this',
|
||||
sortText = '$this',
|
||||
@@ -264,4 +263,19 @@ describe('entry', function()
|
||||
assert.are.equal(e:get_vim_item(e:get_offset()).word, '$this')
|
||||
assert.are.equal(e:get_filter_text(), '$this')
|
||||
end)
|
||||
|
||||
it('[#47] word should not contain \\n character', function()
|
||||
local state = spec.state('', 1, 1)
|
||||
|
||||
-- press g
|
||||
state.input('_')
|
||||
local e = entry.new(state.manual(), state.source(), {
|
||||
kind = 6,
|
||||
label = '__init__',
|
||||
insertTextFormat = 1,
|
||||
insertText = '__init__(self) -> None:\n pass',
|
||||
})
|
||||
assert.are.equal(e:get_vim_item(e:get_offset()).word, '__init__')
|
||||
assert.are.equal(e:get_filter_text(), '__init__')
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user