Closed akpircher closed 7 months ago
There's another case-statement situation that has actual broken syntax with inline case statements and arrays:
demo | comparison |
---|---|
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)
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.
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.
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.
Shell Parameter Expansion has a complete list of all parameter expansions syntax with examples, which also apply to arrays. Scroll past the paragraphs.
:-
) do NOT need the colon. The colon means "unset or empty" and without the colon the tests just means "unset"$
)
Shell Arithmetic has a complete list of shell arithmetic operators
let
expression[s]
declare -i
expression[s]
local -i
expression[s]
((
expression[s]
))
and $((
expression[s]
))
base#value
, which looks like it's covered.set
and shopt
commands (not actually listed elsewhere)(I'm happy to help with the grammar if you'd like, though my time would be limited to late nights and weekends)
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.
The code with a problem is:
https://gist.github.com/akpircher/1e30212e219104e1de6d5b38a9a9bc0e
What it looks like:
VSCode Theme: Default Dark+
Handling Array Parameters I don't know if this is a bug or intentional, it just seems inconsistent
Highlight inconsistencies with inline vs multi-line case statements
Other inline detection weirdness
It should look like:
demo
screen shots should match the syntax highlighting in thecomparison
screen shots.Originally posted by @akpircher in https://github.com/microsoft/vscode/issues/176190#issuecomment-1473026366