Fix #47
This commit is contained in:
@@ -109,11 +109,10 @@ entry.get_word = function(self)
|
|||||||
end
|
end
|
||||||
elseif misc.safe(self.completion_item.insertText) then
|
elseif misc.safe(self.completion_item.insertText) then
|
||||||
word = str.trim(self.completion_item.insertText)
|
word = str.trim(self.completion_item.insertText)
|
||||||
if self.completion_item.insertTextFormat == types.lsp.InsertTextFormat.Snippet then
|
|
||||||
word = str.get_word(word)
|
word = str.get_word(word)
|
||||||
end
|
|
||||||
else
|
else
|
||||||
word = str.trim(self.completion_item.label)
|
word = str.trim(self.completion_item.label)
|
||||||
|
word = str.get_word(word, '')
|
||||||
end
|
end
|
||||||
return word
|
return word
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -243,7 +243,6 @@ describe('entry', function()
|
|||||||
-- press g
|
-- press g
|
||||||
state.input('$')
|
state.input('$')
|
||||||
local e = entry.new(state.manual(), state.source(), {
|
local e = entry.new(state.manual(), state.source(), {
|
||||||
detail = '\\Nico_URLConf',
|
|
||||||
kind = 6,
|
kind = 6,
|
||||||
label = '$this',
|
label = '$this',
|
||||||
sortText = '$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_vim_item(e:get_offset()).word, '$this')
|
||||||
assert.are.equal(e:get_filter_text(), '$this')
|
assert.are.equal(e:get_filter_text(), '$this')
|
||||||
end)
|
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)
|
end)
|
||||||
|
|||||||
Reference in New Issue
Block a user