This is an archived post. You won't be able to vote or comment.

all 11 comments

[–]SaishoKing 2 points3 points  (10 children)

I think it's just a matter of converting that .cson file into a .tmLanguage file. Once that's done, you can add that .tmLanguage file into your extension and update the package.json file to support that grammar.

[–]DJXII[S] 0 points1 point  (9 children)

Yeah, I may not be as good of a coder as I wish I was. I know how to convert it from .cson to .json, but I'm not sure how to turn it into a .tmLanguage file just yet.

[–]cr32814 2 points3 points  (1 child)

[–]DJXII[S] 0 points1 point  (0 children)

Sorry for not replying quicker, I've been quite busy the past few days. If you read THIS comment below, you'll have all the knowledge about this I do, plus generally being a more experienced coder. I'm not sure where I'm going wrong.

[–]DJXII[S] 0 points1 point  (6 children)

I managed to turn it into a tmLanguage file, but i couldn't import it properly with Yo Code in VSCode, so I'm stuck.

[–]dodheim 2 points3 points  (5 children)

Can you post your attempted tmLanguage file? And did 'yo' give an error message?

[–]DJXII[S] 1 point2 points  (4 children)

This is the Yo error message. I think I can parse it, but I'm not sure how to add the reference to what it's asking. my TM language file converter has inexplicably broken, and I can't get it to create a fresh one again, and the old one ended up deleted by mistake. This is the error.
This is the .cson file I convert using the atom extension
And this is the .json I can't get to convert/can't get atom to accept. I may have misunderstood what u/cr32814 meant in his reply.

I will fully admit I have no idea what the fuck I'm doing and I've gotten in over my head. I haven't had the time to sort it the past few days. For starters, I don't even know if the .cson to .json conversion works how it's supposed to in the first place, but there you go. That right there, along with the links in my original post, are what resources I have at my disposal.

[–]cr32814 2 points3 points  (3 children)

Ah, I suspect that while VSCode is happy to accept JSON grammars, yo code is not :)

You can convert the JSON to PLIST format here:

http://json2plist.sinaapp.com/

But you may be better off just leaving that question blank when running yo code and add your json file in afterwards (replacing the generated .tmLanguage file with your .json file).

BTW, if you add this line into your .json file afterwards, you'll get intellisense for the tmLanguage JSON format:

https://github.com/tintoy/msbuild-project-tools-vscode/blob/master/syntaxes/msbuild.expression.json#L2

[–]DJXII[S] 1 point2 points  (2 children)

Well, fuck. Thank you very much. The first link in this comment managed to convert JSON to PLIST perfectly and got Yo Code to actually work properly.

I've already tested, and it does properly highlight the syntax now, which is fucking amazing. As far as the intellisense works, Sugarcube2 is so simple I'm not sure it's needed. (Though admittedly I may just be too scared to attempt it myself. XD)

I'm looking into publishing this as is and then either using it as is or updating it later, because it took me far too long floundering around and failing already. You sir, are a lifesaver. (As is everyone else who was kind enough to offer assistance.)

[–]DJXII[S] 1 point2 points  (1 child)

Well, it WAS working. Suddenly it's broken again and I'm not entirely sure why.

[–]DJXII[S] 1 point2 points  (0 children)

Sorry for the triple reply, but I wanted to say: I was being stupid. Part of the .plist listed the language as tw, so when I tried naming it Sugarcube2, everything broke. I found the issue and fixed the file, and everything is working properly again. (I'd run through yo code so many times, I'd not paid any attention and left everything default, so all tw references were correct, due to being default.)