codethesaur.us icon indicating copy to clipboard operation
codethesaur.us copied to clipboard

Add C++ strings

Open geekygirlsarah opened this issue 3 years ago • 17 comments

Description

Strings for C++ aren't presently on Code Thesaurus. This issue is to add that concept to the system.

Directions

  • On the home page, on the right side (the reference sheet side), choose the language and version, and then the concept.
  • The page says the data doesn't exist, but clicking the arrow for the template will provide the template and file for you to use.
  • Save that file in /web/thesauruses/[language]/[version]/[concept].json.
  • Fill out all of the "code" sections.
  • Add in "not-implemented": "true" if the concept doesn't exist in the language. You can then delete the "code" line.
  • Add in "comment": if you wish to explain something in the code
  • Delete the "name": fields before your PR
  • Save, commit your code, push to your fork, then make a PR.
  • Watch the checks to make sure they all pass. If they don't, click on "Details" and it should tell you what to modify.

Claiming This Issue

Please leave a comment below so I can assign you to it. This is to prevent multiple people from working on the same issue.

Check out CONTRIBUTING.md for more information on how to contribute.

Check out https://docs.codethesaur.us/thesaurus/ for information on how Code Thesaurus works and how to add to the thesauruses.

Need Help?

Leave a comment on here with your question, or feel free to ask @geekygirlsarah on Twitter. You can also email [email protected] too.

Thanks!

We really value and appreciate the additions people make to Code Thesaurus, no matter how large or small. So thank you for taking the time to work on this!

geekygirlsarah avatar Oct 31 '21 04:10 geekygirlsarah

@geekygirlsarah I would like to work on this issue

aabhas-sao avatar Oct 31 '21 04:10 aabhas-sao

Yeah, I can assign it to you. Please look over the docs, and let me know if you have any questions or need any help!

geekygirlsarah avatar Oct 31 '21 05:10 geekygirlsarah

Hey @aabhas-sao, how is this coming along? I haven't seen any updates and it's been over 3 weeks now. If you still want the issue, let me know otherwise I'll probably unassign you. And if you have any questions, let me know too!

geekygirlsarah avatar Nov 25 '21 02:11 geekygirlsarah

Sorry to not inform you but I have been busy with some other stuff. Can you unassign me

aabhas-sao avatar Nov 25 '21 02:11 aabhas-sao

That's understandable and ok. Thanks for letting me know!

geekygirlsarah avatar Nov 25 '21 03:11 geekygirlsarah

@oneamanish I did see it. It looks like you didn't follow any directions or understand how the project works so I had to close the PR.

If you want to work on this issue, I'll assign it to you, but you'll need to understand how language data gets correctly added to the project.

Let me know if you still want to work on it.

geekygirlsarah avatar Nov 28 '21 16:11 geekygirlsarah

I want to work on this issue

rishabhagniihotri avatar Nov 30 '21 13:11 rishabhagniihotri

Hi @rishabhagniihotri, yeah, I'll assign you. Don't forget to look at the issue instructions and the documentation, and let me know if you have any questions!

geekygirlsarah avatar Nov 30 '21 14:11 geekygirlsarah

@rishabhagniihotri It looks like you claimed this at the end of November. Were you still working on this or should I take your name off so it's open for others? (It's ok either way, just trying to keep the issues list updated!)

geekygirlsarah avatar Mar 28 '22 22:03 geekygirlsarah

@rishabhagniihotri I'm removing you off this issue. If you want to work on it again, let me know and I can add you back on. Otherwise it opens it up for others to work on.

geekygirlsarah avatar May 21 '22 00:05 geekygirlsarah

@geekygirlsarah Count me in for this issue.

I began work on this in forked repo changes towards issue 420

craigdebug avatar Aug 27 '22 16:08 craigdebug

I noted an issue using the 'template' json file... web\thesauruses_meta\strings.json where the page rendering threw an error. Looks related to the elements in schema. I will post the error in next message.

My speculation is that there is an upgrade to the schema and this template may need updated, maybe? (If so, I would be happy to update that as well so that other languages get the benefit.) To get this working I used the "concepts" section from the 'working' python version of the file, assuming that is using the new schema.

craigdebug avatar Aug 27 '22 16:08 craigdebug

I noted an issue using the 'template' json file... web\thesauruses_meta\strings.json where the page rendering threw an error. Looks related to the elements in schema. I will post the error in next message.

Yes, please do! As far as I know there's no error to the file.

geekygirlsarah avatar Aug 30 '22 14:08 geekygirlsarah

@geekygirlsarah if I copy the file at web\thesauruses_meta and then edit the meta element to have the following, which matches the meta entry in the working functions.json,

"meta": { "language": "cpp", "language_version": "C++17", "language_name": "C++", "structure": "strings", "structure_name": "Strings" },

I then see the following... diff_meta_to_cpp_not_working

So I looked at the existing and working C++ file for functions.json and see that the next element parallel to meta is concepts and not categories. I change categories to concepts in the C++ srings.json and the page loads properly.

So here is the working diff between the _meta copy of strings.json and the new C++ version of strings.json that works... diff_meta_to_cpp_works

In my working branch that is commit: 3fd87ed2cab37a51e9bd6bd4c1730a53d2222810

That is where I was suspecting that the schema changed at some point. If you look further in the commit history at my branch, you will see that I had to copy the concepts element node and its children from the working Python strings.json to get the page to load properly as well. Here is my working branch: https://github.com/craigdebug/codethesaur.us/tree/issue420-cd-add-cpp17-strings

craigdebug avatar Aug 31 '22 01:08 craigdebug

In the beginning, the _meta files and the files in the language directories were about the same. As the site grew and we discovered some bugs with the original matching algorithm, we had to revise it a bit. The _meta files don't correspond to how you should start a new file anymore. (If this is still in the docs, let me know and I'll update it.)

The easiest way is probably go to the Strings in C++17 page (which will 404) but expand the "template for strings.json" link. It will give you the file you need. Then just fill in the code blanks, or add "not-implemented": true for concepts that don't exist.

You can also run python manage.py generate_template cpp strings to get the file you need too.

Does that help?

geekygirlsarah avatar Aug 31 '22 04:08 geekygirlsarah

Ok, so yes, using the strings.json from the _meta folder provides a json that does not fit the new matching algo. I did not look for this mention in the doc, but from the issue here above, where it states to copy the file.

I followed your first recommendation on obtaining the template via the resulting 404 page and then swapping the string data that I have into that. This works!

I am about 1/3rd of the way done with the strings for C++17.

craigdebug avatar Aug 31 '22 05:08 craigdebug

Oh, the issue directions are old! Sorry about that. It's been a copy/paste template for language issues. I'll try to go back and update that!

geekygirlsarah avatar Aug 31 '22 14:08 geekygirlsarah

I want to work on this issue

dcavalei avatar Oct 04 '22 21:10 dcavalei

Hey @dcavalei, I think @craigdebug has started on this (though will admit I forgot to assign them to the issue). I might wait and see if craigdebug does a PR and keeps this. If not, I can assign you!

There's #402 or #282 if you want another C++ issue.

geekygirlsarah avatar Oct 05 '22 04:10 geekygirlsarah

@geekygirlsarah , Hi. I am working on this over in my fork of the repo. I was actually aiming to complete the remaining portion and begin a PR on this coming Saturday (EDT). I think I only have a few hours left.

craigdebug avatar Oct 06 '22 02:10 craigdebug

That's fine @craigdebug . I was mostly trying to clarify that I forgot to add your name to the issue and it was already taken. No rush!

geekygirlsarah avatar Oct 08 '22 03:10 geekygirlsarah

Thanks @geekygirlsarah, I had fun working on this! Will likely pick up another issue soon.

craigdebug avatar Oct 10 '22 22:10 craigdebug