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

Syntax highlighting breaks for defs with multiple commands separated by ; (semicolon) #190

Open
chrisheib opened this issue Feb 18, 2025 · 1 comment

Comments

@chrisheib
Copy link

chrisheib commented Feb 18, 2025

Syntax highlighting currently doesn't seem to working correctly with defs consisting of multiple command.
I would expect e.g. the nrs command to highlight cur and gcp in the green function color.

def l [] { ls }
def ll [] { ls }
def nrt [] { sudo nixos-rebuild test }
def nrs [msg] { up; sudo nixos-rebuild switch; cur; gcp $msg; gc }
def nrsu [] { sudo nix-channel --update; nrs "System Update" }
def nrsb [msg] { nrs $msg; gut }
def nrsrepair [] { sudo nixos-rebuild switch --repair }
def gut [] { qdbus org.kde.Shutdown /Shutdown org.kde.Shutdown.logoutAndReboot }
def gcp [msg] { cd ~/.nixos; git add .; git commit -m $"Generation (cur): ($msg)"; git push; source $nu.config-path }
def cur [] { sudo nix-env --list-generations --profile /nix/var/nix/profiles/system | find current | split column " " | get column2.0 }
def up [] { sudo nix-channel --update; nixos-rebuild build --upgrade; nvd diff /run/current-system ./result | save -f nixdiff.txt; cat nixdiff.txt }
def gc [] { nix-collect-garbage --delete-older-than 7d }
# def top [] { btm }

(Ironically the github highlighting does the same mistakes, probably uses the same highlighter grammar 😁)

Image

@fdncred
Copy link
Contributor

fdncred commented Feb 18, 2025

This is the grammar that GitHub uses in it's linguist repo. It's take from this repo. @hustcer Keeps it updated when we update this repo.

We'd happily accept a PR to correct this issue. It's close to time to update this to the next version, maybe after 0.102 is release because there are some new commands and functionality in nushell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants