-
Notifications
You must be signed in to change notification settings - Fork 13
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
Request: Add some way to represent trailing whitespace without actual trailing whitespace #50
Comments
Doesn't |
An inline list must always end with a closing |
What happens to trailing spaces in strings not marked with one of these special tags? |
I was aiming here not to change the behavior of any currently valid NestedText, though I might not be opposed to a change there either. |
I'm in agreement that this isn't a great situation. I'd also agree that "it's an editor issue" doesn't hold much water for me. I'd prefer if your proposal was a more generic "add some demarcation syntax" rather than immediately offering a syntax, because it sets the discussion off on bikeshedding and syntax concerns (e.g. #50 (comment)), rather than whether the high-level request is worth the added complexity. There are always options for syntax, while it's helpful to consider what a few options might look like, I'd suggest not focusing too much on it right now. The complaint raised in #4 (comment) (@pierre-rouleau) was "I see it as transferring the responsibility of ensuring reliability from the implementation to the user.", which I think is a valid concern. However, would an alternative perspective be to view it as transferring some responsibility to the parsing library? As explained at https://nestedtext.org/en/latest/schemas.html, everything is a string in nestedtext, and the expectation is that an accompanying schema be used to assign types to fields. One option would be for nestedtext parsers to be expected (or have an option) to interpret escapes in certain contexts (such as values typed as "string" via a schema), e.g. URL encoding (space is |
Yeah, I'll modify the title and description to make it more general, but will keep the proposal in as "Proposal A." I was excited to have proof that this could be done without invalidating or changing the meaning of any currently valid NT, without the new syntax introducing ambiguity, and without breaking the rule of each line describing its own type without context. |
I'll note that the drawback of potentially jagged alignment could be removed by trading the markers from ( Possibly I might prefer the closing markers this dict value has three trailing spaces and no leading spaces:
[ hello |<
this value will have trailing spaces on some lines:
[ trailing |<
> no trailing
[ trailing again |< [ this key has 4 trailing spaces |:
> value
: this key has 4 but on the second line
[ |:
> value2 [ item with 3 trailing |-
- item2 |
I have a number of issues with this proposal.
|
Regarding concern 1: this issue is not asking to disallow trailing whitespace. Regarding 2:
It would also be a helper for the human eye, outside of editors, where the information that is trailing spaces is otherwise invisible. For 3 and 5: maybe a simpler syntax for this purpose could be achieved? For 4: this issue is about intentional trailing spaces. |
I use trailing spaces in my NestedText files in two situations. I use NestedText heavily to hold test cases for the software I develop. Occasionally, I need test cases that contain trailing spaces. As such, I configure my editor to show trailing spaces, not to delete them. So personally, I would not use this proposal. Even if I did wish to mark the end of my strings, I would write the test software to accept and remove a terminal character I chose, such as §. I understand that I only have this option because I am writing the code that consumes the NT file. But, this case shows that that there are alternatives available that do not require modifying NestedText. I also use NestedText to hold prose. Here I use the Vim feature where I just type the prose in one long line and Vim automatically breaks the lines to fit the width of the screen. Vim then leaves a trailing space on each line to indicate that the line breaks should be adjusted as the text is edited to keep the width of the text. Adding end of line marker in this case, as you propose, interferes with this feature. You are thinking that the end of line markers are harmless in the NT file as long as they are removed by the NestedText reader. but in this case, my most common case, the trailing spaces without end of line markers must exist in the NT file itself. My point is the case for this proposal is weak. There are several alternate ways of showing trailing spaces on a line:
In addition, your proposal sometimes interferes with the purpose of the trailing spaces and so cannot be used, like the Vim example I described. You started this discussion by stating that you prefer to configure your editor to automatically delete trailing spaces, but in some cases you also want to retain them. I believe that is the motivating example for this proposal. But you can solve that problem by adding a mode line in a comment that disables the deleting of trailing spaces in files where it is needed. Your proposal changes the nature of NestedText is a fundamental way. One of the primary features of NestedText is that it does not employ quoting, This proposal is, at its heart, quoting. It would take a very strong justification for us to consider a change like this. |
Not really, I can configure my own editor; my main motivations are:
So of your three listed alternatives:
I understand this will not happen, but wanted to make clear that none of these suggestions fix my problems, |
I acknowledge that. |
Intro
Hello again!
I currently have only one niggle with the format,
and that's the invisibility and fragility of representing trailing spaces or tabs.
Trailing newlines are already solved 👍🏼.
I understand that this will probably be closed as not worth the added complexity,
but at least would like to put my best proposal forward.
As an experiment I tried implementing my last idea from the comments from #4,
and it was ok, but then I realized that the new syntax conflicted with regular dictionary syntax in some cases,
so here's the next iteration of the idea.
Why not
First I'll repeat the arguments against a change like this:
I can't argue against number 1. It is not great to add any complexity.
Number 2 is not convincing to me, because:
Proposal A
Add three new tags, which are alternate versions of the
>
,-
, and multiline key:
:[>
[-
[:
Unlike their existing counterparts, each line using one of these must end with a closing
|
.The text content of the line is everything after the 3-character tag, excluding the closing
|
.Examples
Drawbacks
[>
,[:
,[-
) is a little strange.Strengths
The text was updated successfully, but these errors were encountered: