-
Notifications
You must be signed in to change notification settings - Fork 471
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
Extend typescript snippets due to #88 changes #105
Comments
Hey, thanks for reporting this. Is typescript the exact same as JavaScript ? I don't work with typescript so I'm not sure, I know they are almost the same but I thought there were some minor differences in the syntax. I can make all the typescript snippets be the same as javascript but I need to be sure that it's not going to bring some problems where some snippets are not proper typescript syntax, or maybe some typescript exclusive snippets are deleted. |
I've run into a similar thing where I want to use the javascript snippets in typescript. All javascript is valid typescript. There are some situations where a type needs to be added, but it should be fine to have the javascript snippets available in typescript. The snippets in react.json and react-ts.json also seem to be identical. What's the best way to make the javascript snippets available when filetype is typescript? |
@rafamadriz any news about it? |
So, you want js snippets in ts? Or ts snippets in js file? |
@bryant-the-coder |
You can make a pr to fix that :)) |
I actually think I have a fix for this Edit: PR soon (hopefully) 😎 Second edit: Taking a bit longer than planned due to some life stuff. But should be up for review this week |
nice nice |
@OkelleyDevelopment |
Heyo ! After several weeks of trying to figure out the best approach to this issue (while ensuring we don't break other users experiences), I arrived at the solution below for getting JS snippets in TS: Though I agree we could probably streamline some of these snippets, but it is a much larger endeavor than I was realizing and I do not wish to cause issues with compatibility for other users (at least not without a solid plan of what we are doing 😅 ) |
Maybe I'm over thinking it, but the issue I'm running into is that JS snippets are useful in TS though some people might only want the TS specific snippets which brings me back to the "just extend it with your snippet engine" answer 🤔 Edit: For those who do want both types of snippets loaded Edit 2 on Oct. 18, 2022: I'm thinking about the best way to handle this issue. Might start a draft PR and just get input as we go. Edit 3: If anyone has ideas, go ahead and try them. My free time seems to be fleeting at best the last few weeks 😓 |
This is what I did too: https://github.com/rafamadriz/friendly-snippets#add-snippets-from-a-framework-to-a-filetype For those who want to copy and paste: require'luasnip'.filetype_extend("typescript", { "javascript" }) |
Hello. I've notices you drop mixing sources for some complex filetypes (ts and tsx in my case).
#88
So now I should invoke additional command to mix js and ts snippets. But i guess typescript still js. It's not a framework or something like that. And js snippets still totally relevant.
May you please copy js snippets into typescript's json to make it consistent?
E.g in js snippets
console.log
iscl
and in ts snippets itslog
. And so on.The text was updated successfully, but these errors were encountered: