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

keywords scoped in places where not actually keywords, IF inside simple interpolation () for instance #152

Open
msftrncs opened this issue Dec 29, 2018 · 1 comment

Comments

@msftrncs
Copy link
Contributor

Environment

  • Editor and Version: VS Code: 1.31 Insiders / 1.30.1
  • Your primary theme: Monokai Dimmed (modified)

Issue Description

In the following image and code, the if is being scoped as 'keyword.control', as if it was valid to utilize an IF statement at this point. However it is not valid, and the code instead causes an error stating that The term 'if' is not recognized as the name … No syntax error is reported by EditorServices either. PSReadLine however does indicate that the if would be treated as a command instead of a keyword.

Screenshots

VS Code:
image
PSReadLine
image
(keywords would be green)

Expected Behavior

I would like to expect that this case would not receive 'keyword.control' scoping, so that I am not led to believe the given command might actually be correct. A quick attempt to correct this indicates that this will require some reorganization, because too many items are in the root patterns and not in the repository.

This also shows that there is more to argument mode vs. expression mode than I had originally thought. Control statements cannot always be used everywhere a command can be used. This also affects other limited scope keywords, such as in, which is scoped as 'keyword.control' in more places than it should be.

Code Samples

    '<?xml version="1.0"' + (if ($encoding) {' encoding="' + $encoding + '"'}) + '?>'

The correct code:

    '<?xml version="1.0"' + $(if ($encoding) {' encoding="' + $encoding + '"'}) + '?>'
@msftrncs
Copy link
Contributor Author

Demonstrating PR #156 regarding the specific example:

image

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

1 participant