iamcco / coc-angular

Angular Language Service coc extension for (neo)vim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Completion cursor placement not behaving as expected

ayazhafiz opened this issue · comments

commented

I have been unable to reproduce the expected cursor completion behavior implemented at

/**
* ((click)) => (click)="|"
*/
case '(':
if (item.textEdit) {
const { start, end } = item.textEdit.range
item.textEdit.range.start = Position.create(start.line, start.character - 1)
if (line[nextCharCol] === ')') {
item.textEdit.range.end = Position.create(end.line, end.character + 1)
}
if (item.textEdit.newText.startsWith('(')) {
item.textEdit.newText = `${item.textEdit.newText}`
} else {
item.textEdit.newText = `(${item.textEdit.newText})`
}
if (line[nextCharCol] !== '=' && line[colnr] !== '=') {
item.insertTextFormat = InsertTextFormat.Snippet
item.textEdit.newText = `${item.textEdit.newText}="\${1}"\${0}`
}
}

For example, completing click in the following template

<div (clic|)></div>

Currently gives

<div (click=""|)></div>

on my machine, with only coc and coc-angular enabled as packages.

Could anyone else verify that they are experiencing the same behavior? If this is in fact not the expected behavior, I would be happy to submit a patch for this.

I can reproduce the issue. it only works as expected that type start from (.

commented

Okay, I will attempt a patch. Do you have insight on the best way to develop this extension with CoC? Just install in CoC from the local branch of this extension?

The easy way to test local extension is to add the extension directory to vim's runtimepath, coc will auto load extension from runtimepath.