diff --git a/extensions/vscode-colorize-tests/.gitignore b/extensions/vscode-colorize-tests/.gitignore new file mode 100644 index 00000000000..8e5962ee727 --- /dev/null +++ b/extensions/vscode-colorize-tests/.gitignore @@ -0,0 +1,2 @@ +out +node_modules \ No newline at end of file diff --git a/extensions/vscode-colorize-tests/.vscode/launch.json b/extensions/vscode-colorize-tests/.vscode/launch.json new file mode 100644 index 00000000000..73c3753c75c --- /dev/null +++ b/extensions/vscode-colorize-tests/.vscode/launch.json @@ -0,0 +1,17 @@ +// A launch configuration that compiles the extension and then opens it inside a new window +{ + "version": "0.1.0", + "configurations": [ + { + "name": "Launch Tests", + "type": "extensionHost", + "request": "launch", + "runtimeExecutable": "${execPath}", + "args": ["${workspaceFolder}/../../", "${workspaceFolder}/test", "--extensionDevelopmentPath=${workspaceFolder}", "--extensionTestsPath=${workspaceFolder}/out" ], + "stopOnEntry": false, + "sourceMaps": true, + "outDir": "${workspaceFolder}/out", + "preLaunchTask": "npm" + } + ] +} \ No newline at end of file diff --git a/extensions/vscode-colorize-tests/.vscode/tasks.json b/extensions/vscode-colorize-tests/.vscode/tasks.json new file mode 100644 index 00000000000..390a93a3a7f --- /dev/null +++ b/extensions/vscode-colorize-tests/.vscode/tasks.json @@ -0,0 +1,11 @@ +{ + "version": "2.0.0", + "command": "npm", + "type": "shell", + "presentation": { + "reveal": "silent" + }, + "args": ["run", "compile"], + "isBackground": true, + "problemMatcher": "$tsc-watch" +} diff --git a/extensions/vscode-colorize-tests/package.json b/extensions/vscode-colorize-tests/package.json new file mode 100644 index 00000000000..30c728cfb4e --- /dev/null +++ b/extensions/vscode-colorize-tests/package.json @@ -0,0 +1,56 @@ +{ + "name": "vscode-colorize-tests", + "description": "Colorize tests for VS Code", + "version": "0.0.1", + "publisher": "vscode", + "license": "MIT", + "private": true, + "activationEvents": [ + "onLanguage:json" + ], + "main": "./out/colorizerTestMain", + "enableProposedApi": true, + "engines": { + "vscode": "*" + }, + "scripts": { + "vscode:prepublish": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../build/gulpfile.extensions.js compile-extension:vscode-colorize-tests ./tsconfig.json" + }, + "dependencies": { + "jsonc-parser": "2.2.1" + }, + "devDependencies": { + "@types/node": "^12.19.9" + }, + "contributes": { + "semanticTokenTypes": [ + { + "id": "testToken", + "description": "A test token" + } + ], + "semanticTokenModifiers": [ + { + "id": "testModifier", + "description": "A test modifier" + } + ], + "semanticTokenScopes": [ + { + "scopes": { + "testToken": [ + "entity.name.function.special" + ] + } + } + ], + "productIconThemes": [ + { + "id": "Test Product Icons", + "label": "The Test Product Icon Theme", + "path": "./producticons/test-product-icon-theme.json", + "_watch": true + } + ] + } +} diff --git a/extensions/vscode-colorize-tests/producticons/ElegantIcons.woff b/extensions/vscode-colorize-tests/producticons/ElegantIcons.woff new file mode 100644 index 00000000000..393305253e5 Binary files /dev/null and b/extensions/vscode-colorize-tests/producticons/ElegantIcons.woff differ diff --git a/extensions/vscode-colorize-tests/producticons/index.html b/extensions/vscode-colorize-tests/producticons/index.html new file mode 100644 index 00000000000..0d34ddedb57 --- /dev/null +++ b/extensions/vscode-colorize-tests/producticons/index.html @@ -0,0 +1,3049 @@ + + + +
+Note:
Hello + * @param args + */ + public void doSomething(int a) { + double b = 0.0; + double c = 10e3; + long l = 134l; + } + + /* + * multiline comment + */ + @SuppressWarnings(value = "aString") + private long privateMethod(long b){ + for (int i = 0; i < 9; i++) { + System.out.println("Hello" + i); + } + return 10; + } + + //single line comment + @Test + public void someTests() { + int hex = 0x5; + Vector
+# a
+
+
+# h
+
++# a +a+ +# h \ No newline at end of file diff --git a/extensions/vscode-colorize-tests/test/colorize-fixtures/test-4287.pug b/extensions/vscode-colorize-tests/test/colorize-fixtures/test-4287.pug new file mode 100644 index 00000000000..8d8c109b53b --- /dev/null +++ b/extensions/vscode-colorize-tests/test/colorize-fixtures/test-4287.pug @@ -0,0 +1,3 @@ +.ssdsd + + // asdsdas \ No newline at end of file diff --git a/extensions/vscode-colorize-tests/test/colorize-fixtures/test-6611.rs b/extensions/vscode-colorize-tests/test/colorize-fixtures/test-6611.rs new file mode 100644 index 00000000000..0c59a443c2b --- /dev/null +++ b/extensions/vscode-colorize-tests/test/colorize-fixtures/test-6611.rs @@ -0,0 +1,26 @@ +impl Foo + where A: B +{ } + +impl Foo for C + where A: B +{ } + +impl Foo for C +{ + fn foo -> C + where A: B + { } +} + +fn foo -> C + where A: B +{ } + +struct Foo + where A: B +{ } + +trait Foo : C + where A: B +{ } \ No newline at end of file diff --git a/extensions/vscode-colorize-tests/test/colorize-fixtures/test-7115.xml b/extensions/vscode-colorize-tests/test/colorize-fixtures/test-7115.xml new file mode 100644 index 00000000000..74bf37e9037 --- /dev/null +++ b/extensions/vscode-colorize-tests/test/colorize-fixtures/test-7115.xml @@ -0,0 +1,7 @@ + +
Enter two whole numbers and then click Add.
+ + + @* now we call the totalMessage method + (a multi line razor comment outside code) *@ + +@totalMessage
+ +@(totalMessage+"!")
+ + An email address (with escaped at character): name@@domain.com + + + \ No newline at end of file diff --git a/extensions/vscode-colorize-tests/test/colorize-fixtures/test.css b/extensions/vscode-colorize-tests/test/colorize-fixtures/test.css new file mode 100644 index 00000000000..4a8bd2395f8 --- /dev/null +++ b/extensions/vscode-colorize-tests/test/colorize-fixtures/test.css @@ -0,0 +1,159 @@ +/* css Zen Garden default style v1.02 */ +/* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ +/* This file based on 'Tranquille' by Dave Shea */ +/* You may use this file as a foundation for any new work, but you may find it easier to start from scratch. */ +/* Not all elements are defined in this file, so you'll most likely want to refer to the xhtml as well. */ +/* Your images should be linked as if the CSS file sits in the same folder as the images. ie. no paths. */ +/* basic elements */ + +@import "mystyle.css"; +@import url("mystyle.css"); +@import url("bluish.css") projection, tv; + +.html { + padding: 0; + font-style: 0; +} +body { + font: 75% georgia, sans-serif; + line-height: 1.88889; + color: #555753; + background: #fff url(blossoms.jpg) no-repeat bottom right; + margin: 0; + padding: 0; + background-image: -webkit-linear-gradient(top, start-color, end-color); + background-image: -webkit-gradient(linear, left top, left bottom, from(start-color), to(end-color)); + background-image: -moz-linear-gradient(top, start-color, end-color); + background-image: linear-gradient(to bottom, start-color, end-color); +} + +p { + margin-top: 0; + text-align: justify; +} + +h3 { + font: italic normal 1.4em georgia, sans-serif; + letter-spacing: 1px; + margin-bottom: 0; + color: #7D775C; +} + +a:link { + font-weight: bold; + text-decoration: none; + color: #B7A5DF; +} + +a:visited { + font-weight: bold; + text-decoration: none; + color: #D4CDDC; + cursor: pointer; +} + +a:hover, +a:focus, +a:active { + text-decoration: underline; + color: #9685BA; +} + +abbr { + border-bottom: none; +} + + +/* specific divs */ + +.page-wrapper { + background: url(zen-bg.jpg) no-repeat top left; + padding: 0 175px 0 110px; + margin: 0; + position: relative; +} + +.intro { + min-width: 470px; + width: 100%; +} + +header h1 { + background: transparent url(h1.gif) no-repeat top left; + margin-top: 10px; + display: block; + width: 219px; + height: 87px; + float: left; + text-indent: 100%; + white-space: nowrap; + overflow: hidden; +} + +header { + padding-top: 20px; + height: 87px; +} + +.summary { + clear: both; + margin: 20px 20px 20px 10px; + width: 160px; + float: left; +} + +.summary p { + font: italic 1.1em/2.2 georgia; + text-align: center; +} + +.preamble { + clear: right; + padding: 0px 10px 0 10px; +} + +.supporting { + padding-left: 10px; + margin-bottom: 40px; +} + +#footer { + text-align: center +} + +footer a:link, +footer a:visited { + margin-right: 20px; +} + +.sidebar { + margin-left: 600px; + position: absolute; + top: 0; + right: 0; +} + +.sidebar .wrapper { + font: 10px verdana, sans-serif; + background: transparent url(paper-bg.jpg) top left repeat-y; + padding: 10px; + margin-top: 150px; + width: 130px; +} + +.sidebar li a:link { + color: #988F5E; +} + +.sidebar li a:visited { + color: '#B3AE94'; +} + +.extra1 { + background: transparent url(cr2.gif) top left no-repeat; + position: absolute; + top: 40px; + right: 0; + width: 148px; + height: 110px; +} \ No newline at end of file diff --git a/extensions/vscode-colorize-tests/test/colorize-fixtures/test.fs b/extensions/vscode-colorize-tests/test/colorize-fixtures/test.fs new file mode 100644 index 00000000000..7ad49b9deef --- /dev/null +++ b/extensions/vscode-colorize-tests/test/colorize-fixtures/test.fs @@ -0,0 +1,18 @@ +// from https://msdn.microsoft.com/en-us/library/dd233160.aspx + +// The declaration creates a constructor that takes two values, name and age. +type Person(name:string, age:int) = + let mutable internalAge = age + + new(name:string) = Person(name, 0) + + member this.Name = name + // A read/write property. + member this.Age + with get() = internalAge + and set(value) = internalAge <- value + + member this.HasABirthday () = internalAge <- internalAge + 1 + member this.IsOfAge targetAge = internalAge >= targetAge + override this.ToString () = + "Name: " + name + "\n" + "Age: " + (string)internalAge \ No newline at end of file diff --git a/extensions/vscode-colorize-tests/test/colorize-fixtures/test.go b/extensions/vscode-colorize-tests/test/colorize-fixtures/test.go new file mode 100644 index 00000000000..ade235742c6 --- /dev/null +++ b/extensions/vscode-colorize-tests/test/colorize-fixtures/test.go @@ -0,0 +1,25 @@ +package main + +import ( + "encoding/base64" + "fmt" +) + +func main() { + dnsName := "test-vm-from-go" + storageAccount := "mystorageaccount" + c := make(chan int) + + client, err := management.ClientFromPublishSettingsFile("path/to/downloaded.publishsettings", "") + if err != nil { + panic(err) + } + + // create virtual machine + role := vmutils.NewVMConfiguration(dnsName, vmSize) + vmutils.ConfigureDeploymentFromPlatformImage( + &role, + vmImage, + fmt.Sprintf("http://%s.blob.core.windows.net/sdktest/%s.vhd", storageAccount, dnsName), + "") +} \ No newline at end of file diff --git a/extensions/vscode-colorize-tests/test/colorize-fixtures/test.groovy b/extensions/vscode-colorize-tests/test/colorize-fixtures/test.groovy new file mode 100644 index 00000000000..f367f30058a --- /dev/null +++ b/extensions/vscode-colorize-tests/test/colorize-fixtures/test.groovy @@ -0,0 +1,219 @@ + +// Hello World +println "Hello world!" + +/* + Variables: + + You can assign values to variables for later use +*/ + +def x = 1 +println x + +x = new java.util.Date() +println x + +x = -3.1499392 +println x + +x = false +println x + +x = "Groovy!" +println x + +/* + Collections and maps +*/ + +//Creating an empty list +def technologies = [] + +/*** Adding a elements to the list ***/ + +// As with Java +technologies.add("Grails") + +// Left shift adds, and returns the list +technologies << "Groovy" + +// Add multiple elements +technologies.addAll(["Gradle","Griffon"]) + +/*** Removing elements from the list ***/ + +// As with Java +technologies.remove("Griffon") + +// Subtraction works also +technologies = technologies - 'Grails' + +/*** Iterating Lists ***/ + +// Iterate over elements of a list +technologies.each { println "Technology: $it"} +technologies.eachWithIndex { it, i -> println "$i: $it"} + +/*** Checking List contents ***/ + +//Evaluate if a list contains element(s) (boolean) +contained = technologies.contains( 'Groovy' ) + +// Or +contained = 'Groovy' in technologies + +// To sort without mutating original, you can do: +sortedTechnologies = technologies.sort( false ) + + +//Replace all elements in the list +Collections.replaceAll(technologies, 'Gradle', 'gradle') + +//Shuffle a list +Collections.shuffle(technologies, new Random()) + +//Clear a list +technologies.clear() + +//Creating an empty map +def devMap = [:] + +//Add values +devMap = ['name':'Roberto', 'framework':'Grails', 'language':'Groovy'] +devMap.put('lastName','Perez') + +//Iterate over elements of a map +devMap.each { println "$it.key: $it.value" } +devMap.eachWithIndex { it, i -> println "$i: $it"} + +//Evaluate if a map contains a key +assert devMap.containsKey('name') + +//Get the keys of a map +println devMap.keySet() + +class Foo { + // read only property + final String name = "Roberto" + + // read only property with public getter and protected setter + String language + protected void setLanguage(String language) { this.language = language } + + // dynamically typed property + def lastName +} + +/* + Logical Branching and Looping +*/ + +//Groovy supports the usual if - else syntax +def x = 3 + +if(x==1) { + println "One" +} else if(x==2) { + println "Two" +} else { + println "X greater than Two" +} + +//Groovy also supports the ternary operator: +def y = 10 +def x = (y > 1) ? "worked" : "failed" +assert x == "worked" + +//Groovy supports 'The Elvis Operator' too! +//Instead of using the ternary operator: + +displayName = user.name ? user.name : 'Anonymous' + +//We can write it: +displayName = user.name ?: 'Anonymous' + +//For loop +//Iterate over a range +def x = 0 +for (i in 0 .. 30) { + x += i +} + +//Iterate over a list +x = 0 +for( i in [5,3,2,1] ) { + x += i +} + +//Iterate over an array +array = (0..20).toArray() +x = 0 +for (i in array) { + x += i +} + +//Iterate over a map +def map = ['name':'Roberto', 'framework':'Grails', 'language':'Groovy'] +x = 0 +for ( e in map ) { + x += e.value +} + +def technologies = ['Groovy','Grails','Gradle'] +technologies*.toUpperCase() // = to technologies.collect { it?.toUpperCase() } + +def user = User.get(1) +def username = user?.username + +def clos = { println "Hello World!" } + +def sum = { a, b -> println a+b } +sum(2,4) + +def x = 5 +def multiplyBy = { num -> num * x } +println multiplyBy(10) + +def clos = { print it } +clos( "hi" ) + +def cl = {a, b -> + sleep(3000) // simulate some time consuming processing + a + b +} + +mem = cl.memoize() + +def callClosure(a, b) { + def start = System.currentTimeMillis() + mem(a, b) + println "Inputs(a = $a, b = $b) - took ${System.currentTimeMillis() - start} msecs." +} + +callClosure(1, 2) + +//Another example: +import groovy.transform.TypeChecked + +@TypeChecked +Integer test() { + Integer num = "1" + + Integer[] numbers = [1,2,3,4] + + Date date = numbers[1] + + return "Test" + +} + +//CompileStatic example: +import groovy.transform.CompileStatic + +@CompileStatic +int sum(int x, int y) { + x + y +} + +assert sum(2,5) == 7 diff --git a/extensions/vscode-colorize-tests/test/colorize-fixtures/test.handlebars b/extensions/vscode-colorize-tests/test/colorize-fixtures/test.handlebars new file mode 100644 index 00000000000..5558731ece2 --- /dev/null +++ b/extensions/vscode-colorize-tests/test/colorize-fixtures/test.handlebars @@ -0,0 +1,30 @@ +{{./name}} or {{this/name}} or {{this.name}}
+
{{title}}
+