Repository navigation
fix: fix lexing of comments, such that a#b becomes a coherent Item - #8151
Merged
Merged
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #8151 +/- ##
=======================================
Coverage 54.61% 54.61%
=======================================
Files 608 608
Lines 99009 99011 +2
=======================================
+ Hits 54069 54074 +5
+ Misses 44940 44937 -3
|
Contributor
|
Nice, thank you for the fix! |
fdncred
added this pull request to the merge queue
Feb 22, 2023
This was referenced Mar 30, 2023
sholderbach
added a commit
to nushell/nushell.github.io
that referenced
this pull request
Apr 4, 2023
Reflect the lexing change in nushell/nushell#8151 Addresses nushell/nushell#8731
sholderbach
added a commit
to nushell/nushell.github.io
that referenced
this pull request
Apr 4, 2023
* Fix the use of comments Reflect the lexing change in nushell/nushell#8151 Addresses nushell/nushell#8731 * Add a warning note to externs * Add warning note to the command docs * Fix custom_completions.md * Fix coloring_and_theming.md * Fix `0.77` release notes to include the breaking change
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Previously
nix run nixpkgs#hellowas lexed asItem, Item, Item, Comment, however,#hellois not supposed to be a comment here and should be parsed as part of the thirdItem.This change introduces this behavior by not interrupting the parse of the current token upon seeing a
#.Thank you so much for considering this, I think many
nixusers will be grateful for this change and I think this will lead to more adaptation in the ecosystem.#parsing inhibits use of some commands #6335User-Facing Changes
somecode# blaandsomecode#blawill not be parsed assomecode, commentbut assomecode#bla, hence this is a breaking change for all users who didn't put a space before a comment introducing token (#)Tests + Formatting
I've added tests that cover this behavior in
test_lex.rscargo fmt --all -- --checkto check standard code formatting (cargo fmt --allapplies these changes)cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A clippy::needless_collectto check that you're using the standard code stylecargo test --workspaceto check that all tests passAfter Submitting
I think this is expected behavior in most other shells, so the documentation was lacking for not documenting the unexpected behavior before and hence now is automatically more complete >D