Skip to content

Coloring existing and non-existing commands #2269

Open
@yihuajack

Description

@yihuajack

Description of the new feature/enhancement

Inspired by zsh's plugin zsh-syntax-highlighting, the feature that coloring existing cmdlets, functions, script files, or executable programs with green and non-existing ones with red. Besides, it can underline paths or filenames if they are existing and does not underline if they does not exist.
From #687.
Expected effects:
image

Proposed technical implementation details (optional)

Activity

ghost added
Needs-Triage 🔍It's a new issue that core contributor team needs to triage.
on Mar 5, 2021
added
Issue-TriagedIt indicates an issue was triaged
and removed
Needs-Triage 🔍It's a new issue that core contributor team needs to triage.
on Apr 6, 2021
thomazmoura

thomazmoura commented on Aug 9, 2022

@thomazmoura

Hey guys, any chance on at least a feedback of what would be needed or the feasibility of such a change?

Since trying zsh I've been wanting this feature, but so far that closest I've seen is pwsh-syntax-highlighting from digitalguy99. I even managed to optimize it so it would look like a bit more real time, but the limitation of not being able to trigger it at every stroke seems to defeat its purpose. Also, the coloring API used doesn't seem to work on Linux - I know echoing special characters seem to solve it, but I don't know how I could do it for text that has already been typed.

So, what I would like to know is:

  • Is there currently any way to trigger a PSReadLineKeyHandler (or something like it) on every key stroke?
  • Is there a way to color the text the user has already typed (and change it afterwards) that would work on both Windows and Linux?
yutotakano

yutotakano commented on May 12, 2024

@yutotakano

The third party software 'Clink' for cmd.exe is able to achieve this without any visible delays, and it's been a massive help in knowing whether you typed a command correctly before you continue typing.

image
image

Currently it's one of the rather big UX issues that's blocking my full migration to Powershell. It's sad that this issue is labelled as "Not Planned"...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @thomazmoura@theJasonHelmick@yihuajack@yutotakano

        Issue actions

          Coloring existing and non-existing commands · Issue #2269 · PowerShell/PSReadLine