jeff-hykin / better-shell-syntax

💾 📦 ♻️ An improvement to the shell syntax for VS Code
MIT License
51 stars 4 forks source link

Array Syntax Has Inconsistent Highlighting #55

Closed akpircher closed 5 months ago

akpircher commented 1 year ago

The code with a problem is:

https://gist.github.com/akpircher/1e30212e219104e1de6d5b38a9a9bc0e

What it looks like:

VSCode Theme: Default Dark+

  1. Handling Array Parameters I don't know if this is a bug or intentional, it just seems inconsistent array-handling

  2. Highlight inconsistencies with inline vs multi-line case statements

    demo comparison
    case-weirdness-demo case-weirdness-comp
  3. Other inline detection weirdness

    demo comparison
    inline-weirdness-demo inline-weirdness-comp

It should look like:

Originally posted by @akpircher in https://github.com/microsoft/vscode/issues/176190#issuecomment-1473026366

akpircher commented 1 year ago

There's another case-statement situation that has actual broken syntax with inline case statements and arrays:

demo comparison
arrays-in-case-broken arrays-in-case-not-broken

I noticed #41, which is specific to the case-statements, after migrating the issue over. I'm not sure where you want to track this array-breaking issue, though. (I updated my gist to include this case-statement)

jeff-hykin commented 1 year ago

Right now there's basically no array support, so the behavior is just to minimized breakages caused by []'s

I don't know much about the POSIX, Bash, and Zsh specifications of arrays. So if you're feeling generous, linking specifications or explaining the syntax would help speed up the implementation of highlighting array syntax.

jeff-hykin commented 1 year ago

I'm going to focus this issue to array syntax, I opened up a new one for the local keyword, and I'll use #41 to focus on case-statement issues.

akpircher commented 1 year ago

I'm more than happy to provide documentation for POSIX/bash. I have gotten quite familiar with navigating their specification and info pages. This is taking a minute, because I'd like to compile some helpful information (re: summarize the important details hidden in paragraphs), but you can expect something today/soon.

I hear zsh is similar, but I haven't actually used it.

akpircher commented 1 year ago

Quick Reference Guides

GNU Bash Documentation

Builtin references pages

(I'm happy to help with the grammar if you'd like, though my time would be limited to late nights and weekends)

jeff-hykin commented 5 months ago

Alright I think these have been fixed (local, case and array) v1.8.5. I'll be honest I haven't yet read the builtins doc's so I can't be too certain. Free to test out the edgecases and open this back up if any are found.

Thanks again for linking the docs. My guess is there's still problems with (( vs $(( so I'm going to need to read the docs on those.

Parameter expansion is yet to be solved/highlighted, but there's another issue for it.