Skip to content

Colorization breaks dot sourced paths in latest insiders build #122

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

Closed
Mark-Foresta opened this issue Jul 11, 2018 · 5 comments
Closed

Colorization breaks dot sourced paths in latest insiders build #122

Mark-Foresta opened this issue Jul 11, 2018 · 5 comments

Comments

@Mark-Foresta
Copy link

I am using the same theme (PandaSyntax) and I have tried others and colorization for variables with dot sourced variables seems broke

Environment

VS Code(Released on the right) Desired result
Version: 1.25.0
Commit: 0f080e5267e829de46638128001aeb7ca2d6d50e
Date: 2018-07-05T13:11:11.248Z
Electron: 1.7.12
Chrome: 58.0.3029.110
Node.js: 7.9.0
V8: 5.8.283.38
Architecture: ia32

VS Code Insiders (Insiders on the left) Example problem
Version: 1.26.0-insider
Commit: 5a4eab812bd485942061f71af39f3eabc52a1035
Date: 2018-07-11T09:33:23.382Z
Electron: 1.7.12
Chrome: 58.0.3029.110
Node.js: 7.9.0
V8: 5.8.283.38
Architecture: x64

Screenshots

image

@omniomi
Copy link
Contributor

omniomi commented Jul 11, 2018

I changed some things around so that variables are now more consistently coloured in themes that aren't super granular. Basically went from this:

$Variable.Member
^ Sigil
 ^^^^^^^^ Variable
         ^ Punctuation
          ^^^^^^ Member

To this:

$Variable.Member
^ Sigil
         ^ Punctuation
          ^^^^^^ Member
^^^^^^^^^^^^^^^^ Variable

In the old version if a theme had no spec for the member or sigil it would default to the theme's default foreground colour. Now it defaults to the variable color.

In the $MyObj.Tester example it's scoped like this:

  • $ -> punctuation.definition.variable.powershell
  • .Tester -> variable.other.member.powershell
  • Whole thing -> variable.other.readwrite.powershell

Also compounding the issue is that .Tester would have been scoped previously entity.name.function.invocation.powershell which was incorrect. (See #107)

The only color being applied to the current scopes in Panda Syntax is this:

    {
      "scope": "variable",
      "settings": {
        "foreground": "#E6E6E6"
      }

As they don't define anything more granular that applies to the scopes being used. https://github.com/tinkertrain/panda-syntax-vscode/blob/master/dist/Panda.json

The current scopes comply with https://www.sublimetext.com/docs/3/scope_naming.html#variable

Fields, properties, members and attributes of a class or other data structure should use:

  • variable.other.member

so I'm note sure what we can do short of going back to a scope that's incorrect but sets the member apart or submitting PRs against some of the major themes to have variable.other.member broken out.

@tylerl0706 , @vors, @keith-hall -> Thoughts? See #107 for context on the changes.

@vors
Copy link
Contributor

vors commented Jul 12, 2018

I'd prefer to stick to the correct scope unless none of the popular themes uses them.

@keith-hall
Copy link
Contributor

I'd prefer to stick to the correct scopes even if none of the popular color schemes use them ;)
I'm not sure how many color schemes assign a different color to variable.other.member, but at least all syntaxes will be consistently colored if we (and other syntax definitions) use the correct scope. If users want the members colored differently, they can always raise an issue or PR to the color scheme or just override it themselves.

@Mark-Foresta
Copy link
Author

Thanks a million for looking at this so quickly. I understand VSCode is primarily for TS\JS and I imagine many theme writers don't think of things like this. For Instance I really wanted to use the Cobalt 2 theme from Wes Bos and it looked like it didn't account for PowerShell much at all. So I was wondering if you could give me an example of the kind of changes I would make or where to look to get better highlighting?

@omniomi
Copy link
Contributor

omniomi commented Jul 12, 2018

@Mark-Foresta you can use a theme override in your settings:

"editor.tokenColorCustomizations": {
    "textMateRules": [
        {
            "scope": "variable.other.member.powershell",
            "settings": {
                "foreground": "#33f"
            }
        }
    ]
}

In the Insiders version with the new settings pane:

  1. Open the Settings.
  2. Search for "tokenColorCustomizations".
  3. Click "edit in settings.json".

Obviously sub in whatever colour you'd like. Then it will color the variable members regardless of the theme you choose.

If you wanted to submit a PR to the theme itself so anyone who uses it would benefit you would (using Cobalt 2 as an example):

  • Fork https://github.com/wesbos/cobalt2-vscode
  • Edit theme/cobalt2.json
    • Somewhere near the bottom add:
      {
          "name": "Variable - Members",
          "scope": "variable.other.member",
          "settings": {
            "foreground": "#33f"
          }
        },
    
    Again replacing the colour with something appropriate.
  • Submit a PR back to /wesbos/cobalt2-vscode

I will eventually submit a number of PRs to the default VS Code themes and the one included in https://github.com/PowerShell/vscode-powershell/ to make sure a lot of the changes we're making are taken advantage of/covered but want to wait until we've fixes a few more scopes and do it all at once. If you have any other questions feel free to ping me or join us on either Gitter (https://gitter.im/PowerShell/EditorSyntax) or Slack (http://poshcode.org/).

@omniomi omniomi closed this as completed Jul 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants