Skip to content
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

Add optional line numbers #130

Open
HRSAndrabi opened this issue Dec 8, 2024 · 3 comments
Open

Add optional line numbers #130

HRSAndrabi opened this issue Dec 8, 2024 · 3 comments
Labels
user request Requested by user

Comments

@HRSAndrabi
Copy link

It would be nice to see line numbers, as in geist code blocks.

@CarlosNZ
Copy link
Owner

Thanks for the suggestion. I'm not sure it makes a lot of sense to number the lines, as it's not "lines of code", it's a data structure. How would it look when collapsed? It makes sense for a code editor, but this is not a code editor nor is it intended to replace one.

What is the use case you're thinking of where this would be helpful?

@HRSAndrabi
Copy link
Author

Thanks for the response! I suppose it's a matter of preference, I personally prefer to see line numbers when I'm editing JSON (particularly larger files), but perhaps others don't. It's a common feature in other JSON viewing/editing tools I have used in the past. I don't envision a specific use case beyond helping users navigate documents and orient themselves.

For collapsed sections, line numbers could either reflect the first line of the block (e.g., the line where the opening brace or bracket starts) or provide a range (e.g., 12-30 if the collapsed block spans multiple lines). Have a look at jsonformatter.org for an example of the former.

@CarlosNZ
Copy link
Owner

Big fan of https://jsonformatter.org/ !

Yeah, I can see the appeal in certain situations. It would actually be fairly tricky to implement though, since each node of the tree is essentially a stand-alone component, and has no knowledge of where it fits in the bigger structure. So calculating what each line would be would require some thought.

I'll keep the idea in mind, but I wouldn't expect to implement it any time soon.

@CarlosNZ CarlosNZ added the user request Requested by user label Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
user request Requested by user
Projects
None yet
Development

No branches or pull requests

2 participants