Coder Social home page Coder Social logo

coc-snippets's Introduction

Neoclide

Neoclide is a rework of Nyaovim, the reason is I want it have best user experience.

Neoclide is an editor built with web technologies while emebed with neovim.

Neoclide is in early development, which means it could break easily, and you should not take it seriously.

Since I use Mac only, something could break on other platform, I need your help!

What have done

  • Global session save and restore
  • Fixed copy/paste behaviour
  • Fixed drag and click position calculate
  • Fixed trigger of VimLeave event
  • Background transparent support
  • Improved input method support
  • Improved cursor support
  • Accessable editor state object
  • Automatic resize handler, no screen blink

How to use

Since it's in early age, no prebuild currently avaiable, you have to use it from souce code.

  • Clone this repository

  • Run following commands to install dependencies and build code

    npm run dep
    npm run build
    
  • To start the app, use:

    npm run app
    

LICENSE

Copyright 2016 [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

coc-snippets's People

Contributors

avi-d-coder avatar chemzqm avatar dependabot[bot] avatar ehowe avatar fannheyward avatar heftig avatar kebhr avatar kevinhwang91 avatar mvcouwen avatar pmizio avatar rmzg avatar unrealapex avatar wfxr avatar whyreal avatar wodesuck avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

coc-snippets's Issues

Ultisnips snippet with "Regular expression" snippet options are not displayed in PUM, but work

UltiSnips snippets with "regular expression (r)" option are not displayed in the PUM. They are expanded 100% correctly (including jumping to placeholders).

Example snippet:

 snippet "(\S+)\.det" "<elements>.detect do |<element>| <block> end" r                                                              `!p snip.rv=match.group(1)`.detect do |${1}|
  $0
end
endsnippet

If I expand this in an empty line nothing happens, which is correct.
If I expand this after e.g. [], I can get items in the PUM from other sources, like buffer, but not from snippet source. But, when expanding the item, it works fine.

Seems like not high priority bug because I can work with it fine, it's just display issue.

From UltiSnips docs:

r Regular expression - With this option, the tab trigger is expected to
be a python regular expression. The snippet is expanded if the recently
typed characters match the regular expression. Note: The regular
expression MUST be quoted (or surrounded with another character) like a
multi-word tab trigger (see above) whether it has spaces or not. A
resulting match is passed to any python code blocks in the snippet
definition as the local variable "match".

Clean up temp files

When loaded, this extension writes a 25kB file named coc-ultisnips-${process.pid}.py into the tmpdir. These are never cleaned up, potentially taking hundreds of MB.

snippets not loaded for filetype typescript/typescript.tsx

I use yats.vim for typescript & tsx syntax file, it sets *.tsx file as typescript.tsx, and *.ts file as typescript

And I have SirVer/ultisnips honza/vim-snippets installed.

Issues of using coc for snippets completion:

  1. For *.tsx file, it seems only all.snippets from vim-snippets is loaded.
  2. For *.ts file, typescript.snippets is loaded.(which extends javascript)
  3. Neither of them load library snippets, for example: javascript-jasmine-arrow.snippets

If I use SirVer/ultisnips, all of the snippets mentioned above are loaded for both ts and tsx file.

I can see from :CocInfo that all the snippets are loaded.

Stop $0 does not work

snipmate

snippet imp
	import ${0:Data.Text}

Expected behavior
Selected Data.Text instead the cursor is before Data.Text

Changing the snippet fixes the problem.

snippet imp
	import ${1:Data.Text}

Can coc-snippets support snipmate extends

As title, can coc-snippet support extends command when using snipmate snippets.

In the past, i'v use neosnippet, it's include command is really useful.

Like i have a folder named angular with three file in it: html.snip, flex-layout.snip, material.snip

If i want to use all of them for html filetype i just have to use include command like this in my html.snip file. Like this:

include angular/html.snip
include angular/flex-layout.snip
include angular/material.snip

But since switch to coc.nvim i'v to use snipmate cause coc-snippets doesn't support neosnippet. So i'v to change all of my snips to snipmate format.

But then i'v found out the extends command of snipmate doesn't work. All i'v to do is setting it by using "snippet.extends" in coc-settings.json.

It work well but the naming is kind of annoying.

I'v to name my files like: angularhtml, angularmaterial, angularflexlayout...

With the - in name, it wont work.

Is there any solution for this. If we can not split snippets to folders then snippet names at least should have '-' or '_'. I think it's easier to organize our snippet with a glance...

❤️ Thank you for great plugin and extentions.

How can I stop snippets activating within snippets?

For example, I'm trying to use the 'meth' snippet in Golang which expands to

func (receiver type) name(params) type {

}

When I'm trying to change the receiver placeholder to, say, 's'. When I press tab, it expands to sha256 and imports sha256 instead of moving to the next placeholder.

output

How can I stop this from happening? Thank you.

Is visual placeholder working?

I do vmap <tab> <Plug>(coc-snippets-expand), and select text visually, and then trigger the snippet. But visual placeholder is empty.

Expanding snippets

I'm trying to set some key mapping to expand all available snippets for current file language.
Pretty much what the readme file suggest:
imap <C-l> <Plug>(coc-snippets-expand)
The problem with this is that it's only working if cursor is next to some letter. If it's following space or new line nothing will happen until you start typing. Is there any way to tweak this to show all available snippets even if cursor is at the beginning of new line?

Where do I store snippets?

I've tried looking in :help :coc, the wiki, and this readme but it doesn't tell you anywhere where to store them.

Where is the correct place?
Thanks!

README uses $VIMCONFG

I'm not sure if this was a mistake or not, but the README.md specifies the following:

$VIMCONFG/coc/ultisnips

which from what I can tell of the source is intended to be:

$VIMCONFIG/coc/ultisnips

Sorry if I'm mistaken, and thanks for all your hard work!

Help set up a tab key

I want to press the key to show me a list with auto-completion and snippet. When you click on the , it switched to the next line of auto-completion (snippet) and the key was used to confirm the required confirmation line. If a snippet is selected, then when you click on the it will switch to the next field for editing.

  • neosnippet
  • cquery (autocomplete for c/c++)

If these extensions do not fit, I can install other

Add command/function for anonymous snippets

An anonymous snippet (like in Ultisnips) is a snippet that is looked up in a file, but instead passed to the command as an argument. This will allow other plugins to generate the snippet at runtime and use coc-snippets as the frontend for filling it.

Uncaught exception in ultisnipsParser.js

[vim-node-coc]: Uncaught exception: Error: multiple line pattern not supported
    at Object.convertRegex (/home/xxx/.config/coc/extensions/node_modules/coc-snippets/lib/util.js:133:15)
    at body.replace (/home/xxx/.config/coc/extensions/node_modules/coc-snippets/lib/ultisnipsParser.js:64:40)
    at String.replace (<anonymous>)
    at Interface.rl.on.line (/home/xxx/.config/coc/extensions/node_modules/coc-snippets/lib/ultisnipsParser.js:63:29)
    at Interface.emit (events.js:197:13)
    at Interface._onLine (readline.js:308:10)
    at Interface._normalWrite (readline.js:449:12)
    at ReadStream.ondata (readline.js:165:10)
    at ReadStream.emit (events.js:197:13)
    at addChunk (_stream_readable.js:288:12)
[vim-node-coc]: Uncaught exception: Error: multiple line pattern not supported
    at Object.convertRegex (/home/xxx/.config/coc/extensions/node_modules/coc-snippets/lib/util.js:133:15)
    at body.replace (/home/xxx/.config/coc/extensions/node_modules/coc-snippets/lib/ultisnipsParser.js:64:40)
    at String.replace (<anonymous>)
    at Interface.rl.on.line (/home/xxx/.config/coc/extensions/node_modules/coc-snippets/lib/ultisnipsParser.js:63:29)
    at Interface.emit (events.js:197:13)
    at Interface._onLine (readline.js:308:10)
    at Interface._normalWrite (readline.js:449:12)
    at ReadStream.ondata (readline.js:165:10)
    at ReadStream.emit (events.js:197:13)
    at addChunk (_stream_readable.js:288:12)

:CocCommand snippets.editSnippets opens wrong file on windows+WSL

Hi, I use gvim.exe but I always start XLaunch, which essentially provides an X server, and I also have WSL. I don't exactly know how all of the pieces fit together, as it is quite a mess, but I do know this: when I type :CocCommand snippets.editSnippets, it opens "AppData/Local/coc/ultisnips/*.snippets" rather than "C:/Users/myuser/coc/ultisnips".

My $VIMCONFIG is "C:\Users\myuser/vimfiles" and I have `snippets.ultisnippets.directories = "C:/Users/myuser/vimfiles/coc/ultisnips/", but the editSnippets command still opens the appdata location.

Hopefully, you can spot something. Thanks,

yarn build/install fails

:CocInstall https://github.com/neoclide/coc-snippets.git also fails.

yarn install v1.13.0
[1/5] Validating package.json...
warning [email protected]: The engine "coc" appears to be invalid.
[2/5] Resolving packages...
success Already up-to-date.
$ yarn clean && yarn build
yarn run v1.13.0
$ rimraf lib
Done in 0.16s.
yarn run v1.13.0
$ tsc -p tsconfig.json
src/index.ts:159:6 - error TS2345: Argument of type '{ silent: boolean; sync: boolean; cancel: boolean; }' is not assignable to parameter of type 'boolean'.

159   }, { silent: true, sync: true, cancel: false }))
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/index.ts:172:6 - error TS2345: Argument of type '{ silent: boolean; sync: boolean; cancel: boolean; }' is not assignable to parameter of type 'boolean'.

172   }, { silent: true, sync: true, cancel: false }))
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/index.ts:205:6 - error TS2345: Argument of type '{ silent: boolean; sync: boolean; cancel: boolean; }' is not assignable to parameter of type 'boolean'.

205   }, { silent: true, sync: false, cancel: true }))
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Found 3 errors.

error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

Not handling extends

Hey,

I run my nvim setup with vim-polyglot which sets typescript => typescript.jsx and javascript => javascript.jsx. According to :h g:coc_filetype_map@en these filetypes get mapped to javascriptreact or typescriptreact.

My javascript.snippets file extends react.snippets (which holds specific react snippets) but I cannot for the life of me get them to load. I've tried the following:

  • Create a javascriptreact.snippets file that extends javascript.snippets
  • Create a javascriptreact.snippets file that extends javascript.snippets and react.snippets
  • Create a javascript.jsx.snippets file that extends javascript.snippets
  • Create a javascript.jsx.snippets file that extends javascript.snippets and react.snippets
  • "snippets.extends": { "javascript": ["react"] }
  • "snippets.extends": { "javascriptreact": ["react"] }
  • "snippets.extends": { "javascriptreact": ["javascript", "react"] }
  • "snippets.extends": { "javascript.jsx": ["react"] }
  • "snippets.extends": { "javascript.jsx": ["javascript", "react"] }

As soon as I run :set ft=javascript they load fine (but without jsx support).

How am I supposed to get this to work properly?

My snippets files are available here: https://github.com/sQVe/dotfiles/tree/kodama/config/coc/ultisnips

some UltiSnip go snippet expand error

Plug 'honza/vim-snippets'

imap <C-l> <Plug>(coc-snippets-expand)

Open main.go, input any snippet prefix, for example func or if, then C-l to expands:

func name(params)typetype {
         |
}

there is two types.

if conditioncondition{
         |
}

there is two conditions. C-j jumps to type, only first part will be selected.

1

Can't get <tab> mapping from Readme to work for snippet expansion

Hello,

I'm trying the "Make used for trigger completion, completion confirm, snippet expand and jump like VSCode." example from the readme, but the snippet expansion odes not work for me.
Triggering completion etc. work fine, only the call with coc#rpc#request('doKeymap', ['snippets-expand-jump','']) does not work. If I replace it with "teststring", that gets inserted. So the correct action gets called in the mapping.
Also, if instead of pressing I do <c-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump','']) <cr>, the snippet gets expanded as expected.
I have another mapping, imap <c-j> <Plug>(coc-snippets-expand-jump), which expands the snippet completely as expected.

Do you have any ideas?
Unfortunately, even with NVIM_COC_LOG_LEVEL=debug snippet completion seems to not be logged. CocCommand workspace.showOutput snippets is also empty.

It happens even if CoC is the only plugin, and with minimal vim config.

verbose imap <tab>:

i  <Tab>       * pumvisible() ? coc#_select_confirm() : coc#expandableOrJumpable() ? coc#rpc#request('doKeymap', ['snippets-expand-jump','']) : <SNR>3_check_back_space() ? "\<Tab>" : coc#refresh()

I also have let g:coc_snippet_next = "<tab>" set.

## versions

vim version: VIM - Vi IMproved 8.1 (2018 May 18, compiled Feb 22 2019 12:55:04)
node version: v10.14.2
coc.nvim version: 0.0.65-f7874ec7d7
term: dumb
platform: linux

## Error messages

## Output channel: snippets

Snippets starting with special characters not triggered.

I'm having some js snippets, and some of them start with special characters, eg: =. The window don't even appear, and i can't trigger it.
Example of ultisnips snippet:

snippet => "Arrow function"
(${1:args}) => {
	return $3;
}${2:;}
endsnippet

Also, I have a question to ask. If we have a snippet that has multiple parts like the above, how we can auto navigate to the next one like in ultisnips? (I used to do that with tab key)

Thank you!

Vim hangs when expanding some snippets

Description

When using coc-snippets-expand to expand some snippets which only contain one placeholder, vim will hang for a long time. When it completes, the snippet will contain a 0 where the cursor was, in the middle of the snippet. E.g. co0nsole.log(); instead of console.log();, and the cursor will be positioned one character too far to the left.

I can't confirm for sure that the issue only happens with snippets with only one placeholder, but I haven't experienced the issue with other snippets. The snippets that I have tested where the issue occurs are cl, cd, ed, has and ret for javascript files, and ret and fut for python files. All of these contain ${0}, except for ret for javascript which contains ${0:result}.

Other snippets I've tested which contains ${0:something} doesn't trigger the issue, like ct, /** and jsonp for javascript and " for python. I've not experienced the issue with snippets that I've tested which contains more than one placeholder either, like fun and let for javascript and cl for python.

All of the mentioned snippets are from honza/vim-snippets. When using the completion menu to expand the snippet, the issue doesn't occur.

Steps to reproduce

  1. Create mini.vim:
set nocompatible
set runtimepath^=~/.vim/plugged/coc.nvim
set runtimepath^=~/.vim/plugged/vim-snippets
filetype plugin indent on
syntax on
set hidden
imap <C-l> <Plug>(coc-snippets-expand)
  1. Run vim -u mini.vim test.js
  2. Type cl
  3. Press Ctrl-L

CocInfo

## versions

vim version: VIM - Vi IMproved 8.1 (2018 May 18, compiled Jul  2 2019 20:06:04)
node version: v11.15.0
coc.nvim version: 0.0.72-4aee0cab77
term: dumb
platform: linux

## Messages
Messages maintainer: Bram Moolenaar <[email protected]>
1 change; before #2  0 seconds ago
1 line less; before #1  2 seconds ago
Already at oldest change
## Output channel: snippets

Features for 2.0

  • Context of snippet.
  • Load snipmate snippet.
  • Load VSCode snippets from folders contains snippets.
  • Standalone user snippets.
  • Completion and diagnostics support for snippets file.

Incompatible snippet shows up as an empty snippet

From vim-snippets haskell

ultisnips

snippet impq "Qualified import"
import qualified ${1:Data.Text} as ${0:`!p snip.rv = t[1].split(".")[-1]`}
endsnippet

snipmate

snippet impq
	import qualified ${1:Data.Text} as ${0:T}

Completing impq inserts nothing else.
Since the ultisnips snippet did not parse the snipmate one should be used.
If I rename the snipmate snippet I can use it, but the broken ultisnips snippet remains.

vim: "rpc error: undefined" on coc#expandable() etc.

Hello,

trying to use the new coc#expandable(), coc#jumpable() or coc#expandableOrJumpable() functions, I get [vim-node-rpc] rpc error: undefined.

What I have tried: completey uninstalling coc and reinstalling.

## versions                                                                                                                      
                                                                                                                                   
  vim version: VIM - Vi IMproved 8.1 (2018 May 18, compiled Feb 22 2019 12:55:04)                                                  
  node version: v8.9.0                                                                                                             
  coc.nvim version: 0.0.61                                                                                                         
  term: dumb                                                                                                                       
  platform: linux                                                                                                                  
                                                                                                                                   
  ## Error messages                                                                                                                
                                                                                                                                   
  ## Output channel: snippets

[Info 17:01:46] Loaded 0 snippets from...

snippet can't active.

use CocCommand workspace.showOutput snippets, show as below:
[Info 17:01:46] Loaded 0 snippets from: /home/MegaMewtwoY/.vim/bundle/vim-snippets/snippets/vhdl.snippets[Info 17:01:46] Loaded 0 snippets from: /home/MegaMewtwoY/.vim/bundle/vim-snippets/snippets/vim.snippets
[Info 17:01:46] Loaded 0 snippets from: /home/MegaMewtwoY/.vim/bundle/vim-snippets/snippets/vue.snippets[Info 17:01:46] Loaded 0 snippets from: /home/MegaMewtwoY/.vim/bundle/vim-snippets/snippets/xml.snippets
[Info 17:01:46] Loaded 0 snippets from: /home/MegaMewtwoY/.vim/bundle/vim-snippets/snippets/xslt.snippets[Info 17:01:46] Loaded 0 snippets from: /home/MegaMewtwoY/.vim/bundle/vim-snippets/snippets/yii-chtml.snippets[Info 17:01:46] Loaded 0 snippets from: /home/MegaMewtwoY/.vim/bundle/vim-snippets/snippets/yii.snippets
[Info 17:01:46] Loaded 0 snippets from: /home/MegaMewtwoY/.vim/bundle/vim-snippets/snippets/zsh.snippets

My vimrc:
Plug 'honza/vim-snippets'

conflict when i use php $var

This is my snippets

snippet ifuca "Desc" b
     <?php if (Yii::$app->user->can('${1:string}')): ?>

     <?php endif; ?>
endsnippet

---------------------------------- output like this

 <?php if (Yii::->user->can('string')): ?>

  <?php endif; ?>


```the result lose $app variable 

Wrongfully triggering snippet expand

I noticed today that some of my snippets where triggered even though I didn't manually expand them. It seems to happens if I try to go the the "next item" very quickly, before or at the same time as the completion menu appears.

I've recorded this gif demonstrating it (The last snippet expand is happening by itself):
Peek 2019-07-17 22-43

I'm unsure on when this was introduced as I'm currently on my summer vacation and do not code as much as I usually do.

Examples from ultisnips do not work

Not sure if these are cases of those "not possible to implement features":

  • Automatic reformat snippet after change of placeholder (can't support).
  • Format related snippet options, including t, s and m (can't support).
  • Snippet actions (can't support).

Example 1

From ultisnip doc:
------------------- SNIP -------------------
snippet wow
${1:Text}!p snip.rv = (75-2*len(t[1]))*' '+t[1].upper()
endsnippet
------------------- SNAP -------------------
wow<tab>Hello World ->
Hello World HELLO WORLD

but with coc-snippet:
Hello World TEXT

Example 2

------------------- SNIP -------------------
snippet title "Title transformation"
${1:a text}
${1/\w+\s*/\u$0/}
endsnippet
------------------- SNAP -------------------
title<tab>big small ->
big small
Big small

but with coc-snippet:
\ubig small

Old UltiSnip snippets not being provided

For snippets I had

Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'

:CocInstall coc-ultisnips

I changed that to

Plug 'honza/vim-snippets'

:CocUninstall coc-ultisnips
:CocInstall coc-snippets

The ~/.vim/plugged/vim-snippets provides the UltiSnips directory, but coc-snippets isn't providing any snippets by itself.

Error loading extension: coc.nvim/lib/util not found

When entering neovim:

Error loading extension from /home/xxx/.config/coc/extensions/node_modules/coc-snippets/lib/index.js: Cannot find module 'coc.nvim/lib/util'

coc is installed with:

Plug 'neoclide/coc.nvim', {'tag': '*', 'do': 'yarn install'}

And:
:CocInstall coc-snippets

CocInfo:

## versions

vim version: NVIM v0.3.4
node version: v11.10.0
coc.nvim version: 0.0.56
term: tmux-256color
platform: linux

## Error messages

visual snippet trigger after (

I use coc-snippet with visual snippet : html.json
I don't trigger after '('
With ultsnips, I've option : Position check of trigger option, including b, w and i

Is it possible to add option in json ?

New releases should be kept in sync with coc.nvim

The currently released version of coc-snippets (1.0.5) does not work with the currently released version of coc.nvim (0.0.49). On startup, coc-snippets generates the following error:

[coc.nvim] Error on active extension coc-snippets: coc_nvim_1.workspace.createMru is not function

This seems to be because createMru was only added after 0.0.49 was released (neoclide/coc.nvim@0ec7054).

Would it be possible to keep things in sync with released versions of coc.nvim in the future?

Class extends value undefined is not a constructor or null

Hi after install I got the error as title.

there's more error in CocOpenLog

2019-03-08T14:01:35.208 ERROR (pid:66437) [util-factoroy] - TypeError: Class extends value undefined is not a constructor or null
    at Object.<anonymous> (/Users/xueg/.config/coc/extensions/node_modules/coc-snippets/lib/list/snippet.js:12:39)
    at Module._compile (/snapshot/coc.nvim/lib/util/factory.js:58:32)
    at Object.Module._extensions..js (module.js:644:10)
    at Module.load (module.js:552:32)
    at tryModuleLoad (module.js:495:12)
    at Function.Module._load (module.js:487:3)
    at Module.require (module.js:577:17)
    at Module.require (pkg/prelude/bootstrap.js:1159:31)
    at req (/snapshot/coc.nvim/lib/util/factory.js:37:21)
    at Object.<anonymous> (/Users/xueg/.config/coc/extensions/node_modules/coc-snippets/lib/index.js:9:43)
2019-03-08T14:01:43.137 ERROR (pid:67582) [util-factoroy] - TypeError: Class extends value undefined is not a constructor or null
    at Object.<anonymous> (/Users/xueg/.config/coc/extensions/node_modules/coc-snippets/lib/list/snippet.js:12:39)
    at Module._compile (/snapshot/coc.nvim/lib/util/factory.js:58:32)
    at Object.Module._extensions..js (module.js:644:10)
    at Module.load (module.js:552:32)
    at tryModuleLoad (module.js:495:12)
    at Function.Module._load (module.js:487:3)
    at Module.require (module.js:577:17)
    at Module.require (pkg/prelude/bootstrap.js:1159:31)
    at req (/snapshot/coc.nvim/lib/util/factory.js:37:21)
    at Object.<anonymous> (/Users/xueg/.config/coc/extensions/node_modules/coc-snippets/lib/index.js:9:43)

My node version is 10

Context snippet not working

Hi,

the context snippet below defines the math mode context within latex, s.t. relevant snippets are only auto-triggered in math mode (cf. norm below). While the below snippet code works within plain UltiSnips, context-sensitive snippets such as norm are triggered irrespective of the context with coc-snippets. Not sure whether it's an issue with coc-snippets or the context would have to be reformulated.

Many thanks in advance!

edit: context works also as intended when merely coc-ultisnips is installed

Context snippet:

global !p
texMathZones = ['texMathZone'+x for x in ['A', 'AS', 'B', 'BS', 'C', 'CS', 'D', 'DS', 'E', 'ES', 'F', 'FS', 'G', 'GS', 'H', 'HS', 'I', 'IS', 'J', 'JS', 'K', 'KS', 'L', 'LS', 'DS', 'V', 'W', 'X', 'Y', 'Z']]

texIgnoreMathZones = ['texMathText']
texMathZoneIds = vim.eval('map('+str(texMathZones)+", 'hlID(v:val)')")
texIgnoreMathZoneIds = vim.eval('map('+str(texIgnoreMathZones)+", 'hlID(v:val)')")

ignore = texIgnoreMathZoneIds[0]

def math():
    	synstackids = vim.eval("synstack(line('.'), col('.') - (col('.')>=2 ? 1 : 0))")
        try:
	        first = next(i for i in reversed(synstackids) if i in texIgnoreMathZoneIds or i in texMathZoneIds)
	        return first != ignore
        except StopIteration:
	        return False
endglobal

Norm snippet with context math():

context "math()"
snippet norm "norm" iA
\|$1\|$0
endsnippet

CocInfo:

## versions
vim version: NVIM v0.4.0-450-g2d50bf349
node version: v10.15.3
coc.nvim version: 0.0.64
term: screen-256color-bce
platform: linux
coc-snippets: 2.0.6

Snippets crashing when description is an array

Snippet expansion was crashing and I was getting the following error:

[coc.nvim] snippets complete error: TypeError: item.detail.replace is not a function

After some digging I found out that this error happens when description is an array. For example:

"LoremIpsum": {
  "prefix": "li",
  "body": [
    "Lorem Ipsum is simply dummy text of the printing and typesetting industry.",
    "Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book."
  ],
  "description": [
    "Lorem Ipsum is simply dummy text of the printing and typesetting industry.",
    "Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book."
  ]
},

This snippet works fine in vscode. It's not clear to me if description is allowed to be an array or not.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.