-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Improve discoverability of cddatags #37954
Conversation
This is fixing a hypothetical bug which I think cddatags would have suffered from on Windows (but untested there).
There were already two rules for creating tags; update them both.
doc/JSON_INFO.md
Outdated
# Navigating the JSON | ||
A lot of the JSON involves cross-references to other JSON entities. To make it easier to navigate, we provide a script `tools/json_tools/cddatags.py` that can build a `tags` file for you. If your editor has [ctags support](http://ctags.sourceforge.net/) then you can use this file to easily jump to the definition of any entity. For example, in Vim you can jump by positioning your cursor over an id and hitting `^]` (by default). | ||
|
||
`cddatags.py` is designed to safely update a tags file containing source code tags, so if you want both types of tag in your `tags` file then you can run `ctags -R . && tools/json_tools/cddatags.py`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am interested in using this but "you can run ctags -R . && tools/json_tools/cddatags.py
." does not tell me much and I doubt it will mean much to the people that would read JSON_INFO.md. I suggest you move what you wrote here to /doc/DEVELOPER_TOOLING.md or /tools/readme.md and just leave a link to that page here.
Then, please describe what I should use to run the ctags command and if you think that is too elementary, please point to where I can read up on how I would do this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was torn between here and DEVELOPER_TOOLING. I'll move this second paragraph there.
For the first paragraph, it really should be as simple as running that script and then figuring out how your editor works with tags files. I run into trouble providing more details, for a couple of reasons:
- It's hard for me to give reasonable guidance for Windows users; I don't really know what the easiest approach is for that platform, but it's probably the one most in need of it.
- Every text editor is different. I explained what to do for Vim, but I have no idea what the most popular editors amongst CDDA JSON folks is, nor would I probably know how to configure them.
I'm hopeful that someone who is in a better position to expand on these points will come along and add more detail.
The second paragraph was not useful to non-code-writing contributors, so move it and rewrite it.
You need a python launcher to be installed. And .py files associated with it. |
Thanks, I associated the filetype. I have python 3.8 installed. now i'm getting this: `Microsoft Windows [Version 6.3.9600] C:\Users\User\Downloads\ctags58\ctags58>ctags -R . && C:\Users\User\Documents\GitHub\Cataclysm-DDA\tools\json_tools\cddatags.py |
Me too. Anyway it adds data to |
Thanks for trying it out; that's very helpful. I've tweaked the Python script to hopefully avoid the error messages you observed. Can you see if that fixed them? I'll think about what to write in the docs. |
Also, @snipercup: the I'm also curious to know if just double-clicking on |
Thanks to snipercup for researching useful tips for Windows.
I've updated the docs to include your findings. You can see this on my branch. What do you think? |
No problem jbytheway. I'll get back to you as soon as I can. |
I deleted the ctags file and I can run the python script by doubleclicking. It's hard to test the results because the existence of the tags file does not seem to matter, the results are the same. Pressing alt+space still shows the tagleet references window. The weird thing is that jumping to the selected location in the references window worked the first time but not after that. In https://sourceforge.net/p/tagleet/wiki/Home/ it says it uses a ctags file but for me it does not matter if it exists or not. Edit: Tried some other things, it only seems to work for actual source files but not json. I used the cmake command in my own project that has json-schemas in the form of json and somehow that works. But that's right now, maybe after I reboot it stops working, just like what happened with the first time I tried it on the CDDA json files. Running Edit2: I'm finally getting some results with this command: Also, your documentation is looking good. |
OK, these are strange symptoms. Let me check that I understand what you're saying:
Also, can I check: are you running My only idea right now is that there's something about the file format my script is generating that TagLEET doesn't like. Can you upload / attach an example of a tags file from my script that doesn't work, and one from ctags.exe that does work, and I'll see if I can discern any obvious differences? (The latter file doesn't have to be a huge 400MB file; you can get a smaller one by running in a subdirectory with only a few files in). Thanks again for helping try to figure this out. |
It shouldn't matter where you run it from. It figures out where to write the tags file relative to where the script itself is. Can you double-check if it really makes a difference? |
It does not make a difference where the script is run from. I deleted my existing tags file and confirmed the references were gone. Then I ran this command: |
Excellent. Sounds like everything is working as expected, then, and this is ready to merge. |
Summary
SUMMARY: None
Purpose of change
To help people discover
cddatags.py
, added in #37877 (and fix a bug in it).Describe the solution
Makefile
rule for creating atags
file./
being the path separator).Testing
Used
make ctags
. Looks good, and seems to still work.