├── .github └── workflows │ ├── cla.yml │ ├── continuous-integration.yml │ └── deploy.yml ├── .gitignore ├── .vscodeignore ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE.md ├── README.md ├── images └── smooth-spiral.png ├── language-configuration.json ├── package.json ├── src ├── schemas │ └── tmlanguage.json └── typescript │ ├── GenerateTmLanguageFile.ts │ ├── Scala.tmLanguage.ts │ └── TMLanguageModel.ts ├── syntaxes ├── .gitkeep └── Scala.tmLanguage.json ├── tests ├── snap │ ├── #128.test.scala │ ├── #128.test.scala.snap │ ├── #191.test.scala │ ├── #191.test.scala.snap │ ├── backticks.test.scala │ ├── backticks.test.scala.snap │ ├── comments.test.scala │ ├── comments.test.scala.snap │ ├── end.test.scala │ ├── end.test.scala.snap │ ├── lexical.test.scala │ ├── lexical.test.scala.snap │ ├── scala_spec.test.scala │ └── scala_spec.test.scala.snap └── unit │ ├── #103.test.scala │ ├── #104.test.scala │ ├── #105.test.scala │ ├── #107.test.scala │ ├── #110.test.scala │ ├── #118.test.scala │ ├── #119.test.scala │ ├── #122.test.scala │ ├── #124.test.scala │ ├── #133.test.scala │ ├── #135.test.scala │ ├── #139.test.scala │ ├── #140.test.scala │ ├── #141.test.scala │ ├── #155.test.scala │ ├── #156.test.scala │ ├── #157.test.scala │ ├── #180.test.scala │ ├── #182.test.scala │ ├── #183.test.scala │ ├── #191.test.scala │ ├── #192.test.scala │ ├── #195.test.scala │ ├── #202.test.scala │ ├── #222.test.scala │ ├── #233.test.scala │ ├── #234.test.scala │ ├── #260.test.scala │ ├── #264.test.scala │ ├── #266.test.scala │ ├── #51.test.scala │ ├── #52.test.scala │ ├── #57.test.scala │ ├── #62.test.scala │ ├── #69.test.scala │ ├── #71.test.scala │ ├── #72.test.scala │ ├── #77.test.scala │ ├── #83.test.scala │ ├── #84.test.scala │ ├── #91.test.scala │ ├── basic.test.scala │ ├── definitions-with-nested-comments.test.scala │ ├── enum.test.scala │ ├── exports.test.scala │ ├── extension-on.test.scala │ ├── extension.test.scala │ ├── fast-definitions.test.scala │ ├── given.test.scala │ ├── imports.test.scala │ ├── lexical.test.scala │ ├── multiple.bounds.test.scala │ ├── named.bounds.test.scala │ ├── nested.comments.test.scala │ ├── numeric.literals.test.scala │ ├── quoted.test.scala │ ├── symbol.test.scala │ ├── unicode.identifiers.test.scala │ └── using.test.scala └── yarn.lock /.github/workflows/cla.yml: -------------------------------------------------------------------------------- 1 | name: "Check Scala CLA" 2 | on: 3 | pull_request: 4 | jobs: 5 | cla-check: 6 | runs-on: ubuntu-latest 7 | steps: 8 | - name: Verify CLA 9 | uses: scala/cla-checker@v1 10 | with: 11 | author: ${{ github.event.pull_request.user.login }} 12 | -------------------------------------------------------------------------------- /.github/workflows/continuous-integration.yml: -------------------------------------------------------------------------------- 1 | name: continuous-integration 2 | 3 | # Only run for pushes to a branch, not to a tag 4 | on: 5 | push: 6 | branches: 7 | - '*' 8 | pull_request: 9 | branches: 10 | - '*' 11 | 12 | jobs: 13 | build-and-test: 14 | runs-on: ubuntu-latest 15 | steps: 16 | - uses: actions/checkout@v3 17 | - uses: actions/setup-node@v3 18 | with: 19 | node-version: '14' 20 | - name: Cache Node.js modules 21 | uses: actions/cache@v4 22 | with: 23 | path: "**/node_modules" 24 | key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} 25 | - run: yarn 26 | - run: yarn build 27 | - run: yarn test 28 | -------------------------------------------------------------------------------- /.github/workflows/deploy.yml: -------------------------------------------------------------------------------- 1 | name: deploy 2 | 3 | on: 4 | push: 5 | tags: 6 | - "*.*.*" 7 | 8 | env: 9 | OWNER: scala 10 | REPOSITORY: vscode-scala-syntax 11 | RELEASE_BRANCH: main 12 | 13 | jobs: 14 | deploy: 15 | runs-on: ubuntu-latest 16 | steps: 17 | - uses: actions/checkout@v2 18 | - uses: actions/setup-node@v3 19 | with: 20 | node-version: "14" 21 | - name: Cache Node.js modules 22 | uses: actions/cache@v2 23 | with: 24 | path: "**/node_modules" 25 | key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} 26 | - run: yarn 27 | 28 | - name: Update package.json version 29 | run: yarn version --no-git-tag-version --new-version ${GITHUB_REF#refs/*/} 30 | - name: Generate CHANGELOG.md 31 | run: yarn run github-changes --token ${{ secrets.GITHUB_TOKEN }} --owner $OWNER --repository $REPOSITORY --branch $RELEASE_BRANCH --no-merges --title "Scala Syntax (official) Changelog" 32 | - run: yarn build 33 | - run: yarn test 34 | 35 | # Comment this out if it causes problems... 36 | - name: Commit generated files 37 | run: | 38 | git config --global user.name "Scala bot" 39 | git config --global user.email "$GITHUB_RUN_NUMBER@$GITHUB_SHA" 40 | git commit -am "Release ${GITHUB_REF#refs/*/}" 41 | git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY 42 | git push origin HEAD:$RELEASE_BRANCH 43 | 44 | - name: Release extension 45 | run: yarn vscode:publish --pat ${{ secrets.VS_MARKETPLACE_TOKEN }} 46 | 47 | - name: Generate GitHub Release notes 48 | run: yarn run github-changes --token ${{ secrets.GITHUB_TOKEN }} --owner $OWNER --repository $REPOSITORY --branch $RELEASE_BRANCH --no-merges --title "Changelog" --for-tag ${GITHUB_REF#refs/*/} --file release-notes.md 49 | - name: Create GitHub Release 50 | id: create-release 51 | uses: actions/create-release@v1 52 | env: 53 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 54 | with: 55 | tag_name: ${{ github.ref }} 56 | release_name: Release ${{ github.ref }} 57 | body_path: release-notes.md 58 | draft: false 59 | prerelease: false 60 | - run: mv scala-*.vsix scala.vsix 61 | - name: Upload Release Asset 62 | uses: actions/upload-release-asset@v1 63 | env: 64 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 65 | with: 66 | upload_url: ${{ steps.create-release.outputs.upload_url }} 67 | asset_path: ./scala.vsix 68 | asset_name: scala.vsix 69 | asset_content_type: application/zip 70 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | 3 | *.vsix 4 | .metals 5 | .vscode 6 | -------------------------------------------------------------------------------- /.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | .vscode-test/** 3 | .gitignore 4 | tests/** 5 | src/** 6 | node_modules 7 | **/.gitkeep 8 | project/ 9 | .github/ 10 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | This document explains the developer workflow for making changes to the 4 | [Scala Syntax (official) extension](https://marketplace.visualstudio.com/items?itemName=scala-lang.scala) 5 | for Visual Studio Code. 6 | 7 | To contribute, make sure you have signed the [Scala CLA](http://typesafe.com/contribute/cla/scala), if not, please sign it. 8 | 9 | ## Prerequisites 10 | 11 | Make sure you have the following binaries installed: 12 | 13 | - [`yarn`](https://yarnpkg.com/en/): to build the project 14 | - [`code`](https://code.visualstudio.com/docs/setup/mac): to launch VS Code from 15 | the terminal. 16 | 17 | ## Building the project 18 | 19 | First, install library dependencies. This step needs to re-run every time a new 20 | dependency is added to `package.json`. 21 | 22 | ```bash 23 | yarn install 24 | ``` 25 | 26 | Next, open the source language file `src/typescript/Scala.tmlanguage.ts` to make 27 | changes to the code. To generate the the syntax definition file 28 | `syntaxes/Scala.tmLanguage.json` with your local changes, run the following 29 | command: 30 | 31 | ```bash 32 | yarn build 33 | ``` 34 | 35 | The output tmLanguage file `syntaxes/Scala.tmLanguage.json` is tracked by git, 36 | and is committed on every release (see [#23](https://github.com/scala/vscode-scala-syntax/pull/23)). 37 | The output file is validated against the json schema before being written. 38 | 39 | To run the tests, run the following command: 40 | 41 | ```bash 42 | yarn test 43 | ``` 44 | 45 | ## Installing the extension locally 46 | 47 | Run the following commands to globally install this extension with your local 48 | changes. 49 | 50 | ```bash 51 | yarn install 52 | yarn build 53 | 54 | # replace `*` below with the version of the generated vsix file 55 | code --install-extension scala-*.vsix 56 | ``` 57 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Nicolas Stucki 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Scala Syntax (official) 2 | 3 | [![Install extension](https://img.shields.io/badge/scala-vscode-blue.png)](vscode:extension/scala-lang.scala) 4 | [![Version](https://img.shields.io/github/package-json/v/scala/vscode-scala-syntax.svg)](https://marketplace.visualstudio.com/items?itemName=scala-lang.scala) 5 | ![GitHub Actions Build Status](https://github.com/scala/vscode-scala-syntax/workflows/continuous-integration/badge.svg) 6 | 7 | Visual Studio Code extension providing syntax highlighting for Scala 2 and Scala 3 source files. 8 | 9 | ![Syntax Highlighting Demo](https://i.imgur.com/TDx0mC3.png) 10 | 11 | This repo also powers the Scala syntax highlighting on GitHub. (It is vendored in [github/linguist](https://github.com/github/linguist).) 12 | 13 | ### Team 14 | 15 | The current maintainers (people who can merge pull requests) are: 16 | 17 | - Nicolas Stucki- [`@nicolasstucki`](https://github.com/nicolasstucki) 18 | - Maxime Kjaer - [`@MaximeKjaer`](https://github.com/MaximeKjaer) 19 | - Olafur Pall Geirsson - [`@olafurpg`](https://github.com/olafurpg) 20 | - Vitalii Voloshyn - [`@PanAeon`](https://github.com/PanAeon) 21 | - all other members of the Scala organization on GitHub 22 | 23 | ## Based on 24 | 25 | - Plugin: https://github.com/daltonjorge/vscode-scala 26 | - Template: https://github.com/sellmerfud/scala.tmbundle 27 | (https://github.com/mads-hartmann/scala.tmbundle) 28 | - Textmate JSON schema: 29 | https://github.com/Septh/tmlanguage/blob/master/tmLanguage.schema.json 30 | 31 | ## License 32 | 33 | [MIT](LICENSE.md) 34 | -------------------------------------------------------------------------------- /images/smooth-spiral.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scala/vscode-scala-syntax/bc77c34c114d575962c4326569f8676d3a684641/images/smooth-spiral.png -------------------------------------------------------------------------------- /language-configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | "comments": { 3 | // symbol used for single line comment. Remove this entry if your language does not support line comments 4 | "lineComment": "//", 5 | // symbols used for start and end a block comment. Remove this entry if your language does not support block comments 6 | "blockComment": [ "/*", "*/" ] 7 | }, 8 | // symbols used as brackets 9 | "brackets": [ 10 | ["{", "}"], 11 | ["[", "]"], 12 | ["(", ")"] 13 | ], 14 | // symbols that are auto closed when typing 15 | "autoClosingPairs": [ 16 | ["{", "}"], 17 | ["[", "]"], 18 | ["(", ")"], 19 | ["\"", "\""], 20 | ["s\"", "\""], 21 | ["f\"", "\""], 22 | ["raw\"", "\""], 23 | ["`", "`"] 24 | ], 25 | // symbols that that can be used to surround a selection 26 | "surroundingPairs": [ 27 | ["{", "}"], 28 | ["[", "]"], 29 | ["(", ")"], 30 | ["\"", "\""], 31 | ["'", "'"], 32 | ["`", "`"] 33 | ] 34 | } 35 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "scala", 3 | "displayName": "Scala Syntax (official)", 4 | "description": "Official Scala Syntax", 5 | "version": "0.5.9", 6 | "publisher": "scala-lang", 7 | "license": "SEE LICENSE IN LICENSE.md", 8 | "engines": { 9 | "vscode": "^1.5.0" 10 | }, 11 | "homepage": "https://github.com/scala/vscode-scala-syntax/blob/main/README.md", 12 | "repository": { 13 | "type": "git", 14 | "url": "https://github.com/scala/vscode-scala-syntax.git" 15 | }, 16 | "icon": "images/smooth-spiral.png", 17 | "categories": [ 18 | "Programming Languages" 19 | ], 20 | "contributes": { 21 | "languages": [ 22 | { 23 | "id": "scala", 24 | "aliases": [ 25 | "Scala", 26 | "scala" 27 | ], 28 | "extensions": [ 29 | ".scala", 30 | ".sbt", 31 | ".sc", 32 | ".mill" 33 | ], 34 | "configuration": "./language-configuration.json" 35 | } 36 | ], 37 | "grammars": [ 38 | { 39 | "language": "scala", 40 | "scopeName": "source.scala", 41 | "path": "./syntaxes/Scala.tmLanguage.json" 42 | } 43 | ] 44 | }, 45 | "devDependencies": { 46 | "@types/node": "^14.6.4", 47 | "ajv": "^6.12.4", 48 | "github-changes": "^2.0.2", 49 | "npm-run-all": "^4.1.5", 50 | "rimraf": "^3.0.2", 51 | "ts-node": "^9.0.0", 52 | "typescript": "^4.0.2", 53 | "vsce": "^2.7.0", 54 | "vscode-tmgrammar-test": "0.0.11" 55 | }, 56 | "scripts": { 57 | "clean": "rimraf scala-*.vsix", 58 | "vscode:prepublish": "test -f ./syntaxes/Scala.tmLanguage.json", 59 | "vscode:publish": "vsce publish --yarn", 60 | "build": "npm-run-all build:syntax build:extension", 61 | "build:syntax": "ts-node src/typescript/GenerateTmLanguageFile.ts > ./syntaxes/Scala.tmLanguage.json", 62 | "build:extension": "vsce package --yarn", 63 | "test": "npm-run-all -c test:*", 64 | "test:unit": "vscode-tmgrammar-test -s source.scala -g syntaxes/Scala.tmLanguage.json -t 'tests/unit/**/*.test.scala'", 65 | "test:snap": "vscode-tmgrammar-snap -s source.scala -g syntaxes/Scala.tmLanguage.json -t 'tests/snap/**/*.test.scala'", 66 | "update:snapshots": "vscode-tmgrammar-snap --updateSnapshot -s source.scala -g syntaxes/Scala.tmLanguage.json -t 'tests/snap/**/*.test.scala'" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/schemas/tmlanguage.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-06/schema#", 3 | "title": "tmLanguage", 4 | "description": "Schema for language grammar description files in Textmate and compatible editors. See https://github.com/Septh/tmlanguage/blob/master/tmLanguage.schema.json", 5 | "type": "object", 6 | "properties": { 7 | "scopeName": { 8 | "description": "This should be a unique name for the grammar, following the convention of being a dot-separated name where each new (left-most) part specializes the name. Normally it would be a two-part name where the first is either `text` or `source` and the second is the name of the language or document type. But if you are specializing an existing type, you probably want to derive the name from the type you are specializing. For example Markdown is `text.html.markdown` and Ruby on Rails (rhtml files) is `text.html.rails`. The advantage of deriving it from (in this case) `text.html` is that everything which works in the `text.html` scope will also work in the `text.html.«something»` scope (but with a lower precedence than something specifically targeting `text.html.«something»`).", 9 | "type": "string", 10 | "pattern": "^[\\w$@][\\w\\-$@]*(?:\\.[\\w$@][\\w\\-$@]*)*$" 11 | }, 12 | "fileTypes": { 13 | "description": "An array of file type extensions that the grammar should (by default) be used with.", 14 | "type": "array", 15 | "items": { 16 | "type": "string" 17 | } 18 | }, 19 | "firstLineMatch": { 20 | "description": "A regular expression which is matched against the first line of the document when it is first loaded. If it matches, the grammar is used for the document.", 21 | "type": "string" 22 | }, 23 | "uuid": { 24 | "description": "When the grammer is part of a larger bundle (ie., grammer + theme + whatever), the uuid helps classify which file is a part of which bundle.", 25 | "type": "string" 26 | }, 27 | "foldingStartMarker": { 28 | "description": "Regular expression that lines (in the document) are matched against. If a line matches the pattern, it starts a foldable block.", 29 | "type": "string" 30 | }, 31 | "foldingStopMarker": { 32 | "description": "Regular expressions that lines (in the document) are matched against. If a line matches pattern, it ends a foldable block.", 33 | "type": "string" 34 | }, 35 | "patterns": { 36 | "description": "An array with the actual rules used to parse the document.", 37 | "$ref": "#/definitions/patterns" 38 | }, 39 | "repository": { 40 | "description": "A dictionary (i.e. key/value pairs) of rules which can be included from other places in the grammar. The key is the name of the rule and the value is the actual rule.", 41 | "$ref": "#/definitions/repository" 42 | }, 43 | "injectionSelector": { 44 | "description": "The key is a scope selector that specifies which scope(s) the current grammar should be injected in.", 45 | "type": "string" 46 | }, 47 | "injections": { 48 | "description": "[VS Code only, it seems] A dictionary (i.e. key/value pairs) of rules which will be injected into an existing grammar. The key is the target scope of the parent grammar and the value is the actual rule to inject.", 49 | "$ref": "#/definitions/repository" 50 | } 51 | }, 52 | "required": [ 53 | "scopeName", 54 | "patterns" 55 | ], 56 | "dependencies": { 57 | "foldingStartMarker": [ 58 | "foldingStopMarker" 59 | ], 60 | "foldingStopMarker": [ 61 | "foldingStartMarker" 62 | ], 63 | "injections": { 64 | "not": { 65 | "required": [ 66 | "injectionSelector" 67 | ] 68 | } 69 | } 70 | }, 71 | "additionalProperties": true, 72 | "definitions": { 73 | "boolean-or-integer": { 74 | "oneOf": [ 75 | { 76 | "type": "boolean" 77 | }, 78 | { 79 | "type": "number", 80 | "enum": [ 81 | 0, 82 | 1 83 | ] 84 | } 85 | ] 86 | }, 87 | "patterns": { 88 | "type": "array", 89 | "items": { 90 | "$ref": "#/definitions/rule" 91 | } 92 | }, 93 | "repository": { 94 | "type": "object", 95 | "additionalProperties": { 96 | "$ref": "#/definitions/rule" 97 | } 98 | }, 99 | "name": { 100 | "type": "string", 101 | "pattern": "^[\\w$@][\\w\\-$@]*(?:(?:\\.| )[\\w$@][\\w\\-$@]*)*$" 102 | }, 103 | "captures": { 104 | "type": "object", 105 | "patternProperties": { 106 | "^[0-9]+$": { 107 | "type": "object", 108 | "properties": { 109 | "name": { 110 | "description": "The scope name which gets assigned to the capture matched. This should generally be derived from one of the standard names.", 111 | "type": "string" 112 | }, 113 | "patterns": { 114 | "description": "Yes, captures can be further matched against additional patterns, too.", 115 | "$ref": "#/definitions/patterns" 116 | } 117 | }, 118 | "additionalProperties": false 119 | } 120 | }, 121 | "additionalProperties": false 122 | }, 123 | "rule": { 124 | "type": "object", 125 | "properties": { 126 | "comment": { 127 | "description": "A generic text used to describe or explain the rule.", 128 | "type": "string" 129 | }, 130 | "name": { 131 | "description": "The scope name which gets assigned to the capture matched. This should generally be derived from one of the standard names.", 132 | "type": "string" 133 | }, 134 | "disabled": { 135 | "description": "Marks the rule as disabled. A disabled rule should be ignored by the tokenization engine.", 136 | "$ref": "#/definitions/boolean-or-integer" 137 | }, 138 | "include": { 139 | "description": "This key allows you to reference a different language (value == scope name), recursively reference the grammar itself (value == \"$self\") or a rule declared in this file’s repository (value starts with a pound (#) sign).", 140 | "type": "string" 141 | }, 142 | "match": { 143 | "description": "A regular expression which is used to identify the portion of text to which the name should be assigned.", 144 | "type": "string" 145 | }, 146 | "begin": { 147 | "description": "The `begin` key is a regular expression pattern that allows matches which span several lines. Captures from the `begin` pattern can be referenced in the corresponding `end` or `while` pattern by using normal regular expression back-references, eg. `\\1$`.", 148 | "type": "string" 149 | }, 150 | "end": { 151 | "description": "A regular expression pattern that, when matched, ends the multi-line block started by the `begin` key.", 152 | "type": "string" 153 | }, 154 | "while": { 155 | "description": "A regular expression pattern that, while matched, continues the multi-line block started by the `begin` key.", 156 | "type": "string" 157 | }, 158 | "applyEndPatternLast": { 159 | "description": "Tests the `end` pattern after the other patterns in the `begin`/`end` block.", 160 | "$ref": "#/definitions/boolean-or-integer" 161 | }, 162 | "contentName": { 163 | "description": "This key is similar to the `name` key but it only assigns the name to the text between what is matched by the `begin`/`end` patterns.", 164 | "type": "string" 165 | }, 166 | "captures": { 167 | "description": "This key allows you to assign attributes to the captures of the `match`, `begin`, `end` and `while`patterns. Using the `captures` key for a `begin`/`end` rule is short-hand for giving both `beginCaptures` and `endCaptures` with same values. The value of this key is a dictionary with the key being the capture number and the value being a dictionary of attributes to assign to the captured text.", 168 | "$ref": "#/definitions/captures" 169 | }, 170 | "beginCaptures": { 171 | "description": "This key allows you to assign attributes to the captures of the `begin` pattern. The value of this key is a dictionary with the key being the capture number and the value being a dictionary of attributes to assign to the captured text.", 172 | "$ref": "#/definitions/captures" 173 | }, 174 | "endCaptures": { 175 | "description": "This key allows you to assign attributes to the captures of the `end` pattern. The value of this key is a dictionary with the key being the capture number and the value being a dictionary of attributes to assign to the captured text.", 176 | "$ref": "#/definitions/captures" 177 | }, 178 | "whileCaptures": { 179 | "description": "This key allows you to assign attributes to the captures of the `while` pattern. The value of this key is a dictionary with the key being the capture number and the value being a dictionary of attributes to assign to the captured text.", 180 | "$ref": "#/definitions/captures" 181 | }, 182 | "patterns": { 183 | "description": "An array with the actual rules used to parse the matched content.", 184 | "$ref": "#/definitions/patterns" 185 | }, 186 | "repository": { 187 | "description": "A dictionary (i.e. key/value pairs) of rules which can be included from other places in the grammar. The key is the name of the rule and the value is the actual rule.", 188 | "$ref": "#/definitions/repository" 189 | } 190 | }, 191 | "additionalProperties": false, 192 | "dependencies": { 193 | "include": { 194 | "allOf": [ 195 | { 196 | "not": { 197 | "required": [ 198 | "match" 199 | ] 200 | } 201 | }, 202 | { 203 | "not": { 204 | "required": [ 205 | "begin" 206 | ] 207 | } 208 | } 209 | ] 210 | }, 211 | "match": { 212 | "not": { 213 | "required": [ 214 | "begin" 215 | ] 216 | } 217 | }, 218 | "begin": { 219 | "oneOf": [ 220 | { 221 | "required": [ 222 | "end" 223 | ] 224 | }, 225 | { 226 | "required": [ 227 | "while" 228 | ] 229 | } 230 | ] 231 | }, 232 | "end": [ 233 | "begin" 234 | ], 235 | "while": [ 236 | "begin" 237 | ], 238 | "applyEndPatternLast": [ 239 | "begin" 240 | ], 241 | "captures": { 242 | "oneOf": [ 243 | { 244 | "required": [ 245 | "match" 246 | ] 247 | }, 248 | { 249 | "required": [ 250 | "begin" 251 | ] 252 | } 253 | ] 254 | }, 255 | "beginCaptures": [ 256 | "begin" 257 | ], 258 | "endCaptures": [ 259 | "end" 260 | ], 261 | "whileCaptures": [ 262 | "while" 263 | ] 264 | } 265 | } 266 | } 267 | } -------------------------------------------------------------------------------- /src/typescript/GenerateTmLanguageFile.ts: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | import * as fs from 'fs'; 4 | import * as Ajv from 'ajv'; 5 | import { scalaTmLanguage } from "./Scala.tmLanguage"; 6 | 7 | let schema = fs.readFileSync('./src/schemas/tmlanguage.json').toString(); 8 | 9 | var ajv = new Ajv({verbose: true}); 10 | ajv.addMetaSchema(require('ajv/lib/refs/json-schema-draft-06.json')); 11 | 12 | var validate = ajv.compile(JSON.parse(schema)); 13 | var valid = validate(scalaTmLanguage); 14 | if (!valid) { 15 | console.error("The were validation errors.\n"); 16 | console.error(validate.errors); 17 | } else { 18 | console.log(JSON.stringify(scalaTmLanguage)); 19 | } 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/typescript/TMLanguageModel.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable */ 2 | /** 3 | * This file was automatically generated by json-schema-to-typescript. 4 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 5 | * and run json-schema-to-typescript to regenerate this file. 6 | */ 7 | 8 | /** 9 | * Schema for language grammar description files in Textmate and compatible editors. 10 | */ 11 | export interface TmLanguage { 12 | /** 13 | * This should be a unique name for the grammar, following the convention of being a dot-separated name where each new (left-most) part specializes the name. Normally it would be a two-part name where the first is either `text` or `source` and the second is the name of the language or document type. But if you are specializing an existing type, you probably want to derive the name from the type you are specializing. For example Markdown is `text.html.markdown` and Ruby on Rails (rhtml files) is `text.html.rails`. The advantage of deriving it from (in this case) `text.html` is that everything which works in the `text.html` scope will also work in the `text.html.«something»` scope (but with a lower precedence than something specifically targeting `text.html.«something»`). 14 | */ 15 | scopeName: string; 16 | /** 17 | * An array of file type extensions that the grammar should (by default) be used with. 18 | */ 19 | fileTypes?: string[]; 20 | /** 21 | * A regular expression which is matched against the first line of the document when it is first loaded. If it matches, the grammar is used for the document. 22 | */ 23 | firstLineMatch?: string; 24 | /** 25 | * When the grammer is part of a larger bundle (ie., grammer + theme + whatever), the uuid helps classify which file is a part of which bundle. 26 | */ 27 | uuid?: string; 28 | /** 29 | * Regular expression that lines (in the document) are matched against. If a line matches the pattern, it starts a foldable block. 30 | */ 31 | foldingStartMarker?: string; 32 | /** 33 | * Regular expressions that lines (in the document) are matched against. If a line matches pattern, it ends a foldable block. 34 | */ 35 | foldingStopMarker?: string; 36 | /** 37 | * An array with the actual rules used to parse the document. 38 | */ 39 | patterns: Rule[]; 40 | /** 41 | * A dictionary (i.e. key/value pairs) of rules which can be included from other places in the grammar. The key is the name of the rule and the value is the actual rule. 42 | */ 43 | repository?: { 44 | [k: string]: Rule; 45 | }; 46 | /** 47 | * The key is a scope selector that specifies which scope(s) the current grammar should be injected in. 48 | */ 49 | injectionSelector?: string; 50 | /** 51 | * [VS Code only, it seems] A dictionary (i.e. key/value pairs) of rules which will be injected into an existing grammar. The key is the target scope of the parent grammar and the value is the actual rule to inject. 52 | */ 53 | injections?: { 54 | [k: string]: Rule; 55 | }; 56 | [k: string]: any; 57 | } 58 | export interface Rule { 59 | /** 60 | * A generic text used to describe or explain the rule. 61 | */ 62 | comment?: string; 63 | /** 64 | * The scope name which gets assigned to the capture matched. This should generally be derived from one of the standard names. 65 | */ 66 | name?: string; 67 | /** 68 | * Marks the rule as disabled. A disabled rule should be ignored by the tokenization engine. 69 | */ 70 | disabled?: boolean | (0 | 1); 71 | /** 72 | * This key allows you to reference a different language (value == scope name), recursively reference the grammar itself (value == "$self") or a rule declared in this file’s repository (value starts with a pound (#) sign). 73 | */ 74 | include?: string; 75 | /** 76 | * A regular expression which is used to identify the portion of text to which the name should be assigned. 77 | */ 78 | match?: string; 79 | /** 80 | * The `begin` key is a regular expression pattern that allows matches which span several lines. Captures from the `begin` pattern can be referenced in the corresponding `end` or `while` pattern by using normal regular expression back-references, eg. `\1$`. 81 | */ 82 | begin?: string; 83 | /** 84 | * A regular expression pattern that, when matched, ends the multi-line block started by the `begin` key. 85 | */ 86 | end?: string; 87 | /** 88 | * A regular expression pattern that, while matched, continues the multi-line block started by the `begin` key. 89 | */ 90 | while?: string; 91 | /** 92 | * Tests the `end` pattern after the other patterns in the `begin`/`end` block. 93 | */ 94 | applyEndPatternLast?: boolean | (0 | 1); 95 | /** 96 | * This key is similar to the `name` key but it only assigns the name to the text between what is matched by the `begin`/`end` patterns. 97 | */ 98 | contentName?: string; 99 | /** 100 | * This key allows you to assign attributes to the captures of the `match`, `begin`, `end` and `while`patterns. Using the `captures` key for a `begin`/`end` rule is short-hand for giving both `beginCaptures` and `endCaptures` with same values. The value of this key is a dictionary with the key being the capture number and the value being a dictionary of attributes to assign to the captured text. 101 | */ 102 | captures?: { 103 | /** 104 | * This interface was referenced by `undefined`'s JSON-Schema definition 105 | * via the `patternProperty` "^[0-9]+$". 106 | * 107 | * This interface was referenced by `undefined`'s JSON-Schema definition 108 | * via the `patternProperty` "^[0-9]+$". 109 | * 110 | * This interface was referenced by `undefined`'s JSON-Schema definition 111 | * via the `patternProperty` "^[0-9]+$". 112 | * 113 | * This interface was referenced by `undefined`'s JSON-Schema definition 114 | * via the `patternProperty` "^[0-9]+$". 115 | */ 116 | [k: string]: { 117 | /** 118 | * The scope name which gets assigned to the capture matched. This should generally be derived from one of the standard names. 119 | */ 120 | name?: string; 121 | /** 122 | * Yes, captures can be further matched against additional patterns, too. 123 | */ 124 | patterns?: Rule[]; 125 | }; 126 | }; 127 | /** 128 | * This key allows you to assign attributes to the captures of the `begin` pattern. The value of this key is a dictionary with the key being the capture number and the value being a dictionary of attributes to assign to the captured text. 129 | */ 130 | beginCaptures?: { 131 | /** 132 | * This interface was referenced by `undefined`'s JSON-Schema definition 133 | * via the `patternProperty` "^[0-9]+$". 134 | * 135 | * This interface was referenced by `undefined`'s JSON-Schema definition 136 | * via the `patternProperty` "^[0-9]+$". 137 | * 138 | * This interface was referenced by `undefined`'s JSON-Schema definition 139 | * via the `patternProperty` "^[0-9]+$". 140 | * 141 | * This interface was referenced by `undefined`'s JSON-Schema definition 142 | * via the `patternProperty` "^[0-9]+$". 143 | */ 144 | [k: string]: { 145 | /** 146 | * The scope name which gets assigned to the capture matched. This should generally be derived from one of the standard names. 147 | */ 148 | name?: string; 149 | /** 150 | * Yes, captures can be further matched against additional patterns, too. 151 | */ 152 | patterns?: Rule[]; 153 | }; 154 | }; 155 | /** 156 | * This key allows you to assign attributes to the captures of the `end` pattern. The value of this key is a dictionary with the key being the capture number and the value being a dictionary of attributes to assign to the captured text. 157 | */ 158 | endCaptures?: { 159 | /** 160 | * This interface was referenced by `undefined`'s JSON-Schema definition 161 | * via the `patternProperty` "^[0-9]+$". 162 | * 163 | * This interface was referenced by `undefined`'s JSON-Schema definition 164 | * via the `patternProperty` "^[0-9]+$". 165 | * 166 | * This interface was referenced by `undefined`'s JSON-Schema definition 167 | * via the `patternProperty` "^[0-9]+$". 168 | * 169 | * This interface was referenced by `undefined`'s JSON-Schema definition 170 | * via the `patternProperty` "^[0-9]+$". 171 | */ 172 | [k: string]: { 173 | /** 174 | * The scope name which gets assigned to the capture matched. This should generally be derived from one of the standard names. 175 | */ 176 | name?: string; 177 | /** 178 | * Yes, captures can be further matched against additional patterns, too. 179 | */ 180 | patterns?: Rule[]; 181 | }; 182 | }; 183 | /** 184 | * This key allows you to assign attributes to the captures of the `while` pattern. The value of this key is a dictionary with the key being the capture number and the value being a dictionary of attributes to assign to the captured text. 185 | */ 186 | whileCaptures?: { 187 | /** 188 | * This interface was referenced by `undefined`'s JSON-Schema definition 189 | * via the `patternProperty` "^[0-9]+$". 190 | * 191 | * This interface was referenced by `undefined`'s JSON-Schema definition 192 | * via the `patternProperty` "^[0-9]+$". 193 | * 194 | * This interface was referenced by `undefined`'s JSON-Schema definition 195 | * via the `patternProperty` "^[0-9]+$". 196 | * 197 | * This interface was referenced by `undefined`'s JSON-Schema definition 198 | * via the `patternProperty` "^[0-9]+$". 199 | */ 200 | [k: string]: { 201 | /** 202 | * The scope name which gets assigned to the capture matched. This should generally be derived from one of the standard names. 203 | */ 204 | name?: string; 205 | /** 206 | * Yes, captures can be further matched against additional patterns, too. 207 | */ 208 | patterns?: Rule[]; 209 | }; 210 | }; 211 | /** 212 | * An array with the actual rules used to parse the matched content. 213 | */ 214 | patterns?: Rule[]; 215 | /** 216 | * A dictionary (i.e. key/value pairs) of rules which can be included from other places in the grammar. The key is the name of the rule and the value is the actual rule. 217 | */ 218 | repository?: { 219 | [k: string]: Rule; 220 | }; 221 | } 222 | -------------------------------------------------------------------------------- /syntaxes/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scala/vscode-scala-syntax/bc77c34c114d575962c4326569f8676d3a684641/syntaxes/.gitkeep -------------------------------------------------------------------------------- /syntaxes/Scala.tmLanguage.json: -------------------------------------------------------------------------------- 1 | {"fileTypes":["scala"],"firstLineMatch":"^#!/.*\\b\\w*scala\\b","foldingStartMarker":"/\\*\\*|\\{\\s*$","foldingStopMarker":"\\*\\*/|^\\s*\\}","keyEquivalent":"^~S","repository":{"empty-parentheses":{"match":"(\\(\\))","captures":{"1":{"name":"meta.bracket.scala"}},"name":"meta.parentheses.scala"},"imports":{"end":"(?<=[\\n;])","begin":"\\b(import)\\s+","beginCaptures":{"1":{"name":"keyword.other.import.scala"}},"patterns":[{"include":"#comments"},{"match":"\\b(given)\\b","name":"keyword.other.import.given.scala"},{"match":"\\s(as)\\s","name":"keyword.other.import.as.scala"},{"match":"[A-Z\\p{Lt}\\p{Lu}][A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*(?:(?<=_)[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)?","name":"entity.name.class.import.scala"},{"match":"(`[^`]+`|(?:[A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}][A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*(?:(?<=_)[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)?|[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+))","name":"entity.name.import.scala"},{"match":"\\.","name":"punctuation.definition.import"},{"end":"}","begin":"{","beginCaptures":{"0":{"name":"meta.bracket.scala"}},"patterns":[{"match":"(?x)(given\\s)?\\s*(?:([A-Z\\p{Lt}\\p{Lu}][A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*(?:(?<=_)[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)?)|(`[^`]+`|(?:[A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}][A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*(?:(?<=_)[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)?|[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)))\\s*(=>)\\s*(?:([A-Z\\p{Lt}\\p{Lu}][A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*(?:(?<=_)[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)?)|(`[^`]+`|(?:[A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}][A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*(?:(?<=_)[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)?|[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)))\\s*","captures":{"1":{"name":"keyword.other.import.given.scala"},"2":{"name":"entity.name.class.import.renamed-from.scala"},"3":{"name":"entity.name.import.renamed-from.scala"},"4":{"name":"keyword.other.arrow.scala"},"5":{"name":"entity.name.class.import.renamed-to.scala"},"6":{"name":"entity.name.import.renamed-to.scala"}}},{"match":"\\b(given)\\b","name":"keyword.other.import.given.scala"},{"match":"(given\\s+)?(?:([A-Z\\p{Lt}\\p{Lu}][A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*(?:(?<=_)[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)?)|(`[^`]+`|(?:[A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}][A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*(?:(?<=_)[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)?|[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)))","captures":{"1":{"name":"keyword.other.import.given.scala"},"2":{"name":"entity.name.class.import.scala"},"3":{"name":"entity.name.import.scala"}}}],"endCaptures":{"0":{"name":"meta.bracket.scala"}},"name":"meta.import.selector.scala"}],"name":"meta.import.scala"},"exports":{"end":"(?<=[\\n;])","begin":"\\b(export)\\s+","beginCaptures":{"1":{"name":"keyword.other.export.scala"}},"patterns":[{"include":"#comments"},{"match":"\\b(given)\\b","name":"keyword.other.export.given.scala"},{"match":"[A-Z\\p{Lt}\\p{Lu}][A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*(?:(?<=_)[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)?","name":"entity.name.class.export.scala"},{"match":"(`[^`]+`|(?:[A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}][A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*(?:(?<=_)[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)?|[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+))","name":"entity.name.export.scala"},{"match":"\\.","name":"punctuation.definition.export"},{"end":"}","begin":"{","beginCaptures":{"0":{"name":"meta.bracket.scala"}},"patterns":[{"match":"(?x)(given\\s)?\\s*(?:([A-Z\\p{Lt}\\p{Lu}][A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*(?:(?<=_)[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)?)|(`[^`]+`|(?:[A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}][A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*(?:(?<=_)[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)?|[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)))\\s*(=>)\\s*(?:([A-Z\\p{Lt}\\p{Lu}][A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*(?:(?<=_)[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)?)|(`[^`]+`|(?:[A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}][A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*(?:(?<=_)[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)?|[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)))\\s*","captures":{"1":{"name":"keyword.other.export.given.scala"},"2":{"name":"entity.name.class.export.renamed-from.scala"},"3":{"name":"entity.name.export.renamed-from.scala"},"4":{"name":"keyword.other.arrow.scala"},"5":{"name":"entity.name.class.export.renamed-to.scala"},"6":{"name":"entity.name.export.renamed-to.scala"}}},{"match":"\\b(given)\\b","name":"keyword.other.export.given.scala"},{"match":"(given\\s+)?(?:([A-Z\\p{Lt}\\p{Lu}][A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*(?:(?<=_)[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)?)|(`[^`]+`|(?:[A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}][A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*(?:(?<=_)[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)?|[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)))","captures":{"1":{"name":"keyword.other.export.given.scala"},"2":{"name":"entity.name.class.export.scala"},"3":{"name":"entity.name.export.scala"}}}],"endCaptures":{"0":{"name":"meta.bracket.scala"}},"name":"meta.export.selector.scala"}],"name":"meta.export.scala"},"constants":{"patterns":[{"match":"\\b(false|null|true)\\b","name":"constant.language.scala"},{"match":"\\b(0[xX][0-9a-fA-F_]*)\\b","name":"constant.numeric.scala"},{"match":"\\b(([0-9][0-9_]*(\\.[0-9][0-9_]*)?)([eE](\\+|-)?[0-9][0-9_]*)?|[0-9][0-9_]*)[LlFfDd]?\\b","name":"constant.numeric.scala"},{"match":"(\\.[0-9][0-9_]*)([eE](\\+|-)?[0-9][0-9_]*)?[LlFfDd]?\\b","name":"constant.numeric.scala"},{"match":"\\b0[bB][01]([01_]*[01])?[Ll]?\\b","name":"constant.numeric.scala"},{"match":"\\b(this|super)\\b","name":"variable.language.scala"}]},"script-header":{"match":"^#!(.*)$","captures":{"1":{"name":"string.unquoted.shebang.scala"}},"name":"comment.block.shebang.scala"},"code":{"patterns":[{"include":"#using-directive"},{"include":"#script-header"},{"include":"#storage-modifiers"},{"include":"#declarations"},{"include":"#inheritance"},{"include":"#extension"},{"include":"#imports"},{"include":"#exports"},{"include":"#comments"},{"include":"#strings"},{"include":"#initialization"},{"include":"#xml-literal"},{"include":"#namedBounds"},{"include":"#keywords"},{"include":"#using"},{"include":"#constants"},{"include":"#singleton-type"},{"include":"#inline"},{"include":"#scala-quoted-or-symbol"},{"include":"#char-literal"},{"include":"#empty-parentheses"},{"include":"#parameter-list"},{"include":"#qualifiedClassName"},{"include":"#backQuotedVariable"},{"include":"#curly-braces"},{"include":"#meta-brackets"},{"include":"#meta-bounds"},{"include":"#meta-colons"}]},"strings":{"patterns":[{"end":"\"\"\"(?!\")","begin":"\"\"\"","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.scala"}},"patterns":[{"match":"\\\\\\\\|\\\\u[0-9A-Fa-f]{4}","name":"constant.character.escape.scala"}],"endCaptures":{"0":{"name":"punctuation.definition.string.end.scala"}},"name":"string.quoted.triple.scala"},{"begin":"\\b(raw)(\"\"\")","end":"(\"\"\")(?!\")|\\$\n|(\\$[^\\$\"_{A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}])","beginCaptures":{"1":{"name":"keyword.interpolation.scala"},"2":{"name":"string.quoted.triple.interpolated.scala punctuation.definition.string.begin.scala"}},"patterns":[{"match":"\\$[\\$\"]","name":"constant.character.escape.scala"},{"include":"#string-interpolation"},{"match":".","name":"string.quoted.triple.interpolated.scala"}],"endCaptures":{"1":{"name":"string.quoted.triple.interpolated.scala punctuation.definition.string.end.scala"},"2":{"name":"invalid.illegal.unrecognized-string-escape.scala"}}},{"begin":"\\b((?:[A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}][A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*(?:(?<=_)[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)?))(\"\"\")","end":"(\"\"\")(?!\")|\\$\n|(\\$[^\\$\"_{A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}])","beginCaptures":{"1":{"name":"keyword.interpolation.scala"},"2":{"name":"string.quoted.triple.interpolated.scala punctuation.definition.string.begin.scala"}},"patterns":[{"include":"#string-interpolation"},{"match":"\\\\\\\\|\\\\u[0-9A-Fa-f]{4}","name":"constant.character.escape.scala"},{"match":".","name":"string.quoted.triple.interpolated.scala"}],"endCaptures":{"1":{"name":"string.quoted.triple.interpolated.scala punctuation.definition.string.end.scala"},"2":{"name":"invalid.illegal.unrecognized-string-escape.scala"}}},{"end":"\"","begin":"\"","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.scala"}},"patterns":[{"match":"\\\\(?:[btnfr\\\\\"']|[0-7]{1,3}|u[0-9A-Fa-f]{4})","name":"constant.character.escape.scala"},{"match":"\\\\.","name":"invalid.illegal.unrecognized-string-escape.scala"}],"endCaptures":{"0":{"name":"punctuation.definition.string.end.scala"}},"name":"string.quoted.double.scala"},{"begin":"\\b(raw)(\")","end":"(\")|\\$\n|(\\$[^\\$\"_{A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}])","beginCaptures":{"1":{"name":"keyword.interpolation.scala"},"2":{"name":"string.quoted.double.interpolated.scala punctuation.definition.string.begin.scala"}},"patterns":[{"match":"\\$[\\$\"]","name":"constant.character.escape.scala"},{"include":"#string-interpolation"},{"match":".","name":"string.quoted.double.interpolated.scala"}],"endCaptures":{"1":{"name":"string.quoted.double.interpolated.scala punctuation.definition.string.end.scala"},"2":{"name":"invalid.illegal.unrecognized-string-escape.scala"}}},{"begin":"\\b((?:[A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}][A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*(?:(?<=_)[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)?))(\")","end":"(\")|\\$\n|(\\$[^\\$\"_{A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}])","beginCaptures":{"1":{"name":"keyword.interpolation.scala"},"2":{"name":"string.quoted.double.interpolated.scala punctuation.definition.string.begin.scala"}},"patterns":[{"match":"\\$[\\$\"]","name":"constant.character.escape.scala"},{"include":"#string-interpolation"},{"match":"\\\\(?:[btnfr\\\\\"']|[0-7]{1,3}|u[0-9A-Fa-f]{4})","name":"constant.character.escape.scala"},{"match":"\\\\.","name":"invalid.illegal.unrecognized-string-escape.scala"},{"match":".","name":"string.quoted.double.interpolated.scala"}],"endCaptures":{"1":{"name":"string.quoted.double.interpolated.scala punctuation.definition.string.end.scala"},"2":{"name":"invalid.illegal.unrecognized-string-escape.scala"}}}]},"using":{"patterns":[{"match":"(?<=\\()\\s*(using)\\s","captures":{"1":{"name":"keyword.declaration.scala"}}}]},"string-interpolation":{"patterns":[{"name":"constant.character.escape.interpolation.scala","match":"\\$\\$"},{"name":"meta.template.expression.scala","match":"(\\$)([A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}][A-Z\\p{Lt}\\p{Lu}_a-z\\p{Lo}\\p{Nl}\\p{Ll}0-9]*)","captures":{"1":{"name":"punctuation.definition.template-expression.begin.scala"}}},{"name":"meta.template.expression.scala","begin":"\\$\\{","beginCaptures":{"0":{"name":"punctuation.definition.template-expression.begin.scala"}},"end":"\\}","endCaptures":{"0":{"name":"punctuation.definition.template-expression.end.scala"}},"patterns":[{"include":"#code"}],"contentName":"meta.embedded.line.scala"}]},"xml-entity":{"match":"(&)([:a-zA-Z_][:a-zA-Z0-9_.-]*|#[0-9]+|#x[0-9a-fA-F]+)(;)","captures":{"1":{"name":"punctuation.definition.constant.xml"},"3":{"name":"punctuation.definition.constant.xml"}},"name":"constant.character.entity.xml"},"xml-singlequotedString":{"end":"'","begin":"'","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.xml"}},"patterns":[{"include":"#xml-entity"}],"endCaptures":{"0":{"name":"punctuation.definition.string.end.xml"}},"name":"string.quoted.single.xml"},"meta-colons":{"patterns":[{"match":"(?=?@^|~\\p{Sm}\\p{So}]+)?))(?=\\s*(//.*|/\\*(?!.*\\*/\\s*\\S.*).*)?$)","captures":{"1":{"name":"keyword.declaration.end.scala"},"2":{"name":"keyword.declaration.end.scala"},"3":{"name":"entity.name.type.declaration"}}},{"match":"\\b(catch|finally|try)\\b","name":"keyword.control.exception.scala"},{"match":"^\\s*(end)\\s+(try)(?=\\s*(//.*|/\\*(?!.*\\*/\\s*\\S.*).*)?$)","name":"keyword.control.exception.end.scala"},{"match":"^\\s*(end)\\s+(`[^`]+`|(?:[A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}][A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*(?:(?<=_)[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)?|[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+))?(?=\\s*(//.*|/\\*(?!.*\\*/\\s*\\S.*).*)?$)","captures":{"1":{"name":"keyword.declaration.end.scala"},"2":{"name":"entity.name.declaration"}}},{"match":"([!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]|[\\\\]){3,}","name":"keyword.operator.scala"},{"match":"((?:[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]|[\\\\]){2,}|_\\*)","captures":{"1":{"patterns":[{"match":"(\\|\\||&&)","name":"keyword.operator.logical.scala"},{"match":"(\\!=|==|\\<=|>=)","name":"keyword.operator.comparison.scala"},{"match":"..","name":"keyword.operator.scala"}]}}},{"match":"(?=?@^|~\\p{Sm}\\p{So}]|\\\\)","captures":{"1":{"patterns":[{"match":"(\\!)","name":"keyword.operator.logical.scala"},{"match":"(\\*|-|\\+|/|%|~)","name":"keyword.operator.arithmetic.scala"},{"match":"(=|\\<|>)","name":"keyword.operator.comparison.scala"},{"match":".","name":"keyword.operator.scala"}]}}}]},"singleton-type":{"match":"\\.(type)(?![A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}][A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*(?:(?<=_)[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)?|[0-9])","captures":{"1":{"name":"keyword.type.scala"}}},"inline":{"patterns":[{"match":"\\b(inline)(?=\\s+((?:[A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}][A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*(?:(?<=_)[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)?|[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)|`[^`]+`)\\s*:)","name":"storage.modifier.other"},{"match":"\\b(inline)\\b(?=(?:.(?!\\b(?:val|def|given)\\b))*\\b(if|match)\\b)","name":"keyword.control.flow.scala"}]},"scala-quoted-or-symbol":{"patterns":[{"match":"(')((?>(?:[A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}][A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*(?:(?<=_)[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)?|[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)))(?!')","captures":{"1":{"name":"keyword.control.flow.staging.scala constant.other.symbol.scala"},"2":{"name":"constant.other.symbol.scala"}}},{"match":"'(?=\\s*\\{(?!'))","name":"keyword.control.flow.staging.scala"},{"match":"'(?=\\s*\\[(?!'))","name":"keyword.control.flow.staging.scala"},{"match":"\\$(?=\\s*\\{)","name":"keyword.control.flow.staging.scala"}]},"xml-doublequotedString":{"end":"\"","begin":"\"","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.xml"}},"patterns":[{"include":"#xml-entity"}],"endCaptures":{"0":{"name":"punctuation.definition.string.end.xml"}},"name":"string.quoted.double.xml"},"declarations":{"patterns":[{"match":"\\b(def)\\b\\s*(?!//|/\\*)((?:(?:[A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}][A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*(?:(?<=_)[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)?|[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)|`[^`]+`))?","captures":{"1":{"name":"keyword.declaration.scala"},"2":{"name":"entity.name.function.declaration"}}},{"match":"\\b(trait)\\b\\s*(?!//|/\\*)((?:(?:[A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}][A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*(?:(?<=_)[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)?|[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)|`[^`]+`))?","captures":{"1":{"name":"keyword.declaration.scala"},"2":{"name":"entity.name.class.declaration"}}},{"match":"\\b(?:(case)\\s+)?(class|object|enum)\\b\\s*(?!//|/\\*)((?:(?:[A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}][A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*(?:(?<=_)[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)?|[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)|`[^`]+`))?","captures":{"1":{"name":"keyword.declaration.scala"},"2":{"name":"keyword.declaration.scala"},"3":{"name":"entity.name.class.declaration"}}},{"match":"(?=?@^|~\\p{Sm}\\p{So}]+)?|[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)|`[^`]+`))?","captures":{"1":{"name":"keyword.declaration.scala"},"2":{"name":"entity.name.type.declaration"}}},{"match":"\\b(?:(val)|(var))\\b\\s*(?!//|/\\*)(?=(?:(?:[A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}][A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*(?:(?<=_)[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)?|[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)|`[^`]+`)?\\()","captures":{"1":{"name":"keyword.declaration.stable.scala"},"2":{"name":"keyword.declaration.volatile.scala"}}},{"match":"\\b(val)\\b\\s*(?!//|/\\*)((?:(?:[A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}][A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*(?:(?<=_)[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)?|[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)|`[^`]+`)(?:\\s*,\\s*(?:(?:[A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}][A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*(?:(?<=_)[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)?|[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)|`[^`]+`))*)?(?!\")","captures":{"1":{"name":"keyword.declaration.stable.scala"},"2":{"name":"variable.stable.declaration.scala"}}},{"match":"\\b(var)\\b\\s*(?!//|/\\*)((?:(?:[A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}][A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*(?:(?<=_)[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)?|[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)|`[^`]+`)(?:\\s*,\\s*(?:(?:[A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}][A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*(?:(?<=_)[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)?|[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)|`[^`]+`))*)?(?!\")","captures":{"1":{"name":"keyword.declaration.volatile.scala"},"2":{"name":"variable.volatile.declaration.scala"}}},{"match":"\\b(package)\\s+(object)\\b\\s*(?!//|/\\*)((?:(?:[A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}][A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*(?:(?<=_)[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)?|[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)|`[^`]+`))?","captures":{"1":{"name":"keyword.other.package.scala"},"2":{"name":"keyword.declaration.scala"},"3":{"name":"entity.name.class.declaration"}}},{"end":"(?<=[\\n;])","begin":"\\b(package)\\s+","beginCaptures":{"1":{"name":"keyword.other.package.scala"}},"patterns":[{"include":"#comments"},{"match":"(`[^`]+`|(?:[A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}][A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*(?:(?<=_)[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)?|[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+))","name":"entity.name.package.scala"},{"match":"\\.","name":"punctuation.definition.package"}],"name":"meta.package.scala"},{"match":"\\b(given)\\b\\s*([_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}][A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*(?:(?<=_)[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)?|`[^`]+`)?","captures":{"1":{"name":"keyword.declaration.scala"},"2":{"name":"entity.name.given.declaration"}}}]},"char-literal":{"patterns":[{"match":"(')'(')","name":"string.quoted.other constant.character.literal.scala","captures":{"1":{"name":"punctuation.definition.character.begin.scala"},"2":{"name":"punctuation.definition.character.end.scala"}}},{"end":"'|$","begin":"'","beginCaptures":{"0":{"name":"punctuation.definition.character.begin.scala"}},"patterns":[{"match":"\\\\(?:[btnfr\\\\\"']|[0-7]{1,3}|u[0-9A-Fa-f]{4})","name":"constant.character.escape.scala"},{"match":"\\\\.","name":"invalid.illegal.unrecognized-character-escape.scala"},{"match":"[^']{2,}","name":"invalid.illegal.character-literal-too-long"},{"match":"(?=?@^|~\\p{Sm}\\p{So}]+)?)\\b","captures":{"1":{"name":"keyword.other.import.as.scala"},"2":{"name":"variable.stable.declaration.scala"}}}]},"qualifiedClassName":{"match":"(\\b([A-Z][\\w]*)(?:(?<=_)[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)?)","captures":{"1":{"name":"entity.name.class"}}},"backQuotedVariable":{"match":"`[^`]+`"},"storage-modifiers":{"patterns":[{"match":"\\b(private\\[\\S+\\]|protected\\[\\S+\\]|private|protected)\\b","name":"storage.modifier.access"},{"match":"\\b(synchronized|@volatile|abstract|final|lazy|sealed|implicit|override|@transient|@native)\\b","name":"storage.modifier.other"},{"match":"(?<=^|\\s)\\b(transparent|opaque|infix|open|inline)\\b(?=[a-z\\s]*\\b(def|val|var|given|type|class|trait|object|enum)\\b)","name":"storage.modifier.other"}]},"meta-bounds":{"match":"<%|=:=|<:<|<%<|>:|<:","comment":"For themes: Matching view bounds","name":"meta.bounds.scala"},"using-directive":{"end":"\\n","begin":"^\\s*(//>)\\s*(using)[^\\S\\n]+(?:(\\S+))?","beginCaptures":{"1":{"name":"punctuation.definition.comment.scala"},"2":{"name":"keyword.other.import.scala"},"3":{"patterns":[{"match":"[A-Z\\p{Lt}\\p{Lu}][A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*(?:(?<=_)[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)?|`[^`]+`|(?:[A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}][A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*(?:(?<=_)[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)?|[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)","name":"entity.name.import.scala"},{"match":"\\.","name":"punctuation.definition.import"}]}},"patterns":[{"include":"#constants"},{"include":"#strings"},{"match":"[^\\s,]+","name":"string.quoted.double.scala"}],"name":"comment.line.shebang.scala"},"comments":{"patterns":[{"include":"#block-comments"},{"end":"(?!\\G)","begin":"(^[ \\t]+)?(?=//)","beginCaptures":{"1":{"name":"punctuation.whitespace.comment.leading.scala"}},"patterns":[{"end":"\\n","begin":"//","beginCaptures":{"0":{"name":"punctuation.definition.comment.scala"}},"name":"comment.line.double-slash.scala"}]}]},"block-comments":{"patterns":[{"match":"/\\*\\*/","captures":{"0":{"name":"punctuation.definition.comment.scala"}},"name":"comment.block.empty.scala"},{"end":"\\*/","begin":"^\\s*(/\\*\\*)(?!/)","beginCaptures":{"1":{"name":"punctuation.definition.comment.scala"}},"patterns":[{"match":"(@param)\\s+(\\S+)","captures":{"1":{"name":"keyword.other.documentation.scaladoc.scala"},"2":{"name":"variable.parameter.scala"}}},{"match":"(@(?:tparam|throws))\\s+(\\S+)","captures":{"1":{"name":"keyword.other.documentation.scaladoc.scala"},"2":{"name":"entity.name.class"}}},{"match":"@(return|see|note|example|constructor|usecase|author|version|since|todo|deprecated|migration|define|inheritdoc|groupname|groupprio|groupdesc|group|contentDiagram|documentable|syntax)\\b","name":"keyword.other.documentation.scaladoc.scala"},{"match":"(\\[\\[)([^\\]]+)(\\]\\])","captures":{"1":{"name":"punctuation.definition.documentation.link.scala"},"2":{"name":"string.other.link.title.markdown"},"3":{"name":"punctuation.definition.documentation.link.scala"}}},{"include":"#block-comments"}],"endCaptures":{"0":{"name":"punctuation.definition.comment.scala"}},"name":"comment.block.documentation.scala"},{"end":"\\*/","begin":"/\\*","captures":{"0":{"name":"punctuation.definition.comment.scala"}},"patterns":[{"include":"#block-comments"}],"name":"comment.block.scala"}]},"xml-embedded-content":{"patterns":[{"end":"}","begin":"{","patterns":[{"include":"#code"}],"captures":{"0":{"name":"meta.bracket.scala"}},"name":"meta.source.embedded.scala"},{"match":" (?:([-_a-zA-Z0-9]+)((:)))?([_a-zA-Z-]+)=","captures":{"1":{"name":"entity.other.attribute-name.namespace.xml"},"2":{"name":"entity.other.attribute-name.xml"},"3":{"name":"punctuation.separator.namespace.xml"},"4":{"name":"entity.other.attribute-name.localname.xml"}}},{"include":"#xml-doublequotedString"},{"include":"#xml-singlequotedString"}]},"inheritance":{"patterns":[{"match":"\\b(extends|with|derives)\\b\\s*([A-Z\\p{Lt}\\p{Lu}][A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*(?:(?<=_)[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)?|`[^`]+`|(?=\\([^\\)]+=>)|(?=(?:[A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}][A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*(?:(?<=_)[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)?|[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+))|(?=\"))?","captures":{"1":{"name":"keyword.declaration.scala"},"2":{"name":"entity.name.class"}}}]},"extension":{"patterns":[{"match":"^\\s*(extension)\\s+(?=[\\[\\(])","captures":{"1":{"name":"keyword.declaration.scala"}}}]},"parameter-list":{"patterns":[{"match":"(?<=[^\\._$a-zA-Z0-9])(`[^`]+`|[_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}][A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*(?:(?<=_)[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)?)\\s*(:)\\s+","captures":{"1":{"name":"variable.parameter.scala"},"2":{"name":"meta.colon.scala"}}}]},"xml-literal":{"patterns":[{"end":"(>(<))/(?:([-_a-zA-Z0-9]+)((:)))?([-_a-zA-Z0-9:]*[_a-zA-Z0-9])(>)","begin":"(<)((?:([_a-zA-Z0-9][_a-zA-Z0-9]*)((:)))?([_a-zA-Z0-9][-_a-zA-Z0-9:]*))(?=(\\s[^>]*)?>)","beginCaptures":{"1":{"name":"punctuation.definition.tag.xml"},"3":{"name":"entity.name.tag.namespace.xml"},"4":{"name":"entity.name.tag.xml"},"5":{"name":"punctuation.separator.namespace.xml"},"6":{"name":"entity.name.tag.localname.xml"}},"patterns":[{"include":"#xml-embedded-content"}],"comment":"We do not allow a tag name to start with a - since this would likely conflict with the <- operator. This is not very common for tag names anyway. Also code such as -- if (val val3) will falsly be recognized as an xml tag. The solution is to put a space on either side of the comparison operator","endCaptures":{"1":{"name":"punctuation.definition.tag.xml"},"2":{"name":"meta.scope.between-tag-pair.xml"},"3":{"name":"entity.name.tag.namespace.xml"},"4":{"name":"entity.name.tag.xml"},"5":{"name":"punctuation.separator.namespace.xml"},"6":{"name":"entity.name.tag.localname.xml"},"7":{"name":"punctuation.definition.tag.xml"}},"name":"meta.tag.no-content.xml"},{"end":"(/?>)","begin":"(]*?>)","patterns":[{"include":"#xml-embedded-content"}],"captures":{"1":{"name":"punctuation.definition.tag.xml"},"2":{"name":"entity.name.tag.namespace.xml"},"3":{"name":"entity.name.tag.xml"},"4":{"name":"punctuation.separator.namespace.xml"},"5":{"name":"entity.name.tag.localname.xml"}},"name":"meta.tag.xml"},{"include":"#xml-entity"}]}},"uuid":"158C0929-299A-40C8-8D89-316BE0C446E8","patterns":[{"include":"#code"}],"name":"Scala","scopeName":"source.scala"} 2 | -------------------------------------------------------------------------------- /tests/snap/#128.test.scala: -------------------------------------------------------------------------------- 1 | p133 2 | p133. 3 | p133.42 4 | p4e1 5 | p.2 6 | x124x 7 | -------------------------------------------------------------------------------- /tests/snap/#128.test.scala.snap: -------------------------------------------------------------------------------- 1 | >p133 2 | #^^^^^ source.scala 3 | >p133. 4 | #^^^^^^ source.scala 5 | >p133.42 6 | #^^^^ source.scala 7 | # ^^^ source.scala constant.numeric.scala 8 | >p4e1 9 | #^^^^^ source.scala 10 | >p.2 11 | #^ source.scala 12 | # ^^ source.scala constant.numeric.scala 13 | >x124x 14 | #^^^^^^ source.scala 15 | > -------------------------------------------------------------------------------- /tests/snap/#191.test.scala: -------------------------------------------------------------------------------- 1 | a \\\ b 2 | 3 | a \+\ b 4 | -------------------------------------------------------------------------------- /tests/snap/#191.test.scala.snap: -------------------------------------------------------------------------------- 1 | >a \\\ b 2 | #^^ source.scala 3 | # ^^^ source.scala keyword.operator.scala 4 | # ^^^ source.scala 5 | > 6 | >a \+\ b 7 | #^^ source.scala 8 | # ^^^ source.scala keyword.operator.scala 9 | # ^^^ source.scala 10 | > -------------------------------------------------------------------------------- /tests/snap/backticks.test.scala: -------------------------------------------------------------------------------- 1 | 2 | object `Backtics test` { 3 | val x = MediaRange.`*/*` 4 | 5 | val y = `MediaRange`.`*/*` 6 | 7 | val z = `Media Range` 8 | 9 | def `*/*`(`a b`: `C D`): `e f` = ??? 10 | 11 | 12 | 13 | val `*/*` = 5 14 | } -------------------------------------------------------------------------------- /tests/snap/backticks.test.scala.snap: -------------------------------------------------------------------------------- 1 | > 2 | >object `Backtics test` { 3 | #^^^^^^ source.scala keyword.declaration.scala 4 | # ^ source.scala 5 | # ^^^^^^^^^^^^^^^ source.scala entity.name.class.declaration 6 | # ^ source.scala 7 | # ^ source.scala punctuation.section.block.begin.scala 8 | > val x = MediaRange.`*/*` 9 | #^^^^ source.scala 10 | # ^^^ source.scala keyword.declaration.stable.scala 11 | # ^ source.scala 12 | # ^ source.scala variable.stable.declaration.scala 13 | # ^ source.scala 14 | # ^ source.scala keyword.operator.comparison.scala 15 | # ^ source.scala 16 | # ^^^^^^^^^^ source.scala entity.name.class 17 | # ^ source.scala 18 | # ^^^^^ source.scala 19 | > 20 | > val y = `MediaRange`.`*/*` 21 | #^^^^ source.scala 22 | # ^^^ source.scala keyword.declaration.stable.scala 23 | # ^ source.scala 24 | # ^ source.scala variable.stable.declaration.scala 25 | # ^ source.scala 26 | # ^ source.scala keyword.operator.comparison.scala 27 | # ^ source.scala 28 | # ^^^^^^^^^^^^ source.scala 29 | # ^ source.scala 30 | # ^^^^^ source.scala 31 | > 32 | > val z = `Media Range` 33 | #^^^^ source.scala 34 | # ^^^ source.scala keyword.declaration.stable.scala 35 | # ^ source.scala 36 | # ^ source.scala variable.stable.declaration.scala 37 | # ^ source.scala 38 | # ^ source.scala keyword.operator.comparison.scala 39 | # ^ source.scala 40 | # ^^^^^^^^^^^^^ source.scala 41 | > 42 | > def `*/*`(`a b`: `C D`): `e f` = ??? 43 | #^^^^ source.scala 44 | # ^^^ source.scala keyword.declaration.scala 45 | # ^ source.scala 46 | # ^^^^^ source.scala entity.name.function.declaration 47 | # ^ source.scala meta.bracket.scala 48 | # ^^^^^ source.scala variable.parameter.scala 49 | # ^ source.scala meta.colon.scala 50 | # ^ source.scala 51 | # ^^^^^ source.scala 52 | # ^ source.scala meta.bracket.scala 53 | # ^ source.scala keyword.operator.scala 54 | # ^ source.scala 55 | # ^^^^^ source.scala 56 | # ^ source.scala 57 | # ^ source.scala keyword.operator.comparison.scala 58 | # ^ source.scala 59 | # ^^^ source.scala keyword.operator.scala 60 | > 61 | > 62 | > 63 | > val `*/*` = 5 64 | #^^^^ source.scala 65 | # ^^^ source.scala keyword.declaration.stable.scala 66 | # ^ source.scala 67 | # ^^^^^ source.scala variable.stable.declaration.scala 68 | # ^ source.scala 69 | # ^ source.scala keyword.operator.comparison.scala 70 | # ^ source.scala 71 | # ^ source.scala constant.numeric.scala 72 | > } 73 | #^ source.scala 74 | # ^ source.scala punctuation.section.block.end.scala -------------------------------------------------------------------------------- /tests/snap/comments.test.scala: -------------------------------------------------------------------------------- 1 | /// SYNTAX TEST "source.scala" 2 | #!/usr/bin/env scala 3 | 4 | //> using packaging.version "1.0.0" 5 | //> using scala 2.13 6 | //> using dep org.scala-lang::toolkit:0.2.0 7 | //> using deps org.scala-lang::toolkit:0.2.0,org.scala-lang::toolkit:0.2.1 8 | //> using numbers 123, 111 9 | //> using strings "asdf", bfds 10 | //> using booleans true false 11 | // > using this.is comment 12 | // //> using comment "out" 13 | 14 | //> using 15 | object X 16 | 17 | /* /**/ /** */ /* comments within comments */ */ 18 | 19 | /** /* */ /** **/ **/ 20 | 21 | 22 | /************************ 23 | * 24 | * [[scala.Option]] 25 | * @return smth 26 | ***********************/ 27 | 28 | case class C(val x: Int) { 29 | def f(p:Double) : String = { 30 | 31 | } 32 | } 33 | 34 | /** Provides classes for dealing with complex numbers. Also provides 35 | * implicits for converting to and from `Int`. 36 | * 37 | * ==Overview== 38 | * The main class to use is [[my.package.complex.Complex]], as so 39 | * {{{ 40 | * scala> val complex = Complex(4,3) 41 | * complex: my.package.complex.Complex = 4 + 3i 42 | * }}} 43 | * 44 | * If you include [[my.package.complex.ComplexConversions]], you can 45 | * convert numbers more directly 46 | * {{{ 47 | * scala> import my.package.complex.ComplexConversions._ 48 | * scala> val complex = 4 + 3.i 49 | * complex: my.package.complex.Complex = 4 + 3i 50 | * }}} 51 | */ 52 | package complex {} 53 | 54 | /** A person who uses our application. 55 | * 56 | * @constructor create a new person with a name and age. 57 | * @tparam T useless param 58 | * @param name the person's name 59 | * @param age the person's age in years 60 | * @throws java.lang.Exception 61 | * 62 | * @see reference other sources of information like external document links or related entities in the documentation. 63 | * @note add a note for pre or post conditions, or any other notable restrictions or expectations. 64 | * @example for providing example code or related example documentation. 65 | * @usecase def apply(name: String, age: Int) : Unit 66 | * 67 | * @groupname group name 68 | * @groupprio group 2 69 | * @groupdesc group desc 70 | * @group group 71 | * @contentDiagram 72 | * 73 | * 74 | * @author provide author information for the following entity 75 | * @version the version of the system or API that this entity is a part of. 76 | * @since like @version but defines the system or API that this entity was first defined in. 77 | * @todo for documenting unimplemented features or unimplemented aspects of an entity. 78 | * @deprecated marks the entity as deprecated, providing both the replacement implementation that should be used and the version/date at which this entity was deprecated. 79 | * @migration like deprecated but provides advanced warning of planned changes ahead of deprecation. Same fields as @deprecated. 80 | * @inheritdoc take comments from a superclass as defaults if comments are not provided locally. 81 | * @documentable Expand a type alias and abstract type into a full template page. - TODO: Test the “abstract type” claim - no examples of this in the Scala code base 82 | * 83 | * @define 84 | * 85 | * @shortDescription ??? 86 | * @hideImplicitConversion ??? 87 | * 88 | * @syntax markdown 89 | * 90 | */ 91 | class Person[T](name: String, age: Int) { 92 | } 93 | 94 | /** Factory for [[mypackage.Person]] instances. */ 95 | object Person { 96 | /** Creates a person with a given name and age. 97 | * 98 | * @param name their name 99 | * @param age the age of the person to create 100 | */ 101 | def apply(name: String, age: Int) = {} 102 | 103 | /** Creates a person with a given name and birthdate 104 | * 105 | * @param name their name 106 | * @param birthDate the person's birthdate 107 | * @return a new Person instance with the age determined by the 108 | * birthdate and current date. 109 | */ 110 | def apply(name: String, birthDate: java.util.Date) = {} 111 | } 112 | 113 | /** Implicit conversions and helpers for [[mypackage.Complex]] instances. 114 | * 115 | * {{{ 116 | * import ComplexImplicits._ 117 | * val c: Complex = 4 + 3.i 118 | * }}} 119 | */ 120 | object ComplexImplicits {} 121 | 122 | /** 123 | * =Heading=, ==Sub-Heading== 124 | * 125 | * `monospace` 126 | * ''italic text'' 127 | * '''bold text''' 128 | * __underline__ 129 | * ^superscript^ 130 | * ,,subscript,, 131 | * [[entity link]], e.g. [[scala.collection.Seq]] 132 | * [[http://external.link External Link]], 133 | * e.g. [[http://scala-lang.org Scala Language Site]] 134 | * 135 | */ 136 | object Markup { 137 | /** Here is an unordered list: 138 | * 139 | * - First item 140 | * - Second item 141 | * - Sub-item to the second 142 | * - Another sub-item 143 | * - Third item 144 | * 145 | * Here is an ordered list: 146 | * 147 | * 1. First numbered item 148 | * 1. Second numbered item 149 | * i. Sub-item to the second 150 | * i. Another sub-item 151 | * 1. Third item 152 | */ 153 | def lists = () 154 | } 155 | -------------------------------------------------------------------------------- /tests/snap/end.test.scala: -------------------------------------------------------------------------------- 1 | /// SYNTAX TEST "source.scala" 2 | // From: https://dotty.epfl.ch/docs/reference/other-new-features/indentation.html 3 | 4 | package p1.p2: 5 | 6 | abstract class C() with 7 | 8 | def this(x: Int) = 9 | this() 10 | if x > 0 then 11 | val a :: b = 12 | x :: Nil 13 | end val 14 | var y = 15 | x 16 | end y 17 | while y > 0 do 18 | println(y) 19 | y -= 1 20 | end while 21 | try 22 | x match 23 | case 0 => println("0") 24 | case _ => 25 | end match 26 | finally 27 | println("done") 28 | end try 29 | end if 30 | end this 31 | 32 | def f: String 33 | end C 34 | 35 | object C with 36 | given C = 37 | new C: 38 | def f = "!" 39 | end f 40 | end new 41 | end given 42 | end C 43 | 44 | extension (x: C) 45 | def ff: String = x.f ++ x.f 46 | end extension 47 | 48 | end p2 49 | -------------------------------------------------------------------------------- /tests/snap/end.test.scala.snap: -------------------------------------------------------------------------------- 1 | >/// SYNTAX TEST "source.scala" 2 | #^^ source.scala comment.line.double-slash.scala punctuation.definition.comment.scala 3 | # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.scala comment.line.double-slash.scala 4 | >// From: https://dotty.epfl.ch/docs/reference/other-new-features/indentation.html 5 | #^^ source.scala comment.line.double-slash.scala punctuation.definition.comment.scala 6 | # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.scala comment.line.double-slash.scala 7 | > 8 | >package p1.p2: 9 | #^^^^^^^ source.scala meta.package.scala keyword.other.package.scala 10 | # ^ source.scala meta.package.scala 11 | # ^^ source.scala meta.package.scala entity.name.package.scala 12 | # ^ source.scala meta.package.scala punctuation.definition.package 13 | # ^^ source.scala meta.package.scala entity.name.package.scala 14 | # ^ source.scala meta.package.scala entity.name.package.scala 15 | > 16 | > abstract class C() with 17 | #^^^ source.scala 18 | # ^^^^^^^^ source.scala storage.modifier.other 19 | # ^ source.scala 20 | # ^^^^^ source.scala keyword.declaration.scala 21 | # ^ source.scala 22 | # ^ source.scala entity.name.class.declaration 23 | # ^^ source.scala meta.parentheses.scala meta.bracket.scala 24 | # ^ source.scala 25 | # ^^^^ source.scala keyword.declaration.scala 26 | > 27 | > def this(x: Int) = 28 | #^^^^^^ source.scala 29 | # ^^^ source.scala keyword.declaration.scala 30 | # ^ source.scala 31 | # ^^^^ source.scala entity.name.function.declaration 32 | # ^ source.scala meta.bracket.scala 33 | # ^ source.scala variable.parameter.scala 34 | # ^ source.scala meta.colon.scala 35 | # ^ source.scala 36 | # ^^^ source.scala entity.name.class 37 | # ^ source.scala meta.bracket.scala 38 | # ^ source.scala 39 | # ^ source.scala keyword.operator.comparison.scala 40 | > this() 41 | #^^^^^^^^^ source.scala 42 | # ^^^^ source.scala variable.language.scala 43 | # ^^ source.scala meta.parentheses.scala meta.bracket.scala 44 | > if x > 0 then 45 | #^^^^^^^^^ source.scala 46 | # ^^ source.scala keyword.control.flow.scala 47 | # ^^^ source.scala 48 | # ^ source.scala keyword.operator.comparison.scala 49 | # ^ source.scala 50 | # ^ source.scala constant.numeric.scala 51 | # ^ source.scala 52 | # ^^^^ source.scala keyword.control.flow.scala 53 | > val a :: b = 54 | #^^^^^^^^^^^^ source.scala 55 | # ^^^ source.scala keyword.declaration.stable.scala 56 | # ^ source.scala 57 | # ^ source.scala variable.stable.declaration.scala 58 | # ^ source.scala 59 | # ^^ source.scala keyword.operator.scala 60 | # ^^^ source.scala 61 | # ^ source.scala keyword.operator.comparison.scala 62 | > x :: Nil 63 | #^^^^^^^^^^^^^^^^^ source.scala 64 | # ^^ source.scala keyword.operator.scala 65 | # ^ source.scala 66 | # ^^^ source.scala entity.name.class 67 | > end val 68 | #^^^^^^^^^^^^^^^^^^^ source.scala keyword.declaration.stable.end.scala 69 | > var y = 70 | #^^^^^^^^^^^^ source.scala 71 | # ^^^ source.scala keyword.declaration.volatile.scala 72 | # ^ source.scala 73 | # ^ source.scala variable.volatile.declaration.scala 74 | # ^ source.scala 75 | # ^ source.scala keyword.operator.comparison.scala 76 | > x 77 | #^^^^^^^^^^^^^^^^^ source.scala 78 | > end y 79 | #^^^^^^^^^^^^ source.scala 80 | # ^^^ source.scala keyword.declaration.end.scala 81 | # ^ source.scala 82 | # ^ source.scala entity.name.declaration 83 | > while y > 0 do 84 | #^^^^^^^^^^^^ source.scala 85 | # ^^^^^ source.scala keyword.control.flow.scala 86 | # ^^^ source.scala 87 | # ^ source.scala keyword.operator.comparison.scala 88 | # ^ source.scala 89 | # ^ source.scala constant.numeric.scala 90 | # ^ source.scala 91 | # ^^ source.scala keyword.control.flow.scala 92 | > println(y) 93 | #^^^^^^^^^^^^^^^^^^^^^^ source.scala 94 | # ^ source.scala meta.bracket.scala 95 | # ^ source.scala 96 | # ^ source.scala meta.bracket.scala 97 | > y -= 1 98 | #^^^^^^^^^^^^^^^^^ source.scala 99 | # ^^ source.scala keyword.operator.scala 100 | # ^ source.scala 101 | # ^ source.scala constant.numeric.scala 102 | > end while 103 | #^^^^^^^^^^^^^^^^^^^^^ source.scala keyword.control.flow.end.scala 104 | > try 105 | #^^^^^^^^^^^^ source.scala 106 | # ^^^ source.scala keyword.control.exception.scala 107 | > x match 108 | #^^^^^^^^^^^^^^^^^ source.scala 109 | # ^^^^^ source.scala keyword.control.flow.scala 110 | > case 0 => println("0") 111 | #^^^^^^^^^^^^^^^^^^ source.scala 112 | # ^^^^ source.scala keyword.control.flow.scala 113 | # ^ source.scala 114 | # ^ source.scala constant.numeric.scala 115 | # ^ source.scala 116 | # ^^ source.scala keyword.operator.scala 117 | # ^^^^^^^^ source.scala 118 | # ^ source.scala meta.bracket.scala 119 | # ^ source.scala string.quoted.double.scala punctuation.definition.string.begin.scala 120 | # ^ source.scala string.quoted.double.scala 121 | # ^ source.scala string.quoted.double.scala punctuation.definition.string.end.scala 122 | # ^ source.scala meta.bracket.scala 123 | > case _ => 124 | #^^^^^^^^^^^^^^^^^^ source.scala 125 | # ^^^^ source.scala keyword.control.flow.scala 126 | # ^^^ source.scala 127 | # ^^ source.scala keyword.operator.scala 128 | > end match 129 | #^^^^^^^^^^^^^^^^^^^^^^^^ source.scala keyword.control.flow.end.scala 130 | > finally 131 | #^^^^^^^^^^^^ source.scala 132 | # ^^^^^^^ source.scala keyword.control.exception.scala 133 | > println("done") 134 | #^^^^^^^^^^^^^^^^^^^^^^ source.scala 135 | # ^ source.scala meta.bracket.scala 136 | # ^ source.scala string.quoted.double.scala punctuation.definition.string.begin.scala 137 | # ^^^^ source.scala string.quoted.double.scala 138 | # ^ source.scala string.quoted.double.scala punctuation.definition.string.end.scala 139 | # ^ source.scala meta.bracket.scala 140 | > end try 141 | #^^^^^^^^^^^^^^^^^^^ source.scala keyword.control.exception.end.scala 142 | > end if 143 | #^^^^^^^^^^^^^^^ source.scala keyword.control.flow.end.scala 144 | > end this 145 | #^^^^^^ source.scala 146 | # ^^^ source.scala keyword.declaration.end.scala 147 | # ^ source.scala 148 | # ^^^^ source.scala entity.name.declaration 149 | > 150 | > def f: String 151 | #^^^^^^ source.scala 152 | # ^^^ source.scala keyword.declaration.scala 153 | # ^ source.scala 154 | # ^ source.scala entity.name.function.declaration 155 | # ^ source.scala keyword.operator.scala 156 | # ^ source.scala 157 | # ^^^^^^ source.scala entity.name.class 158 | > end C 159 | #^^^ source.scala 160 | # ^^^ source.scala keyword.declaration.end.scala 161 | # ^ source.scala 162 | # ^ source.scala entity.name.type.declaration 163 | > 164 | > object C with 165 | #^^^ source.scala 166 | # ^^^^^^ source.scala keyword.declaration.scala 167 | # ^ source.scala 168 | # ^ source.scala entity.name.class.declaration 169 | # ^ source.scala 170 | # ^^^^ source.scala keyword.declaration.scala 171 | > given C = 172 | #^^^^^^ source.scala 173 | # ^^^^^ source.scala keyword.declaration.scala 174 | # ^ source.scala 175 | # ^ source.scala entity.name.class 176 | # ^ source.scala 177 | # ^ source.scala keyword.operator.comparison.scala 178 | > new C: 179 | #^^^^^^^^^ source.scala 180 | # ^^^ source.scala keyword.declaration.scala 181 | # ^ source.scala 182 | # ^ source.scala entity.name.class 183 | # ^ source.scala keyword.operator.scala 184 | > def f = "!" 185 | #^^^^^^^^^^^^ source.scala 186 | # ^^^ source.scala keyword.declaration.scala 187 | # ^ source.scala 188 | # ^ source.scala entity.name.function.declaration 189 | # ^ source.scala 190 | # ^ source.scala keyword.operator.comparison.scala 191 | # ^ source.scala 192 | # ^ source.scala string.quoted.double.scala punctuation.definition.string.begin.scala 193 | # ^ source.scala string.quoted.double.scala 194 | # ^ source.scala string.quoted.double.scala punctuation.definition.string.end.scala 195 | > end f 196 | #^^^^^^^^^^^^ source.scala 197 | # ^^^ source.scala keyword.declaration.end.scala 198 | # ^ source.scala 199 | # ^ source.scala entity.name.declaration 200 | > end new 201 | #^^^^^^^^^ source.scala 202 | # ^^^ source.scala keyword.declaration.end.scala 203 | # ^ source.scala 204 | # ^^^ source.scala keyword.declaration.end.scala 205 | > end given 206 | #^^^^^^ source.scala 207 | # ^^^ source.scala keyword.declaration.end.scala 208 | # ^ source.scala 209 | # ^^^^^ source.scala entity.name.declaration 210 | > end C 211 | #^^^ source.scala 212 | # ^^^ source.scala keyword.declaration.end.scala 213 | # ^ source.scala 214 | # ^ source.scala entity.name.type.declaration 215 | > 216 | > extension (x: C) 217 | #^^^ source.scala 218 | # ^^^^^^^^^ source.scala keyword.declaration.scala 219 | # ^ source.scala 220 | # ^ source.scala meta.bracket.scala 221 | # ^ source.scala variable.parameter.scala 222 | # ^ source.scala meta.colon.scala 223 | # ^ source.scala 224 | # ^ source.scala entity.name.class 225 | # ^ source.scala meta.bracket.scala 226 | > def ff: String = x.f ++ x.f 227 | #^^^^^^ source.scala 228 | # ^^^ source.scala keyword.declaration.scala 229 | # ^ source.scala 230 | # ^^ source.scala entity.name.function.declaration 231 | # ^ source.scala keyword.operator.scala 232 | # ^ source.scala 233 | # ^^^^^^ source.scala entity.name.class 234 | # ^ source.scala 235 | # ^ source.scala keyword.operator.comparison.scala 236 | # ^^^^^ source.scala 237 | # ^^ source.scala keyword.operator.scala 238 | # ^^^^^ source.scala 239 | > end extension 240 | #^^^ source.scala 241 | # ^^^ source.scala keyword.declaration.end.scala 242 | # ^ source.scala 243 | # ^^^^^^^^^ source.scala keyword.declaration.end.scala 244 | > 245 | >end p2 246 | #^^^ source.scala keyword.declaration.end.scala 247 | # ^ source.scala 248 | # ^^ source.scala entity.name.declaration 249 | > -------------------------------------------------------------------------------- /tests/snap/lexical.test.scala: -------------------------------------------------------------------------------- 1 | 2 | object ExampleIdentifiers { 3 | val x = 3 4 | val Object = 3 5 | val maxIndex = 3 6 | val p2p = 3 7 | val empty_? = 3 8 | val + = 3 9 | val `yield` = 3 10 | val αρετη = 3 11 | val _y = 3 12 | val dot_product_* = 3 13 | val __system = 3 14 | val _MAX_LEN_ = 3 15 | } 16 | 17 | object IntegerLiterals { 18 | (0, 21, 0xFFFFFFFF, -42L) 19 | } 20 | 21 | object FloatingPointLiterals { 22 | ( 0.0, 1e30f, 3.14159f, 1.0e-100, .1 ) 23 | } 24 | 25 | object Boolean { 26 | (true, false) 27 | } 28 | 29 | object CharacterLiterals { 30 | ('a', '\u0041', '\n', '\t') 31 | } 32 | 33 | object StringLiterals { 34 | ("Hello,\nWorld!", "This string contains a \" character.") 35 | 36 | """the present string 37 | spans three 38 | lines.""" 39 | 40 | """the present string 41 | |spans three 42 | |lines.""".stripMargin 43 | 44 | 45 | val escapeSequences = "\b\t\n\f\r\"\'\\" 46 | 47 | s"$x plain ${val x = y}" 48 | custom"$x plain ${val x = y}" 49 | 50 | s"""$x plain ${val x = y}""" 51 | custom"""$x plain ${val x = y}""" 52 | } 53 | 54 | object Symbols { 55 | ('x, 'X, 'αρετη, '=, '+ ) 56 | } 57 | 58 | // single line comment 59 | 60 | /* 61 | 62 | multiline comment*/ 63 | 64 | /** 65 | * Scaladoc comment 66 | * @scaladoc @param 67 | */ 68 | 69 | /* nested /* multi-line */ comment */ 70 | 71 | 72 | object Xml { 73 | val b = 74 | The Scala Language Specification 75 | {scalaBook.version} 76 | {scalaBook.authors.mkList("", ", ", "")} 77 | 78 | } 79 | -------------------------------------------------------------------------------- /tests/snap/scala_spec.test.scala: -------------------------------------------------------------------------------- 1 | package org.scala.syntax 2 | package test 3 | 4 | 5 | class TreeMap[A <: Comparable[A], B] { } 6 | class List[A] { } 7 | class I extends Comparable[I] {} 8 | 9 | class F[M[_], X] { } 10 | class S[K <: String] {} 11 | class G[M[ Z <: I ], I] { } 12 | 13 | case class Bird (val name: String @suspendable) extends Object { 14 | def fly(height: Int @suspendable) = ??? 15 | def walk[T1 : T2](_distance: Int, empty_? : Int, `yield`: String, αρετη: Boolean)(implicit fa: Functor[T1]) = ??? 16 | def c (x: Int) (y: String, z: String): String = ??? 17 | def union[A <: Comparable[A]] (x: Set[A], xs: Set[A]): Set[A] 18 | } 19 | 20 | trait Iterable[+X] { 21 | def flatMap[newType[+X] <: Iterable[X], S](f: X => newType[S]): newType[S] 22 | } 23 | 24 | package org.scala { 25 | class List[+T] 26 | class Set[-T] 27 | } 28 | 29 | class A[+T] {} 30 | class B extends A[B] 31 | class C extends A[C] 32 | 33 | 34 | 35 | abstract class AbstractClass 36 | sealed trait Sealed 37 | 38 | object Types { 39 | val x : String @suspendable = "" 40 | 41 | def infix() : T1 \/ T2 = ??? 42 | 43 | type Z1 = Ref[T] forSome { type T <: java.lang.Number } 44 | type Z2 = Ref[x.T] forSome { val x: Outer } 45 | type Z3 = Ref[x_type # T] forSome { type x_type <: Outer with Singleton } 46 | 47 | def complexBounds[A, B >: A, C >: A <: B]() 48 | def complexBounds2[M[X <: Bound[X]], Bound[_]] 49 | def complexBounds3[@specialized T, U]() 50 | 51 | def compare[T](a: T = 0)(b: T = a) = (a == b) 52 | def f(a: Int = 0)(b: Int = a + 1) = b 53 | 54 | def whileLoop (cond: => Boolean) (stat: => Unit): Unit 55 | 56 | def sum(args: Int*) = { 57 | var result = 0 58 | for (arg <- args) result += arg 59 | result 60 | } 61 | 62 | def write(str: String) { System.out.println(str) } 63 | def write(str: String): Unit = { System.out.println(str) } 64 | 65 | 66 | 67 | type Pair[+A, +B] = Tuple2[A, B] 68 | object Pair { 69 | { import M.{one, z => zero, _}; add(zero, one) } 70 | def apply[A, B](x: A, y: B) = Tuple2(x, y) 71 | def unapply[A, B](x: Tuple2[A, B]): Option[Tuple2[A, B]] = Some(x) 72 | } 73 | } 74 | 75 | object ValueDefinitions { 76 | val pi = 3.1415 77 | val pi: Double = 3.1415 // equivalent to first definition 78 | val Some(x) = f() // a pattern definition 79 | val x :: xs = mylist // an infix pattern definition 80 | } 81 | 82 | class Iter extends StringIterator with RichIterator { } 83 | trait A extends Root { type T <: A } 84 | 85 | class Modifiers { 86 | final val x = e 87 | override def f() 88 | private val y = "" 89 | abstract override def g() 90 | private lazy final val h = 3 91 | } 92 | 93 | object m { 94 | abstract sealed class C (x: Int) { 95 | def nextC = new C(x + 1) {} 96 | } 97 | val empty = new C(0) {} 98 | } 99 | 100 | class LinkedList[A]() { self: List with Seq => 101 | var head = ??? 102 | var tail = null 103 | def isEmpty = tail != null 104 | def this(head: A) = { this(); this.head = head } 105 | def this(head: A, tail: List[A]) = { this(head); this.tail = tail } 106 | } 107 | 108 | case class Lambda(x: String, e: Expr) extends Expr 109 | 110 | trait Comparable[T <: Comparable[T]] { self: T => 111 | def < (that: T): Boolean 112 | def <=(that: T): Boolean = this < that || this == that 113 | def > (that: T): Boolean = that < this 114 | def >=(that: T): Boolean = that <= this 115 | } 116 | 117 | class A extends Root { override def x = "A" ; def superA = super.x } 118 | 119 | object Appl { 120 | def sum(xs: Int*) = (0 /: xs) ((x, y) => x + y) 121 | sum(List(1, 2, 3, 4): _*) 122 | 123 | val x : S = new Z 124 | val y : S = new Z { 125 | val x = 5 126 | } 127 | 128 | def matmul(xss: Array[Array[Double]], yss: Array[Array[Double]]) = { 129 | val zss: Array[Array[Double]] = new Array(xss.length, yss(0).length) 130 | var i = 0 131 | while (i < xss.length) { 132 | var j = 0 133 | while (j < yss(0).length) { 134 | var acc = 0.0 135 | var k = 0 136 | while (k < yss.length) { 137 | acc = acc + xss(i)(k) * yss(k)(j) 138 | k += 1 139 | } 140 | zss(i)(j) = acc 141 | j += 1 142 | } 143 | i += 1 144 | } 145 | zss 146 | } 147 | 148 | def whileLoop(cond: => Boolean)(body: => Unit): Unit = 149 | if (cond) { body ; whileLoop(cond)(body) } else {} 150 | 151 | do {x += 2} while (x < 100) 152 | 153 | for { i <- 1 until n 154 | j <- 1 until i 155 | if isPrime(i+j) 156 | } yield (i, j) 157 | 158 | (1 until n) 159 | .flatMap { 160 | case i => (1 until i) 161 | .withFilter { j => isPrime(i+j) } 162 | .map { case j => (i, j) } } 163 | 164 | try { 165 | throw ex; 166 | } catch { 167 | case NonFatal(e) => throw e; 168 | case other => throw other 169 | } 170 | } 171 | 172 | object Inline { 173 | val summ = (x: Int,y: Int) => x + y 174 | } 175 | 176 | object Monoids { 177 | implicit object stringMonoid extends Monoid[String] { 178 | def add(x: String, y: String): String = x.concat(y) 179 | def unit: String = "" 180 | } 181 | } 182 | 183 | object A1 { 184 | def sum[A](xs: List[A])(implicit m: Monoid[A]): A = 185 | if (xs.isEmpty) m.unit 186 | else m.add(xs.head, sum(xs.tail)) 187 | 188 | implicit def list2ordered[A](x: List[A]) 189 | (implicit elem2ordered: A => Ordered[A]): Ordered[List[A]] 190 | } 191 | 192 | object PatternMatching { 193 | def f(x: Int, y: Int) = x match { 194 | case `y` => 195 | case s @ Seq(_, _, _) => 196 | case Seq(first, tail @ _*) => 197 | case first +: tail => 198 | case 3 | 5 | 6 => 199 | case y: Number => y.n 200 | case Lit(n) => n 201 | case IsZero(u) => eval(u) == 0 202 | case _ => 15 203 | } 204 | 205 | } 206 | 207 | package p1 { 208 | package p2 { 209 | object Kitten 210 | } 211 | } 212 | 213 | package a.b { 214 | class A { 215 | val x = new _root_.b.B 216 | } 217 | } 218 | 219 | object HelloWorld { 220 | def main(args: Array[String]) { println("Hello World") } 221 | } 222 | 223 | object HelloWorld extends App { 224 | println("Hello World") 225 | } 226 | 227 | @SerialVersionUID(12345) 228 | object Annotations { 229 | @deprecated("Use D", "1.0") class C { } 230 | @transient @volatile var m: Int 231 | 232 | def f(x: Option[Int]) = (x: @unchecked) match { 233 | case Some(y) => y 234 | } 235 | 236 | trait Function0[@specialized(Unit, Int, Double) T] { 237 | def apply: T 238 | } 239 | 240 | @UserDefinedUpperCase def x 241 | @userDefinedLowerCase def y 242 | } -------------------------------------------------------------------------------- /tests/unit/#103.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | // THIS FILE CONTAINS OUTDATED GIVEN SYNTAX 4 | 5 | given as Foo = ... 6 | // ^^^^^ keyword.declaration.scala 7 | // ^^ - keyword.declaration.scala 8 | 9 | given foo as Foo = ... 10 | // ^^^^^ keyword.declaration.scala 11 | // ^^^ entity.name.given.declaration 12 | // ^^ - keyword.declaration.scala 13 | 14 | given (x: X) as Foo = ... 15 | // ^^^^^ keyword.declaration.scala 16 | // ^ variable.parameter.scala 17 | // ^ meta.colon.scala 18 | // ^ entity.name.class 19 | // ^^ - keyword.declaration.scala 20 | 21 | given [X](x: X) as Foo = ... 22 | // ^^^^^ keyword.declaration.scala 23 | // ^ entity.name.class 24 | // ^ variable.parameter.scala 25 | // ^ meta.colon.scala 26 | // ^ entity.name.class 27 | // ^^ - keyword.declaration.scala 28 | 29 | given foo(x: A) as Foo = ... 30 | // ^^^^^ keyword.declaration.scala 31 | // ^^^ entity.name.given.declaration 32 | // ^ variable.parameter.scala 33 | // ^ meta.colon.scala 34 | // ^ entity.name.class 35 | // ^^ - keyword.declaration.scala 36 | 37 | given foo[X](x: X) as Foo = ... 38 | // ^^^^^ keyword.declaration.scala 39 | // ^^^ entity.name.given.declaration 40 | // ^ entity.name.class 41 | // ^ variable.parameter.scala 42 | // ^ meta.colon.scala 43 | // ^ entity.name.class 44 | // ^^ - keyword.declaration.scala 45 | 46 | given foo[X <: Y { type A = 1; def f(using a: Int): 2 }](x: X = 2) as Foo = ... 47 | // ^^^^^ keyword.declaration.scala 48 | // ^^^ entity.name.given.declaration 49 | // ^^^^ keyword.declaration.scala 50 | // ^ constant.numeric.scala 51 | // ^^^ keyword.declaration.scala 52 | // ^ entity.name.function.declaration 53 | // ^^^^^ keyword.declaration.scala 54 | // ^ variable.parameter.scala 55 | // ^ meta.colon.scala 56 | // ^^^ entity.name.class 57 | // ^ constant.numeric.scala 58 | // ^ constant.numeric.scala 59 | 60 | given (using x: X = "abs")(using y: Y = s"y: $x", y: Char = if true then 'a' else 2) as Foo = ... 61 | // ^^^^^ keyword.declaration.scala 62 | // ^^^^^ string.quoted.double.scala 63 | // ^ keyword.interpolation.scala 64 | // ^^^^ string.quoted.double.interpolated.scala 65 | // ^^ meta.template.expression.scala 66 | // ^^ keyword.control.flow.scala 67 | // ^^^^ constant.language.scala 68 | // ^^^^ keyword.control.flow.scala 69 | // ^^^ constant.character.literal.scala 70 | // ^^^^ keyword.control.flow.scala 71 | // ^ constant.numeric.scala 72 | 73 | given // this should be a comment 74 | // ^^^^^ keyword.declaration.scala 75 | // ^^ punctuation.definition.comment.scala 76 | // ^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.double-slash.scala 77 | as Foo 78 | // ^^ - keyword.declaration.scala 79 | 80 | given// this should be a comment 81 | // ^^^^^ keyword.declaration.scala 82 | // ^^ punctuation.definition.comment.scala 83 | // ^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.double-slash.scala 84 | 85 | given /* this should be a comment */ 86 | // ^^^^^ keyword.declaration.scala 87 | // ^^ punctuation.definition.comment.scala 88 | // ^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block.scala 89 | // ^^ punctuation.definition.comment.scala 90 | -------------------------------------------------------------------------------- /tests/unit/#104.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | 4 | class Foo: // shares colour of stable identifier 5 | // ^^^ entity.name.class.declaration 6 | // ^ keyword.operator.scala 7 | 8 | class Bar : // has same colour as declarations 9 | // ^^^ entity.name.class.declaration 10 | // ^ keyword.operator.scala 11 | 12 | trait Foo: 13 | // ^^^ entity.name.class.declaration 14 | // ^ keyword.operator.scala 15 | 16 | trait Bar : 17 | // ^^^ entity.name.class.declaration 18 | // ^ keyword.operator.scala 19 | 20 | object Foo: 21 | // ^^^ entity.name.class.declaration 22 | // ^ keyword.operator.scala 23 | 24 | object Bar : 25 | // ^^^ entity.name.class.declaration 26 | // ^ keyword.operator.scala 27 | 28 | trait *: 29 | // ^^ entity.name.class.declaration 30 | 31 | trait *: : 32 | // ^^ entity.name.class.declaration 33 | // ^ keyword.operator.scala 34 | 35 | trait :: : 36 | // ^^ entity.name.class.declaration 37 | // ^ keyword.operator.scala 38 | 39 | class :: 40 | // ^^ entity.name.class.declaration 41 | 42 | class :: : 43 | // ^^ entity.name.class.declaration 44 | // ^ keyword.operator.scala 45 | 46 | 1 :: Nil 47 | // ^^ keyword.operator.scala 48 | 49 | 1 :: 50 | // ^^ keyword.operator.scala 51 | -------------------------------------------------------------------------------- /tests/unit/#105.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | 1e12 1e+34 1e-56 1e12f 1e+34f 1e-56f 1e12d 1e+34d 1e-56d 4 | // ^^^^ constant.numeric.scala 5 | // ^^^^ constant.numeric.scala 6 | // ^^^^^ constant.numeric.scala 7 | // ^^^^^ constant.numeric.scala 8 | // ^^^^^^ constant.numeric.scala 9 | // ^^^^^ constant.numeric.scala 10 | // ^^^^^ constant.numeric.scala 11 | // ^^^^^^ constant.numeric.scala 12 | // ^^^^^^ constant.numeric.scala 13 | 14 | 1E12 1E+34 1E-56 1E12f 1E+34f 1E-56f 1E12d 1E+34d 1E-56d 15 | // ^^^^ constant.numeric.scala 16 | // ^^^^ constant.numeric.scala 17 | // ^^^^^ constant.numeric.scala 18 | // ^^^^^ constant.numeric.scala 19 | // ^^^^^^ constant.numeric.scala 20 | // ^^^^^ constant.numeric.scala 21 | // ^^^^^ constant.numeric.scala 22 | // ^^^^^^ constant.numeric.scala 23 | // ^^^^^^ constant.numeric.scala 24 | 25 | .1e12 .1e+34 .1e-56 .1e12f .1e+34f .1e-56f .1e12d .1e+34d .1e-56d 26 | // ^^^^^ constant.numeric.scala 27 | // ^^^^^^ constant.numeric.scala 28 | // ^^^^^^ constant.numeric.scala 29 | // ^^^^^^ constant.numeric.scala 30 | // ^^^^^^^ constant.numeric.scala 31 | // ^^^^^^^ constant.numeric.scala 32 | // ^^^^^^ constant.numeric.scala 33 | // ^^^^^^^ constant.numeric.scala 34 | // ^^^^^^^ constant.numeric.scala 35 | 36 | .1E12 .1E+34 .1E-56 .1E12f .1E+34f .1E-56f .1E12d .1E+34d .1E-56d 37 | // ^^^^^ constant.numeric.scala 38 | // ^^^^^^ constant.numeric.scala 39 | // ^^^^^^ constant.numeric.scala 40 | // ^^^^^^ constant.numeric.scala 41 | // ^^^^^^^ constant.numeric.scala 42 | // ^^^^^^^ constant.numeric.scala 43 | // ^^^^^^ constant.numeric.scala 44 | // ^^^^^^^ constant.numeric.scala 45 | // ^^^^^^^ constant.numeric.scala 46 | -------------------------------------------------------------------------------- /tests/unit/#107.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | new Foo: 4 | // ^^^ keyword.declaration.scala 5 | ... 6 | end new 7 | // ^^^ keyword.declaration.end.scala 8 | // ^^^ keyword.declaration.end.scala 9 | 10 | end extension 11 | // ^^^ keyword.declaration.end.scala 12 | // ^^^^^^^^^ keyword.declaration.end.scala 13 | 14 | end if 15 | // ^^^ keyword.control.flow.end.scala 16 | // ^^ keyword.control.flow.end.scala 17 | 18 | end while 19 | // ^^^ keyword.control.flow.end.scala 20 | // ^^^^^ keyword.control.flow.end.scala 21 | 22 | end for 23 | // ^^^ keyword.control.flow.end.scala 24 | // ^^^ keyword.control.flow.end.scala 25 | 26 | end match 27 | // ^^^ keyword.control.flow.end.scala 28 | // ^^^^^ keyword.control.flow.end.scala 29 | 30 | class Foo 31 | // ^^^ entity.name.class.declaration 32 | end Foo 33 | // ^^^ keyword.declaration.end.scala 34 | // ^^^ entity.name.type.declaration 35 | 36 | def foo 37 | // ^^^ entity.name.function.declaration 38 | end bar 39 | // ^^^ keyword.declaration.end.scala 40 | // ^^^ entity.name.declaration 41 | 42 | end `bar` 43 | // ^^^ keyword.declaration.end.scala 44 | // ^^^ entity.name.declaration 45 | 46 | end 47 | // ^^^ keyword.declaration.end.scala -------------------------------------------------------------------------------- /tests/unit/#110.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | import java.io.BufferedReaded 4 | // ^^^^^^ keyword.other.import.scala 5 | // ^^^^ entity.name.import.scala 6 | // ^^ entity.name.import.scala 7 | // ^^^^^^^^^^^^^^ entity.name.class.import.scala 8 | 9 | import foo._ 10 | // ^^^^^^ keyword.other.import.scala 11 | // ^^^ entity.name.import.scala 12 | // ^ entity.name.import.scala 13 | 14 | import foo.Bar 15 | // ^^^^^^ keyword.other.import.scala 16 | // ^^^ entity.name.import.scala 17 | // ^^^ entity.name.class.import.scala 18 | 19 | import foo.Bar._ 20 | // ^^^^^^ keyword.other.import.scala 21 | // ^^^ entity.name.import.scala 22 | // ^^^ entity.name.class.import.scala 23 | // ^ entity.name.import.scala 24 | 25 | import foo.Foo.Bar._ 26 | // ^^^^^^ keyword.other.import.scala 27 | // ^^^ entity.name.import.scala 28 | // ^^^ entity.name.class.import.scala 29 | // ^^^ entity.name.class.import.scala 30 | 31 | import foo.{Foo, bar} 32 | // ^^^^^^ keyword.other.import.scala 33 | // ^^^ entity.name.import.scala 34 | // ^^^ entity.name.class.import.scala 35 | // ^^^ entity.name.import.scala 36 | 37 | import foo.{Foo => Bar, bar => foo} 38 | // ^^^^^^ keyword.other.import.scala 39 | // ^^^ entity.name.import.scala 40 | // ^^^ meta.import.scala meta.import.selector.scala entity.name.class.import.renamed-from.scala 41 | // ^^ meta.import.scala 42 | // ^^^ meta.import.scala meta.import.selector.scala entity.name.class.import.renamed-to.scala 43 | // ^^^ meta.import.scala meta.import.selector.scala entity.name.import.renamed-from.scala 44 | // ^^ meta.import.scala meta.import.selector.scala keyword.other.arrow.scala 45 | // ^^^ meta.import.scala meta.import.selector.scala entity.name.import.renamed-to.scala 46 | -------------------------------------------------------------------------------- /tests/unit/#118.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | new A 4 | // ^^^ keyword.declaration.scala 5 | // ^ entity.name.class 6 | 7 | new { } 8 | // ^^^ keyword.declaration.scala 9 | // ^ punctuation.section.block.begin.scala 10 | // ^ punctuation.section.block.end.scala 11 | -------------------------------------------------------------------------------- /tests/unit/#119.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | (using) 4 | // ^ meta.bracket.scala 5 | // ^^^^^ source.scala 6 | // ^ meta.bracket.scala 7 | 8 | (using ) 9 | // ^ meta.bracket.scala 10 | // ^^^^^^^ source.scala 11 | // ^ meta.bracket.scala 12 | 13 | (using , ) 14 | // ^ meta.bracket.scala 15 | // ^^^^^^^^ source.scala 16 | // ^ meta.bracket.scala 17 | 18 | (usingSomething) 19 | // ^ meta.bracket.scala 20 | // ^^^^^^^^^^^^^^ source.scala 21 | // ^ meta.bracket.scala 22 | -------------------------------------------------------------------------------- /tests/unit/#122.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | new Foo 4 | // ^^^ keyword.declaration.scala 5 | // ^^^ entity.name.class 6 | 7 | new foo.Foo 8 | // ^^^ keyword.declaration.scala 9 | // ^^^^ source.scala 10 | // ^^^ entity.name.class 11 | 12 | new Foo.Foo 13 | // ^^^ keyword.declaration.scala 14 | // ^^^ entity.name.class 15 | // ^ source.scala 16 | // ^^^ entity.name.class 17 | -------------------------------------------------------------------------------- /tests/unit/#124.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | def foo(x: A with B, c: C): Int = 0 4 | // ^^^^ keyword.declaration.scala 5 | // ^ entity.name.class 6 | // ^ source.scala 7 | 8 | class B extends A with B, 9 | // ^^^^ keyword.declaration.scala 10 | // ^ entity.name.class 11 | // ^ source.scala 12 | 13 | class B extends A with B: 14 | // ^^^^ keyword.declaration.scala 15 | // ^ entity.name.class 16 | // ^ source.scala 17 | 18 | class B extends A: 19 | // ^^^^^^^ keyword.declaration.scala 20 | // ^ entity.name.class 21 | // ^ source.scala 22 | 23 | class B extends A, 24 | // ^^^^^^^ keyword.declaration.scala 25 | // ^ entity.name.class 26 | // ^ source.scala 27 | 28 | class B extends A' 29 | // ^^^^^^^ keyword.declaration.scala 30 | // ^ entity.name.class 31 | // ^ punctuation.definition.character.begin.scala 32 | 33 | class B extends A| 34 | // ^^^^^^^ keyword.declaration.scala 35 | // ^ entity.name.class 36 | // ^ source.scala 37 | 38 | class B extends A+ 39 | // ^^^^^^^ keyword.declaration.scala 40 | // ^ entity.name.class 41 | // ^ source.scala 42 | 43 | class B extends A- 44 | // ^^^^^^^ keyword.declaration.scala 45 | // ^ entity.name.class 46 | // ^ source.scala 47 | 48 | class B extends A* 49 | // ^^^^^^^ keyword.declaration.scala 50 | // ^ entity.name.class 51 | // ^ source.scala 52 | 53 | class B extends A& 54 | // ^^^^^^^ keyword.declaration.scala 55 | // ^ entity.name.class 56 | // ^ source.scala 57 | 58 | class B extends A^ 59 | // ^^^^^^^ keyword.declaration.scala 60 | // ^ entity.name.class 61 | // ^ source.scala 62 | 63 | class B extends `A` 64 | // ^^^^^^^ keyword.declaration.scala 65 | // ^^^ entity.name.class 66 | -------------------------------------------------------------------------------- /tests/unit/#133.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | 4 | inline val c = 0 5 | // ^^^^^^ storage.modifier.other 6 | 7 | inline def power(x: Double, inline n: Int): Double = 8 | // ^^^^^^ storage.modifier.other 9 | // ^^^^^^ storage.modifier.other 10 | inline if (n == 0) 1.0 11 | // ^^^^^^ keyword.control.flow.scala 12 | else inline if (n % 2 == 1) x * power(x, n - 1) 13 | // ^^^^^^ keyword.control.flow.scala 14 | else power(x * x, n / 2) 15 | 16 | 17 | inline x match { 18 | // ^^^^^^ keyword.control.flow.scala 19 | // ^^^^^ keyword.control.flow.scala 20 | 21 | inline xval match { 22 | // ^^^^^^ keyword.control.flow.scala 23 | // ^^^^^ keyword.control.flow.scala 24 | 25 | inline val1 match { 26 | // ^^^^^^ keyword.control.flow.scala 27 | // ^^^^^ keyword.control.flow.scala 28 | 29 | inline def1 match { 30 | // ^^^^^^ keyword.control.flow.scala 31 | // ^^^^^ keyword.control.flow.scala 32 | 33 | inline given1 match { 34 | // ^^^^^^ keyword.control.flow.scala 35 | // ^^^^^ keyword.control.flow.scala 36 | 37 | inline def power(x: Double, inline N: Int): Double = 38 | // ^^^^^^ storage.modifier.other 39 | // ^^^^^^ storage.modifier.other 40 | 41 | inline def power(x: Double, inline `n`: Int): Double = 42 | // ^^^^^^ storage.modifier.other 43 | // ^^^^^^ storage.modifier.other 44 | 45 | val x = inline + 2 46 | // ^^^^^^ - storage.modifier.other keyword.control.flow.scala 47 | val x = inline(x) 48 | // ^^^^^^ - storage.modifier.other keyword.control.flow.scala 49 | val x = inline[T] 50 | // ^^^^^^ - storage.modifier.other keyword.control.flow.scala 51 | 52 | inline def inline(inline inline: Int): Double = 53 | // ^^^^^^ storage.modifier.other 54 | // ^^^^^^ entity.name.function.declaration 55 | // ^^^^^^ storage.modifier.other 56 | // ^^^^^^ variable.parameter.scala 57 | 58 | inline def inline(inline xif: Int, inline ifx: Int): Double = 59 | // ^^^^^^ storage.modifier.other 60 | // ^^^^^^ entity.name.function.declaration 61 | // ^^^^^^ storage.modifier.other 62 | // ^^^ variable.parameter.scala 63 | // ^^^^^^ storage.modifier.other 64 | // ^^^ variable.parameter.scala 65 | 66 | inline def inline(inline xmatch: Int, inline matchx: Int): Double = 67 | // ^^^^^^ storage.modifier.other 68 | // ^^^^^^ entity.name.function.declaration 69 | // ^^^^^^ storage.modifier.other 70 | // ^^^^^^ variable.parameter.scala 71 | // ^^^^^^ storage.modifier.other 72 | // ^^^^^^ variable.parameter.scala 73 | 74 | inline def inline(inline x: Int): Double = if 75 | // ^^^^^^ storage.modifier.other 76 | // ^^^^^^ entity.name.function.declaration 77 | // ^^^^^^ storage.modifier.other 78 | // ^ variable.parameter.scala 79 | 80 | inline def toIntMacro(inline nat: Nat): Int = ${ Macros.toIntImpl('nat) } 81 | // ^^^^^^ storage.modifier.other 82 | // ^^^^^^ storage.modifier.other 83 | 84 | inline def toIntUnapply(inline nat: Nat): Int = inline 1 match 85 | // ^^^^^^ storage.modifier.other 86 | // ^^^^^^ storage.modifier.other 87 | // ^^^^^^ keyword.control.flow.scala 88 | 89 | inline if (n == 0) 1 else 2; val x = 2 90 | // ^^^^^^ keyword.control.flow.scala 91 | // ^^ keyword.control.flow.scala 92 | 93 | inline if (n == 0) 1 else 2; def x = 2 94 | // ^^^^^^ keyword.control.flow.scala 95 | // ^^ keyword.control.flow.scala 96 | 97 | inline f[X](x: X) match { 98 | // ^^^^^^ keyword.control.flow.scala 99 | // ^^^^^ keyword.control.flow.scala 100 | 101 | inline xval 102 | // ^^^^^^ - storage.modifier.other keyword.control.flow.scala 103 | 104 | inline valx 105 | // ^^^^^^ - storage.modifier.other keyword.control.flow.scala 106 | 107 | inline defx 108 | // ^^^^^^ - storage.modifier.other keyword.control.flow.scala 109 | 110 | inline xdef 111 | // ^^^^^^ - storage.modifier.other keyword.control.flow.scala 112 | 113 | inline givenx 114 | // ^^^^^^ - storage.modifier.other keyword.control.flow.scala 115 | 116 | inline xgiven 117 | // ^^^^^^ - storage.modifier.other keyword.control.flow.scala -------------------------------------------------------------------------------- /tests/unit/#135.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | class Foo extends scala.collection.Seq[Int] 4 | // ^^^^^ keyword.declaration.scala 5 | // ^^^ entity.name.class.declaration 6 | // ^^^^^^^ keyword.declaration.scala 7 | // ^^^^^ source.scala 8 | // ^^^^^^^^^^ source.scala 9 | // ^^^ entity.name.class 10 | // ^ meta.bracket.scala 11 | // ^^^ entity.name.class 12 | // ^ meta.bracket.scala 13 | -------------------------------------------------------------------------------- /tests/unit/#139.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | 4 | inline def mkDefaultTypeable[T]: Typeable[T] = ${ TypeableMacros.impl[T] } 5 | // ^^^^^^ storage.modifier.other 6 | // ^^^ keyword.declaration.scala 7 | 8 | inline given [T] as Typeable[T] = mkDefaultTypeable[T] 9 | // ^^^^^^ storage.modifier.other 10 | // ^^^^^ keyword.declaration.scala 11 | -------------------------------------------------------------------------------- /tests/unit/#140.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | given foo.Foo 4 | // ^^^^^ keyword.declaration.scala 5 | // ^^^ - entity.name.declaration 6 | // ^^^ entity.name.class 7 | 8 | given Foo[a] 9 | // ^^^^^ keyword.declaration.scala 10 | // ^^^ - entity.name.type.declaration 11 | // ^^^ entity.name.class 12 | -------------------------------------------------------------------------------- /tests/unit/#141.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | val language = file.extension { 4 | // ^^^^^^^^^ - keyword.declaration.scala 5 | val language = file extension { 6 | // ^^^^^^^^^ - keyword.declaration.scala 7 | val language = file.extension( 8 | // ^^^^^^^^^ - keyword.declaration.scala 9 | val language = file extension ( 10 | // ^^^^^^^^^ - keyword.declaration.scala 11 | -------------------------------------------------------------------------------- /tests/unit/#155.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | transparent inline def foo 4 | // ^^^^^^^^^^^ storage.modifier.other 5 | // ^^^^^^ storage.modifier.other 6 | 7 | transparent inline xdef foo 8 | // ^^^^^^^^^^^ - storage.modifier.other 9 | // ^^^^^^ - storage.modifier.other 10 | 11 | transparent inline defx foo 12 | // ^^^^^^^^^^^ - storage.modifier.other 13 | // ^^^^^^ - storage.modifier.other 14 | 15 | transparent inline final def assert 16 | // ^^^^^^^^^^^ storage.modifier.other 17 | // ^^^^^^ storage.modifier.other 18 | 19 | transparent badkeyword inline override def alternative 20 | // ^^^^^^^^^^^ storage.modifier.other 21 | // ^^^^^^ storage.modifier.other 22 | 23 | transparent trait Enum extends Any with Product with Serializable 24 | // ^^^^^^^^^^^ storage.modifier.other 25 | 26 | opaque type Logarithm = Double 27 | // ^^^^^^ storage.modifier.other 28 | 29 | opaque private type Matching = Option[Tuple] 30 | // ^^^^^^ storage.modifier.other 31 | 32 | infix def + (that: Rational) = 33 | // ^^^^^ storage.modifier.other 34 | 35 | infix type +[X <: Int | String, Y <: Int | String] = (X, Y) match 36 | // ^^^^^ storage.modifier.other 37 | 38 | open class Open 39 | // ^^^^ storage.modifier.other 40 | 41 | open final class Foo1 42 | // ^^^^ storage.modifier.other 43 | 44 | open final class Foo1 45 | // <---- storage.modifier.other 46 | 47 | @inline def 48 | // ^^^^^^ - storage.modifier.other 49 | 50 | @infix def 51 | // ^^^^^ - storage.modifier.other 52 | 53 | @transparent def 54 | // ^^^^^^^^^^^ - storage.modifier.other 55 | 56 | @opaque def 57 | // ^^^^^^ - storage.modifier.other 58 | 59 | @open def 60 | // ^^^^ - storage.modifier.other 61 | 62 | @scala.inline def 63 | // ^^^^^^ - storage.modifier.other 64 | 65 | @infix inline def 66 | // ^^^^^ - storage.modifier.other 67 | // ^^^^^^ storage.modifier.other 68 | 69 | file.open() 70 | // ^^^^ - storage.modifier.other 71 | 72 | -------------------------------------------------------------------------------- /tests/unit/#156.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | 4 | class Foo extends 5 | // ^^^^^ keyword.declaration.scala 6 | // ^^^ entity.name.class.declaration 7 | // ^^^^^^^ keyword.declaration.scala 8 | 9 | class Foo extends Bar with Baz 10 | // ^^^^^ keyword.declaration.scala 11 | // ^^^ entity.name.class.declaration 12 | // ^^^^^^^ keyword.declaration.scala 13 | // ^^^ entity.name.class 14 | // ^^^^ keyword.declaration.scala 15 | // ^^^ entity.name.class 16 | 17 | class Foo extends Bar with 18 | // ^^^^^ keyword.declaration.scala 19 | // ^^^ entity.name.class.declaration 20 | // ^^^^^^^ keyword.declaration.scala 21 | // ^^^ entity.name.class 22 | // ^^^^ keyword.declaration.scala 23 | 24 | 25 | given tc: TC with {} 26 | // ^^^^^ keyword.declaration.scala 27 | // ^^ entity.name.given.declaration 28 | // ^^ entity.name.class 29 | // ^^^^ keyword.declaration.scala 30 | 31 | given Liftable[Boolean] with { 32 | // ^^^^^ keyword.declaration.scala 33 | // ^^^^^^^^ entity.name.class 34 | // ^^^^^^^ entity.name.class 35 | // ^^^^ keyword.declaration.scala 36 | 37 | given listMonad: Monad[List] with 38 | // ^^^^^ keyword.declaration.scala 39 | // ^^^^^^^^^ entity.name.given.declaration 40 | // ^^^^^ entity.name.class 41 | // ^^^^ entity.name.class 42 | // ^^^^ keyword.declaration.scala 43 | 44 | enum Opt[+T] derives Eq { 45 | // ^^^^ keyword.declaration.scala 46 | // ^^^ entity.name.class.declaration 47 | // ^ entity.name.class 48 | // ^^^^^^^ keyword.declaration.scala 49 | // ^^ entity.name.class 50 | 51 | enum Opt[+T] derives 52 | // ^^^^ keyword.declaration.scala 53 | // ^^^ entity.name.class.declaration 54 | // ^ entity.name.class 55 | // ^^^^^^^ keyword.declaration.scala 56 | -------------------------------------------------------------------------------- /tests/unit/#157.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | val Foo = ??? 4 | // ^^^ keyword.declaration.stable.scala 5 | // ^^^ variable.stable.declaration.scala 6 | 7 | val foo = ??? 8 | // ^^^ keyword.declaration.stable.scala 9 | // ^^^ variable.stable.declaration.scala 10 | 11 | var Foo = ??? 12 | // ^^^ keyword.declaration.volatile.scala 13 | // ^^^ variable.volatile.declaration.scala 14 | 15 | var foo = ??? 16 | // ^^^ keyword.declaration.volatile.scala 17 | // ^^^ variable.volatile.declaration.scala 18 | 19 | def Foo = ??? 20 | // ^^^ entity.name.function.declaration 21 | 22 | def foo 23 | // ^^^ entity.name.function.declaration 24 | -------------------------------------------------------------------------------- /tests/unit/#180.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | case '{ Array[T]()(using $ct) } => 4 | // ^^^^^ keyword.declaration.scala 5 | 6 | case '{ Array[T]()(using ($ct: ClassTag[T])) } => 7 | // ^^^^^ keyword.declaration.scala 8 | -------------------------------------------------------------------------------- /tests/unit/#182.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | true&&false 4 | // ^^^^ constant.language.scala 5 | // ^^ keyword.operator.logical.scala 6 | // ^^^^^ constant.language.scala 7 | b&&false 8 | // ^^ keyword.operator.logical.scala 9 | // ^^^^^ constant.language.scala 10 | 11 | b&&b 12 | // ^^ keyword.operator.logical.scala 13 | b||b 14 | // ^^ keyword.operator.logical.scala 15 | !b 16 | // ^ keyword.operator.logical.scala 17 | 18 | b&&&b 19 | // ^^^ - keyword.operator.logical.scala 20 | b&&?b 21 | // ^^^ - keyword.operator.logical.scala 22 | b&&!b 23 | // ^^^ - keyword.operator.logical.scala 24 | b!&&b 25 | // ^^^ - keyword.operator.logical.scala 26 | b&&+b 27 | // ^^^ - keyword.operator.logical.scala 28 | b&&^b 29 | // ^^^ - keyword.operator.logical.scala 30 | b&&~b 31 | // ^^^ - keyword.operator.logical.scala 32 | b&&#b 33 | // ^^^ - keyword.operator.logical.scala 34 | b&&%b 35 | // ^^^ - keyword.operator.logical.scala 36 | b&&@b 37 | // ^^^ - keyword.operator.logical.scala 38 | b@&&b 39 | // ^^^ - keyword.operator.logical.scala 40 | -------------------------------------------------------------------------------- /tests/unit/#183.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | 4 | s"\\" 5 | // ^ source.scala keyword.interpolation.scala 6 | // ^ string.quoted.double.interpolated.scala punctuation.definition.string.begin.scala 7 | // ^^ constant.character.escape.scala 8 | // ^ punctuation.definition.string.end.scala 9 | 10 | raw"\\" 11 | // ^^^ source.scala keyword.interpolation.scala 12 | // ^ string.quoted.double.interpolated.scala punctuation.definition.string.begin.scala 13 | // ^^ string.quoted.double.interpolated.scala 14 | // ^^ - constant.character.escape.scala 15 | // ^ punctuation.definition.string.end.scala 16 | 17 | raw"$$ " // `$$` is an escaped `$` in raw interpolators 18 | // ^^^ source.scala keyword.interpolation.scala 19 | // ^ string.quoted.double.interpolated.scala punctuation.definition.string.begin.scala 20 | // ^^ constant.character.escape.scala 21 | // ^ string.quoted.double.interpolated.scala 22 | // ^ punctuation.definition.string.end.scala 23 | 24 | raw"$" " // `$"` is an escaped `"` in raw interpolators 25 | // ^^^ source.scala keyword.interpolation.scala 26 | // ^ string.quoted.double.interpolated.scala punctuation.definition.string.begin.scala 27 | // ^^ constant.character.escape.scala 28 | // ^ string.quoted.double.interpolated.scala 29 | // ^ punctuation.definition.string.end.scala 30 | 31 | raw"${4} " 32 | // ^^^ source.scala keyword.interpolation.scala 33 | // ^ string.quoted.double.interpolated.scala punctuation.definition.string.begin.scala 34 | // ^^ meta.template.expression.scala punctuation.definition.template-expression.begin.scala 35 | // ^ meta.template.expression.scala meta.embedded.line.scala constant.numeric.scala 36 | // ^ meta.template.expression.scala punctuation.definition.template-expression.end.scala 37 | // ^ string.quoted.double.interpolated.scala 38 | // ^ punctuation.definition.string.end.scala 39 | 40 | 41 | s"""\\""" 42 | // ^ source.scala keyword.interpolation.scala 43 | // ^^^ string.quoted.triple.interpolated.scala punctuation.definition.string.begin.scala 44 | // ^^ constant.character.escape.scala 45 | // ^^^ punctuation.definition.string.end.scala 46 | 47 | raw"""\\""" 48 | // ^^^ source.scala keyword.interpolation.scala 49 | // ^^^ string.quoted.triple.interpolated.scala punctuation.definition.string.begin.scala 50 | // ^^ string.quoted.triple.interpolated.scala 51 | // ^^ - constant.character.escape.scala 52 | // ^^^ punctuation.definition.string.end.scala 53 | 54 | raw"""$$ """ 55 | // ^^^ source.scala keyword.interpolation.scala 56 | // ^^^ string.quoted.triple.interpolated.scala punctuation.definition.string.begin.scala 57 | // ^^ constant.character.escape.scala 58 | // ^ string.quoted.triple.interpolated.scala 59 | // ^^^ punctuation.definition.string.end.scala 60 | 61 | raw"""$" """ 62 | // ^^^ source.scala keyword.interpolation.scala 63 | // ^^^ string.quoted.triple.interpolated.scala punctuation.definition.string.begin.scala 64 | // ^^ constant.character.escape.scala 65 | // ^ string.quoted.triple.interpolated.scala 66 | // ^^^ punctuation.definition.string.end.scala 67 | 68 | 69 | raw"""${4} """ 70 | // ^^^ source.scala keyword.interpolation.scala 71 | // ^^^ string.quoted.triple.interpolated.scala punctuation.definition.string.begin.scala 72 | // ^^ meta.template.expression.scala punctuation.definition.template-expression.begin.scala 73 | // ^ meta.template.expression.scala meta.embedded.line.scala constant.numeric.scala 74 | // ^ meta.template.expression.scala punctuation.definition.template-expression.end.scala 75 | // ^ string.quoted.triple.interpolated.scala 76 | // ^^^ punctuation.definition.string.end.scala 77 | 78 | raw"$ 79 | // ^^^ source.scala keyword.interpolation.scala 80 | // ^ string.quoted.double.interpolated.scala punctuation.definition.string.begin.scala 81 | // ^ - string.quoted.double.interpolated.scala punctuation.definition.string.end.scala 82 | -------------------------------------------------------------------------------- /tests/unit/#191.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | seq:+element 4 | // ^^ keyword.operator.scala 5 | setting := value 6 | // ^^ keyword.operator.scala 7 | 8 | a->b 9 | // ^^ keyword.operator.scala 10 | a->>b 11 | // ^^^ keyword.operator.scala 12 | a->->b 13 | // ^^^ keyword.operator.scala 14 | 15 | a | b 16 | // ^ keyword.operator.scala 17 | a ||| b 18 | // ^^^ keyword.operator.scala 19 | a |+ b 20 | // ^^ keyword.operator.scala 21 | 22 | element +: seq 23 | // ^^ keyword.operator.scala 24 | i -= 1 25 | // ^^ keyword.operator.scala 26 | 27 | b ^? c 28 | // ^^ keyword.operator.scala 29 | 30 | a ==> b 31 | // ^^^ keyword.operator.scala 32 | 33 | a >=> b 34 | // ^^^ keyword.operator.scala 35 | a &= b 36 | // ^^ keyword.operator.scala 37 | 38 | a \ b 39 | // ^ keyword.operator.scala 40 | 41 | a \\ b 42 | // ^^ keyword.operator.scala 43 | 44 | a \/ b 45 | // ^^ keyword.operator.scala 46 | 47 | a /\ b 48 | // ^^ keyword.operator.scala 49 | 50 | a \\\ b 51 | // ^^^ keyword.operator.scala 52 | -------------------------------------------------------------------------------- /tests/unit/#192.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | 4 | val a :: b = 5 | x :: Nil 6 | end val 7 | // ^^^ source.scala keyword.declaration.stable.end.scala 8 | // ^^^ source.scala keyword.declaration.stable.end.scala 9 | 10 | var a :: b = 11 | x :: Nil 12 | end var 13 | // ^^^ source.scala keyword.declaration.volatile.end.scala 14 | // ^^^ source.scala keyword.declaration.volatile.end.scala -------------------------------------------------------------------------------- /tests/unit/#195.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | s"$a" 4 | // ^ string.quoted.double.interpolated.scala punctuation.definition.string.begin.scala 5 | // ^ meta.template.expression.scala punctuation.definition.template-expression.begin.scala 6 | // ^ meta.template.expression.scala 7 | // ^ string.quoted.double.interpolated.scala punctuation.definition.string.end.scala 8 | 9 | s"${a}" 10 | // ^ string.quoted.double.interpolated.scala punctuation.definition.string.begin.scala 11 | // ^^ meta.template.expression.scala punctuation.definition.template-expression.begin.scala 12 | // ^ meta.template.expression.scala 13 | // ^ meta.template.expression.scala punctuation.definition.template-expression.end.scala 14 | // ^ string.quoted.double.interpolated.scala punctuation.definition.string.end.scala 15 | 16 | s"$_" 17 | // ^ string.quoted.double.interpolated.scala punctuation.definition.string.begin.scala 18 | // ^ source.scala meta.template.expression.scala punctuation.definition.template-expression.begin.scala 19 | // ^ source.scala meta.template.expression.scala 20 | // ^ string.quoted.double.interpolated.scala punctuation.definition.string.end.scala 21 | 22 | s"$$" 23 | // ^ string.quoted.double.interpolated.scala punctuation.definition.string.begin.scala 24 | // ^^ constant.character.escape.scala 25 | // ^ string.quoted.double.interpolated.scala punctuation.definition.string.end.scala 26 | 27 | s"$"" 28 | // ^ string.quoted.double.interpolated.scala punctuation.definition.string.begin.scala 29 | // ^^ constant.character.escape.scala 30 | // ^ string.quoted.double.interpolated.scala punctuation.definition.string.end.scala 31 | 32 | 33 | s"$ 34 | // ^ string.quoted.double.interpolated.scala punctuation.definition.string.begin.scala 35 | // ^ - string.quoted.double.interpolated.scala punctuation.definition.string.end.scala 36 | // ^ - constant.character.escape.scala 37 | 38 | 39 | s"$ // 40 | // ^ string.quoted.double.interpolated.scala punctuation.definition.string.begin.scala 41 | // ^^ invalid.illegal.unrecognized-string-escape.scala 42 | 43 | s"$++ 44 | // ^ string.quoted.double.interpolated.scala punctuation.definition.string.begin.scala 45 | // ^^ invalid.illegal.unrecognized-string-escape.scala 46 | // ^ keyword.operator.arithmetic.scala 47 | 48 | s"$; val a = 49 | // ^ string.quoted.double.interpolated.scala punctuation.definition.string.begin.scala 50 | // ^^ invalid.illegal.unrecognized-string-escape.scala 51 | // ^^^^^^^^ -string.quoted.double.interpolated.scala 52 | // ^^^ keyword.declaration.stable.scala 53 | 54 | raw"$ 55 | // ^^^ source.scala keyword.interpolation.scala 56 | // ^ string.quoted.double.interpolated.scala punctuation.definition.string.begin.scala 57 | // ^ - string.quoted.double.interpolated.scala invalid.illegal.unrecognized-string-escape.scala 58 | 59 | raw"$4 60 | // ^^^ source.scala keyword.interpolation.scala 61 | // ^ string.quoted.double.interpolated.scala punctuation.definition.string.begin.scala 62 | // ^^ invalid.illegal.unrecognized-string-escape.scala 63 | 64 | raw"""$ 65 | // ^^^ source.scala keyword.interpolation.scala 66 | // ^^^ string.quoted.triple.interpolated.scala punctuation.definition.string.begin.scala 67 | // ^ - string.quoted.triple.interpolated.scala invalid.illegal.unrecognized-string-escape.scala 68 | 69 | raw"""$8 70 | // ^^^ source.scala keyword.interpolation.scala 71 | // ^^^ string.quoted.triple.interpolated.scala punctuation.definition.string.begin.scala 72 | // ^^ invalid.illegal.unrecognized-string-escape.scala 73 | 74 | s"""$ 75 | // ^ source.scala keyword.interpolation.scala 76 | // ^^^ string.quoted.triple.interpolated.scala punctuation.definition.string.begin.scala 77 | // ^ - string.quoted.triple.interpolated.scala invalid.illegal.unrecognized-string-escape.scala 78 | 79 | s"""$8 80 | // ^ source.scala keyword.interpolation.scala 81 | // ^^^ string.quoted.triple.interpolated.scala punctuation.definition.string.begin.scala 82 | // ^^ invalid.illegal.unrecognized-string-escape.scala 83 | -------------------------------------------------------------------------------- /tests/unit/#202.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | defn.Any_! 4 | // ^^^^^ entity.name.class 5 | // ^^^^^ - keyword.operator.logical.scala 6 | 7 | defn.any_! 8 | // ^^^^^ - keyword.operator.logical.scala 9 | 10 | def any_!: 11 | // ^^^^^ entity.name.function.declaration 12 | // ^^^^^ - keyword.operator.logical.scala -------------------------------------------------------------------------------- /tests/unit/#222.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | test"hello $name" 4 | // ^^^^ keyword.interpolation.scala 5 | // ^ string.quoted.double.interpolated.scala punctuation.definition.string.begin.scala 6 | // ^^^^^^ string.quoted.double.interpolated.scala 7 | // ^ meta.template.expression.scala punctuation.definition.template-expression.begin.scala 8 | // ^^^^ meta.template.expression.scala 9 | // ^ string.quoted.double.interpolated.scala punctuation.definition.string.end.scala 10 | 11 | test1"hello $name" 12 | // ^^^^^ keyword.interpolation.scala 13 | // ^ string.quoted.double.interpolated.scala punctuation.definition.string.begin.scala 14 | // ^^^^^^ string.quoted.double.interpolated.scala 15 | // ^ meta.template.expression.scala punctuation.definition.template-expression.begin.scala 16 | // ^^^^ meta.template.expression.scala 17 | // ^ string.quoted.double.interpolated.scala punctuation.definition.string.end.scala 18 | 19 | test1a"hello $name" 20 | // ^^^^^^ keyword.interpolation.scala 21 | // ^ string.quoted.double.interpolated.scala punctuation.definition.string.begin.scala 22 | // ^^^^^^ string.quoted.double.interpolated.scala 23 | // ^ meta.template.expression.scala punctuation.definition.template-expression.begin.scala 24 | // ^^^^ meta.template.expression.scala 25 | // ^ string.quoted.double.interpolated.scala punctuation.definition.string.end.scala 26 | 27 | test_+"hello $name" 28 | // ^^^^^^ keyword.interpolation.scala 29 | // ^ string.quoted.double.interpolated.scala punctuation.definition.string.begin.scala 30 | // ^^^^^^ string.quoted.double.interpolated.scala 31 | // ^ meta.template.expression.scala punctuation.definition.template-expression.begin.scala 32 | // ^^^^ meta.template.expression.scala 33 | // ^ string.quoted.double.interpolated.scala punctuation.definition.string.end.scala 34 | -------------------------------------------------------------------------------- /tests/unit/#233.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | "abc" match 4 | case x"${x}b$y" => 5 | // ^ keyword.interpolation.scala 6 | // ^ meta.template.expression.scala punctuation.definition.template-expression.begin.scala 7 | // ^ meta.template.expression.scala punctuation.definition.template-expression.end.scala 8 | 9 | val x"${x}b$y" = "abc" 10 | // ^ keyword.interpolation.scala 11 | // ^ meta.template.expression.scala punctuation.definition.template-expression.begin.scala 12 | // ^ meta.template.expression.scala punctuation.definition.template-expression.end.scala 13 | 14 | var x"${x}b$y" = "abc" 15 | // ^ keyword.interpolation.scala 16 | // ^ meta.template.expression.scala punctuation.definition.template-expression.begin.scala 17 | // ^ meta.template.expression.scala punctuation.definition.template-expression.end.scala 18 | 19 | val (x"${x}b$y", _) = "abc" 20 | // ^ keyword.interpolation.scala 21 | // ^ meta.template.expression.scala punctuation.definition.template-expression.begin.scala 22 | // ^ meta.template.expression.scala punctuation.definition.template-expression.end.scala 23 | -------------------------------------------------------------------------------- /tests/unit/#234.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | val foo = Value 4 | // ^^^ variable.stable.declaration.scala 5 | 6 | val Mon = Value 7 | // ^^^ variable.stable.declaration.scala 8 | 9 | val Mon, Tue = Value 10 | // ^^^ variable.stable.declaration.scala 11 | // ^^^ variable.stable.declaration.scala 12 | 13 | val Mon, Tue, Wed = Value 14 | // ^^^ variable.stable.declaration.scala 15 | // ^^^ variable.stable.declaration.scala 16 | // ^^^ variable.stable.declaration.scala 17 | 18 | var Mon = Value 19 | // ^^^ variable.volatile.declaration.scala 20 | 21 | var Mon, Tue, Wed = Value 22 | // ^^^ variable.volatile.declaration.scala 23 | // ^^^ variable.volatile.declaration.scala 24 | // ^^^ variable.volatile.declaration.scala 25 | -------------------------------------------------------------------------------- /tests/unit/#260.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | val x = ''' + '"' 4 | // ^^^ constant.character.literal.scala 5 | // ^ punctuation.definition.character.begin.scala 6 | // ^ punctuation.definition.character.end.scala 7 | // ^ keyword.operator.arithmetic.scala 8 | 9 | val x = '''' + '"' 10 | // ^^^^ constant.character.literal.scala 11 | // ^ punctuation.definition.character.begin.scala 12 | // ^ punctuation.definition.character.end.scala 13 | // ^ punctuation.definition.character.begin.scala 14 | -------------------------------------------------------------------------------- /tests/unit/#264.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | 4 | import foo.as 5 | // ^^^^^^ meta.import.scala keyword.other.import.scala 6 | // ^^^ meta.import.scala entity.name.import.scala 7 | // ^^ meta.import.scala entity.name.import.scala 8 | 9 | 10 | import bar as baz 11 | // ^^^^^^ meta.import.scala keyword.other.import.scala 12 | // ^^^ meta.import.scala entity.name.import.scala 13 | // ^^ meta.import.scala keyword.other.import.as.scala 14 | // ^^^ meta.import.scala entity.name.import.scala 15 | 16 | -------------------------------------------------------------------------------- /tests/unit/#266.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | 210 4 | // ^^^ constant.numeric.scala 5 | 0b1 6 | // ^^^ constant.numeric.scala 7 | 0B1 8 | // ^^^ constant.numeric.scala 9 | 0b0001 10 | // ^^^^^^ constant.numeric.scala 11 | 0b0001_0000_0000 12 | // ^^^^^^^^^^^^^^^^ constant.numeric.scala 13 | 14 | 15 | 0b1L + 0B10L + 0b11l + 0B100l 16 | // ^^^ constant.numeric.scala 17 | // ^^^^^ constant.numeric.scala 18 | // ^^^^^ constant.numeric.scala 19 | // ^^^^^^ constant.numeric.scala 20 | 21 | 0b0010_1001_0101_1001__1010_0100_1000_1010__1001_1000_0011_0111__1100_1011_0111_0101L 22 | // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.numeric.scala 23 | -------------------------------------------------------------------------------- /tests/unit/#51.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | object Enum extends Enumeration { 4 | val Foo, Bar, Baz = Value 5 | // ^^^ keyword.declaration.stable.scala 6 | // ^^^ - variable.other.declaration.scala 7 | // ^^^ - variable.other.declaration.scala 8 | // ^^^ - variable.other.declaration.scala 9 | // ^^^^^ entity.name.class 10 | 11 | val foo, bar, baz = Value 12 | // ^^^ keyword.declaration.stable.scala 13 | // ^^^ - variable.other.declaration.scala 14 | // ^^^ - variable.other.declaration.scala 15 | // ^^^ - variable.other.declaration.scala 16 | // ^^^^^ entity.name.class 17 | 18 | val (foo 19 | // ^^^ keyword.declaration.stable.scala 20 | // ^^^ - variable.other.declaration.scala 21 | 22 | val `foo`, 23 | // ^^^ keyword.declaration.stable.scala 24 | // ^^^^^ - variable.other.declaration.scala 25 | 26 | var Foo, 27 | // ^^^ keyword.declaration.volatile.scala 28 | // ^^^ - variable.other.declaration.scala 29 | 30 | var foo, 31 | // ^^^ keyword.declaration.volatile.scala 32 | // ^^^ - variable.other.declaration.scala 33 | 34 | var `foo`, 35 | // ^^^ keyword.declaration.volatile.scala 36 | // ^^^^^ - variable.other.declaration.scala 37 | 38 | var (foo 39 | // ^^^ keyword.declaration.volatile.scala 40 | // ^^^ - variable.other.declaration.scala 41 | 42 | val Some(x) = 43 | // ^^^ keyword.declaration.stable.scala 44 | // ^^^^ - variable.other.declaration.scala 45 | 46 | val some(x) = 47 | // ^^^ keyword.declaration.stable.scala 48 | // ^^^^ - variable.other.declaration.scala 49 | } 50 | -------------------------------------------------------------------------------- /tests/unit/#52.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | ' ' 4 | // ^ punctuation.definition.character.begin.scala 5 | // ^ constant.character.literal.scala 6 | // ^ punctuation.definition.character.end.scala 7 | 8 | ' 9 | // ^ punctuation.definition.character.begin.scala 10 | ' 11 | // ^ punctuation.definition.character.begin.scala 12 | 13 | Class[T'] 14 | // ^^^^^ entity.name.class 15 | // ^ meta.bracket.scala 16 | // ^ entity.name.class 17 | // ^ punctuation.definition.character.begin.scala 18 | // ^ invalid.illegal.character-literal-too-long 19 | Class[Int] 20 | 21 | Error: T' Int 22 | // ^ entity.name.class 23 | // ^ punctuation.definition.character.begin.scala 24 | // ^^^^ invalid.illegal.character-literal-too-long 25 | 26 | Error: T' Int 27 | // ^ entity.name.class 28 | // ^ punctuation.definition.character.begin.scala 29 | // ^^^^^ invalid.illegal.character-literal-too-long 30 | 31 | Error: T' Int 32 | // ^ entity.name.class 33 | // ^ punctuation.definition.character.begin.scala 34 | // ^^^^^ invalid.illegal.character-literal-too-long 35 | 36 | Error: T'😀 Int 37 | // ^ entity.name.class 38 | // ^^^ constant.other.symbol.scala 39 | // ^^^ entity.name.class 40 | 41 | Error: T'😀😀 Int 42 | // ^ entity.name.class 43 | // ^^^^^ constant.other.symbol.scala 44 | // ^^^ entity.name.class 45 | 46 | Error: T'aa Int 47 | // ^ entity.name.class 48 | // ^^^ constant.other.symbol.scala 49 | 50 | 51 | 52 | Error: T'aa' Int 53 | // ^ entity.name.class 54 | // ^ punctuation.definition.character.begin.scala 55 | // ^^ invalid.illegal.character-literal-too-long 56 | // ^ punctuation.definition.character.end.scala -------------------------------------------------------------------------------- /tests/unit/#57.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | '[' 4 | // ^ punctuation.definition.character.begin.scala 5 | // ^ constant.character.literal.scala 6 | // ^ punctuation.definition.character.end.scala 7 | 8 | '{' 9 | // ^ punctuation.definition.character.begin.scala 10 | // ^ constant.character.literal.scala 11 | // ^ punctuation.definition.character.end.scala 12 | 13 | '(' 14 | // ^ punctuation.definition.character.begin.scala 15 | // ^ constant.character.literal.scala 16 | // ^ punctuation.definition.character.end.scala 17 | 18 | '\n' 19 | // ^ punctuation.definition.character.begin.scala 20 | // ^^ constant.character.literal.scala 21 | // ^ punctuation.definition.character.end.scala 22 | -------------------------------------------------------------------------------- /tests/unit/#62.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | val _ : XYZ = XYZ 4 | // ^^^ keyword.declaration.stable.scala 5 | // ^^^ entity.name.class 6 | // ^^^ entity.name.class 7 | 8 | val _ : Unit = Unit 9 | // ^^^ keyword.declaration.stable.scala 10 | // ^^^^ entity.name.class 11 | // ^^^^ entity.name.class 12 | 13 | val _ : Boolean = Boolean 14 | // ^^^ keyword.declaration.stable.scala 15 | // ^^^^^^^ entity.name.class 16 | // ^^^^^^^ entity.name.class 17 | 18 | val _ : Byte = Byte 19 | // ^^^ keyword.declaration.stable.scala 20 | // ^^^^ entity.name.class 21 | // ^^^^ entity.name.class 22 | 23 | val _ : Char = Char 24 | // ^^^ keyword.declaration.stable.scala 25 | // ^^^^ entity.name.class 26 | // ^^^^ entity.name.class 27 | 28 | val _ : Short = Short 29 | // ^^^ keyword.declaration.stable.scala 30 | // ^^^^^ entity.name.class 31 | // ^^^^^ entity.name.class 32 | 33 | val _ : Int = Int 34 | // ^^^ keyword.declaration.stable.scala 35 | // ^^^ entity.name.class 36 | // ^^^ entity.name.class 37 | 38 | val _ : Float = Float 39 | // ^^^ keyword.declaration.stable.scala 40 | // ^^^^^ entity.name.class 41 | // ^^^^^ entity.name.class 42 | 43 | val _ : Long = Long 44 | // ^^^ keyword.declaration.stable.scala 45 | // ^^^^ entity.name.class 46 | // ^^^^ entity.name.class 47 | 48 | val _ : Double = Double 49 | // ^^^ keyword.declaration.stable.scala 50 | // ^^^^^^ entity.name.class 51 | // ^^^^^^ entity.name.class 52 | 53 | val _ : String = String 54 | // ^^^ keyword.declaration.stable.scala 55 | // ^^^^^^ entity.name.class 56 | // ^^^^^^ entity.name.class 57 | 58 | val _ : Symbol = Symbol 59 | // ^^^ keyword.declaration.stable.scala 60 | // ^^^^^^ entity.name.class 61 | // ^^^^^^ entity.name.class 62 | 63 | -------------------------------------------------------------------------------- /tests/unit/#69.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | val x = ??? 4 | trait Foo[T <: x.type] 5 | // ^^^^ keyword.type.scala 6 | 7 | val a: x.type = ??? 8 | // ^^^^ keyword.type.scala 9 | 10 | val b: Foo[x.type] = ??? 11 | // ^^^^ keyword.type.scala 12 | -------------------------------------------------------------------------------- /tests/unit/#71.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | s"1 + 2 = ${ 1 + { val x = 2; x } }." 4 | // ^ keyword.interpolation.scala 5 | // ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.template.expression.scala 6 | // ^ punctuation.definition.string.begin.scala 7 | // ^^^^^^^^ string.quoted.double.interpolated.scala 8 | // ^^ punctuation.definition.template-expression.begin.scala 9 | // ^ punctuation.section.block.begin.scala 10 | // ^ punctuation.section.block.end.scala 11 | // ^^^^^^^^^^^^^^^^^^^^^^ meta.embedded.line.scala 12 | // ^ punctuation.definition.template-expression.end.scala 13 | // ^ string.quoted.double.interpolated.scala 14 | // ^ punctuation.definition.string.end.scala 15 | 16 | s"""1 + 2 = ${ 17 | // ^ keyword.interpolation.scala 18 | // ^^^ punctuation.definition.string.begin.scala 19 | // ^^^^^^^^ string.quoted.triple.interpolated.scala 20 | // ^^ meta.template.expression.scala punctuation.definition.template-expression.begin.scala 21 | def add(x: Int, y: Int) = { 22 | // ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.template.expression.scala meta.embedded.line.scala 23 | // ^ punctuation.section.block.begin.scala 24 | x + y 25 | // ^^^^^ meta.template.expression.scala meta.embedded.line.scala 26 | } 27 | // ^ meta.template.expression.scala meta.embedded.line.scala punctuation.section.block.end.scala 28 | add(1, 2) 29 | // ^^^^^^^^^ meta.template.expression.scala meta.embedded.line.scala 30 | }.""" 31 | // ^ meta.template.expression.scala punctuation.definition.template-expression.end.scala 32 | // ^ string.quoted.triple.interpolated.scala 33 | // ^^^ punctuation.definition.string.end.scala 34 | -------------------------------------------------------------------------------- /tests/unit/#72.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | s"$first$second" 4 | // ^ keyword.interpolation.scala 5 | // ^^^^^^^^^^^^^ meta.template.expression.scala 6 | // ^ punctuation.definition.string.begin.scala 7 | // ^ punctuation.definition.template-expression.begin.scala 8 | // ^ punctuation.definition.template-expression.begin.scala 9 | // ^ punctuation.definition.string.end.scala 10 | 11 | s"$safeTagMarker${mtch.matched}$safeTagMarker" 12 | // ^ keyword.interpolation.scala 13 | // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.template.expression.scala 14 | // ^ punctuation.definition.string.begin.scala 15 | // ^ punctuation.definition.template-expression.begin.scala 16 | // ^^ punctuation.definition.template-expression.begin.scala 17 | // ^^^^^^^^^^^^ meta.embedded.line.scala 18 | // ^ punctuation.definition.template-expression.end.scala 19 | // ^ punctuation.definition.template-expression.begin.scala 20 | // ^ punctuation.definition.string.end.scala 21 | 22 | s"${x$}" 23 | // ^ keyword.interpolation.scala 24 | // ^^^^^ meta.template.expression.scala 25 | // ^ punctuation.definition.string.begin.scala 26 | // ^^ punctuation.definition.template-expression.begin.scala 27 | // ^^ meta.embedded.line.scala 28 | // ^ punctuation.definition.template-expression.end.scala 29 | // ^ punctuation.definition.string.end.scala 30 | 31 | val a = 4; foo(a) 32 | // ^^^ keyword.declaration.stable.scala 33 | // ^ variable.stable.declaration.scala 34 | // ^ keyword.operator.comparison.scala 35 | // ^ constant.numeric.scala 36 | s"$safeTagMarker${val a = 4; foo(a)}$safeTagMarker" 37 | // ^^^^^^^^^^^^^^^^^^^^ meta.template.expression.scala 38 | // ^^^^^^^^^^^^^^^^^ meta.embedded.line.scala 39 | // ^^^^^^^^^^^^^^^^^ - punctuation.definition.template-expression 40 | // ^^^ keyword.declaration.stable.scala 41 | // ^ variable.stable.declaration.scala 42 | // ^ keyword.operator.comparison.scala 43 | // ^ constant.numeric.scala 44 | -------------------------------------------------------------------------------- /tests/unit/#77.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | 4 | class A extends B with NoStackTrace) 5 | // ^^^^ keyword.declaration.scala 6 | // ^^^^^^^^^^^^ entity.name.class 7 | // ^ meta.bracket.scala 8 | class A extends B with NoStackTrace} 9 | // ^^^^ keyword.declaration.scala 10 | // ^^^^^^^^^^^^ entity.name.class 11 | // ^ punctuation.section.block.end.scala 12 | class A extends B with NoStackTrace] 13 | // ^^^^ keyword.declaration.scala 14 | // ^^^^^^^^^^^^ entity.name.class 15 | // ^ meta.bracket.scala 16 | -------------------------------------------------------------------------------- /tests/unit/#83.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | trait A extends B 4 | // ^^^^^^^ keyword.declaration.scala 5 | 6 | trait A extends (B => B){} 7 | // ^^^^^^^ keyword.declaration.scala 8 | -------------------------------------------------------------------------------- /tests/unit/#84.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | 4 | Type[A with "user provided string" with B] 5 | // ^ entity.name.class 6 | // ^^^^ keyword.declaration.scala 7 | // ^ string.quoted.double.scala punctuation.definition.string.begin.scala 8 | // ^^^^^^^^^^^^^^^^^^^^ string.quoted.double.scala 9 | // ^ string.quoted.double.scala punctuation.definition.string.end.scala 10 | // ^^^^ keyword.declaration.scala 11 | // ^ entity.name.class 12 | -------------------------------------------------------------------------------- /tests/unit/#91.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | open class A 4 | // ^^^^ storage.modifier.other 5 | // ^^^^^ keyword.declaration.scala 6 | // ^ entity.name.class.declaration 7 | -------------------------------------------------------------------------------- /tests/unit/basic.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | 4 | class Stack[A] { 5 | // <----- keyword.declaration.scala 6 | // ^ - keyword.declaration.scala entity.name.class.declaration 7 | // ^^^^^ entity.name.class.declaration 8 | // ^ source.scala meta.bracket.scala 9 | // ^ entity.name.class 10 | // ^ meta.bracket.scala 11 | // ^ punctuation.section.block.begin.scala 12 | private var elements: List[A] = Nil 13 | //^^^^^^^ storage.modifier.access 14 | // ^^^ keyword.declaration.volatile.scala 15 | // ^^^^^^^^ variable.volatile.declaration.scala 16 | // ^ keyword.operator.scala 17 | // ^^^^ entity.name.class 18 | // ^ meta.bracket.scala 19 | // ^ entity.name.class 20 | // ^ meta.bracket.scala 21 | // ^ keyword.operator.comparison.scala 22 | // ^^^ entity.name.class 23 | def push(x: A) { elements = x :: elements } 24 | // ^^^ keyword.declaration.scala 25 | // ^^^^ entity.name.function.declaration 26 | // ^ meta.bracket.scala 27 | // ^ variable.parameter.scala 28 | // ^ meta.colon.scala 29 | // ^ entity.name.class 30 | // ^ meta.bracket.scala 31 | // ^ punctuation.section.block.begin.scala 32 | // ^^^^^^^^ source.scala 33 | // ^ keyword.operator.comparison.scala 34 | // ^ source.scala 35 | // ^^ keyword.operator.scala 36 | // ^^^^^^^^ source.scala 37 | // ^ punctuation.section.block.end.scala 38 | def peek: A = elements.head 39 | def pop(): A = { 40 | val currentTop = peek 41 | // ^^^ keyword.declaration.stable.scala 42 | // ^^^^^^^^^^ variable.stable.declaration.scala 43 | // ^ keyword.operator.comparison.scala 44 | // ^^^^ source.scala 45 | elements = elements.tail 46 | currentTop 47 | } 48 | //^ punctuation.section.block.end.scala 49 | } 50 | // <- punctuation.section.block.end.scala -------------------------------------------------------------------------------- /tests/unit/definitions-with-nested-comments.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | def // comment 4 | // ^^^ keyword.declaration.scala 5 | // ^^^^^^^^^^ comment.line.double-slash.scala 6 | 7 | def /* comment */ 8 | // ^^^ keyword.declaration.scala 9 | // ^^^^^^^^^^^^^ comment.block.scala 10 | 11 | val // comment 12 | // ^^^ keyword.declaration.stable.scala 13 | // ^^^^^^^^^^ comment.line.double-slash.scala 14 | 15 | val /* comment */ 16 | // ^^^ keyword.declaration.stable.scala 17 | // ^^^^^^^^^^^^^ comment.block.scala 18 | 19 | var // comment 20 | // ^^^ keyword.declaration.volatile.scala 21 | // ^^^^^^^^^^ comment.line.double-slash.scala 22 | 23 | var /* comment */ 24 | // ^^^ keyword.declaration.volatile.scala 25 | // ^^^^^^^^^^^^^ comment.block.scala 26 | 27 | given // comment 28 | // ^^^^^ keyword.declaration.scala 29 | // ^^^^^^^^^^ comment.line.double-slash.scala 30 | 31 | given /* comment */ 32 | // ^^^^^ keyword.declaration.scala 33 | // ^^^^^^^^^^^^^ comment.block.scala 34 | 35 | class // comment 36 | // ^^^^^ keyword.declaration.scala 37 | // ^^^^^^^^^^ comment.line.double-slash.scala 38 | 39 | class /* comment */ 40 | // ^^^^^ keyword.declaration.scala 41 | // ^^^^^^^^^^^^^ comment.block.scala 42 | 43 | trait // comment 44 | // ^^^^^ keyword.declaration.scala 45 | // ^^^^^^^^^^ comment.line.double-slash.scala 46 | 47 | trait /* comment */ 48 | // ^^^^^ keyword.declaration.scala 49 | // ^^^^^^^^^^^^^ comment.block.scala 50 | 51 | object // comment 52 | // ^^^^^^ keyword.declaration.scala 53 | // ^^^^^^^^^^ comment.line.double-slash.scala 54 | 55 | object /* comment */ 56 | // ^^^^^^ keyword.declaration.scala 57 | // ^^^^^^^^^^^^^ comment.block.scala 58 | 59 | enum // comment 60 | // ^^^^ keyword.declaration.scala 61 | // ^^^^^^^^^^ comment.line.double-slash.scala 62 | 63 | enum /* comment */ 64 | // ^^^^ keyword.declaration.scala 65 | // ^^^^^^^^^^^^^ comment.block.scala 66 | 67 | type // comment 68 | // ^^^^ keyword.declaration.scala 69 | // ^^^^^^^^^^ comment.line.double-slash.scala 70 | 71 | type /* comment */ 72 | // ^^^^ keyword.declaration.scala 73 | // ^^^^^^^^^^^^^ comment.block.scala -------------------------------------------------------------------------------- /tests/unit/enum.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | enum Color: 4 | // ^^^^ keyword.declaration.scala 5 | // ^^^^^ entity.name.class.declaration 6 | case Red, Green, Blue, Magenta 7 | // ^^^^ keyword.control.flow.scala 8 | // ^^^^^ entity.name.class 9 | // ^^^^ entity.name.class 10 | // ^^^^^^^ entity.name.class 11 | 12 | enum Vehicle(val numberOfWheels: Int): 13 | // ^^^^ keyword.declaration.scala 14 | // ^^^^^^^ entity.name.class.declaration 15 | // ^^^ keyword.declaration.stable.scala 16 | // ^^^^^^^^^^^^^^ variable.stable.declaration.scala 17 | // ^^^ entity.name.class 18 | case Unicycle extends Vehicle(1) 19 | // ^^^^ source.scala keyword.control.flow.scala 20 | // ^^^^^^^^ entity.name.class 21 | // ^^^^^^^ keyword.declaration.scala 22 | // ^^^^^^^ entity.name.class 23 | // ^ meta.bracket.scala 24 | // ^ constant.numeric.scala 25 | // ^ meta.bracket.scala 26 | 27 | case Bicycle extends Vehicle(2) 28 | // ^^^^ source.scala keyword.control.flow.scala 29 | // ^^^^^^^ entity.name.class 30 | // ^^^^^^^ keyword.declaration.scala 31 | // ^^^^^^^ entity.name.class 32 | // ^ meta.bracket.scala 33 | // ^ constant.numeric.scala 34 | // ^ meta.bracket.scala 35 | -------------------------------------------------------------------------------- /tests/unit/exports.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | export 4 | // ^^^^^^ meta.export.scala keyword.other.export.scala 5 | 6 | 7 | export a.x 8 | // ^^^^^^ meta.export.scala keyword.other.export.scala 9 | // ^ meta.export.scala 10 | // ^ meta.export.scala entity.name.export.scala 11 | // ^ meta.export.scala punctuation.definition.export 12 | // ^ meta.export.scala entity.name.export.scala 13 | 14 | export a._ 15 | // ^^^^^^ meta.export.scala keyword.other.export.scala 16 | // ^ meta.export.scala 17 | // ^ meta.export.scala entity.name.export.scala 18 | // ^ meta.export.scala punctuation.definition.export 19 | // ^ meta.export.scala entity.name.export.scala 20 | 21 | export a.{x, y} 22 | // ^^^^^^ meta.export.scala keyword.other.export.scala 23 | // ^ meta.export.scala 24 | // ^ meta.export.scala entity.name.export.scala 25 | // ^ meta.export.scala punctuation.definition.export 26 | // ^ meta.export.scala meta.export.selector.scala meta.bracket.scala 27 | // ^ meta.export.scala entity.name.export.scala 28 | // ^^ meta.export.scala meta.export.selector.scala 29 | // ^ meta.export.scala meta.export.selector.scala entity.name.export.scala 30 | // ^ meta.export.scala meta.export.selector.scala meta.bracket.scala 31 | 32 | export a.{x => y} 33 | // ^^^^^^ meta.export.scala keyword.other.export.scala 34 | // ^ meta.export.scala 35 | // ^ meta.export.scala entity.name.export.scala 36 | // ^ meta.export.scala punctuation.definition.export 37 | // ^ meta.export.scala meta.export.selector.scala meta.bracket.scala 38 | // ^ meta.export.scala meta.export.selector.scala entity.name.export.renamed-from.scala 39 | // ^ meta.export.scala meta.export.selector.scala 40 | // ^^ meta.export.scala meta.export.selector.scala 41 | // ^ meta.export.scala meta.export.selector.scala 42 | // ^ meta.export.scala meta.export.selector.scala entity.name.export.renamed-to.scala 43 | // ^ meta.export.scala meta.export.selector.scala meta.bracket.scala 44 | 45 | export given 46 | // ^^^^^^ meta.export.scala keyword.other.export.scala 47 | // ^^^^^ keyword.other.export.given.scala 48 | 49 | export a.given 50 | // ^^^^^^ meta.export.scala keyword.other.export.scala 51 | // ^ meta.export.scala 52 | // ^ meta.export.scala entity.name.export.scala 53 | // ^ meta.export.scala punctuation.definition.export 54 | // ^^^^^ meta.export.scala keyword.other.export.given.scala 55 | 56 | export a.{x, y, given} 57 | // ^^^^^^ meta.export.scala keyword.other.export.scala 58 | // ^ meta.export.scala 59 | // ^ meta.export.scala entity.name.export.scala 60 | // ^ meta.export.scala punctuation.definition.export 61 | // ^ meta.export.scala meta.export.selector.scala meta.bracket.scala 62 | // ^ meta.export.scala entity.name.export.scala 63 | // ^^ meta.export.scala meta.export.selector.scala 64 | // ^ meta.export.scala meta.export.selector.scala entity.name.export.scala 65 | // ^^ source.scala meta.export.scala meta.export.selector.scala 66 | // ^^^^^ keyword.other.export.given.scala 67 | // ^ meta.export.scala meta.export.selector.scala meta.bracket.scala 68 | 69 | export a.{x => y, given} 70 | // ^^^^^^ meta.export.scala keyword.other.export.scala 71 | // ^ meta.export.scala 72 | // ^ meta.export.scala entity.name.export.scala 73 | // ^ meta.export.scala punctuation.definition.export 74 | // ^ meta.export.scala meta.export.selector.scala meta.bracket.scala 75 | // ^ meta.export.scala meta.export.selector.scala entity.name.export.renamed-from.scala 76 | // ^ meta.export.scala meta.export.selector.scala 77 | // ^^ meta.export.scala meta.export.selector.scala 78 | // ^ meta.export.scala meta.export.selector.scala 79 | // ^ meta.export.scala meta.export.selector.scala entity.name.export.renamed-to.scala 80 | // ^ meta.export.scala meta.export.selector.scala 81 | // ^^^^^ keyword.other.export.given.scala 82 | // ^ meta.export.scala meta.export.selector.scala meta.bracket.scala 83 | 84 | export A.{a, given Ordering[?]} 85 | // ^^^^^^ meta.export.scala keyword.other.export.scala 86 | // ^ meta.export.scala 87 | // ^ meta.export.scala entity.name.class.export.scala 88 | // ^ meta.export.scala punctuation.definition.export 89 | // ^ meta.export.scala meta.export.selector.scala meta.bracket.scala 90 | // ^ meta.export.scala entity.name.export.scala 91 | // ^^ meta.export.scala meta.export.selector.scala 92 | // ^^^^^ meta.export.scala keyword.other.export.given.scala 93 | // ^ meta.export.scala meta.export.selector.scala 94 | // ^^^^^^^^ meta.export.scala entity.name.class.export.scala 95 | // ^^^^ meta.export.scala meta.export.selector.scala 96 | -------------------------------------------------------------------------------- /tests/unit/extension-on.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | // Old syntax is not supported anymore. We make sure that it is not accidentally highlighted. 4 | 5 | extension on (x: Rational): 6 | // ^^^^^^^^^ - keyword.declaration.scala 7 | // ^^ - keyword.declaration.scala 8 | // ^ variable.parameter.scala 9 | // ^^^^^^^^ entity.name.class 10 | def > (y: Rational): Boolean = y < x 11 | 12 | extension Ops on (x: Rational): 13 | // ^^^^^^^^^ - keyword.declaration.scala 14 | // ^^^ entity.name.class 15 | // ^^ - keyword.declaration.scala 16 | // ^ variable.parameter.scala 17 | // ^^^^^^^^ entity.name.class 18 | def > (y: Rational): Boolean = y < x 19 | 20 | extension stringOps { } 21 | // ^^^^^^^^^ - keyword.declaration.scala 22 | // ^^^^^^^^^ - entity.name.class 23 | 24 | extension { } 25 | // ^^^^^^^^^ - keyword.declaration.scala 26 | -------------------------------------------------------------------------------- /tests/unit/extension.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | extension (x: T) def combine (y: T): T 4 | // ^^^^^^^^^ keyword.declaration.scala 5 | // ^ variable.parameter.scala 6 | // ^ meta.colon.scala 7 | // ^ entity.name.class 8 | // ^^^ keyword.declaration.scala 9 | // ^^^^^^^ entity.name.function.declaration 10 | 11 | 12 | extension [T](x: T) def combine (y: T): T 13 | // ^^^^^^^^^ keyword.declaration.scala 14 | // ^ entity.name.class 15 | // ^ variable.parameter.scala 16 | // ^ meta.colon.scala 17 | // ^ entity.name.class 18 | // ^^^ keyword.declaration.scala 19 | // ^^^^^^^ entity.name.function.declaration 20 | -------------------------------------------------------------------------------- /tests/unit/fast-definitions.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | 4 | val 5 | // ^^^ keyword.declaration.stable.scala 6 | 7 | var 8 | // ^^^ keyword.declaration.volatile.scala 9 | 10 | def 11 | // ^^^ keyword.declaration.scala 12 | 13 | type 14 | // ^^^^ keyword.declaration.scala 15 | 16 | class 17 | // ^^^^^ keyword.declaration.scala 18 | 19 | trait 20 | // ^^^^^ keyword.declaration.scala 21 | 22 | object 23 | // ^^^^^^ keyword.declaration.scala 24 | 25 | given 26 | // ^^^^^ keyword.declaration.scala 27 | 28 | enum 29 | // ^^^^ keyword.declaration.scala 30 | 31 | case class 32 | // ^^^^ keyword.declaration.scala 33 | // ^^^^^ keyword.declaration.scala 34 | 35 | case object 36 | // ^^^^ keyword.declaration.scala 37 | // ^^^^^^ keyword.declaration.scala 38 | 39 | inline def 40 | // ^^^^^^ storage.modifier.other 41 | // ^^^ keyword.declaration.scala 42 | 43 | package object 44 | // ^^^^^^^ keyword.other.package.scala 45 | // ^^^^^^ keyword.declaration.scala 46 | -------------------------------------------------------------------------------- /tests/unit/given.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | 4 | given intOrd: Ordering[Int] with 5 | // ^^^^^ keyword.declaration.scala 6 | // ^^^^^^ entity.name.given.declaration 7 | // ^^^^^^^^ entity.name.class 8 | // ^^^^ keyword.declaration.scala 9 | 10 | given foo: Foo with 11 | // ^^^^^ keyword.declaration.scala 12 | // ^^^ entity.name.given.declaration 13 | // ^^^ entity.name.class 14 | // ^^^^ keyword.declaration.scala 15 | 16 | given listOrd[T: Ordering]: Ordering[List[T]] with 17 | // ^^^^^ keyword.declaration.scala 18 | // ^^^^^^^ entity.name.given.declaration 19 | // ^ entity.name.class 20 | // ^^^^^^^^ entity.name.class 21 | // ^^^^^^^^ entity.name.class 22 | // ^^^^ keyword.declaration.scala 23 | 24 | given listOrd(using ev: Ev): Foo with 25 | // ^^^^^ keyword.declaration.scala 26 | // ^^^^^^^ entity.name.given.declaration 27 | // ^^^^^ keyword.declaration.scala 28 | // ^^ variable.parameter.scala 29 | // ^^ entity.name.class 30 | // ^^^ entity.name.class 31 | // ^^^^ keyword.declaration.scala 32 | 33 | given Ordering[Int] with 34 | // ^^^^^ keyword.declaration.scala 35 | // ^^^^^^^^ entity.name.class 36 | // ^^^^ keyword.declaration.scala 37 | 38 | given Foo with 39 | // ^^^^^ keyword.declaration.scala 40 | // ^^^ entity.name.class 41 | // ^^^^ keyword.declaration.scala 42 | 43 | given [T: Ordering]: Ordering[List[T]] with 44 | // ^^^^^ keyword.declaration.scala 45 | // ^ entity.name.class 46 | // ^^^^^^^^ entity.name.class 47 | // ^^^^^^^^ entity.name.class 48 | // ^^^^ keyword.declaration.scala 49 | 50 | given (using ev: Ev): Foo with 51 | // ^^^^^ keyword.declaration.scala 52 | // ^^^^^ keyword.declaration.scala 53 | // ^^ variable.parameter.scala 54 | // ^^ entity.name.class 55 | // ^^^ entity.name.class 56 | // ^^^^ keyword.declaration.scala 57 | 58 | given intOrd: Ordering[Int] with 59 | // ^^^^^ keyword.declaration.scala 60 | // ^^^^^^ entity.name.given.declaration 61 | // ^^^^^^^^ entity.name.class 62 | // ^^^^ keyword.declaration.scala 63 | 64 | given foo: Foo = ... 65 | // ^^^^^ keyword.declaration.scala 66 | // ^^^ entity.name.given.declaration 67 | // ^^^ entity.name.class 68 | 69 | given `foo`: Foo = ... 70 | // ^^^^^ keyword.declaration.scala 71 | // ^^^^^ entity.name.given.declaration 72 | // ^^^ entity.name.class 73 | 74 | 75 | given listOrd[T: Ordering]: Ordering[List[T]] = ... 76 | // ^^^^^ keyword.declaration.scala 77 | // ^^^^^^^ entity.name.given.declaration 78 | // ^ entity.name.class 79 | // ^^^^^^^^ entity.name.class 80 | // ^^^^^^^^ entity.name.class 81 | 82 | given listOrd(using ev: Ev): Foo = ... 83 | // ^^^^^ keyword.declaration.scala 84 | // ^^^^^^^ entity.name.given.declaration 85 | // ^^^^^ keyword.declaration.scala 86 | // ^^ variable.parameter.scala 87 | // ^^ entity.name.class 88 | // ^^^ entity.name.class 89 | 90 | given Ordering[Int] = ... 91 | // ^^^^^ keyword.declaration.scala 92 | // ^^^^^^^^ entity.name.class 93 | 94 | given Foo = ... 95 | // ^^^^^ keyword.declaration.scala 96 | // ^^^ entity.name.class 97 | 98 | given [T: Ordering]: Ordering[List[T]] = ... 99 | // ^^^^^ keyword.declaration.scala 100 | // ^ entity.name.class 101 | // ^^^^^^^^ entity.name.class 102 | // ^^^^^^^^ entity.name.class 103 | 104 | given (using ev: Ev): Foo = ... 105 | // ^^^^^ keyword.declaration.scala 106 | // ^^^^^ keyword.declaration.scala 107 | // ^^ variable.parameter.scala 108 | // ^^ entity.name.class 109 | // ^^^ entity.name.class 110 | 111 | givenx 112 | // ^^^^^ - keyword.declaration.scala 113 | -------------------------------------------------------------------------------- /tests/unit/imports.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | import 4 | // ^^^^^^ meta.import.scala keyword.other.import.scala 5 | 6 | 7 | import a.x 8 | // ^^^^^^ meta.import.scala keyword.other.import.scala 9 | // ^ meta.import.scala 10 | // ^ meta.import.scala entity.name.import.scala 11 | // ^ meta.import.scala punctuation.definition.import 12 | // ^ meta.import.scala entity.name.import.scala 13 | 14 | import a._ 15 | // ^^^^^^ meta.import.scala keyword.other.import.scala 16 | // ^ meta.import.scala 17 | // ^ meta.import.scala entity.name.import.scala 18 | // ^ meta.import.scala punctuation.definition.import 19 | // ^ meta.import.scala entity.name.import.scala 20 | 21 | import a.{x, y} 22 | // ^^^^^^ meta.import.scala keyword.other.import.scala 23 | // ^ meta.import.scala 24 | // ^ meta.import.scala entity.name.import.scala 25 | // ^ meta.import.scala punctuation.definition.import 26 | // ^ meta.import.scala meta.import.selector.scala meta.bracket.scala 27 | // ^ meta.import.scala entity.name.import.scala 28 | // ^^ meta.import.scala meta.import.selector.scala 29 | // ^ meta.import.scala meta.import.selector.scala entity.name.import.scala 30 | // ^ meta.import.scala meta.import.selector.scala meta.bracket.scala 31 | 32 | import a.{x => y} 33 | // ^^^^^^ meta.import.scala keyword.other.import.scala 34 | // ^ meta.import.scala 35 | // ^ meta.import.scala entity.name.import.scala 36 | // ^ meta.import.scala punctuation.definition.import 37 | // ^ meta.import.scala meta.import.selector.scala meta.bracket.scala 38 | // ^ meta.import.scala meta.import.selector.scala entity.name.import.renamed-from.scala 39 | // ^ meta.import.scala meta.import.selector.scala 40 | // ^^ meta.import.scala meta.import.selector.scala 41 | // ^ meta.import.scala meta.import.selector.scala 42 | // ^ meta.import.scala meta.import.selector.scala entity.name.import.renamed-to.scala 43 | // ^ meta.import.scala meta.import.selector.scala meta.bracket.scala 44 | 45 | import a.`given` 46 | // ^^^^^^ meta.import.scala keyword.other.import.scala 47 | // ^ meta.import.scala 48 | // ^ meta.import.scala entity.name.import.scala 49 | // ^ meta.import.scala punctuation.definition.import 50 | // ^^^^^^^ - keyword.other.import.given.scala 51 | 52 | import a.given 53 | // ^^^^^^ meta.import.scala keyword.other.import.scala 54 | // ^ meta.import.scala 55 | // ^ meta.import.scala entity.name.import.scala 56 | // ^ meta.import.scala punctuation.definition.import 57 | // ^^^^^ meta.import.scala keyword.other.import.given.scala 58 | 59 | import A.{given} 60 | // ^^^^^^ meta.import.scala keyword.other.import.scala 61 | // ^ meta.import.scala 62 | // ^ meta.import.scala entity.name.class.import.scala 63 | // ^ meta.import.scala punctuation.definition.import 64 | // ^ meta.import.scala meta.import.selector.scala meta.bracket.scala 65 | // ^^^^^ meta.import.scala keyword.other.import.given.scala 66 | // ^ meta.import.scala meta.import.selector.scala 67 | 68 | 69 | import A.{`given`, _} 70 | // ^^^^^^ meta.import.scala keyword.other.import.scala 71 | // ^ meta.import.scala 72 | // ^ meta.import.scala entity.name.class.import.scala 73 | // ^ meta.import.scala punctuation.definition.import 74 | // ^ meta.import.scala meta.import.selector.scala meta.bracket.scala 75 | // ^^^^^^^ - keyword.other.import.given.scala 76 | // ^^ meta.import.scala meta.import.selector.scala 77 | // ^ meta.import.scala entity.name.import.scala 78 | // ^ meta.import.scala meta.import.selector.scala 79 | 80 | import A.{given, _} 81 | // ^^^^^^ meta.import.scala keyword.other.import.scala 82 | // ^ meta.import.scala 83 | // ^ meta.import.scala entity.name.class.import.scala 84 | // ^ meta.import.scala punctuation.definition.import 85 | // ^ meta.import.scala meta.import.selector.scala meta.bracket.scala 86 | // ^^^^^ meta.import.scala keyword.other.import.given.scala 87 | // ^^ meta.import.scala meta.import.selector.scala 88 | // ^ meta.import.scala entity.name.import.scala 89 | // ^ meta.import.scala meta.import.selector.scala 90 | 91 | 92 | import A.{given TC} 93 | // ^^^^^^ meta.import.scala keyword.other.import.scala 94 | // ^ meta.import.scala 95 | // ^ meta.import.scala entity.name.class.import.scala 96 | // ^ meta.import.scala punctuation.definition.import 97 | // ^ meta.import.scala meta.import.selector.scala meta.bracket.scala 98 | // ^^^^^ meta.import.scala keyword.other.import.given.scala 99 | // ^ meta.import.scala meta.import.selector.scala 100 | // ^^ meta.import.scala entity.name.class.import.scala 101 | // ^ meta.import.scala meta.import.selector.scala 102 | 103 | import A.{a, given Ordering[?]} 104 | // ^^^^^^ meta.import.scala keyword.other.import.scala 105 | // ^ meta.import.scala 106 | // ^ meta.import.scala entity.name.class.import.scala 107 | // ^ meta.import.scala punctuation.definition.import 108 | // ^ meta.import.scala meta.import.selector.scala meta.bracket.scala 109 | // ^ meta.import.scala entity.name.import.scala 110 | // ^^ meta.import.scala meta.import.selector.scala 111 | // ^^^^^ meta.import.scala keyword.other.import.given.scala 112 | // ^ meta.import.scala meta.import.selector.scala 113 | // ^^^^^^^^ meta.import.scala entity.name.class.import.scala 114 | // ^^^^ meta.import.scala meta.import.selector.scala 115 | 116 | import A.{given Ordering[?], given ExecutionContext} 117 | // ^^^^^^ meta.import.scala keyword.other.import.scala 118 | // ^ meta.import.scala 119 | // ^ meta.import.scala entity.name.class.import.scala 120 | // ^ meta.import.scala punctuation.definition.import 121 | // ^ meta.import.scala meta.import.selector.scala meta.bracket.scala 122 | // ^^^^^ meta.import.scala keyword.other.import.given.scala 123 | // ^ meta.import.scala meta.import.selector.scala 124 | // ^^^^^^^^ meta.import.scala entity.name.class.import.scala 125 | // ^^^^^ meta.import.scala meta.import.selector.scala 126 | // ^^^^^ meta.import.scala keyword.other.import.given.scala 127 | // ^ meta.import.scala meta.import.selector.scala 128 | // ^^^^^^^^^^^^^^^^ meta.import.scala entity.name.class.import.scala 129 | // ^ meta.import.scala meta.import.selector.scala 130 | 131 | import A.givenSomething 132 | // ^^^^^^ meta.import.scala keyword.other.import.scala 133 | // ^ meta.import.scala 134 | // ^ meta.import.scala entity.name.class.import.scala 135 | // ^ meta.import.scala punctuation.definition.import 136 | // ^^^^^^^^^^^^^^ meta.import.scala entity.name.import.scala 137 | 138 | import givenPackage.x 139 | // ^^^^^^ meta.import.scala keyword.other.import.scala 140 | // ^ meta.import.scala 141 | // ^^^^^^^^^^^^ meta.import.scala entity.name.import.scala 142 | // ^ meta.import.scala punctuation.definition.import 143 | // ^ meta.import.scala entity.name.import.scala -------------------------------------------------------------------------------- /tests/unit/lexical.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | object ExampleIdentifiers { 4 | val x = 3 5 | // ^ variable.stable.declaration.scala 6 | val Object = 3 7 | val maxIndex = 3 8 | // ^^^^^^^^ variable.stable.declaration.scala 9 | val p2p = 3 10 | // ^^^ variable.stable.declaration.scala 11 | val empty_? = 3 12 | // ^^^^^^^ variable.stable.declaration.scala 13 | val + = 3 14 | // ^ variable.stable.declaration.scala 15 | val `yield` = 3 16 | // ^^^^^^^ variable.stable.declaration.scala 17 | val αρετη = 3 18 | val _y = 3 19 | // ^^ variable.stable.declaration.scala 20 | val dot_product_* = 3 21 | // ^^^^^^^^^^^^^ variable.stable.declaration.scala 22 | val __system = 3 23 | // ^^^^^^^^ variable.stable.declaration.scala 24 | 25 | val _MAX_LEN_ = 3 26 | // ^^^^^^^^^ variable.stable.declaration.scala 27 | } 28 | 29 | object IntegerLiterals { 30 | (0, 21, 0xFFFFFFFF, -42L) 31 | // ^ constant.numeric.scala 32 | // ^^ constant.numeric.scala 33 | // ^^^^^^^^^^ constant.numeric.scala 34 | // ^ keyword.operator.arithmetic.scala 35 | // ^^^ constant.numeric.scala 36 | } 37 | 38 | object FloatingPointLiterals { 39 | ( 0.0, 1e30f, 3.14159f, 1.0e-100, .1 ) 40 | // ^^^ constant.numeric.scala 41 | // ^^^^^^^^ constant.numeric.scala 42 | // ^^^^^^^^ constant.numeric.scala 43 | // ^^ constant.numeric.scala 44 | } 45 | 46 | object Boolean { 47 | (true, false) 48 | // ^^^^ constant.language.scala 49 | // ^^^^^ constant.language.scala 50 | } 51 | 52 | object CharacterLiterals { 53 | ('a', '\u0041', '\n', '\t') 54 | // ^ punctuation.definition.character.begin.scala 55 | // ^^^ constant.character.literal.scala 56 | // ^ punctuation.definition.character.end.scala 57 | // ^^^^^^^^ constant.character.literal.scala 58 | // ^^^^^^ constant.character.escape.scala 59 | // ^^ constant.character.escape.scala 60 | // ^^ constant.character.escape.scala 61 | } 62 | 63 | object StringLiterals { 64 | ("Hello,\nWorld!", "This string contains a \" character.") 65 | // ^ punctuation.definition.string.begin.scala 66 | // ^^^^^^^^^^^^^^^^ string.quoted.double.scala 67 | // ^^ constant.character.escape.scala 68 | // ^ punctuation.definition.string.end.scala 69 | // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double.scala 70 | """the present string 71 | // ^^^ punctuation.definition.string.begin.scala 72 | // ^^^^^^^^^^^^^^^^^^^^^ string.quoted.triple.scala 73 | spans three 74 | // ^^^^^^^^^^^ string.quoted.triple.scala 75 | lines.""" 76 | // ^^^^^^^^^ string.quoted.triple.scala 77 | // ^^^ punctuation.definition.string.end.scala 78 | 79 | """the present string 80 | |spans three 81 | |lines.""".stripMargin 82 | 83 | 84 | val escapeSequences = "\b\t\n\f\r\"\'\\" 85 | // ^^^^^^^^^^^^^^^^^^ string.quoted.double.scala 86 | // ^^^^^^^^^^^^^^^^ constant.character.escape.scala 87 | 88 | s"$x plain ${val x = y}" 89 | //^ keyword.interpolation.scala 90 | // ^ punctuation.definition.string.begin.scala 91 | // ^ punctuation.definition.template-expression.begin.scala 92 | // ^ - string.quoted.double.interpolated.scala string.quoted.double.scala 93 | // ^^^^^^^ string.quoted.double.interpolated.scala 94 | // ^^^^^^^^^^^^ meta.template.expression.scala 95 | // ^^ punctuation.definition.template-expression.begin.scala 96 | // ^^^^^^^^^ meta.embedded.line.scala 97 | // ^^^ keyword.declaration.stable.scala 98 | // ^^^^^^^^^ - string.quoted.double.interpolated.scala string.quoted.double.scala 99 | // ^ punctuation.definition.template-expression.end.scala 100 | // ^ string.quoted.double.interpolated.scala punctuation.definition.string.end.scala 101 | 102 | custom"$x plain ${val x = y}" 103 | //^^^^^^ keyword.interpolation.scala 104 | // ^ punctuation.definition.string.begin.scala 105 | // ^ punctuation.definition.template-expression.begin.scala 106 | // ^ - string.quoted.double.interpolated.scala string.quoted.double.scala 107 | // ^^^^^^^ string.quoted.double.interpolated.scala 108 | // ^^^^^^^^^^^^ meta.template.expression.scala 109 | // ^^ punctuation.definition.template-expression.begin.scala 110 | // ^^^^^^^^^ meta.embedded.line.scala 111 | // ^^^ keyword.declaration.stable.scala 112 | // ^^^^^^^^^ - string.quoted.double.interpolated.scala string.quoted.double.scala 113 | // ^ punctuation.definition.template-expression.end.scala 114 | // ^ string.quoted.double.interpolated.scala punctuation.definition.string.end.scala 115 | 116 | object Symbols { 117 | ('x, 'X, 'αρετη, '=, '+ ) 118 | // ^^ constant.other.symbol.scala 119 | // ^^ constant.other.symbol.scala 120 | // ^^^^^^ constant.other.symbol.scala 121 | } 122 | 123 | // single line comment 124 | // ^^ punctuation.definition.comment.scala 125 | // ^^^^^^^^^^^^^^^^^^^^^^ comment.line.double-slash.scala 126 | 127 | /* 128 | // ^^ punctuation.definition.comment.scala 129 | multiline comment*/ 130 | // ^^^^^^^^^^^^^^^^^^^ comment.block.scala 131 | /** 132 | * Scaladoc comment 133 | * @scaladoc @param 134 | */ 135 | 136 | /* nested /* multi-line */ comment */ 137 | 138 | 139 | object Xml { 140 | val b = 141 | // ^ punctuation.definition.tag.xml 142 | // ^^^^ entity.name.tag.localname.xml 143 | // ^ punctuation.definition.tag.xml 144 | // ^^^^^^ meta.tag.xml 145 | The Scala Language Specification 146 | // ^^^ entity.name.class 147 | // ^^^^^ entity.name.class 148 | // ^^^^^^^^ entity.name.class 149 | // ^^^^^^^^^^^^^ entity.name.class 150 | {scalaBook.version} 151 | {scalaBook.authors.mkList("", ", ", "")} 152 | 153 | } 154 | 155 | class Parens { 156 | capture("layout(" ~ oneOrMore(CharPredicate.All -- ")" -- ')') ~ ")") 157 | // ^ string.quoted.other constant.character.literal.scala 158 | capture("layout(" ~ oneOrMore(CharPredicate.All -- ")" -- `)`) ~ ")") 159 | } 160 | -------------------------------------------------------------------------------- /tests/unit/multiple.bounds.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | def showMax[X : {Ordering, Show}](x: X, y: X): String 4 | // ^^^ source.scala keyword.declaration.scala 5 | // ^^^^^^^ source.scala entity.name.function.declaration 6 | // ^ source.scala meta.bracket.scala 7 | // ^ source.scala entity.name.class 8 | // ^ source.scala keyword.operator.scala 9 | // ^ source.scala 10 | // ^ source.scala punctuation.section.block.begin.scala 11 | // ^^^^^^^^ source.scala entity.name.class 12 | // ^^^^ source.scala entity.name.class 13 | // ^ source.scala punctuation.section.block.end.scala 14 | // ^ source.scala meta.bracket.scala 15 | // ^ source.scala meta.bracket.scala 16 | // ^ source.scala variable.parameter.scala 17 | // ^ source.scala meta.colon.scala 18 | // ^ source.scala entity.name.class 19 | // ^ source.scala variable.parameter.scala 20 | // ^ source.scala meta.colon.scala 21 | // ^ source.scala entity.name.class 22 | // ^ source.scala meta.bracket.scala 23 | // ^ source.scala keyword.operator.scala 24 | // ^^^^^^ source.scala entity.name.class 25 | 26 | > def showMax[X : {Ordering as ordering, Show as show}](x: X, y: X): String 27 | // ^^^ source.scala keyword.declaration.scala 28 | // ^^^^^^^ source.scala entity.name.function.declaration 29 | // ^ source.scala meta.bracket.scala 30 | // ^ source.scala entity.name.class 31 | // ^ source.scala 32 | // ^ source.scala keyword.operator.scala 33 | // ^ source.scala punctuation.section.block.begin.scala 34 | // ^^^^^^^^ source.scala entity.name.class 35 | // ^^ source.scala keyword.other.import.as.scala 36 | // ^^^^^^^^ source.scala variable.stable.declaration.scala 37 | // ^^^^ source.scala entity.name.class 38 | // ^^ source.scala keyword.other.import.as.scala 39 | // ^^^^ source.scala variable.stable.declaration.scala 40 | // ^ source.scala punctuation.section.block.end.scala 41 | // ^ source.scala meta.bracket.scala 42 | // ^ source.scala meta.bracket.scala 43 | // ^ source.scala variable.parameter.scala 44 | // ^ source.scala meta.colon.scala 45 | // ^ source.scala entity.name.class 46 | // ^ source.scala variable.parameter.scala 47 | // ^ source.scala meta.colon.scala 48 | // ^ source.scala entity.name.class 49 | // ^ source.scala meta.bracket.scala 50 | // ^ source.scala keyword.operator.scala 51 | // ^^^^^^ source.scala entity.name.class 52 | -------------------------------------------------------------------------------- /tests/unit/named.bounds.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | def fromInt[T: Numeric as num](t: Int): T = num.fromInt(t) 4 | // ^^^ keyword.declaration.scala 5 | // ^^^^^^^ source.scala entity.name.function.declaration 6 | // ^ source.scala meta.bracket.scala 7 | // ^ source.scala entity.name.class 8 | // ^ source.scala keyword.operator.scala 9 | // ^ source.scala 10 | // ^^^^^^^ source.scala entity.name.class 11 | // ^^ keyword.other.import.as.scala 12 | // ^^^ variable.stable.declaration.scala 13 | // ^ source.scala meta.bracket.scala 14 | // ^ source.scala meta.bracket.scala 15 | // ^ source.scala variable.parameter.scala 16 | // ^ source.scala meta.colon.scala 17 | // ^ source.scala 18 | // ^^^ source.scala entity.name.class 19 | // ^ source.scala meta.bracket.scala 20 | // ^ source.scala keyword.operator.scala 21 | // ^ source.scala 22 | // ^ source.scala entity.name.class 23 | // ^ source.scala 24 | // ^ source.scala keyword.operator.comparison.scala 25 | // ^^^^^^^^^^^^ source.scala 26 | // ^ source.scala meta.bracket.scala 27 | // ^ source.scala 28 | // ^ source.scala meta.bracket.scala 29 | -------------------------------------------------------------------------------- /tests/unit/nested.comments.test.scala: -------------------------------------------------------------------------------- 1 | # SYNTAX TEST "source.scala" 2 | 3 | // check that `//` comments don't consume block comments. See #39 4 | 5 | 6 | /*** // **/ 7 | # ^^^^^^ - comment.line.double-slash.scala 8 | var a 9 | #^^^ keyword.declaration.volatile.scala 10 | /* // */ 11 | # - ^^^^^ comment.line.double-slash.scala 12 | var b 13 | #^^^ keyword.declaration.volatile.scala 14 | /** 15 | * // */ 16 | # ^^^^^ - comment.line.double-slash.scala 17 | object C {} 18 | #^^^^^^ keyword.declaration.scala 19 | /* 20 | // */ 21 | ^^^^^ - comment.line.double-slash.scala 22 | object D {} 23 | ^^^^^^ keyword.declaration.scala 24 | /* http://link/with/scheme */ 25 | object E {} 26 | # ^ entity.name.class.declaration -------------------------------------------------------------------------------- /tests/unit/numeric.literals.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | 1 2l 2L 3f 3F 4d 4D 5.6 2.3e56 2.3E56 4 | // ^ constant.numeric.scala 5 | // ^^ constant.numeric.scala 6 | // ^^ constant.numeric.scala 7 | // ^^ constant.numeric.scala 8 | // ^^ constant.numeric.scala 9 | // ^^ constant.numeric.scala 10 | // ^^ constant.numeric.scala 11 | // ^^^ constant.numeric.scala 12 | // ^^^^^^ constant.numeric.scala 13 | // ^^^^^^ constant.numeric.scala 14 | 15 | -1 16 | // ^ keyword.operator.arithmetic.scala 17 | // ^ constant.numeric.scala 18 | 19 | 0x123abc 20 | // ^^^^^^^^^ constant.numeric.scala 21 | 22 | 123_456 23 | // ^^^^^^^ constant.numeric.scala 24 | 25 | 0x123_abc 26 | // ^^^^^^^^^ constant.numeric.scala 27 | 28 | 110_222_795_799.99 29 | // ^^^^^^^^^^^^^^^^^^ constant.numeric.scala 30 | 31 | 110.9499_999 32 | // ^^^^^^^^^^^ constant.numeric.scala 33 | 34 | 2_000.343_999e561_100 35 | // ^^^^^^^^^^^^^^^^^^^^^ constant.numeric.scala 36 | 37 | .123_456 38 | // ^^^^^^^ constant.numeric.scala 39 | -------------------------------------------------------------------------------- /tests/unit/quoted.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | 'x 4 | // ^ keyword.control.flow.staging.scala constant.other.symbol.scala 5 | // ^ constant.other.symbol.scala 6 | '{ 2 } 7 | // ^ keyword.control.flow.staging.scala 8 | // ^ punctuation.section.block.begin.scala 9 | // ^ constant.numeric.scala 10 | // ^ punctuation.section.block.end.scala 11 | 12 | ' { 2 } 13 | // ^ keyword.control.flow.staging.scala 14 | // ^ punctuation.section.block.begin.scala 15 | // ^ constant.numeric.scala 16 | // ^ punctuation.section.block.end.scala 17 | 18 | ' 19 | // ^ punctuation.definition.character.begin.scala 20 | { } 21 | 22 | '[ String ] 23 | // ^ keyword.control.flow.staging.scala 24 | // ^ meta.bracket.scala 25 | // ^^^^^^ entity.name.class 26 | // ^ meta.bracket.scala 27 | 28 | ' [ String ] 29 | // ^ keyword.control.flow.staging.scala 30 | // ^ meta.bracket.scala 31 | // ^^^^^^ entity.name.class 32 | // ^ meta.bracket.scala 33 | 34 | ${ 1 } 35 | // ^ keyword.control.flow.staging.scala 36 | // ^ punctuation.section.block.begin.scala 37 | // ^ constant.numeric.scala 38 | // ^ punctuation.section.block.end.scala 39 | 40 | case '{ x } => 41 | // ^^^^ keyword.control.flow.scala 42 | // ^ keyword.control.flow.staging.scala 43 | // ^ punctuation.section.block.begin.scala 44 | // ^ punctuation.section.block.end.scala 45 | 46 | case '[ T ] => 47 | // ^^^^ keyword.control.flow.scala 48 | // ^ keyword.control.flow.staging.scala 49 | // ^ meta.bracket.scala 50 | // ^ meta.bracket.scala 51 | -------------------------------------------------------------------------------- /tests/unit/symbol.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | object Unicode { 4 | 5 | val blue = '* //red 6 | // ^ source.scala 7 | // ^^ source.scala constant.other.symbol.scala 8 | // ^ source.scala 9 | val stillRed = '* 10 | // ^^ source.scala constant.other.symbol.scala 11 | val invalidSymbol = '**_x //' 12 | // ^^^ source.scala constant.other.symbol.scala 13 | // ^^^ source.scala 14 | val symbolFollowedByOp = 'symbol* 15 | // ^^^^^^^ source.scala constant.other.symbol.scala 16 | // ^ source.scala keyword.operator.arithmetic.scala 17 | val symbolEndedWithOp = 'symbol_* 18 | // ^^^^^^^^^ source.scala constant.other.symbol.scala 19 | val unclosedSymbol = '1 //' 20 | // ^ source.scala constant.character.literal.scala punctuation.definition.character.begin.scala 21 | // ^^^^ source.scala constant.character.literal.scala invalid.illegal.character-literal-too-long 22 | // ^ source.scala constant.character.literal.scala punctuation.definition.character.end.scala 23 | val symbolWithDigit = 'symbol1 //' 24 | // ^^^^^^^^ source.scala constant.other.symbol.scala 25 | val characterLit = 'x' 26 | // ^ source.scala constant.character.literal.scala punctuation.definition.character.begin.scala 27 | // ^ source.scala constant.character.literal.scala 28 | // ^ source.scala constant.character.literal.scala punctuation.definition.character.end.scala 29 | val greekSymbol = 'ξφδ 30 | // ^^^^ source.scala constant.other.symbol.scala 31 | val greekSymbolDigit = 'φδφ0 32 | // ^^^^^ source.scala constant.other.symbol.scala 33 | val greekSymbolWithOp = 'δφξφξ_+- 34 | // ^^^^^^^^^ source.scala constant.other.symbol.scala 35 | val multiOpSymbol = '*** 36 | // ^^^^ constant.other.symbol.scala 37 | } 38 | -------------------------------------------------------------------------------- /tests/unit/unicode.identifiers.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | class Φδφκξ(x : Int, δφξκξ: Int, val y: Int, val φξ: Int) { 4 | // <----- keyword.declaration.scala 5 | // ^^^^^ entity.name.class.declaration 6 | // ^ meta.bracket.scala 7 | // ^ variable.parameter.scala 8 | // ^ meta.colon.scala 9 | // ^^^ entity.name.class 10 | // ^^^^^ variable.parameter.scala 11 | // ^ meta.colon.scala 12 | // ^^^ entity.name.class 13 | // ^^^ keyword.declaration.stable.scala 14 | // ^ variable.stable.declaration.scala 15 | // ^ keyword.operator.scala 16 | // ^^^ entity.name.class 17 | // ^^^ keyword.declaration.stable.scala 18 | // ^^ variable.stable.declaration.scala 19 | // ^ keyword.operator.scala 20 | // ^^^ entity.name.class 21 | // ^ meta.bracket.scala 22 | // ^ punctuation.section.block.begin.scala 23 | def δφξ() = 3 24 | //^^^ keyword.declaration.scala 25 | // ^^^ entity.name.function.declaration 26 | // ^^ meta.parentheses.scala meta.bracket.scala 27 | // ^ keyword.operator.comparison.scala 28 | val δφξ = 4 29 | //^^^ keyword.declaration.stable.scala 30 | // ^^^ variable.stable.declaration.scala 31 | // ^ keyword.operator.comparison.scala 32 | var δφξ = 5 33 | //^^^ keyword.declaration.volatile.scala 34 | // ^^^ variable.volatile.declaration.scala 35 | // ^ keyword.operator.comparison.scala 36 | def δφξ(δφξκξ: Int) = () 37 | //^^^ keyword.declaration.scala 38 | // ^^^ entity.name.function.declaration 39 | // ^ meta.bracket.scala 40 | // ^^^^^ variable.parameter.scala 41 | // ^ meta.colon.scala 42 | // ^^^ entity.name.class 43 | // ^ meta.bracket.scala 44 | // ^ keyword.operator.comparison.scala 45 | // ^^ meta.parentheses.scala meta.bracket.scala 46 | def foo(fj: Int) = () 47 | //^^^ keyword.declaration.scala 48 | // ^^^ entity.name.function.declaration 49 | // ^ meta.bracket.scala 50 | // ^^ variable.parameter.scala 51 | // ^ meta.colon.scala 52 | // ^^^ entity.name.class 53 | // ^ meta.bracket.scala 54 | // ^ keyword.operator.comparison.scala 55 | // ^^ meta.parentheses.scala meta.bracket.scala 56 | 57 | val Constant = 3 58 | //^^^ keyword.declaration.stable.scala 59 | // ^^^^^^^^ variable.stable.declaration.scala 60 | // ^ keyword.operator.comparison.scala 61 | val Константа = 4 62 | //^^^ keyword.declaration.stable.scala 63 | // ^^^^^^^^^ variable.stable.declaration.scala 64 | // ^ keyword.operator.comparison.scala 65 | 66 | } 67 | 68 | 69 | trait * { } 70 | // <----- keyword.declaration.scala 71 | // ^ entity.name.class.declaration 72 | // ^ punctuation.section.block.begin.scala 73 | // ^ punctuation.section.block.end.scala 74 | class * { } 75 | // <----- keyword.declaration.scala 76 | // ^ entity.name.class.declaration 77 | // ^ punctuation.section.block.begin.scala 78 | // ^ punctuation.section.block.end.scala 79 | case class **(x: Int) {} 80 | // <---- keyword.declaration.scala 81 | // ^^^^^ keyword.declaration.scala 82 | // ^^ entity.name.class.declaration 83 | // ^ meta.bracket.scala 84 | // ^ variable.parameter.scala 85 | // ^ meta.colon.scala 86 | // ^^^ entity.name.class 87 | // ^ meta.bracket.scala 88 | 89 | trait f_*[A,x] { 90 | // <----- keyword.declaration.scala 91 | // ^^^ entity.name.class.declaration 92 | // ^ meta.bracket.scala 93 | // ^ entity.name.class 94 | // ^ meta.bracket.scala 95 | // ^ punctuation.section.block.begin.scala 96 | 97 | type * = Int 98 | //^^^^ keyword.declaration.scala 99 | // ^ entity.name.type.declaration 100 | // ^ keyword.operator.comparison.scala 101 | // ^^^ entity.name.class 102 | type x_* = Int 103 | //^^^^ keyword.declaration.scala 104 | // ^^^ entity.name.type.declaration 105 | // ^ keyword.operator.comparison.scala 106 | // ^^^ entity.name.class 107 | } 108 | 109 | 110 | import scala.colection.Seq 111 | // <------ meta.import.scala keyword.other.import.scala 112 | // ^ meta.import.scala 113 | // ^^^^^ meta.import.scala entity.name.import.scala 114 | // ^ meta.import.scala punctuation.definition.import 115 | // ^^^^^^^^^ meta.import.scala entity.name.import.scala 116 | // ^ meta.import.scala punctuation.definition.import 117 | // ^^^ meta.import.scala entity.name.class.import.scala 118 | import users._ // import everything from the users package 119 | // <------ meta.import.scala keyword.other.import.scala 120 | // ^ meta.import.scala 121 | // ^^^^^ meta.import.scala entity.name.import.scala 122 | // ^ meta.import.scala punctuation.definition.import 123 | // ^ meta.import.scala entity.name.import.scala 124 | 125 | 126 | import users.User // import the class User 127 | // <------ meta.import.scala keyword.other.import.scala 128 | // ^ meta.import.scala 129 | // ^^^^^ meta.import.scala entity.name.import.scala 130 | // ^ meta.import.scala punctuation.definition.import 131 | // ^^^^ meta.import.scala entity.name.class.import.scala 132 | // ^^ comment.line.double-slash.scala punctuation.definition.comment.scala 133 | // ^^^^^^^^^^^^^^^^^^^^^^ comment.line.double-slash.scala 134 | import users.{User, UserPreferences} // Only imports selected members 135 | // <------ meta.import.scala keyword.other.import.scala 136 | // ^ meta.import.scala 137 | // ^^^^^ meta.import.scala entity.name.import.scala 138 | // ^ meta.import.scala punctuation.definition.import 139 | // ^ meta.import.scala meta.import.selector.scala meta.bracket.scala 140 | // ^^^^ meta.import.scala meta.import.selector.scala entity.name.class.import.scala 141 | // ^^ meta.import.scala meta.import.selector.scala 142 | // ^^^^^^^^^^^^^^^ meta.import.scala meta.import.selector.scala entity.name.class.import.scala 143 | // ^ meta.import.scala meta.import.selector.scala meta.bracket.scala 144 | 145 | 146 | 147 | import users.{UserPreferences => UPrefs} // import and rename for convenience 148 | // <------ meta.import.scala keyword.other.import.scala 149 | // ^ meta.import.scala 150 | // ^^^^^ meta.import.scala entity.name.import.scala 151 | // ^ meta.import.scala punctuation.definition.import 152 | // ^ meta.import.scala meta.import.selector.scala meta.bracket.scala 153 | // ^^^^^^^^^^^^^^^ meta.import.scala meta.import.selector.scala entity.name.class.import.renamed-from.scala 154 | // ^ meta.import.scala meta.import.selector.scala 155 | // ^^ meta.import.scala meta.import.selector.scala keyword.other.arrow.scala 156 | // ^ meta.import.scala meta.import.selector.scala 157 | // ^^^^^^ meta.import.scala meta.import.selector.scala entity.name.class.import.renamed-to.scala 158 | // ^ meta.import.scala meta.import.selector.scala meta.bracket.scala 159 | 160 | 161 | 162 | 163 | import δκφξ._ 164 | // <------ meta.import.scala keyword.other.import.scala 165 | // ^ meta.import.scala 166 | // ^^^^ meta.import.scala entity.name.import.scala 167 | // ^ meta.import.scala punctuation.definition.import 168 | // ^ meta.import.scala entity.name.import.scala 169 | import φξξ0ξ.δκφξ 170 | // <------ meta.import.scala keyword.other.import.scala 171 | // ^ meta.import.scala 172 | // ^^^^^ meta.import.scala entity.name.import.scala 173 | // ^ meta.import.scala punctuation.definition.import 174 | // ^^^^ meta.import.scala entity.name.import.scala 175 | import φξ_+.{+,-, id} 176 | // <------ meta.import.scala keyword.other.import.scala 177 | // ^ meta.import.scala 178 | // ^^^^ meta.import.scala entity.name.import.scala 179 | // ^ meta.import.scala punctuation.definition.import 180 | // ^ meta.import.scala meta.import.selector.scala meta.bracket.scala 181 | // ^ meta.import.scala meta.import.selector.scala entity.name.import.scala 182 | // ^ meta.import.scala meta.import.selector.scala 183 | // ^ meta.import.scala meta.import.selector.scala entity.name.import.scala 184 | // ^^ meta.import.scala meta.import.selector.scala 185 | // ^^ meta.import.scala meta.import.selector.scala entity.name.import.scala 186 | // ^ meta.import.scala meta.import.selector.scala meta.bracket.scala 187 | import δφξ_+.{δφξ => φξ} 188 | // <------ meta.import.scala keyword.other.import.scala 189 | // ^ meta.import.scala 190 | // ^^^^^ meta.import.scala entity.name.import.scala 191 | // ^ meta.import.scala punctuation.definition.import 192 | // ^ meta.import.scala meta.import.selector.scala meta.bracket.scala 193 | // ^^^ source.scala meta.import.scala meta.import.selector.scala entity.name.import.renamed-from.scala 194 | // ^ meta.import.scala meta.import.selector.scala 195 | // ^^ meta.import.selector.scala keyword.other.arrow.scala 196 | // ^ meta.import.scala meta.import.selector.scala 197 | // ^^ meta.import.scala meta.import.selector.scala entity.name.import.renamed-to.scala 198 | // ^ meta.import.scala meta.import.selector.scala meta.bracket.scala 199 | 200 | 201 | -------------------------------------------------------------------------------- /tests/unit/using.test.scala: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "source.scala" 2 | 3 | def f(using x: Int): Unit = () 4 | // ^^^^^ keyword.declaration.scala 5 | 6 | f(using 2) 7 | // ^^^^^ keyword.declaration.scala 8 | // ^ constant.numeric.scala 9 | 10 | f(using .2) 11 | // ^^^^^ keyword.declaration.scala 12 | // ^ constant.numeric.scala 13 | 14 | class A(using x: Int) 15 | // ^^^^^ keyword.declaration.scala 16 | 17 | new A(using 3) 18 | // ^^^^^ keyword.declaration.scala 19 | // ^ constant.numeric.scala 20 | 21 | given [T](using x: Ord[T], using: Int) as Ord[List[T]] 22 | // ^^^^^ keyword.declaration.scala 23 | // ^ variable.parameter.scala 24 | // ^^^^^ variable.parameter.scala 25 | 26 | given [T](using Ord[T]) as Ord[List[T]] 27 | // ^^^^^ keyword.declaration.scala 28 | 29 | f(using ()) 30 | // ^^^^^ keyword.declaration.scala 31 | // ^^ meta.parentheses.scala meta.bracket.scala 32 | 33 | f(using {}) 34 | // ^^^^^ keyword.declaration.scala 35 | // ^ punctuation.section.block.begin.scala 36 | // ^ punctuation.section.block.end.scala 37 | 38 | f(using ' ') 39 | // ^^^^^ keyword.declaration.scala 40 | // ^^^ constant.character.literal.scala 41 | 42 | f(using "") 43 | // ^^^^^ keyword.declaration.scala 44 | // ^^ string.quoted.double.scala 45 | 46 | val using = ... 47 | // ^^^^^ - keyword.declaration.scala 48 | val using: X = ... 49 | // ^^^^^ - keyword.declaration.scala 50 | def using() = ... 51 | // ^^^^^ - keyword.declaration.scala 52 | 53 | using(foo) 54 | // ^^^^^ - keyword.declaration.scala 55 | bar(using(foo)) 56 | // ^^^^^ - keyword.declaration.scala 57 | bar(using.apply(foo)) 58 | // ^^^^^ - keyword.declaration.scala 59 | using.apply(foo) 60 | // ^^^^^ - keyword.declaration.scala 61 | --------------------------------------------------------------------------------