-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding Snippets #51
Comments
coc.nvim already supports this: https://github.com/neoclide/coc.nvim/wiki/Using-snippets
So all we need to do is copy over the snippet file from vscode-powershell and then add these lines into our package.json! @mikeTWC1984 looks like it’s just a bunch of |
Sure, will do. Is everything can be ported from vscode to vim that easy? ) I think the last thing left is ISE color theme (just for fun), can it be ported from VSCode too? |
Can't figure out which package.json file to put that snippet config? I tried ~/.config/coc/extensions/node_modules/coc-powershell/package.json, has no any effect (using nvim). I created snippets folder in the same directory and put PowerShell.json file in there. I tried to install their sample js snippets with CocInstall and it seemed to work. |
Hmm interesting. @yatli have you gotten snippets working in your other coc extensions? |
I haven't played with snippets yet, but according to the doc, it supports quite a few snippet formats. @mikeTWC1984 you'll need to edit package.json:
I have no experience with the actual process though 😅 |
maybe that's the thing, vscode extension uses "powershell" |
@mikeTWC1984 I'm currently working on a CONTRIBUTING.md document in PR #48. Perhaps take a look and let me know if you need assistance. Basically what I do is checkout the repo to a directory, then tell vim to load the plugin from there. |
I played a bit more and still wasn't able to modify coc-powershell's package.json to load snippets, however after replacing snippet file (to PowerShell.json) and language to ps1 in the sample snippet repo I was able to see ps snippets in autocomplete. So at least we can solve that by creating separate repo. |
🤔 I can't seem to get it to work either. I added snippets to the contributes. And copied PowerShell.json to the coc-powershell directory: "contributes": {
"snippets": [
{
"language": "ps1",
"path": "PowerShell.json"
}
],
"languages": [ then I made sure it was loading my config by revving the version to 0.0.38. And either I don't know how to trigger the snippets, or they're not actually loading. I'm going to go and read the docs and report back 😂 |
OK, after reading the docs, there are two things I was missing... I forgot to read my contributing file to know that I needed to run |
Nice. Seems pretty straightforward then. @corbob do you want to send the PR? |
I was going to let @mikeTWC1984 put it together (my testing was done within a differently tracked directory). I'll throw a PR together tonight if mikeTWC1984 hasn't. |
@corbob Good news. Go ahead and throw your PR ( I don't have much to submit on my end :) ) |
One thing to be aware of for snippets is to move between inputs: To navigate forward/backward of a snippet placeholder, use and . Vim global variable g:coc_snippet_next and g:coc_snippet_prev can be used to change the key-mapping. Seeing that we can do that, I wonder if we should integrate something in the build script to pull the snippets out of the vscode-powershell repository... that way we're not duplicating work of including snippets... |
That seems pretty straightforward considering it's just json 👍 |
Another useful feature to have. I personally like ISE way (ctr + j), but VSCode is good too (just typing snippet name and it appears on the autocomplete list).
The text was updated successfully, but these errors were encountered: