Title: Decide on scope names for all language constructs · Issue #8 · PowerShell/EditorSyntax · GitHub
Open Graph Title: Decide on scope names for all language constructs · Issue #8 · PowerShell/EditorSyntax
X Title: Decide on scope names for all language constructs · Issue #8 · PowerShell/EditorSyntax
Description: I'd like to have a discussion where we decide on the "correct" scope names for all PowerShell language constructs. This will mean much less work when doing updates to the tmLanguage file in the future, as the scopes (as well as the color...
Open Graph Description: I'd like to have a discussion where we decide on the "correct" scope names for all PowerShell language constructs. This will mean much less work when doing updates to the tmLanguage file in the fut...
X Description: I'd like to have a discussion where we decide on the "correct" scope names for all PowerShell language constructs. This will mean much less work when doing updates to the tmLanguage f...
Opengraph URL: https://github.com/PowerShell/EditorSyntax/issues/8
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Decide on scope names for all language constructs","articleBody":"I'd like to have a discussion where we decide on the \"correct\" scope names for all PowerShell language constructs. This will mean much less work when doing updates to the tmLanguage file in the future, as the scopes (as well as the color(!) of each) are checked by a Travis CI build job on the vscode repo.\n##### General\n- All scope names should end in `.powershell`\n\nAs we decide, we can fill out this table:\n\n| Language construct | Scope Name | Comments/Examples |\n| --- | --- | --- |\n| Line comment | comment.line.number-sign | `# comments` |\n| Block comment | comment.block | `\u003c# comments #>` |\n| Help directives | comment.documentation.embedded | Meta scope |\n| Help directives - keywords | keyword.operator.documentation | `.SYNOPSIS` |\n| Help directives - keyword value | constant.string.documentation | 'ParameterName' in `.PARAMETER ParameterName` |\n| #Requires statement | keywords.operator.documentation | 'Requires' in `#Requires -Version 3.0` |\n| #Requires statement - parameter | constant.string.documentation | '-Version 3.0' in `#Requires -Version 3.0` |\n| String - double quoted | string.quoted.double | `\"string\"` |\n| String - single quoted | string.quoted.single | `'string'` |\n| String - escape characters | constant.character.escape | '`t' in `\"one`ttwo\"` |\n| String - heredoc double quoted | string.quoted.double.heredoc | |\n| String - heredoc single quoted | string.quoted.single.heredoc | |\n| ScriptBlock | meta.scriptblock | `{ ... }` |\n| SubExpression | meta.subexpression | `$( ... )` |\n| Hashtable | meta.hashtable | `@{ ... }` |\n| Array | meta.array | `@(1,2,3)` & `(1,2,3)` |\n| Property/Member | entity.other.attribute-name | 'property' in `(Invoke-Something).property` & 'property' in `$var.property` |\n| Numeric Constant - real | constant.numeric.real | `+.5` |\n| Numeric Constant - integer | constant.numeric.integer | `5` |\n| Numeric Constant - hexadecimal | constant.numeric.hexadecimal | `0x20` |\n| Type | entity.name.type | 'string' in `[string]` |\n| Type - static method | meta.method | '::MinValue' in `[int]::MinValue` |\n| Parameter decorator | entity.name.type | 'Parameter' in `[Parameter(Position = 1)]` |\n| Parameter decorator - property | entity.other.attribute-name | 'Position' in `[Parameter(Position = 1)]` |\n| Function | meta.function | Meta scope |\n| Function - keyword | storage.type | 'function' in `function script:Invoke-Something { ... }` |\n| Function - scope | storage.modifier.scope | 'script' in `function script:Invoke-Something { ... }` |\n| Function - name | entity.name.function | 'Invoke-Something' in `function script:Invoke-Something { ... }` |\n| Command | meta.command | Meta scope |\n| Command - keyword | support.function | 'Invoke-Something' in `Invoke-Something -p1 'v1'` |\n| Command - parameter | variable.parameter | '-p1' in `Invoke-Something -p1 'v1'` |\n| Reserved words | keyword.other | `configuration` |\n| Control words | keyword.control | `break` |\n| Enum - keyword | storage.type | 'enum' in `enum myEnum { ... }` |\n| Enum - name | entity.name.function | 'myEnum' in `enum myEnum { ... }` |\n| Class | meta.class | Meta scope |\n| Class - keyword | storage.type | 'class' in `class myClass : inheritedClass { ... }` |\n| Class - name | entity.name.function | 'myClass' in `class myClass : inheritedClass { ... }` |\n| Class - inheritance | entity.other.inherited-class | 'inheritedClass' in `class myClass : inheritedClass { ... }` |\n| Class - reserved words | keyword.other | `hidden` & `static` |\n| Class - control words | keyword.control.class | 'base' in `: base( ... )` |\n| Operator - redirection | keyword.operator.redirection | `2>&1` |\n| Operator - comparison | keyword.operator.comparison | `-gt` |\n| Operator - bitwise | keyword.operator.bitwise | `-band` |\n| Operator - logical | keyword.operator.logical | `-and` |\n| Operator - format | keyword.operator.format | `-f` |\n| Operator - assignment | keyword.operator.assignment | `+=` |\n| Operator - logical not | keyword.operator.logical-not | `-not` & `!` |\n| Operator - multiplicative | keyword.operator.multiplicative | `/` & `*` |\n| Operator - unary plus | keyword.operator.unary-plus | `+` |\n| Operator - unary minus | keyword.operator.unary-minus | `-` |\n| Operator - additive | keyword.operator.additive | `+` & `-` |\n| Operator - range | keyword.operator.range | `..` |\n| Operator - command invocation | keyword.operator.other | `&` |\n| Operator - stop parsing | keyword.operator | `--%` |\n| Switch - keyword | keyword.control | 'switch' in `switch -regex ($var) { ... }` |\n| Switch - parameter | variable.parameter | '-regex' in `switch -regex ($var) { ... }` |\n| Switch - reserved word | keyword.other | `default` |\n| Illegal | invalid.illegal | Space after backtick |\n| Variable - $ | keyword.other | '$' in `$variable` |\n| Variable - ${..} | keyword.other | '${' and '}' in `${variable}` |\n| Variable - automatic | constant.language | `$_` & `$error` |\n| Variable - scope | storage.modifier.scope | 'script' in `$script:variable` |\n| Variable - name | variable.other.readwrite | 'variable' in `$script:variable` |\n\nI have started by filling out the scope names as I have used them in my refactored language file.\n##### About scopes and highlighting\n\nIf, in the theme, there are colorization rules only for the scope _constant.operator_, both _constant.operator_ and _constant.operator.range_ will be colorized the same.\n\nIf there isn't any colorization rules for a scope, it will be colorized with the \"root\" color of the current scope. Meaning if the word 'test' only belong to the source scope (or have a scope name that is not defined in the current theme), it will be colorized with the default background color. If the word 'test' is found inside another scope, for instance a string, it will be colorized with the color for the string scope.\n\nColorization rules may differ between editors. For instance the background parameter. This is supported on Sublime Text, but not in VSCode.\n\nA matched set of characters can be (and more often than not are) assigned multiple scopes. So for example the word **variable** in `function MyFunction {\"this is $(\"a $variable\")\"}` have the following scopes: source, string.quoted.double, meta.subexpression, string.quoted.double and lastly variable.other.readwrite. Only the last one is used for colorization.\n##### About the default themes in VSCode\n\nThere are five themes that are defined as _default_ themes in Visual Studio Code:\n- dark_plus \"**Dark+**\"\n- dark_vs \"**Dark Visual Studio**\"\n- hc_black \"**Dark Visual Studio**\"\n- light_plus \"**Light+**\"\n- light_vs \"**Light Visual Studio**\"\n\nThe themes supports nesting, and:\n- Light+ includes light_vs (Light Visual Studio)\n- Dark+ includes dark_vs (Dark Visual Studio)\n\nThe following scopes are defined in the plus-themes:\n- meta.type.name, meta.return.type, meta.return-type, meta.cast, meta.type.annotation, support.type, entity.name.class, entity.name.type, storage.type.cs, storage.type.java\n- entity.name.function, entity.name.method\n- keyword.control\n- meta.parameter.type.variable, variable.parameter, variable, variable.name\n\nThe following scopes are defined in the \"old\" default themes:\n- emphasis\n- strong\n- header\n- comment\n- constant.language\n- constant.numeric\n- constant.regexp\n- constant.rgb-value\n- entity.name.tag\n- entity.name.selector\n- entity.other.attribute-name\n- entity.other.attribute-name.css\n- invalid\n- markup.underline\n- markup.bold\n- markup.heading\n- markup.italic\n- markup.inserted\n- markup.deleted\n- markup.changed\n- meta.selector\n- meta.tag\n- meta.preprocessor\n- meta.preprocessor.string\n- meta.preprocessor.numeric\n- meta.structure.dictionary.key.python\n- storage\n- storage.type\n- storage.modifier\n- string\n- string.xml, string.jade, string.yaml, string.html\n- string.regexp\n- support.property-value\n- support.type.property-name.css, support.type.property-name.less, support.type.property-name.sass\n- support.type.property-name\n- keyword\n- keyword.control\n- keyword.operator\n- keyword.operator.new\n- keyword.other.unit\n- keyword.control.less\n- metatag.php\n- support.function.git-rebase\n- constant.sha.git-rebase\n- storage.modifier.import.java, storage.modifier.package.java\n\nScope names on the same line, means they are defined in the same colorization rule.\n","author":{"url":"https://github.com/gravejester","@type":"Person","name":"gravejester"},"datePublished":"2016-06-10T15:22:03Z","url":"https://github.com/PowerShell/EditorSyntax/issues/8"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:309c0866-53b3-bc27-93b9-4869d9950e4f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D674:28FF9E:84F6BB:BB6D5A:6AFE1406 |
| html-safe-nonce | c53d025b2bea896f94ca665da337f8e47c5d9ed83ce4cffa3e35b41713340c75 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENjc0OjI4RkY5RTo4NEY2QkI6QkI2RDVBOjZBRkUxNDA2IiwidmlzaXRvcl9pZCI6IjE2NzczMDg3MzA4ODM4Mzg5ODIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 94e1c173460bd3e10ee86f5e664327916bc329e3580c79d00fec843ff5ea3b9b |
| hovercard-subject-tag | issue:159659489 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/EditorSyntax/8/issue_layout |
| twitter:image | https://opengraph.githubassets.com/423a21093ecfd9b4a11d92f2a65f5ba30ceb077bfbb4f4883c786c46b7d3d0b7/PowerShell/EditorSyntax/issues/8 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/423a21093ecfd9b4a11d92f2a65f5ba30ceb077bfbb4f4883c786c46b7d3d0b7/PowerShell/EditorSyntax/issues/8 |
| og:image:alt | I'd like to have a discussion where we decide on the "correct" scope names for all PowerShell language constructs. This will mean much less work when doing updates to the tmLanguage file in the fut... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | gravejester |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3cd8a1d79ccbf9aecac62781f79072482a49047fb982b8c9e2ad4aca8bf6a9af |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/EditorSyntax git https://github.com/PowerShell/EditorSyntax.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 59601299 |
| octolytics-dimension-repository_nwo | PowerShell/EditorSyntax |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 59601299 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/EditorSyntax |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 05539640a34afe6142a519483d78ddd766a1304a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width