-
Notifications
You must be signed in to change notification settings - Fork 445
Added TypeScript snippets #72
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
Added TypeScript snippets #72
Conversation
@vadymbiliuk Thank you!, I'm thinking if it's not better to alias this one with ts
not only t
as it can be mislead in future
@dsznajder i can add 'ts' alias for all ts snippets if u wish ^^.
@vadymbiliuk Yes, I would like a ts alias :) Also, I'm thinking about splitting ts snippets from .js
to make them exclusive in .ts
.tsx
files, but I need investigate this one :)
@dsznajder I've been thinking about the same! xD
I need investigate that ither. Also i would like to help if i can :3
@vadymbiliuk I will research topic and get back to you.
@vadymbiliuk I'm pretty sure that we could done something like this:
https://code.visualstudio.com/api/language-extensions/snippet-guide
I do not know yet if we can pass array of languages to this one. -> need to check on your branch
@vadymbiliuk Ok, it seems to be working if you add next ones in package.json
:
"snippets": [
{
"language": "javascript",
"path": "./snippets/snippets.json"
},
{
"language": "javascriptreact",
"path": "./snippets/snippets.json"
},
{
"language": "typescript",
"path": "./snippets/snippets.json"
},
{
"language": "typescript",
"path": "./snippets/snippets-ts.json"
},
{
"language": "typescriptreact",
"path": "./snippets/snippets.json"
},
{
"language": "typescriptreact",
"path": "./snippets/snippets-ts.json"
}
]
But, I'm figuring out how to add this to extension/index.ts
:)
@dsznajder yeah i've found that already
I think i can implement that. I'll do that when i will be free
@vadymbiliuk Ok, I will handle the extension search on my own later :)
@dsznajder i did that. But i'm not really sure about how much my solution is beautiful. I was trying to split same parts from javascript.json and typescript.json into base.json but i haven't found solution for that :/
How is it looks for you now?
@vadymbiliuk Not quite as I planned :). You should add only your snippets to typescript.json
and include both files for typescript
and typescriptreact
. Rest should be untouched.
@dsznajder pardon mate. My bad :C
Now it's should looks just like you imagined it
@dsznajder idk about stuff like snippets with PropTypes. Those should be still available in ts/tsx, but it's useless for typescript xd
@vadymbiliuk Ok thank you for this :) Anyway, I can't release it cos extension which search for snippets won't find those as I tested. I will try to figure it out soon :)
I've added snippets for typescript language, with simple basic typing by interfaces