Steps to reproduce:
- Install micro and run
plugin install snippets command.
- Open any .go file (e. g.
micro main.go) and put the following text (make sure lf is indented with a tab):
package main
func main() {
lf
}
- Place cursor right to
lf and run the snippetinsert command (or use Alt-S).
Result: it says Unknown snippet "lf"
Expected behavior: lf expands to log.Printf("%s", var)
I looked through the snippets.lua code. It seems that the CursorWord function is problematic. It looks back for a word until it encounters a space (literally: if (r == " ") then) or beginning of the line. But in go they use tabs for indents. So it captures \tlf as a snippet name.
I think it should check for any white space, not just "space".
Steps to reproduce:
plugin install snippetscommand.micro main.go) and put the following text (make surelfis indented with a tab):lfand run thesnippetinsertcommand (or useAlt-S).Result: it says
Unknown snippet "lf"Expected behavior:
lfexpands tolog.Printf("%s", var)I looked through the
snippets.luacode. It seems that theCursorWordfunction is problematic. It looks back for a word until it encounters a space (literally:if (r == " ") then) or beginning of the line. But in go they use tabs for indents. So it captures\tlfas a snippet name.I think it should check for any white space, not just "space".