mirror of
https://github.com/Microsoft/vscode
synced 2024-07-17 02:57:19 +00:00
Merge branch 'master' into yarn
This commit is contained in:
commit
deed70d9a2
|
@ -18,7 +18,7 @@ function updateGrammar(location) {
|
|||
}
|
||||
|
||||
const extensions = [
|
||||
// 'bat' Grammar no longer available
|
||||
'bat',
|
||||
'clojure',
|
||||
'coffeescript',
|
||||
'cpp',
|
||||
|
|
|
@ -1,22 +1,7 @@
|
|||
// ATTENTION - THIS DIRECTORY CONTAINS THIRD PARTY OPEN SOURCE MATERIALS:
|
||||
[{
|
||||
"name": "sublimehq/Packages",
|
||||
"name": "mmims/language-batchfile",
|
||||
"version": "0.0.0",
|
||||
"license": "TextMate Bundle License",
|
||||
"repositoryURL": "https://github.com/sublimehq/Packages",
|
||||
"licenseDetail": [
|
||||
"Copyright (c) Sublime Packages project authors",
|
||||
"",
|
||||
"If not otherwise specified (see below), files in this folder fall under the following license: ",
|
||||
"",
|
||||
"Permission to copy, use, modify, sell and distribute this",
|
||||
"software is granted. This software is provided \"as is\" without",
|
||||
"express or implied warranty, and with no claim as to its",
|
||||
"suitability for any purpose.",
|
||||
"",
|
||||
"An exception is made for files in readable text which contain their own license information, ",
|
||||
"or files where an accompanying file exists (in the same directory) with a \"-license\" suffix added ",
|
||||
"to the base-name name of the original file, and an extension of txt, html, or similar. For example ",
|
||||
"\"tidy\" is accompanied by \"tidy-license.txt\"."
|
||||
]
|
||||
"license": "MIT",
|
||||
"repositoryURL": "https://github.com/mmims/language-batchfile"
|
||||
}]
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
"version": "0.1.0",
|
||||
"publisher": "vscode",
|
||||
"engines": { "vscode": "*" },
|
||||
"scripts": {
|
||||
"update-grammar": "node ../../build/npm/update-grammar.js mmims/language-batchfile grammars/batchfile.cson ./syntaxes/batchfile.tmLanguage.json"
|
||||
},
|
||||
"contributes": {
|
||||
"languages": [{
|
||||
"id": "bat",
|
||||
|
@ -12,8 +15,8 @@
|
|||
}],
|
||||
"grammars": [{
|
||||
"language": "bat",
|
||||
"scopeName": "source.dosbatch",
|
||||
"path": "./syntaxes/Batch File.tmLanguage"
|
||||
"scopeName": "source.batchfile",
|
||||
"path": "./syntaxes/batchfile.tmLanguage.json"
|
||||
}]
|
||||
}
|
||||
}
|
693
extensions/bat/syntaxes/batchfile.tmLanguage.json
Normal file
693
extensions/bat/syntaxes/batchfile.tmLanguage.json
Normal file
|
@ -0,0 +1,693 @@
|
|||
{
|
||||
"information_for_contributors": [
|
||||
"This file has been converted from https://github.com/mmims/language-batchfile/blob/master/grammars/batchfile.cson",
|
||||
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
|
||||
"Once accepted there, we are happy to receive an update request."
|
||||
],
|
||||
"version": "https://github.com/mmims/language-batchfile/commit/40b605c75db3967a24b7015f6d3a885360b84e28",
|
||||
"scopeName": "source.batchfile",
|
||||
"name": "Batch File",
|
||||
"fileTypes": [
|
||||
"bat",
|
||||
"cmd"
|
||||
],
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#commands"
|
||||
},
|
||||
{
|
||||
"include": "#comments"
|
||||
},
|
||||
{
|
||||
"include": "#constants"
|
||||
},
|
||||
{
|
||||
"include": "#controls"
|
||||
},
|
||||
{
|
||||
"include": "#escaped_characters"
|
||||
},
|
||||
{
|
||||
"include": "#labels"
|
||||
},
|
||||
{
|
||||
"include": "#numbers"
|
||||
},
|
||||
{
|
||||
"include": "#operators"
|
||||
},
|
||||
{
|
||||
"include": "#parens"
|
||||
},
|
||||
{
|
||||
"include": "#strings"
|
||||
},
|
||||
{
|
||||
"include": "#variables"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
"commands": {
|
||||
"patterns": [
|
||||
{
|
||||
"match": "(?<=^|[\\s@])(?i:adprep|append|arp|assoc|at|atmadm|attrib|auditpol|autochk|autoconv|autofmt|bcdboot|bcdedit|bdehdcfg|bitsadmin|bootcfg|brea|cacls|cd|certreq|certutil|change|chcp|chdir|chglogon|chgport|chgusr|chkdsk|chkntfs|choice|cipher|clip|clscluadmin|cluster|cmd|cmdkey|cmstp|color|comp|compact|convert|copy|cprofile|cscript|csvde|date|dcdiag|dcgpofix|dcpromo|defra|del|dfscmd|dfsdiag|dfsrmig|diantz|dir|dirquota|diskcomp|diskcopy|diskpart|diskperf|diskraid|diskshadow|dispdiag|doin|dnscmd|doskey|driverquery|dsacls|dsadd|dsamain|dsdbutil|dsget|dsmgmt|dsmod|dsmove|dsquery|dsrm|edit|endlocal|eraseesentutl|eventcreate|eventquery|eventtriggers|evntcmd|expand|extract|fc|filescrn|find|findstr|finger|flattemp|fonde|forfiles|format|freedisk|fsutil|ftp|ftype|fveupdate|getmac|gettype|gpfixup|gpresult|gpupdate|graftabl|hashgen|hep|helpctr|hostname|icacls|iisreset|inuse|ipconfig|ipxroute|irftp|ismserv|jetpack|klist|ksetup|ktmutil|ktpass|label|ldifd|ldp|lodctr|logman|logoff|lpq|lpr|macfile|makecab|manage-bde|mapadmin|md|mkdir|mklink|mmc|mode|more|mount|mountvol|move|mqbup|mqsvc|mqtgsvc|msdt|msg|msiexec|msinfo32|mstsc|nbtstat|net computer|net group|net localgroup|net print|net session|net share|net start|net stop|net use|net user|net view|net|netcfg|netdiag|netdom|netsh|netstat|nfsadmin|nfsshare|nfsstat|nlb|nlbmgr|nltest|nslookup|ntackup|ntcmdprompt|ntdsutil|ntfrsutl|openfiles|pagefileconfig|path|pathping|pause|pbadmin|pentnt|perfmon|ping|pnpunatten|pnputil|popd|powercfg|powershell|powershell_ise|print|prncnfg|prndrvr|prnjobs|prnmngr|prnport|prnqctl|prompt|pubprn|pushd|pushprinterconnections|pwlauncher|qappsrv|qprocess|query|quser|qwinsta|rasdial|rcp|rd|rdpsign|regentc|recover|redircmp|redirusr|reg|regini|regsvr32|relog|ren|rename|rendom|repadmin|repair-bde|replace|reset session|rxec|risetup|rmdir|robocopy|route|rpcinfo|rpcping|rsh|runas|rundll32|rwinsta|sc|schtasks|scwcmd|secedit|serverceipoptin|servrmanagercmd|serverweroptin|setlocal|setspn|setx|sfc|shadow|shift|showmount|shutdown|sort|start|storrept|subst|sxstrace|ysocmgr|systeminfo|takeown|tapicfg|taskkill|tasklist|tcmsetup|telnet|tftp|time|timeout|title|tlntadmn|tpmvscmgr|tpmvscmgr|tacerpt|tracert|tree|tscon|tsdiscon|tsecimp|tskill|tsprof|type|typeperf|tzutil|uddiconfig|umount|unlodctr|ver|verifier|verif|vol|vssadmin|w32tm|waitfor|wbadmin|wdsutil|wecutil|wevtutil|where|whoami|winnt|winnt32|winpop|winrm|winrs|winsat|wlbs|mic|wscript|xcopy)(?=$|\\s)",
|
||||
"name": "keyword.command.batchfile"
|
||||
},
|
||||
{
|
||||
"begin": "(?<=^|[\\s@])(?i:echo)(?=$|\\s|\\.)",
|
||||
"beginCaptures": {
|
||||
"0": {
|
||||
"name": "keyword.command.batchfile"
|
||||
}
|
||||
},
|
||||
"end": "(?=$\\n|[&|><)])",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#escaped_characters"
|
||||
},
|
||||
{
|
||||
"include": "#variables"
|
||||
},
|
||||
{
|
||||
"include": "#numbers"
|
||||
},
|
||||
{
|
||||
"include": "#strings"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"include": "#command_set"
|
||||
}
|
||||
]
|
||||
},
|
||||
"command_set": {
|
||||
"patterns": [
|
||||
{
|
||||
"begin": "(?<=^|[\\s@])(?i:SET)(?=$|\\s)",
|
||||
"beginCaptures": {
|
||||
"0": {
|
||||
"name": "keyword.command.batchfile"
|
||||
}
|
||||
},
|
||||
"end": "(?=$\\n|[&|><)])",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#command_set_inside"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"command_set_inside": {
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#escaped_characters"
|
||||
},
|
||||
{
|
||||
"include": "#variables"
|
||||
},
|
||||
{
|
||||
"include": "#numbers"
|
||||
},
|
||||
{
|
||||
"include": "#parens"
|
||||
},
|
||||
{
|
||||
"begin": "(\")\\s*([^ ][^=]*)(=)\"?",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "punctuation.definition.string.begin.batchfile"
|
||||
},
|
||||
"2": {
|
||||
"name": "variable.other.readwrite.batchfile"
|
||||
},
|
||||
"3": {
|
||||
"name": "keyword.operator.assignment.batchfile"
|
||||
}
|
||||
},
|
||||
"end": "\"",
|
||||
"endCaptures": {
|
||||
"0": {
|
||||
"name": "string.quoted.double.batchfile"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#variables"
|
||||
},
|
||||
{
|
||||
"include": "#numbers"
|
||||
},
|
||||
{
|
||||
"include": "#parens"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"include": "#strings"
|
||||
},
|
||||
{
|
||||
"begin": "([^ ][^=]*)(=)",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "variable.other.readwrite.batchfile"
|
||||
},
|
||||
"2": {
|
||||
"name": "keyword.operator.assignment.batchfile"
|
||||
}
|
||||
},
|
||||
"end": "(?=$\\n|[&|><)])",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#escaped_characters"
|
||||
},
|
||||
{
|
||||
"include": "#variables"
|
||||
},
|
||||
{
|
||||
"include": "#numbers"
|
||||
},
|
||||
{
|
||||
"include": "#parens"
|
||||
},
|
||||
{
|
||||
"include": "#strings"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"begin": "\\s+/[aA]\\s+",
|
||||
"end": "(?=$\\n|[&|><)])",
|
||||
"name": "meta.expression.set.batchfile",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#command_set_inside_arithmetic"
|
||||
},
|
||||
{
|
||||
"include": "#command_set_group"
|
||||
},
|
||||
{
|
||||
"begin": "\"",
|
||||
"beginCaptures": {
|
||||
"0": {
|
||||
"name": "punctuation.definition.string.begin.batchfile"
|
||||
}
|
||||
},
|
||||
"end": "\"",
|
||||
"endCaptures": {
|
||||
"0": {
|
||||
"name": "punctuation.definition.string.end.batchfile"
|
||||
}
|
||||
},
|
||||
"name": "string.quoted.double.batchfile",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#command_set_inside_arithmetic"
|
||||
},
|
||||
{
|
||||
"include": "#command_set_group"
|
||||
},
|
||||
{
|
||||
"include": "#variables"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"begin": "\\s+/[pP]\\s+",
|
||||
"end": "(?=$\\n|[&|><)])",
|
||||
"patterns": [
|
||||
{
|
||||
"begin": "([^ ][^=]*)(=)",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "variable.other.readwrite.batchfile"
|
||||
},
|
||||
"2": {
|
||||
"name": "keyword.operator.assignment.batchfile"
|
||||
}
|
||||
},
|
||||
"end": "(?=$\\n|[&|><)])",
|
||||
"name": "meta.prompt.set.batchfile",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#strings"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"command_set_group": {
|
||||
"patterns": [
|
||||
{
|
||||
"begin": "\\(",
|
||||
"beginCaptures": {
|
||||
"0": {
|
||||
"name": "punctuation.section.group.begin.batchfile"
|
||||
}
|
||||
},
|
||||
"end": "\\)",
|
||||
"endCaptures": {
|
||||
"0": {
|
||||
"name": "punctuation.section.group.end.batchfile"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#command_set_inside_arithmetic"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"command_set_inside_arithmetic": {
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#command_set_operators"
|
||||
},
|
||||
{
|
||||
"include": "#numbers"
|
||||
},
|
||||
{
|
||||
"match": ",",
|
||||
"name": "punctuation.separator.batchfile"
|
||||
}
|
||||
]
|
||||
},
|
||||
"command_set_operators": {
|
||||
"patterns": [
|
||||
{
|
||||
"match": "\\+\\=|\\-\\=|\\*\\=|/\\=|%%\\=|&\\=|\\|\\=|\\^\\=|<<\\=|>>\\=",
|
||||
"name": "keyword.operator.assignment.augmented.batchfile"
|
||||
},
|
||||
{
|
||||
"match": "\\+|\\-|/|\\*|%%|\\||&|\\^|<<|>>|~",
|
||||
"name": "keyword.operator.arithmetic.batchfile"
|
||||
},
|
||||
{
|
||||
"match": "!",
|
||||
"name": "keyword.operator.logical.batchfile"
|
||||
},
|
||||
{
|
||||
"match": "=",
|
||||
"name": "keyword.operator.assignment.batchfile"
|
||||
}
|
||||
]
|
||||
},
|
||||
"comments": {
|
||||
"patterns": [
|
||||
{
|
||||
"begin": "(?:^|(&))\\s*(?=((?::[+=,;: ])))",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "keyword.operator.conditional.batchfile"
|
||||
}
|
||||
},
|
||||
"end": "\\n",
|
||||
"patterns": [
|
||||
{
|
||||
"begin": "((?::[+=,;: ]))",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "punctuation.definition.comment.batchfile"
|
||||
}
|
||||
},
|
||||
"end": "(?=\\n)",
|
||||
"name": "comment.line.colon.batchfile"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"begin": "(?<=^|[\\s@])(?i)(REM)(\\.)",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "keyword.command.rem.batchfile"
|
||||
},
|
||||
"2": {
|
||||
"name": "punctuation.separator.batchfile"
|
||||
}
|
||||
},
|
||||
"end": "(?=$\\n|[&|><)])",
|
||||
"name": "comment.line.rem.batchfile"
|
||||
},
|
||||
{
|
||||
"begin": "(?<=^|[\\s@])(?i:rem)\\b",
|
||||
"beginCaptures": {
|
||||
"0": {
|
||||
"name": "keyword.command.rem.batchfile"
|
||||
}
|
||||
},
|
||||
"end": "\\n",
|
||||
"name": "comment.line.rem.batchfile",
|
||||
"patterns": [
|
||||
{
|
||||
"match": "[><|]",
|
||||
"name": "invalid.illegal.unexpected-character.batchfile"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"constants": {
|
||||
"patterns": [
|
||||
{
|
||||
"match": "\\b(?i:NUL)\\b",
|
||||
"name": "constant.language.batchfile"
|
||||
}
|
||||
]
|
||||
},
|
||||
"controls": {
|
||||
"patterns": [
|
||||
{
|
||||
"match": "(?<=^|\\s)(?i)(?:goto|call|exit)(?=$|\\s)",
|
||||
"name": "keyword.control.statement.batchfile"
|
||||
},
|
||||
{
|
||||
"match": "(?<=^|\\s)(?i)(if)\\s+(?:(not)\\s+)?(exist|defined|errorlevel|cmdextversion)(?=\\s)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "keyword.control.conditional.batchfile"
|
||||
},
|
||||
"2": {
|
||||
"name": "keyword.operator.logical.batchfile"
|
||||
},
|
||||
"3": {
|
||||
"name": "keyword.other.special-method.batchfile"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"match": "(?<=^|\\s)(?i)(?:if|else)(?=$|\\s)",
|
||||
"name": "keyword.control.conditional.batchfile"
|
||||
},
|
||||
{
|
||||
"match": "(?<=^|\\s)(?i)for(?=\\s)",
|
||||
"name": "keyword.control.repeat.batchfile"
|
||||
}
|
||||
]
|
||||
},
|
||||
"escaped_characters": {
|
||||
"patterns": [
|
||||
{
|
||||
"match": "%%|\\^\\^!|\\^.|\\^\\n",
|
||||
"name": "constant.character.escape.batchfile"
|
||||
}
|
||||
]
|
||||
},
|
||||
"labels": {
|
||||
"patterns": [
|
||||
{
|
||||
"match": "^\\s*(:)([^+=,;:\\s].*)$",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "punctuation.separator.batchfile"
|
||||
},
|
||||
"2": {
|
||||
"name": "keyword.other.special-method.batchfile"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"numbers": {
|
||||
"patterns": [
|
||||
{
|
||||
"match": "(?<=^|\\s|=)(0[xX][0-9A-Fa-f]*|[+-]?\\d+)(?=$|\\s|<|>)",
|
||||
"name": "constant.numeric.batchfile"
|
||||
}
|
||||
]
|
||||
},
|
||||
"operators": {
|
||||
"patterns": [
|
||||
{
|
||||
"match": "@(?=\\S)",
|
||||
"name": "keyword.operator.at.batchfile"
|
||||
},
|
||||
{
|
||||
"match": "(?<=\\s)(?i:EQU|NEQ|LSS|LEQ|GTR|GEQ)(?=\\s)|==",
|
||||
"name": "keyword.operator.comparison.batchfile"
|
||||
},
|
||||
{
|
||||
"match": "(?<=\\s)(?i)(NOT)(?=\\s)",
|
||||
"name": "keyword.operator.logical.batchfile"
|
||||
},
|
||||
{
|
||||
"match": "&&?|\\|\\|",
|
||||
"name": "keyword.operator.conditional.batchfile"
|
||||
},
|
||||
{
|
||||
"match": "\\|",
|
||||
"name": "keyword.operator.pipe.batchfile"
|
||||
},
|
||||
{
|
||||
"match": "<&?|>[&>]?",
|
||||
"name": "keyword.operator.redirection.batchfile"
|
||||
}
|
||||
]
|
||||
},
|
||||
"parens": {
|
||||
"patterns": [
|
||||
{
|
||||
"begin": "\\(",
|
||||
"beginCaptures": {
|
||||
"0": "punctuation.section.group.begin.batchfile"
|
||||
},
|
||||
"end": "\\)",
|
||||
"endCaptures": {
|
||||
"0": "punctuation.section.group.end.batchfile"
|
||||
},
|
||||
"name": "meta.group.batchfile",
|
||||
"patterns": [
|
||||
{
|
||||
"match": ",|;",
|
||||
"name": "punctuation.separator.batchfile"
|
||||
},
|
||||
{
|
||||
"include": "$self"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"strings": {
|
||||
"patterns": [
|
||||
{
|
||||
"begin": "\"",
|
||||
"beginCaptures": {
|
||||
"0": {
|
||||
"name": "punctuation.definition.string.begin.batchfile"
|
||||
}
|
||||
},
|
||||
"end": "(\")|(\\n)",
|
||||
"endCaptures": {
|
||||
"1": {
|
||||
"name": "punctuation.definition.string.end.batchfile"
|
||||
},
|
||||
"2": {
|
||||
"name": "invalid.illegal.newline.batchfile"
|
||||
}
|
||||
},
|
||||
"name": "string.quoted.double.batchfile",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#variables"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"variables": {
|
||||
"patterns": [
|
||||
{
|
||||
"match": "(%)((~([fdpnxsatz]|\\$PATH:)*)?\\d|\\*)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "punctuation.definition.variable.batchfile"
|
||||
}
|
||||
},
|
||||
"name": "variable.parameter.batchfile"
|
||||
},
|
||||
{
|
||||
"include": "#variable"
|
||||
},
|
||||
{
|
||||
"include": "#variable_delayed_expansion"
|
||||
}
|
||||
]
|
||||
},
|
||||
"variable": {
|
||||
"patterns": [
|
||||
{
|
||||
"begin": "%(?=[^%]+%)",
|
||||
"beginCaptures": {
|
||||
"0": {
|
||||
"name": "punctuation.definition.variable.begin.batchfile"
|
||||
}
|
||||
},
|
||||
"end": "(%)|\\n",
|
||||
"endCaptures": {
|
||||
"1": {
|
||||
"name": "punctuation.definition.variable.end.batchfile"
|
||||
}
|
||||
},
|
||||
"name": "variable.other.readwrite.batchfile",
|
||||
"patterns": [
|
||||
{
|
||||
"begin": ":~",
|
||||
"beginCaptures": {
|
||||
"0": {
|
||||
"name": "punctuation.separator.batchfile"
|
||||
}
|
||||
},
|
||||
"end": "(?=%|\\n)",
|
||||
"name": "meta.variable.substring.batchfile",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#variable_substring"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"begin": ":",
|
||||
"beginCaptures": {
|
||||
"0": {
|
||||
"name": "punctuation.separator.batchfile"
|
||||
}
|
||||
},
|
||||
"end": "(?=%|\\n)",
|
||||
"name": "meta.variable.substitution.batchfile",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#variable_replace"
|
||||
},
|
||||
{
|
||||
"begin": "=",
|
||||
"beginCaptures": {
|
||||
"0": {
|
||||
"name": "punctuation.separator.batchfile"
|
||||
}
|
||||
},
|
||||
"end": "(?=%|\\n)",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#variable_delayed_expansion"
|
||||
},
|
||||
{
|
||||
"match": "[^%]+",
|
||||
"name": "string.unquoted.batchfile"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"variable_delayed_expansion": {
|
||||
"patterns": [
|
||||
{
|
||||
"begin": "!(?=[^!]+!)",
|
||||
"beginCaptures": {
|
||||
"0": {
|
||||
"name": "punctuation.definition.variable.begin.batchfile"
|
||||
}
|
||||
},
|
||||
"end": "(!)|\\n",
|
||||
"endCaptures": {
|
||||
"1": {
|
||||
"name": "punctuation.definition.variable.end.batchfile"
|
||||
}
|
||||
},
|
||||
"name": "variable.other.readwrite.batchfile",
|
||||
"patterns": [
|
||||
{
|
||||
"begin": ":~",
|
||||
"beginCaptures": {
|
||||
"0": {
|
||||
"name": "punctuation.separator.batchfile"
|
||||
}
|
||||
},
|
||||
"end": "(?=!|\\n)",
|
||||
"name": "meta.variable.substring.batchfile",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#variable_substring"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"begin": ":",
|
||||
"beginCaptures": {
|
||||
"0": {
|
||||
"name": "punctuation.separator.batchfile"
|
||||
}
|
||||
},
|
||||
"end": "(?=!|\\n)",
|
||||
"name": "meta.variable.substitution.batchfile",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#escaped_characters"
|
||||
},
|
||||
{
|
||||
"include": "#variable_replace"
|
||||
},
|
||||
{
|
||||
"include": "#variable"
|
||||
},
|
||||
{
|
||||
"begin": "=",
|
||||
"beginCaptures": {
|
||||
"0": {
|
||||
"name": "punctuation.separator.batchfile"
|
||||
}
|
||||
},
|
||||
"end": "(?=!|\\n)",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#variable"
|
||||
},
|
||||
{
|
||||
"match": "[^!]+",
|
||||
"name": "string.unquoted.batchfile"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"variable_replace": {
|
||||
"patterns": [
|
||||
{
|
||||
"match": "[^=%!\\n]+",
|
||||
"name": "string.unquoted.batchfile"
|
||||
}
|
||||
]
|
||||
},
|
||||
"variable_substring": {
|
||||
"patterns": [
|
||||
{
|
||||
"match": "([+-]?\\d+)(?:(,)([+-]?\\d+))?",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "constant.numeric.batchfile"
|
||||
},
|
||||
"2": {
|
||||
"name": "punctuation.separator.batchfile"
|
||||
},
|
||||
"3": {
|
||||
"name": "constant.numeric.batchfile"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,18 +1,18 @@
|
|||
[
|
||||
{
|
||||
"c": "@",
|
||||
"t": "source.dosbatch",
|
||||
"t": "source.batchfile keyword.operator.at.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
"light_plus": "default: #000000",
|
||||
"dark_vs": "default: #D4D4D4",
|
||||
"light_vs": "default: #000000",
|
||||
"hc_black": "default: #FFFFFF"
|
||||
"dark_plus": "keyword.operator: #D4D4D4",
|
||||
"light_plus": "keyword.operator: #000000",
|
||||
"dark_vs": "keyword.operator: #D4D4D4",
|
||||
"light_vs": "keyword.operator: #000000",
|
||||
"hc_black": "keyword.operator: #D4D4D4"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": "echo",
|
||||
"t": "source.dosbatch keyword.command.dosbatch",
|
||||
"t": "source.batchfile keyword.command.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "keyword: #569CD6",
|
||||
"light_plus": "keyword: #0000FF",
|
||||
|
@ -23,7 +23,7 @@
|
|||
},
|
||||
{
|
||||
"c": " off",
|
||||
"t": "source.dosbatch",
|
||||
"t": "source.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
"light_plus": "default: #000000",
|
||||
|
@ -34,7 +34,7 @@
|
|||
},
|
||||
{
|
||||
"c": "setlocal",
|
||||
"t": "source.dosbatch keyword.command.dosbatch",
|
||||
"t": "source.batchfile keyword.command.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "keyword: #569CD6",
|
||||
"light_plus": "keyword: #0000FF",
|
||||
|
@ -45,7 +45,7 @@
|
|||
},
|
||||
{
|
||||
"c": "title",
|
||||
"t": "source.dosbatch keyword.command.dosbatch",
|
||||
"t": "source.batchfile keyword.command.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "keyword: #569CD6",
|
||||
"light_plus": "keyword: #0000FF",
|
||||
|
@ -56,7 +56,7 @@
|
|||
},
|
||||
{
|
||||
"c": " VSCode Dev",
|
||||
"t": "source.dosbatch",
|
||||
"t": "source.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
"light_plus": "default: #000000",
|
||||
|
@ -67,7 +67,7 @@
|
|||
},
|
||||
{
|
||||
"c": "pushd",
|
||||
"t": "source.dosbatch keyword.command.dosbatch",
|
||||
"t": "source.batchfile keyword.command.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "keyword: #569CD6",
|
||||
"light_plus": "keyword: #0000FF",
|
||||
|
@ -78,7 +78,7 @@
|
|||
},
|
||||
{
|
||||
"c": " ",
|
||||
"t": "source.dosbatch",
|
||||
"t": "source.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
"light_plus": "default: #000000",
|
||||
|
@ -89,7 +89,7 @@
|
|||
},
|
||||
{
|
||||
"c": "%",
|
||||
"t": "source.dosbatch variable.parameter.function.dosbatch variable.parameter.function.begin.shell",
|
||||
"t": "source.batchfile variable.parameter.batchfile punctuation.definition.variable.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "variable: #9CDCFE",
|
||||
"light_plus": "variable: #001080",
|
||||
|
@ -100,7 +100,7 @@
|
|||
},
|
||||
{
|
||||
"c": "~dp0",
|
||||
"t": "source.dosbatch variable.parameter.function.dosbatch",
|
||||
"t": "source.batchfile variable.parameter.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "variable: #9CDCFE",
|
||||
"light_plus": "variable: #001080",
|
||||
|
@ -111,7 +111,7 @@
|
|||
},
|
||||
{
|
||||
"c": "\\..",
|
||||
"t": "source.dosbatch",
|
||||
"t": "source.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
"light_plus": "default: #000000",
|
||||
|
@ -121,8 +121,8 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"c": ":: Node modules",
|
||||
"t": "source.dosbatch comment.line.colons.dosbatch",
|
||||
"c": "::",
|
||||
"t": "source.batchfile comment.line.colon.batchfile punctuation.definition.comment.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "comment: #608B4E",
|
||||
"light_plus": "comment: #008000",
|
||||
|
@ -132,8 +132,19 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"c": "if not exist",
|
||||
"t": "source.dosbatch keyword.control.conditional.if.dosbatch",
|
||||
"c": " Node modules",
|
||||
"t": "source.batchfile comment.line.colon.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "comment: #608B4E",
|
||||
"light_plus": "comment: #008000",
|
||||
"dark_vs": "comment: #608B4E",
|
||||
"light_vs": "comment: #008000",
|
||||
"hc_black": "comment: #7CA668"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": "if",
|
||||
"t": "source.batchfile keyword.control.conditional.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "keyword.control: #C586C0",
|
||||
"light_plus": "keyword.control: #AF00DB",
|
||||
|
@ -142,9 +153,53 @@
|
|||
"hc_black": "keyword.control: #C586C0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": " ",
|
||||
"t": "source.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
"light_plus": "default: #000000",
|
||||
"dark_vs": "default: #D4D4D4",
|
||||
"light_vs": "default: #000000",
|
||||
"hc_black": "default: #FFFFFF"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": "not",
|
||||
"t": "source.batchfile keyword.operator.logical.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "keyword.operator: #D4D4D4",
|
||||
"light_plus": "keyword.operator: #000000",
|
||||
"dark_vs": "keyword.operator: #D4D4D4",
|
||||
"light_vs": "keyword.operator: #000000",
|
||||
"hc_black": "keyword.operator: #D4D4D4"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": " ",
|
||||
"t": "source.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
"light_plus": "default: #000000",
|
||||
"dark_vs": "default: #D4D4D4",
|
||||
"light_vs": "default: #000000",
|
||||
"hc_black": "default: #FFFFFF"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": "exist",
|
||||
"t": "source.batchfile keyword.other.special-method.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "keyword: #569CD6",
|
||||
"light_plus": "keyword: #0000FF",
|
||||
"dark_vs": "keyword: #569CD6",
|
||||
"light_vs": "keyword: #0000FF",
|
||||
"hc_black": "keyword: #569CD6"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": " node_modules ",
|
||||
"t": "source.dosbatch",
|
||||
"t": "source.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
"light_plus": "default: #000000",
|
||||
|
@ -155,7 +210,7 @@
|
|||
},
|
||||
{
|
||||
"c": "call",
|
||||
"t": "source.dosbatch keyword.control.statement.dosbatch",
|
||||
"t": "source.batchfile keyword.control.statement.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "keyword.control: #C586C0",
|
||||
"light_plus": "keyword.control: #AF00DB",
|
||||
|
@ -166,7 +221,7 @@
|
|||
},
|
||||
{
|
||||
"c": " .\\scripts\\npm.bat install",
|
||||
"t": "source.dosbatch",
|
||||
"t": "source.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
"light_plus": "default: #000000",
|
||||
|
@ -176,8 +231,19 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"c": ":: Get electron",
|
||||
"t": "source.dosbatch comment.line.colons.dosbatch",
|
||||
"c": "::",
|
||||
"t": "source.batchfile comment.line.colon.batchfile punctuation.definition.comment.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "comment: #608B4E",
|
||||
"light_plus": "comment: #008000",
|
||||
"dark_vs": "comment: #608B4E",
|
||||
"light_vs": "comment: #008000",
|
||||
"hc_black": "comment: #7CA668"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": " Get electron",
|
||||
"t": "source.batchfile comment.line.colon.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "comment: #608B4E",
|
||||
"light_plus": "comment: #008000",
|
||||
|
@ -188,7 +254,7 @@
|
|||
},
|
||||
{
|
||||
"c": "node .\\node_modules\\gulp\\bin\\gulp.js electron",
|
||||
"t": "source.dosbatch",
|
||||
"t": "source.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
"light_plus": "default: #000000",
|
||||
|
@ -198,8 +264,8 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"c": ":: Build",
|
||||
"t": "source.dosbatch comment.line.colons.dosbatch",
|
||||
"c": "::",
|
||||
"t": "source.batchfile comment.line.colon.batchfile punctuation.definition.comment.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "comment: #608B4E",
|
||||
"light_plus": "comment: #008000",
|
||||
|
@ -209,8 +275,19 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"c": "if not exist",
|
||||
"t": "source.dosbatch keyword.control.conditional.if.dosbatch",
|
||||
"c": " Build",
|
||||
"t": "source.batchfile comment.line.colon.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "comment: #608B4E",
|
||||
"light_plus": "comment: #008000",
|
||||
"dark_vs": "comment: #608B4E",
|
||||
"light_vs": "comment: #008000",
|
||||
"hc_black": "comment: #7CA668"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": "if",
|
||||
"t": "source.batchfile keyword.control.conditional.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "keyword.control: #C586C0",
|
||||
"light_plus": "keyword.control: #AF00DB",
|
||||
|
@ -220,8 +297,8 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"c": " out node .\\node_modules\\gulp\\bin\\gulp.js compile",
|
||||
"t": "source.dosbatch",
|
||||
"c": " ",
|
||||
"t": "source.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
"light_plus": "default: #000000",
|
||||
|
@ -231,8 +308,63 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"c": ":: Configuration",
|
||||
"t": "source.dosbatch comment.line.colons.dosbatch",
|
||||
"c": "not",
|
||||
"t": "source.batchfile keyword.operator.logical.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "keyword.operator: #D4D4D4",
|
||||
"light_plus": "keyword.operator: #000000",
|
||||
"dark_vs": "keyword.operator: #D4D4D4",
|
||||
"light_vs": "keyword.operator: #000000",
|
||||
"hc_black": "keyword.operator: #D4D4D4"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": " ",
|
||||
"t": "source.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
"light_plus": "default: #000000",
|
||||
"dark_vs": "default: #D4D4D4",
|
||||
"light_vs": "default: #000000",
|
||||
"hc_black": "default: #FFFFFF"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": "exist",
|
||||
"t": "source.batchfile keyword.other.special-method.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "keyword: #569CD6",
|
||||
"light_plus": "keyword: #0000FF",
|
||||
"dark_vs": "keyword: #569CD6",
|
||||
"light_vs": "keyword: #0000FF",
|
||||
"hc_black": "keyword: #569CD6"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": " out node .\\node_modules\\gulp\\bin\\gulp.js compile",
|
||||
"t": "source.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
"light_plus": "default: #000000",
|
||||
"dark_vs": "default: #D4D4D4",
|
||||
"light_vs": "default: #000000",
|
||||
"hc_black": "default: #FFFFFF"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": "::",
|
||||
"t": "source.batchfile comment.line.colon.batchfile punctuation.definition.comment.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "comment: #608B4E",
|
||||
"light_plus": "comment: #008000",
|
||||
"dark_vs": "comment: #608B4E",
|
||||
"light_vs": "comment: #008000",
|
||||
"hc_black": "comment: #7CA668"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": " Configuration",
|
||||
"t": "source.batchfile comment.line.colon.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "comment: #608B4E",
|
||||
"light_plus": "comment: #008000",
|
||||
|
@ -243,7 +375,7 @@
|
|||
},
|
||||
{
|
||||
"c": "set",
|
||||
"t": "source.dosbatch keyword.command.dosbatch",
|
||||
"t": "source.batchfile keyword.command.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "keyword: #569CD6",
|
||||
"light_plus": "keyword: #0000FF",
|
||||
|
@ -253,8 +385,41 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"c": " NODE_ENV=development",
|
||||
"t": "source.dosbatch",
|
||||
"c": " ",
|
||||
"t": "source.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
"light_plus": "default: #000000",
|
||||
"dark_vs": "default: #D4D4D4",
|
||||
"light_vs": "default: #000000",
|
||||
"hc_black": "default: #FFFFFF"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": "NODE_ENV",
|
||||
"t": "source.batchfile variable.other.readwrite.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "variable: #9CDCFE",
|
||||
"light_plus": "variable: #001080",
|
||||
"dark_vs": "default: #D4D4D4",
|
||||
"light_vs": "default: #000000",
|
||||
"hc_black": "variable: #9CDCFE"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": "=",
|
||||
"t": "source.batchfile keyword.operator.assignment.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "keyword.operator: #D4D4D4",
|
||||
"light_plus": "keyword.operator: #000000",
|
||||
"dark_vs": "keyword.operator: #D4D4D4",
|
||||
"light_vs": "keyword.operator: #000000",
|
||||
"hc_black": "keyword.operator: #D4D4D4"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": "development",
|
||||
"t": "source.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
"light_plus": "default: #000000",
|
||||
|
@ -265,7 +430,7 @@
|
|||
},
|
||||
{
|
||||
"c": "call",
|
||||
"t": "source.dosbatch keyword.control.statement.dosbatch",
|
||||
"t": "source.batchfile keyword.control.statement.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "keyword.control: #C586C0",
|
||||
"light_plus": "keyword.control: #AF00DB",
|
||||
|
@ -276,7 +441,7 @@
|
|||
},
|
||||
{
|
||||
"c": " ",
|
||||
"t": "source.dosbatch",
|
||||
"t": "source.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
"light_plus": "default: #000000",
|
||||
|
@ -287,7 +452,7 @@
|
|||
},
|
||||
{
|
||||
"c": "echo",
|
||||
"t": "source.dosbatch keyword.command.dosbatch",
|
||||
"t": "source.batchfile keyword.command.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "keyword: #569CD6",
|
||||
"light_plus": "keyword: #0000FF",
|
||||
|
@ -298,7 +463,7 @@
|
|||
},
|
||||
{
|
||||
"c": " ",
|
||||
"t": "source.dosbatch",
|
||||
"t": "source.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
"light_plus": "default: #000000",
|
||||
|
@ -308,19 +473,41 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"c": "%%LINE:rem +=%%",
|
||||
"t": "source.dosbatch variable.other.parsetime.dosbatch",
|
||||
"c": "%%",
|
||||
"t": "source.batchfile constant.character.escape.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "variable: #9CDCFE",
|
||||
"light_plus": "variable: #001080",
|
||||
"dark_plus": "constant.character.escape: #D7BA7D",
|
||||
"light_plus": "constant.character.escape: #A31515",
|
||||
"dark_vs": "default: #D4D4D4",
|
||||
"light_vs": "default: #000000",
|
||||
"hc_black": "variable: #9CDCFE"
|
||||
"hc_black": "constant.character: #569CD6"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": "LINE:rem +=",
|
||||
"t": "source.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "default: #D4D4D4",
|
||||
"light_plus": "default: #000000",
|
||||
"dark_vs": "default: #D4D4D4",
|
||||
"light_vs": "default: #000000",
|
||||
"hc_black": "default: #FFFFFF"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": "%%",
|
||||
"t": "source.batchfile constant.character.escape.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "constant.character.escape: #D7BA7D",
|
||||
"light_plus": "constant.character.escape: #A31515",
|
||||
"dark_vs": "default: #D4D4D4",
|
||||
"light_vs": "default: #000000",
|
||||
"hc_black": "constant.character: #569CD6"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": "popd",
|
||||
"t": "source.dosbatch keyword.command.dosbatch",
|
||||
"t": "source.batchfile keyword.command.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "keyword: #569CD6",
|
||||
"light_plus": "keyword: #0000FF",
|
||||
|
@ -331,7 +518,7 @@
|
|||
},
|
||||
{
|
||||
"c": "endlocal",
|
||||
"t": "source.dosbatch keyword.command.dosbatch",
|
||||
"t": "source.batchfile keyword.command.batchfile",
|
||||
"r": {
|
||||
"dark_plus": "keyword: #569CD6",
|
||||
"light_plus": "keyword: #0000FF",
|
||||
|
|
|
@ -44,12 +44,6 @@
|
|||
"path": "./syntaxes/css.tmLanguage.json"
|
||||
}
|
||||
],
|
||||
"snippets": [
|
||||
{
|
||||
"language": "css",
|
||||
"path": "./snippets/css.json"
|
||||
}
|
||||
],
|
||||
"configuration": [
|
||||
{
|
||||
"order": 22,
|
||||
|
|
|
@ -165,13 +165,13 @@ function validateTextDocument(textDocument: TextDocument): void {
|
|||
connection.onCompletion(textDocumentPosition => {
|
||||
let document = documents.get(textDocumentPosition.textDocument.uri);
|
||||
let stylesheet = stylesheets.get(document);
|
||||
return getLanguageService(document).doComplete(document, textDocumentPosition.position, stylesheet);
|
||||
return getLanguageService(document).doComplete(document, textDocumentPosition.position, stylesheet)!; /* TODO: remove ! once LS has null annotations */
|
||||
});
|
||||
|
||||
connection.onHover(textDocumentPosition => {
|
||||
let document = documents.get(textDocumentPosition.textDocument.uri);
|
||||
let styleSheet = stylesheets.get(document);
|
||||
return getLanguageService(document).doHover(document, textDocumentPosition.position, styleSheet);
|
||||
return getLanguageService(document).doHover(document, textDocumentPosition.position, styleSheet)!; /* TODO: remove ! once LS has null annotations */
|
||||
});
|
||||
|
||||
connection.onDocumentSymbol(documentSymbolParams => {
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
{
|
||||
"transition property": {
|
||||
"prefix": "transition",
|
||||
"body": [
|
||||
"-webkit-transition: ${1:property} ${2:duration} ${3:timing-function} ${4:delay};",
|
||||
"-moz-transition: ${1:property} ${2:duration} ${3:timing-function} ${4:delay};",
|
||||
"transition: ${1:property} ${2:duration} ${3:timing-function} ${4:delay};"
|
||||
],
|
||||
"description": "The transition property across browsers"
|
||||
},
|
||||
"border": {
|
||||
"prefix": "border",
|
||||
"body": [
|
||||
"border: ${1:width} ${2:border-style} ${3:color};$0"
|
||||
],
|
||||
"description": "[width] [border-style] [color]"
|
||||
},
|
||||
"gradient": {
|
||||
"prefix": "gradient",
|
||||
"body": [
|
||||
"background-image: -webkit-gradient(linear, left top, left bottom, from(${1:start-color}), to(${2:end-color}));",
|
||||
"background-image: -webkit-linear-gradient(top, ${1:start-color}, ${2:end-color});",
|
||||
"background-image: -moz-linear-gradient(top, ${1:start-color}, ${2:end-color});",
|
||||
"background-image: linear-gradient(to bottom, ${1:start-color}, ${2:end-color});"
|
||||
],
|
||||
"description": "Set the 'background-image' property to a linear gradient"
|
||||
}
|
||||
}
|
||||
|
|
@ -13,9 +13,9 @@ fi
|
|||
cd $ROOT
|
||||
|
||||
# Integration Tests
|
||||
./scripts/code.sh $ROOT/extensions/vscode-api-tests/testWorkspace --extensionDevelopmentPath=$ROOT/extensions/vscode-api-tests --extensionTestsPath=$ROOT/extensions/vscode-api-tests/out --disableExtensions --user-data-dir=$VSCODEUSERDATADIR --skip-getting-started
|
||||
#./scripts/code.sh $ROOT/extensions/vscode-api-tests/testWorkspace --extensionDevelopmentPath=$ROOT/extensions/vscode-api-tests --extensionTestsPath=$ROOT/extensions/vscode-api-tests/out --disableExtensions --user-data-dir=$VSCODEUSERDATADIR --skip-getting-started
|
||||
./scripts/code.sh $ROOT/extensions/vscode-colorize-tests/test --extensionDevelopmentPath=$ROOT/extensions/vscode-colorize-tests --extensionTestsPath=$ROOT/extensions/vscode-colorize-tests/out --user-data-dir=$VSCODEUSERDATADIR --skip-getting-started
|
||||
./scripts/test-int-mocha.sh
|
||||
./scripts/code.sh $ROOT/extensions/emmet/test-fixtures --extensionDevelopmentPath=$ROOT/extensions/emmet --extensionTestsPath=$ROOT/extensions/emmet/out/test --disableExtensions --user-data-dir=$VSCODEUSERDATADIR --skip-getting-started
|
||||
#./scripts/test-int-mocha.sh
|
||||
#./scripts/code.sh $ROOT/extensions/emmet/test-fixtures --extensionDevelopmentPath=$ROOT/extensions/emmet --extensionTestsPath=$ROOT/extensions/emmet/out/test --disableExtensions --user-data-dir=$VSCODEUSERDATADIR --skip-getting-started
|
||||
|
||||
rm -r $VSCODEUSERDATADIR
|
||||
|
|
|
@ -5,157 +5,8 @@
|
|||
'use strict';
|
||||
|
||||
import nls = require('vs/nls');
|
||||
import objects = require('vs/base/common/objects');
|
||||
import types = require('vs/base/common/types');
|
||||
import arrays = require('vs/base/common/arrays');
|
||||
import strings = require('vs/base/common/strings');
|
||||
import { isUndefinedOrNull } from 'vs/base/common/types';
|
||||
|
||||
export interface IXHRResponse {
|
||||
responseText: string;
|
||||
status: number;
|
||||
|
||||
readyState: number;
|
||||
getResponseHeader: (header: string) => string;
|
||||
}
|
||||
|
||||
export interface IConnectionErrorData {
|
||||
status: number;
|
||||
statusText?: string;
|
||||
responseText?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* The base class for all connection errors originating from XHR requests.
|
||||
*/
|
||||
export class ConnectionError implements Error {
|
||||
public status: number;
|
||||
public statusText: string;
|
||||
public responseText: string;
|
||||
public errorMessage: string;
|
||||
public errorCode: string;
|
||||
public errorObject: any;
|
||||
public name: string;
|
||||
|
||||
constructor(mixin: IConnectionErrorData);
|
||||
constructor(request: IXHRResponse);
|
||||
constructor(arg: any) {
|
||||
this.status = arg.status;
|
||||
this.statusText = arg.statusText;
|
||||
this.name = 'ConnectionError';
|
||||
|
||||
try {
|
||||
this.responseText = arg.responseText;
|
||||
} catch (e) {
|
||||
this.responseText = '';
|
||||
}
|
||||
|
||||
this.errorMessage = null;
|
||||
this.errorCode = null;
|
||||
this.errorObject = null;
|
||||
|
||||
if (this.responseText) {
|
||||
try {
|
||||
let errorObj = JSON.parse(this.responseText);
|
||||
this.errorMessage = errorObj.message;
|
||||
this.errorCode = errorObj.code;
|
||||
this.errorObject = errorObj;
|
||||
} catch (error) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public get message(): string {
|
||||
return this.connectionErrorToMessage(this, false);
|
||||
}
|
||||
|
||||
public get verboseMessage(): string {
|
||||
return this.connectionErrorToMessage(this, true);
|
||||
}
|
||||
|
||||
private connectionErrorDetailsToMessage(error: ConnectionError, verbose: boolean): string {
|
||||
let errorCode = error.errorCode;
|
||||
let errorMessage = error.errorMessage;
|
||||
|
||||
if (!isUndefinedOrNull(errorCode) && typeof errorMessage === 'string') {
|
||||
return nls.localize(
|
||||
{
|
||||
key: 'message',
|
||||
comment: [
|
||||
'{0} represents the error message',
|
||||
'{1} represents the error code'
|
||||
]
|
||||
},
|
||||
"{0}. Error code: {1}",
|
||||
strings.rtrim(errorMessage, '.'), errorCode);
|
||||
}
|
||||
|
||||
if (typeof errorMessage === 'string') {
|
||||
return errorMessage;
|
||||
}
|
||||
|
||||
if (verbose && typeof error.responseText === 'string') {
|
||||
return error.responseText;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private connectionErrorToMessage(error: ConnectionError, verbose: boolean): string {
|
||||
let details = this.connectionErrorDetailsToMessage(error, verbose);
|
||||
|
||||
// Status Code based Error
|
||||
if (error.status === 401) {
|
||||
if (typeof details === 'string') {
|
||||
return nls.localize(
|
||||
{
|
||||
key: 'error.permission.verbose',
|
||||
comment: [
|
||||
'{0} represents detailed information why the permission got denied'
|
||||
]
|
||||
},
|
||||
"Permission Denied (HTTP {0})",
|
||||
details);
|
||||
}
|
||||
|
||||
return nls.localize('error.permission', "Permission Denied");
|
||||
}
|
||||
|
||||
// Return error details if present
|
||||
if (details) {
|
||||
return details;
|
||||
}
|
||||
|
||||
// Fallback to HTTP Status and Code
|
||||
if (error.status > 0 && typeof error.statusText === 'string') {
|
||||
if (verbose && typeof error.responseText === 'string' && error.responseText.length > 0) {
|
||||
return nls.localize('error.http.verbose', "{0} (HTTP {1}: {2})", error.statusText, error.status, error.responseText);
|
||||
}
|
||||
|
||||
return nls.localize('error.http', "{0} (HTTP {1})", error.statusText, error.status);
|
||||
}
|
||||
|
||||
// Finally its an Unknown Connection Error
|
||||
if (verbose && typeof error.responseText === 'string' && error.responseText.length > 0) {
|
||||
return nls.localize('error.connection.unknown.verbose', "Unknown Connection Error ({0})", error.responseText);
|
||||
}
|
||||
|
||||
return nls.localize('error.connection.unknown', "An unknown connection error occurred. Either you are no longer connected to the internet or the server you are connected to is offline.");
|
||||
}
|
||||
}
|
||||
|
||||
// Bug: Can not subclass a JS Type. Do it manually (as done in WinJS.Class.derive)
|
||||
objects.derive(Error, ConnectionError);
|
||||
|
||||
function xhrToErrorMessage(xhr: IConnectionErrorData, verbose: boolean): string {
|
||||
let ce = new ConnectionError(xhr);
|
||||
if (verbose) {
|
||||
return ce.verboseMessage;
|
||||
} else {
|
||||
return ce.message;
|
||||
}
|
||||
}
|
||||
|
||||
function exceptionToErrorMessage(exception: any, verbose: boolean): string {
|
||||
if (exception.message) {
|
||||
|
@ -182,6 +33,7 @@ function detectSystemErrorMessage(exception: any): string {
|
|||
/**
|
||||
* Tries to generate a human readable error message out of the error. If the verbose parameter
|
||||
* is set to true, the error message will include stacktrace details if provided.
|
||||
*
|
||||
* @returns A string containing the error message.
|
||||
*/
|
||||
export function toErrorMessage(error: any = null, verbose: boolean = false): string {
|
||||
|
@ -190,8 +42,8 @@ export function toErrorMessage(error: any = null, verbose: boolean = false): str
|
|||
}
|
||||
|
||||
if (Array.isArray(error)) {
|
||||
let errors: any[] = arrays.coalesce(error);
|
||||
let msg = toErrorMessage(errors[0], verbose);
|
||||
const errors: any[] = arrays.coalesce(error);
|
||||
const msg = toErrorMessage(errors[0], verbose);
|
||||
|
||||
if (errors.length > 1) {
|
||||
return nls.localize('error.moreErrors', "{0} ({1} errors in total)", msg, errors.length);
|
||||
|
@ -204,36 +56,14 @@ export function toErrorMessage(error: any = null, verbose: boolean = false): str
|
|||
return error;
|
||||
}
|
||||
|
||||
if (!types.isUndefinedOrNull(error.status)) {
|
||||
return xhrToErrorMessage(error, verbose);
|
||||
}
|
||||
|
||||
if (error.detail) {
|
||||
let detail = error.detail;
|
||||
const detail = error.detail;
|
||||
|
||||
if (detail.error) {
|
||||
if (detail.error && !types.isUndefinedOrNull(detail.error.status)) {
|
||||
return xhrToErrorMessage(detail.error, verbose);
|
||||
}
|
||||
|
||||
if (types.isArray(detail.error)) {
|
||||
for (let i = 0; i < detail.error.length; i++) {
|
||||
if (detail.error[i] && !types.isUndefinedOrNull(detail.error[i].status)) {
|
||||
return xhrToErrorMessage(detail.error[i], verbose);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
return exceptionToErrorMessage(detail.error, verbose);
|
||||
}
|
||||
return exceptionToErrorMessage(detail.error, verbose);
|
||||
}
|
||||
|
||||
if (detail.exception) {
|
||||
if (!types.isUndefinedOrNull(detail.exception.status)) {
|
||||
return xhrToErrorMessage(detail.exception, verbose);
|
||||
}
|
||||
|
||||
return exceptionToErrorMessage(detail.exception, verbose);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -205,34 +205,6 @@ export function createKeywordMatcher(arr: string[], caseInsensitive: boolean = f
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Started from TypeScript's __extends function to make a type a subclass of a specific class.
|
||||
* Modified to work with properties already defined on the derivedClass, since we can't get TS
|
||||
* to call this method before the constructor definition.
|
||||
*/
|
||||
export function derive(baseClass: any, derivedClass: any): void {
|
||||
for (let prop in baseClass) {
|
||||
if (baseClass.hasOwnProperty(prop)) {
|
||||
derivedClass[prop] = baseClass[prop];
|
||||
}
|
||||
}
|
||||
|
||||
derivedClass = derivedClass || function () { };
|
||||
const basePrototype = baseClass.prototype;
|
||||
const derivedPrototype = derivedClass.prototype;
|
||||
derivedClass.prototype = Object.create(basePrototype);
|
||||
|
||||
for (let prop in derivedPrototype) {
|
||||
if (derivedPrototype.hasOwnProperty(prop)) {
|
||||
// handle getters and setters properly
|
||||
Object.defineProperty(derivedClass.prototype, prop, Object.getOwnPropertyDescriptor(derivedPrototype, prop));
|
||||
}
|
||||
}
|
||||
|
||||
// Cast to any due to Bug 16188:PropertyDescriptor set and get function should be optional.
|
||||
Object.defineProperty(derivedClass.prototype, 'constructor', { value: derivedClass, writable: true, configurable: true, enumerable: true });
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls JSON.Stringify with a replacer to break apart any circular references.
|
||||
* This prevents JSON.stringify from throwing the exception
|
||||
|
|
|
@ -42,14 +42,14 @@ export class PolyfillPromise<T = any> implements Promise<T> {
|
|||
|
||||
constructor(winjsPromise: WinJSPromise);
|
||||
constructor(callback: (resolve: (value?: T) => void, reject: (err?: any) => void) => any);
|
||||
constructor(callback: WinJSPromise | ((resolve: (value?: T) => void, reject: (err?: any) => void) => any)) {
|
||||
constructor(initOrPromise: WinJSPromise | ((resolve: (value?: T) => void, reject: (err?: any) => void) => any)) {
|
||||
|
||||
if (WinJSPromise.is(callback)) {
|
||||
this._winjsPromise = callback;
|
||||
if (WinJSPromise.is(initOrPromise)) {
|
||||
this._winjsPromise = initOrPromise;
|
||||
} else {
|
||||
this._winjsPromise = new WinJSPromise((resolve, reject) => {
|
||||
let initializing = true;
|
||||
callback(function (value) {
|
||||
initOrPromise(function (value) {
|
||||
if (!initializing) {
|
||||
resolve(value);
|
||||
} else {
|
||||
|
@ -68,10 +68,28 @@ export class PolyfillPromise<T = any> implements Promise<T> {
|
|||
}
|
||||
|
||||
then(onFulfilled?: any, onRejected?: any): PolyfillPromise {
|
||||
return new PolyfillPromise(this._winjsPromise.then(onFulfilled, onRejected));
|
||||
let sync = true;
|
||||
let promise = new PolyfillPromise(this._winjsPromise.then(
|
||||
onFulfilled && function (value) {
|
||||
if (!sync) {
|
||||
onFulfilled(value);
|
||||
} else {
|
||||
setImmediate(onFulfilled, value);
|
||||
}
|
||||
},
|
||||
onRejected && function (err) {
|
||||
if (!sync) {
|
||||
onFulfilled(err);
|
||||
} else {
|
||||
setImmediate(onFulfilled, err);
|
||||
}
|
||||
}
|
||||
));
|
||||
sync = false;
|
||||
return promise;
|
||||
}
|
||||
|
||||
catch(onRejected?: any): PolyfillPromise {
|
||||
return new PolyfillPromise(this._winjsPromise.then(null, onRejected));
|
||||
return this.then(null, onRejected);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,33 +13,12 @@ suite('Errors', () => {
|
|||
assert.strictEqual(toErrorMessage(new Error('Foo Bar')), 'Foo Bar');
|
||||
|
||||
let error: any = new Error();
|
||||
error.status = 404;
|
||||
error.statusText = 'Not Found';
|
||||
assert.strictEqual(toErrorMessage(error), 'Not Found (HTTP 404)');
|
||||
|
||||
error = new Error();
|
||||
error.detail = {};
|
||||
error.detail.exception = {};
|
||||
error.detail.exception.message = 'Foo Bar';
|
||||
assert.strictEqual(toErrorMessage(error), 'Foo Bar');
|
||||
|
||||
error = new Error();
|
||||
error.detail = {};
|
||||
error.detail.error = {};
|
||||
error.detail.error.status = 404;
|
||||
error.detail.error.statusText = 'Not Found';
|
||||
assert.strictEqual(toErrorMessage(error), 'Not Found (HTTP 404)');
|
||||
|
||||
error = new Error();
|
||||
error.detail = {};
|
||||
error.detail.error = [];
|
||||
|
||||
let foo: any = {};
|
||||
error.detail.error.push(foo);
|
||||
foo.status = 404;
|
||||
foo.statusText = 'Not Found';
|
||||
assert.strictEqual(toErrorMessage(error), 'Not Found (HTTP 404)');
|
||||
|
||||
assert(toErrorMessage());
|
||||
assert(toErrorMessage(null));
|
||||
assert(toErrorMessage({}));
|
||||
|
|
|
@ -138,42 +138,6 @@ suite('Objects', () => {
|
|||
});
|
||||
});
|
||||
|
||||
test('derive', function () {
|
||||
|
||||
let someValue = 2;
|
||||
|
||||
function Base(): void {
|
||||
//example
|
||||
}
|
||||
(<any>Base).favoriteColor = 'blue';
|
||||
Base.prototype.test = function () { return 42; };
|
||||
|
||||
function Child(): void {
|
||||
//example
|
||||
}
|
||||
Child.prototype.test2 = function () { return 43; };
|
||||
Object.defineProperty(Child.prototype, 'getter', {
|
||||
get: function () { return someValue; },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
objects.derive(Base, Child);
|
||||
|
||||
let base = new Base();
|
||||
let child = new Child();
|
||||
|
||||
assert(base instanceof Base);
|
||||
assert(child instanceof Child);
|
||||
|
||||
assert.strictEqual(base.test, child.test);
|
||||
assert.strictEqual(base.test(), 42);
|
||||
assert.strictEqual(child.test2(), 43);
|
||||
assert.strictEqual((<any>Child).favoriteColor, 'blue');
|
||||
someValue = 4;
|
||||
assert.strictEqual(child.getter, 4);
|
||||
});
|
||||
|
||||
test('distinct', function () {
|
||||
let base = {
|
||||
one: 'one',
|
||||
|
|
|
@ -51,6 +51,33 @@ suite('Polyfill Promise', function () {
|
|||
});
|
||||
});
|
||||
|
||||
test('sync-then, NativePromise', function () {
|
||||
const actual: string[] = [];
|
||||
const promise = Promise.resolve(123).then(() => actual.push('inThen'));
|
||||
actual.push('afterThen');
|
||||
return promise.then(() => {
|
||||
assert.deepEqual(actual, ['afterThen', 'inThen']);
|
||||
});
|
||||
});
|
||||
|
||||
test('sync-then, WinJSPromise', function () {
|
||||
const actual: string[] = [];
|
||||
const promise = WinJSPromise.as(123).then(() => actual.push('inThen'));
|
||||
actual.push('afterThen');
|
||||
return promise.then(() => {
|
||||
assert.deepEqual(actual, ['inThen', 'afterThen']);
|
||||
});
|
||||
});
|
||||
|
||||
test('sync-then, PolyfillPromise', function () {
|
||||
const actual: string[] = [];
|
||||
const promise = PolyfillPromise.resolve(123).then(() => actual.push('inThen'));
|
||||
actual.push('afterThen');
|
||||
return promise.then(() => {
|
||||
assert.deepEqual(actual, ['afterThen', 'inThen']);
|
||||
});
|
||||
});
|
||||
|
||||
test('PolyfillPromise, executor has two params', function () {
|
||||
return new PolyfillPromise(function () {
|
||||
assert.equal(arguments.length, 2);
|
||||
|
|
|
@ -154,10 +154,15 @@ abstract class AbstractSortLinesAction extends EditorAction {
|
|||
return;
|
||||
}
|
||||
|
||||
var command = new SortLinesCommand(editor.getSelection(), this.descending);
|
||||
var commands: ICommand[] = [];
|
||||
var selections = editor.getSelections();
|
||||
|
||||
for (var i = 0; i < selections.length; i++) {
|
||||
commands.push(new SortLinesCommand(selections[i], this.descending));
|
||||
}
|
||||
|
||||
editor.pushUndoStop();
|
||||
editor.executeCommands(this.id, [command]);
|
||||
editor.executeCommands(this.id, commands);
|
||||
editor.pushUndoStop();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,11 +12,6 @@
|
|||
padding-left: 2px;
|
||||
}
|
||||
|
||||
.monaco-editor .lightbulb-glyph.hidden {
|
||||
display: none;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.monaco-editor .lightbulb-glyph:hover {
|
||||
cursor: pointer;
|
||||
/* transform: scale(1.3, 1.3); */
|
||||
|
|
|
@ -62,11 +62,9 @@ export class LightBulbWidget implements IDisposable, IContentWidget {
|
|||
// is being pressed -> hide the lightbulb and block future
|
||||
// showings until mouse is released
|
||||
this.hide();
|
||||
dom.addClass(this._domNode, 'hidden');
|
||||
const monitor = new GlobalMouseMoveMonitor<IStandardMouseMoveEventData>();
|
||||
monitor.startMonitoring(standardMouseMoveMerger, () => { }, () => {
|
||||
monitor.dispose();
|
||||
dom.removeClass(this._domNode, 'hidden');
|
||||
});
|
||||
}));
|
||||
this._disposables.push(this._editor.onDidChangeConfiguration(e => {
|
||||
|
|
|
@ -157,6 +157,7 @@ export interface IGalleryExtension {
|
|||
assets: IGalleryExtensionAssets;
|
||||
properties: IGalleryExtensionProperties;
|
||||
telemetryData: any;
|
||||
preview: boolean;
|
||||
}
|
||||
|
||||
export interface IGalleryMetadata {
|
||||
|
@ -324,4 +325,4 @@ export interface IExtensionTipsService {
|
|||
|
||||
export const ExtensionsLabel = localize('extensions', "Extensions");
|
||||
export const ExtensionsChannelId = 'extensions';
|
||||
export const PreferencesLabel = localize('preferences', "Preferences");
|
||||
export const PreferencesLabel = localize('preferences', "Preferences");
|
||||
|
|
|
@ -54,6 +54,7 @@ interface IRawGalleryExtension {
|
|||
publisher: { displayName: string, publisherId: string, publisherName: string; };
|
||||
versions: IRawGalleryExtensionVersion[];
|
||||
statistics: IRawGalleryExtensionStatistics[];
|
||||
flags: string;
|
||||
}
|
||||
|
||||
interface IRawGalleryQueryResult {
|
||||
|
@ -252,6 +253,10 @@ function getEngine(version: IRawGalleryExtensionVersion): string {
|
|||
return (values.length > 0 && values[0].value) || '';
|
||||
}
|
||||
|
||||
function getIsPreview(flags: string): boolean {
|
||||
return flags.indexOf('preview') !== -1;
|
||||
}
|
||||
|
||||
function toExtension(galleryExtension: IRawGalleryExtension, extensionsGalleryUrl: string, index: number, query: Query, querySource?: string): IGalleryExtension {
|
||||
const [version] = galleryExtension.versions;
|
||||
const assets = {
|
||||
|
@ -296,7 +301,8 @@ function toExtension(galleryExtension: IRawGalleryExtension, extensionsGalleryUr
|
|||
index: ((query.pageNumber - 1) * query.pageSize) + index,
|
||||
searchText: query.searchText,
|
||||
querySource
|
||||
}
|
||||
},
|
||||
preview: getIsPreview(galleryExtension.flags)
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ function readManifest(extensionPath: string): TPromise<{ manifest: IExtensionMan
|
|||
interface InstallableExtension {
|
||||
zipPath: string;
|
||||
id: string;
|
||||
metadata: IGalleryMetadata;
|
||||
metadata?: IGalleryMetadata;
|
||||
current?: ILocalExtension;
|
||||
}
|
||||
|
||||
|
@ -123,17 +123,14 @@ export class ExtensionManagementService implements IExtensionManagementService {
|
|||
|
||||
this._onInstallExtension.fire({ identifier, zipPath });
|
||||
|
||||
return this.galleryService.query({ names: [getGalleryExtensionId(manifest.publisher, manifest.name)], pageSize: 1 })
|
||||
.then(galleryResult => {
|
||||
const galleryExtension = galleryResult.firstPage[0];
|
||||
const metadata = galleryExtension ? <IGalleryMetadata>{ id: galleryExtension.identifier.uuid, publisherDisplayName: galleryExtension.publisherDisplayName, publisherId: galleryExtension.publisherId } : null;
|
||||
return this.installExtension({ zipPath, id: identifier.id, metadata })
|
||||
.then(
|
||||
local => this._onDidInstallExtension.fire({ identifier, zipPath, local }),
|
||||
error => { this._onDidInstallExtension.fire({ identifier, zipPath, error }); return TPromise.wrapError(error); }
|
||||
);
|
||||
});
|
||||
|
||||
return this.getMetadata(getGalleryExtensionId(manifest.publisher, manifest.name))
|
||||
.then(
|
||||
metadata => this.installExtension({ zipPath, id: identifier.id, metadata }),
|
||||
error => this.installExtension({ zipPath, id: identifier.id }))
|
||||
.then(
|
||||
local => this._onDidInstallExtension.fire({ identifier, zipPath, local }),
|
||||
error => { this._onDidInstallExtension.fire({ identifier, zipPath, error }); return TPromise.wrapError(error); }
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -298,6 +295,14 @@ export class ExtensionManagementService implements IExtensionManagementService {
|
|||
.then(() => local);
|
||||
}
|
||||
|
||||
private getMetadata(extensionName: string): TPromise<IGalleryMetadata> {
|
||||
return this.galleryService.query({ names: [extensionName], pageSize: 1 })
|
||||
.then(galleryResult => {
|
||||
const galleryExtension = galleryResult.firstPage[0];
|
||||
return galleryExtension ? <IGalleryMetadata>{ id: galleryExtension.identifier.uuid, publisherDisplayName: galleryExtension.publisherDisplayName, publisherId: galleryExtension.publisherId } : null;
|
||||
});
|
||||
}
|
||||
|
||||
private checkForRename(currentExtension: ILocalExtension, newExtension: ILocalExtension): TPromise<void> {
|
||||
// Check if the gallery id for current and new exensions are same, if not, remove the current one.
|
||||
if (currentExtension && getGalleryExtensionIdFromLocal(currentExtension) !== getGalleryExtensionIdFromLocal(newExtension)) {
|
||||
|
|
|
@ -49,7 +49,7 @@ export enum LifecyclePhase {
|
|||
Starting = 1,
|
||||
Restoring = 2,
|
||||
Running = 3,
|
||||
RunningForABit = 4,
|
||||
Eventually = 4,
|
||||
ShuttingDown = 5
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,6 @@ export class TabsTitleControl extends TitleControl {
|
|||
private tabDisposeables: IDisposable[];
|
||||
private blockRevealActiveTab: boolean;
|
||||
private dimension: Dimension;
|
||||
private editorToolbarWidth: number;
|
||||
|
||||
constructor(
|
||||
@IContextMenuService contextMenuService: IContextMenuService,
|
||||
|
@ -87,7 +86,6 @@ export class TabsTitleControl extends TitleControl {
|
|||
|
||||
this.tabDisposeables = [];
|
||||
this.editorLabels = [];
|
||||
this.editorToolbarWidth = 0;
|
||||
}
|
||||
|
||||
protected initActions(services: IInstantiationService): void {
|
||||
|
@ -541,25 +539,6 @@ export class TabsTitleControl extends TitleControl {
|
|||
return tabContainer;
|
||||
}
|
||||
|
||||
public updateEditorActionsToolbar(): void {
|
||||
super.updateEditorActionsToolbar();
|
||||
|
||||
this.editorToolbarWidth = this.getElementWidth(this.editorToolbarContainer);
|
||||
}
|
||||
|
||||
protected clearEditorActionsToolbar(): void {
|
||||
super.clearEditorActionsToolbar();
|
||||
|
||||
this.editorToolbarWidth = this.getElementWidth(this.editorToolbarContainer);
|
||||
}
|
||||
|
||||
private getElementWidth(element: HTMLElement): number {
|
||||
// We are using getBoundingClientRect() over offsetWidth for a reason: only the former will return subpixel sizes
|
||||
// whereas the other (offsetWidth) will round the value to the nearest number. For our layout code we really need
|
||||
// the sizes with their fractions to not cause rounding issues.
|
||||
return element.getBoundingClientRect().width;
|
||||
}
|
||||
|
||||
public layout(dimension: Dimension): void {
|
||||
if (!this.activeTab || !dimension) {
|
||||
return;
|
||||
|
@ -567,7 +546,7 @@ export class TabsTitleControl extends TitleControl {
|
|||
|
||||
this.dimension = dimension;
|
||||
|
||||
const visibleContainerWidth = this.dimension.width - this.editorToolbarWidth;
|
||||
const visibleContainerWidth = this.tabsContainer.offsetWidth;
|
||||
const totalContainerWidth = this.tabsContainer.scrollWidth;
|
||||
|
||||
// Update scrollbar
|
||||
|
|
|
@ -72,20 +72,33 @@ export class WorkbenchContributionsRegistry implements IWorkbenchContributionsRe
|
|||
this.instantiationService = instantiationService;
|
||||
this.lifecycleService = lifecycleService;
|
||||
|
||||
[LifecyclePhase.Starting, LifecyclePhase.Restoring, LifecyclePhase.Running, LifecyclePhase.RunningForABit, LifecyclePhase.ShuttingDown].forEach(phase => {
|
||||
[LifecyclePhase.Starting, LifecyclePhase.Restoring, LifecyclePhase.Running, LifecyclePhase.Eventually, LifecyclePhase.ShuttingDown].forEach(phase => {
|
||||
this.instantiateByPhase(instantiationService, lifecycleService, phase);
|
||||
});
|
||||
}
|
||||
|
||||
private instantiateByPhase(instantiationService: IInstantiationService, lifecycleService: ILifecycleService, phase: LifecyclePhase): void {
|
||||
lifecycleService.when(phase).then(() => {
|
||||
const toBeInstantiated = this.toBeInstantiated.get(phase);
|
||||
if (toBeInstantiated) {
|
||||
while (toBeInstantiated.length > 0) {
|
||||
instantiationService.createInstance(toBeInstantiated.shift());
|
||||
}
|
||||
|
||||
// Instantiate contributions directly when phase is already reached
|
||||
if (lifecycleService.phase >= phase) {
|
||||
this.doInstantiateByPhase(instantiationService, phase);
|
||||
}
|
||||
|
||||
// Otherwise wait for phase to be reached
|
||||
else {
|
||||
lifecycleService.when(phase).then(() => {
|
||||
this.doInstantiateByPhase(instantiationService, phase);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private doInstantiateByPhase(instantiationService: IInstantiationService, phase: LifecyclePhase): void {
|
||||
const toBeInstantiated = this.toBeInstantiated.get(phase);
|
||||
if (toBeInstantiated) {
|
||||
while (toBeInstantiated.length > 0) {
|
||||
instantiationService.createInstance(toBeInstantiated.shift());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -205,7 +205,7 @@ export class WorkbenchShell {
|
|||
// Set lifecycle phase to `Runnning For A Bit` after a short delay
|
||||
let timeoutHandle = setTimeout(() => {
|
||||
timeoutHandle = void 0;
|
||||
this.lifecycleService.phase = LifecyclePhase.RunningForABit;
|
||||
this.lifecycleService.phase = LifecyclePhase.Eventually;
|
||||
}, 3000);
|
||||
this.toUnbind.push({
|
||||
dispose: () => {
|
||||
|
|
|
@ -11,4 +11,4 @@ import { NodeCachedDataManager } from 'vs/workbench/parts/cache/node/nodeCachedD
|
|||
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
|
||||
// Register NodeCachedDataManager Contribution
|
||||
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(NodeCachedDataManager, LifecyclePhase.Running);
|
||||
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(NodeCachedDataManager, LifecyclePhase.Eventually);
|
|
@ -753,12 +753,13 @@ export class DebugService implements debug.IDebugService {
|
|||
return TPromise.wrapError(errors.create(message, { actions: [this.instantiationService.createInstance(debugactions.ConfigureAction, debugactions.ConfigureAction.ID, debugactions.ConfigureAction.LABEL), CloseAction] }));
|
||||
}
|
||||
|
||||
this.toDisposeOnSessionEnd.set(sessionId, []);
|
||||
const debugAnywayAction = new Action('debug.continue', nls.localize('debugAnyway', "Debug Anyway"), null, true, () => {
|
||||
this.messageService.hideAll();
|
||||
return this.doCreateProcess(root, resolvedConfig, sessionId);
|
||||
});
|
||||
|
||||
return this.runPreLaunchTask(root, resolvedConfig.preLaunchTask).then((taskSummary: ITaskSummary) => {
|
||||
return this.runPreLaunchTask(sessionId, root, resolvedConfig.preLaunchTask).then((taskSummary: ITaskSummary) => {
|
||||
const errorCount = resolvedConfig.preLaunchTask ? this.markerService.getStatistics().errors : 0;
|
||||
const successExitCode = taskSummary && taskSummary.exitCode === 0;
|
||||
const failureExitCode = taskSummary && taskSummary.exitCode !== undefined && taskSummary.exitCode !== 0;
|
||||
|
@ -845,7 +846,6 @@ export class DebugService implements debug.IDebugService {
|
|||
const process = this.model.addProcess(configuration, session);
|
||||
this.allProcesses.set(process.getId(), process);
|
||||
|
||||
this.toDisposeOnSessionEnd.set(session.getId(), []);
|
||||
if (client) {
|
||||
this.toDisposeOnSessionEnd.get(session.getId()).push(client);
|
||||
}
|
||||
|
@ -946,7 +946,7 @@ export class DebugService implements debug.IDebugService {
|
|||
});
|
||||
}
|
||||
|
||||
private runPreLaunchTask(root: IWorkspaceFolder, taskName: string): TPromise<ITaskSummary> {
|
||||
private runPreLaunchTask(sessionId: string, root: IWorkspaceFolder, taskName: string): TPromise<ITaskSummary> {
|
||||
if (!taskName) {
|
||||
return TPromise.as(null);
|
||||
}
|
||||
|
@ -957,29 +957,29 @@ export class DebugService implements debug.IDebugService {
|
|||
return TPromise.wrapError(errors.create(nls.localize('DebugTaskNotFound', "Could not find the preLaunchTask \'{0}\'.", taskName)));
|
||||
}
|
||||
|
||||
// If a task is missing the problem matcher the promise will never complete, so we need to have a workaround #35340
|
||||
let taskStarted = false;
|
||||
const promise = this.taskService.getActiveTasks().then(tasks => {
|
||||
if (tasks.filter(t => t._id === task._id).length) {
|
||||
// task is already running - nothing to do.
|
||||
return TPromise.as(null);
|
||||
}
|
||||
|
||||
this.toDisposeOnSessionEnd.get(sessionId).push(this.taskService.addOneTimeListener(TaskServiceEvents.Active, () => taskStarted = true));
|
||||
const taskPromise = this.taskService.run(task);
|
||||
if (task.isBackground) {
|
||||
return new TPromise((c, e) => this.toDispose.push(this.taskService.addOneTimeListener(TaskServiceEvents.Inactive, () => c(null))));
|
||||
return new TPromise((c, e) => this.toDisposeOnSessionEnd.get(sessionId).push(this.taskService.addOneTimeListener(TaskServiceEvents.Inactive, () => c(null))));
|
||||
}
|
||||
|
||||
return taskPromise;
|
||||
});
|
||||
|
||||
return new TPromise((c, e) => {
|
||||
// If a task is missing the problem matcher the promise will never complete, so we need to have a workaround #35340
|
||||
let taskStarted = false;
|
||||
promise.then(result => {
|
||||
taskStarted = true;
|
||||
c(result);
|
||||
}, error => e(error));
|
||||
|
||||
this.toDispose.push(this.taskService.addOneTimeListener(TaskServiceEvents.Active, () => taskStarted = true));
|
||||
setTimeout(() => {
|
||||
if (!taskStarted) {
|
||||
e({ severity: severity.Error, message: nls.localize('taskNotTracked', "The preLaunchTask '{0}' cannot be tracked.", taskName) });
|
||||
|
|
|
@ -153,6 +153,7 @@ export class ExtensionEditor extends BaseEditor {
|
|||
private icon: HTMLImageElement;
|
||||
private name: HTMLElement;
|
||||
private identifier: HTMLElement;
|
||||
private preview: HTMLElement;
|
||||
private license: HTMLElement;
|
||||
private publisher: HTMLElement;
|
||||
private installCount: HTMLElement;
|
||||
|
@ -215,6 +216,7 @@ export class ExtensionEditor extends BaseEditor {
|
|||
const title = append(details, $('.title'));
|
||||
this.name = append(title, $('span.name.clickable', { title: localize('name', "Extension name") }));
|
||||
this.identifier = append(title, $('span.identifier', { title: localize('extension id', "Extension identifier") }));
|
||||
this.preview = append(title, $('span.preview', { title: localize('preview', "Preview") }));
|
||||
|
||||
const subtitle = append(details, $('.subtitle'));
|
||||
this.publisher = append(subtitle, $('span.publisher.clickable', { title: localize('publisher', "Publisher name") }));
|
||||
|
@ -286,6 +288,11 @@ export class ExtensionEditor extends BaseEditor {
|
|||
|
||||
this.name.textContent = extension.displayName;
|
||||
this.identifier.textContent = extension.id;
|
||||
if (extension.preview) {
|
||||
this.preview.textContent = localize('preview', "Preview");
|
||||
} else {
|
||||
this.preview.textContent = null;
|
||||
}
|
||||
|
||||
this.publisher.textContent = extension.publisherDisplayName;
|
||||
this.description.textContent = extension.description;
|
||||
|
|
|
@ -62,6 +62,19 @@
|
|||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.vs .extension-editor > .header > .details > .title > .preview {
|
||||
color: white;
|
||||
}
|
||||
|
||||
.extension-editor > .header > .details > .title > .preview {
|
||||
background: rgb(214, 63, 38);
|
||||
font-size: 10px;
|
||||
font-style: italic;
|
||||
margin-left: 10px;
|
||||
padding: 0px 4px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.extension-editor > .header > .details > .subtitle {
|
||||
padding-top: 6px;
|
||||
white-space: nowrap;
|
||||
|
@ -324,4 +337,4 @@
|
|||
font-size: 90%;
|
||||
font-weight: 600;
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ export interface IExtension {
|
|||
disabledForWorkspace: boolean;
|
||||
dependencies: string[];
|
||||
telemetryData: any;
|
||||
preview: boolean;
|
||||
getManifest(): TPromise<IExtensionManifest>;
|
||||
getReadme(): TPromise<string>;
|
||||
getChangelog(): TPromise<string>;
|
||||
|
@ -88,4 +89,4 @@ export const AutoUpdateConfigurationKey = 'extensions.autoUpdate';
|
|||
export interface IExtensionsConfiguration {
|
||||
autoUpdate: boolean;
|
||||
ignoreRecommendations: boolean;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -179,6 +179,10 @@ class Extension implements IExtension {
|
|||
}
|
||||
}
|
||||
|
||||
get preview(): boolean {
|
||||
return this.gallery ? this.gallery.preview : false;
|
||||
}
|
||||
|
||||
getManifest(): TPromise<IExtensionManifest> {
|
||||
if (this.gallery) {
|
||||
if (this.gallery.assets.manifest) {
|
||||
|
@ -935,4 +939,4 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService {
|
|||
this.syncDelayer.cancel();
|
||||
this.disposables = dispose(this.disposables);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ class OpenSCMViewletAction extends ToggleViewletAction {
|
|||
}
|
||||
|
||||
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench)
|
||||
.registerWorkbenchContribution(DirtyDiffWorkbenchController, LifecyclePhase.Starting);
|
||||
.registerWorkbenchContribution(DirtyDiffWorkbenchController, LifecyclePhase.Running);
|
||||
|
||||
const viewletDescriptor = new ViewletDescriptor(
|
||||
SCMViewlet,
|
||||
|
@ -45,10 +45,10 @@ Registry.as<ViewletRegistry>(ViewletExtensions.Viewlets)
|
|||
.registerViewlet(viewletDescriptor);
|
||||
|
||||
Registry.as(WorkbenchExtensions.Workbench)
|
||||
.registerWorkbenchContribution(StatusUpdater, LifecyclePhase.Starting);
|
||||
.registerWorkbenchContribution(StatusUpdater, LifecyclePhase.Running);
|
||||
|
||||
Registry.as(WorkbenchExtensions.Workbench)
|
||||
.registerWorkbenchContribution(StatusBarController, LifecyclePhase.Starting);
|
||||
.registerWorkbenchContribution(StatusBarController, LifecyclePhase.Running);
|
||||
|
||||
// Register Action to Open Viewlet
|
||||
Registry.as<IWorkbenchActionRegistry>(WorkbenchActionExtensions.WorkbenchActions).registerWorkbenchAction(
|
||||
|
|
|
@ -11,4 +11,4 @@ import { WorkspaceStats } from 'vs/workbench/parts/stats/node/workspaceStats';
|
|||
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
|
||||
// Register Workspace Stats Contribution
|
||||
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(WorkspaceStats, LifecyclePhase.RunningForABit);
|
||||
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(WorkspaceStats, LifecyclePhase.Eventually);
|
|
@ -372,7 +372,11 @@ export class FileService implements IFileService {
|
|||
decoder.end();
|
||||
}
|
||||
if (fd) {
|
||||
fs.close(fd, err => { });
|
||||
fs.close(fd, err => {
|
||||
if (err) {
|
||||
this.options.errorLogger(err.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
'use strict';
|
||||
/// <reference path="employee.ts" />
|
||||
var Workforce;
|
||||
(function (Workforce_1) {
|
||||
var Company = (function () {
|
||||
function Company() {
|
||||
}
|
||||
return Company;
|
||||
})();
|
||||
(function (property, Workforce, IEmployee) {
|
||||
if (property === void 0) { property = employees; }
|
||||
if (IEmployee === void 0) { IEmployee = []; }
|
||||
property;
|
||||
calculateMonthlyExpenses();
|
||||
{
|
||||
var result = 0;
|
||||
for (var i = 0; i < employees.length; i++) {
|
||||
result += employees[i].calculatePay();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
});
|
||||
})(Workforce || (Workforce = {}));
|
|
@ -0,0 +1,117 @@
|
|||
'use strict';
|
||||
var Conway;
|
||||
(function (Conway) {
|
||||
var Cell = (function () {
|
||||
function Cell() {
|
||||
}
|
||||
return Cell;
|
||||
})();
|
||||
(function (property, number, property, number, property, boolean) {
|
||||
if (property === void 0) { property = row; }
|
||||
if (property === void 0) { property = col; }
|
||||
if (property === void 0) { property = live; }
|
||||
});
|
||||
var GameOfLife = (function () {
|
||||
function GameOfLife() {
|
||||
}
|
||||
return GameOfLife;
|
||||
})();
|
||||
(function () {
|
||||
property;
|
||||
gridSize = 50;
|
||||
property;
|
||||
canvasSize = 600;
|
||||
property;
|
||||
lineColor = '#cdcdcd';
|
||||
property;
|
||||
liveColor = '#666';
|
||||
property;
|
||||
deadColor = '#eee';
|
||||
property;
|
||||
initialLifeProbability = 0.5;
|
||||
property;
|
||||
animationRate = 60;
|
||||
property;
|
||||
cellSize = 0;
|
||||
property;
|
||||
context: ICanvasRenderingContext2D;
|
||||
property;
|
||||
world = createWorld();
|
||||
circleOfLife();
|
||||
function createWorld() {
|
||||
return travelWorld(function (cell) {
|
||||
cell.live = Math.random() < initialLifeProbability;
|
||||
return cell;
|
||||
});
|
||||
}
|
||||
function circleOfLife() {
|
||||
world = travelWorld(function (cell) {
|
||||
cell = world[cell.row][cell.col];
|
||||
draw(cell);
|
||||
return resolveNextGeneration(cell);
|
||||
});
|
||||
setTimeout(function () { circleOfLife(); }, animationRate);
|
||||
}
|
||||
function resolveNextGeneration(cell) {
|
||||
var count = countNeighbors(cell);
|
||||
var newCell = new Cell(cell.row, cell.col, cell.live);
|
||||
if (count < 2 || count > 3)
|
||||
newCell.live = false;
|
||||
else if (count == 3)
|
||||
newCell.live = true;
|
||||
return newCell;
|
||||
}
|
||||
function countNeighbors(cell) {
|
||||
var neighbors = 0;
|
||||
for (var row = -1; row <= 1; row++) {
|
||||
for (var col = -1; col <= 1; col++) {
|
||||
if (row == 0 && col == 0)
|
||||
continue;
|
||||
if (isAlive(cell.row + row, cell.col + col)) {
|
||||
neighbors++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return neighbors;
|
||||
}
|
||||
function isAlive(row, col) {
|
||||
// todo - need to guard with worl[row] exists?
|
||||
if (row < 0 || col < 0 || row >= gridSize || col >= gridSize)
|
||||
return false;
|
||||
return world[row][col].live;
|
||||
}
|
||||
function travelWorld(callback) {
|
||||
var result = [];
|
||||
for (var row = 0; row < gridSize; row++) {
|
||||
var rowData = [];
|
||||
for (var col = 0; col < gridSize; col++) {
|
||||
rowData.push(callback(new Cell(row, col, false)));
|
||||
}
|
||||
result.push(rowData);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function draw(cell) {
|
||||
if (context == null)
|
||||
context = createDrawingContext();
|
||||
if (cellSize == 0)
|
||||
cellSize = canvasSize / gridSize;
|
||||
context.strokeStyle = lineColor;
|
||||
context.strokeRect(cell.row * cellSize, cell.col * cellSize, cellSize, cellSize);
|
||||
context.fillStyle = cell.live ? liveColor : deadColor;
|
||||
context.fillRect(cell.row * cellSize, cell.col * cellSize, cellSize, cellSize);
|
||||
}
|
||||
function createDrawingContext() {
|
||||
var canvas = document.getElementById('conway-canvas');
|
||||
if (canvas == null) {
|
||||
canvas = document.createElement('canvas');
|
||||
canvas.id = "conway-canvas";
|
||||
canvas.width = canvasSize;
|
||||
canvas.height = canvasSize;
|
||||
document.body.appendChild(canvas);
|
||||
}
|
||||
return canvas.getContext('2d');
|
||||
}
|
||||
});
|
||||
})(Conway || (Conway = {}));
|
||||
var game = new Conway.GameOfLife();
|
|
@ -0,0 +1,38 @@
|
|||
'use strict';
|
||||
var Workforce;
|
||||
(function (Workforce) {
|
||||
var Employee = (function () {
|
||||
function Employee() {
|
||||
}
|
||||
return Employee;
|
||||
})();
|
||||
(property);
|
||||
name: string, property;
|
||||
basepay: number;
|
||||
implements;
|
||||
IEmployee;
|
||||
{
|
||||
name;
|
||||
basepay;
|
||||
}
|
||||
var SalesEmployee = (function () {
|
||||
function SalesEmployee() {
|
||||
}
|
||||
return SalesEmployee;
|
||||
})();
|
||||
();
|
||||
Employee(name, basepay);
|
||||
{
|
||||
function calculatePay() {
|
||||
var multiplier = (document.getElementById("mult")), as = any, value;
|
||||
return _super.calculatePay.call(this) * multiplier + bonus;
|
||||
}
|
||||
}
|
||||
var employee = new Employee('Bob', 1000);
|
||||
var salesEmployee = new SalesEmployee('Jim', 800, 400);
|
||||
salesEmployee.calclatePay(); // error: No member 'calclatePay' on SalesEmployee
|
||||
})(Workforce || (Workforce = {}));
|
||||
extern;
|
||||
var $;
|
||||
var s = Workforce.salesEmployee.calculatePay();
|
||||
$('#results').text(s);
|
|
@ -0,0 +1,24 @@
|
|||
'use strict';
|
||||
var M;
|
||||
(function (M) {
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
})();
|
||||
(function (x, property, number) {
|
||||
if (property === void 0) { property = w; }
|
||||
var local = 1;
|
||||
// unresolved symbol because x is local
|
||||
//self.x++;
|
||||
self.w--; // ok because w is a property
|
||||
property;
|
||||
f = function (y) {
|
||||
return y + x + local + w + self.w;
|
||||
};
|
||||
function sum(z) {
|
||||
return z + f(z) + w + self.w;
|
||||
}
|
||||
});
|
||||
})(M || (M = {}));
|
||||
var c = new M.C(12, 5);
|
|
@ -0,0 +1,121 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head id='headID'>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<title>Strada </title>
|
||||
<link href="site.css" rel="stylesheet" type="text/css" />
|
||||
<script src="jquery-1.4.1.js"></script>
|
||||
<script src="../compiler/dtree.js" type="text/javascript"></script>
|
||||
<script src="../compiler/typescript.js" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
// Compile strada source into resulting javascript
|
||||
function compile(prog, libText) {
|
||||
var outfile = {
|
||||
source: "",
|
||||
Write: function (s) { this.source += s; },
|
||||
WriteLine: function (s) { this.source += s + "\r"; },
|
||||
}
|
||||
|
||||
var parseErrors = []
|
||||
|
||||
var compiler=new Tools.TypeScriptCompiler(outfile,true);
|
||||
compiler.setErrorCallback(function(start,len, message) { parseErrors.push({start:start, len:len, message:message}); });
|
||||
compiler.addUnit(libText,"lib.ts");
|
||||
compiler.addUnit(prog,"input.ts");
|
||||
compiler.typeCheck();
|
||||
compiler.emit();
|
||||
|
||||
if(parseErrors.length > 0 ) {
|
||||
//throw new Error(parseErrors);
|
||||
}
|
||||
|
||||
while(outfile.source[0] == '/' && outfile.source[1] == '/' && outfile.source[2] == ' ') {
|
||||
outfile.source = outfile.source.slice(outfile.source.indexOf('\r')+1);
|
||||
}
|
||||
var errorPrefix = "";
|
||||
for(var i = 0;i<parseErrors.length;i++) {
|
||||
errorPrefix += "// Error: (" + parseErrors[i].start + "," + parseErrors[i].len + ") " + parseErrors[i].message + "\r";
|
||||
}
|
||||
|
||||
return errorPrefix + outfile.source;
|
||||
}
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
|
||||
var libText = "";
|
||||
$.get("../compiler/lib.ts", function(newLibText) {
|
||||
libText = newLibText;
|
||||
});
|
||||
|
||||
|
||||
// execute the javascript in the compiledOutput pane
|
||||
function execute() {
|
||||
$('#compilation').text("Running...");
|
||||
var txt = $('#compiledOutput').val();
|
||||
var res;
|
||||
try {
|
||||
var ret = eval(txt);
|
||||
res = "Ran successfully!";
|
||||
} catch(e) {
|
||||
res = "Exception thrown: " + e;
|
||||
}
|
||||
$('#compilation').text(String(res));
|
||||
}
|
||||
|
||||
// recompile the stradaSrc and populate the compiledOutput pane
|
||||
function srcUpdated() {
|
||||
var newText = $('#stradaSrc').val();
|
||||
var compiledSource;
|
||||
try {
|
||||
compiledSource = compile(newText, libText);
|
||||
} catch (e) {
|
||||
compiledSource = "//Parse error"
|
||||
for(var i in e)
|
||||
compiledSource += "\r// " + e[i];
|
||||
}
|
||||
$('#compiledOutput').val(compiledSource);
|
||||
}
|
||||
|
||||
// Populate the stradaSrc pane with one of the built in samples
|
||||
function exampleSelectionChanged() {
|
||||
var examples = document.getElementById('examples');
|
||||
var selectedExample = examples.options[examples.selectedIndex].value;
|
||||
if (selectedExample != "") {
|
||||
$.get('examples/' + selectedExample, function (srcText) {
|
||||
$('#stradaSrc').val(srcText);
|
||||
setTimeout(srcUpdated,100);
|
||||
}, function (err) {
|
||||
console.log(err);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>TypeScript</h1>
|
||||
<br />
|
||||
<select id="examples" onchange='exampleSelectionChanged()'>
|
||||
<option value="">Select...</option>
|
||||
<option value="small.ts">Small</option>
|
||||
<option value="employee.ts">Employees</option>
|
||||
<option value="conway.ts">Conway Game of Life</option>
|
||||
<option value="typescript.ts">TypeScript Compiler</option>
|
||||
</select>
|
||||
|
||||
<div>
|
||||
<textarea id='stradaSrc' rows='40' cols='80' onchange='srcUpdated()' onkeyup='srcUpdated()' spellcheck="false">
|
||||
//Type your TypeScript here...
|
||||
</textarea>
|
||||
<textarea id='compiledOutput' rows='40' cols='80' spellcheck="false">
|
||||
//Compiled code will show up here...
|
||||
</textarea>
|
||||
<br />
|
||||
<button onclick='execute()'/>Run</button>
|
||||
<div id='compilation'>Press 'run' to execute code...</div>
|
||||
<div id='results'>...write your results into #results...</div>
|
||||
</div>
|
||||
<div id='bod' style='display:none'></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,23 @@
|
|||
'use strict';
|
||||
/// <reference path="employee.ts" />
|
||||
var Workforce;
|
||||
(function (Workforce_1) {
|
||||
var Company = (function () {
|
||||
function Company() {
|
||||
}
|
||||
return Company;
|
||||
})();
|
||||
(function (property, Workforce, IEmployee) {
|
||||
if (property === void 0) { property = employees; }
|
||||
if (IEmployee === void 0) { IEmployee = []; }
|
||||
property;
|
||||
calculateMonthlyExpenses();
|
||||
{
|
||||
var result = 0;
|
||||
for (var i = 0; i < employees.length; i++) {
|
||||
result += employees[i].calculatePay();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
});
|
||||
})(Workforce || (Workforce = {}));
|
|
@ -0,0 +1,117 @@
|
|||
'use strict';
|
||||
var Conway;
|
||||
(function (Conway) {
|
||||
var Cell = (function () {
|
||||
function Cell() {
|
||||
}
|
||||
return Cell;
|
||||
})();
|
||||
(function (property, number, property, number, property, boolean) {
|
||||
if (property === void 0) { property = row; }
|
||||
if (property === void 0) { property = col; }
|
||||
if (property === void 0) { property = live; }
|
||||
});
|
||||
var GameOfLife = (function () {
|
||||
function GameOfLife() {
|
||||
}
|
||||
return GameOfLife;
|
||||
})();
|
||||
(function () {
|
||||
property;
|
||||
gridSize = 50;
|
||||
property;
|
||||
canvasSize = 600;
|
||||
property;
|
||||
lineColor = '#cdcdcd';
|
||||
property;
|
||||
liveColor = '#666';
|
||||
property;
|
||||
deadColor = '#eee';
|
||||
property;
|
||||
initialLifeProbability = 0.5;
|
||||
property;
|
||||
animationRate = 60;
|
||||
property;
|
||||
cellSize = 0;
|
||||
property;
|
||||
context: ICanvasRenderingContext2D;
|
||||
property;
|
||||
world = createWorld();
|
||||
circleOfLife();
|
||||
function createWorld() {
|
||||
return travelWorld(function (cell) {
|
||||
cell.live = Math.random() < initialLifeProbability;
|
||||
return cell;
|
||||
});
|
||||
}
|
||||
function circleOfLife() {
|
||||
world = travelWorld(function (cell) {
|
||||
cell = world[cell.row][cell.col];
|
||||
draw(cell);
|
||||
return resolveNextGeneration(cell);
|
||||
});
|
||||
setTimeout(function () { circleOfLife(); }, animationRate);
|
||||
}
|
||||
function resolveNextGeneration(cell) {
|
||||
var count = countNeighbors(cell);
|
||||
var newCell = new Cell(cell.row, cell.col, cell.live);
|
||||
if (count < 2 || count > 3)
|
||||
newCell.live = false;
|
||||
else if (count == 3)
|
||||
newCell.live = true;
|
||||
return newCell;
|
||||
}
|
||||
function countNeighbors(cell) {
|
||||
var neighbors = 0;
|
||||
for (var row = -1; row <= 1; row++) {
|
||||
for (var col = -1; col <= 1; col++) {
|
||||
if (row == 0 && col == 0)
|
||||
continue;
|
||||
if (isAlive(cell.row + row, cell.col + col)) {
|
||||
neighbors++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return neighbors;
|
||||
}
|
||||
function isAlive(row, col) {
|
||||
// todo - need to guard with worl[row] exists?
|
||||
if (row < 0 || col < 0 || row >= gridSize || col >= gridSize)
|
||||
return false;
|
||||
return world[row][col].live;
|
||||
}
|
||||
function travelWorld(callback) {
|
||||
var result = [];
|
||||
for (var row = 0; row < gridSize; row++) {
|
||||
var rowData = [];
|
||||
for (var col = 0; col < gridSize; col++) {
|
||||
rowData.push(callback(new Cell(row, col, false)));
|
||||
}
|
||||
result.push(rowData);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function draw(cell) {
|
||||
if (context == null)
|
||||
context = createDrawingContext();
|
||||
if (cellSize == 0)
|
||||
cellSize = canvasSize / gridSize;
|
||||
context.strokeStyle = lineColor;
|
||||
context.strokeRect(cell.row * cellSize, cell.col * cellSize, cellSize, cellSize);
|
||||
context.fillStyle = cell.live ? liveColor : deadColor;
|
||||
context.fillRect(cell.row * cellSize, cell.col * cellSize, cellSize, cellSize);
|
||||
}
|
||||
function createDrawingContext() {
|
||||
var canvas = document.getElementById('conway-canvas');
|
||||
if (canvas == null) {
|
||||
canvas = document.createElement('canvas');
|
||||
canvas.id = "conway-canvas";
|
||||
canvas.width = canvasSize;
|
||||
canvas.height = canvasSize;
|
||||
document.body.appendChild(canvas);
|
||||
}
|
||||
return canvas.getContext('2d');
|
||||
}
|
||||
});
|
||||
})(Conway || (Conway = {}));
|
||||
var game = new Conway.GameOfLife();
|
|
@ -0,0 +1,38 @@
|
|||
'use strict';
|
||||
var Workforce;
|
||||
(function (Workforce) {
|
||||
var Employee = (function () {
|
||||
function Employee() {
|
||||
}
|
||||
return Employee;
|
||||
})();
|
||||
(property);
|
||||
name: string, property;
|
||||
basepay: number;
|
||||
implements;
|
||||
IEmployee;
|
||||
{
|
||||
name;
|
||||
basepay;
|
||||
}
|
||||
var SalesEmployee = (function () {
|
||||
function SalesEmployee() {
|
||||
}
|
||||
return SalesEmployee;
|
||||
})();
|
||||
();
|
||||
Employee(name, basepay);
|
||||
{
|
||||
function calculatePay() {
|
||||
var multiplier = (document.getElementById("mult")), as = any, value;
|
||||
return _super.calculatePay.call(this) * multiplier + bonus;
|
||||
}
|
||||
}
|
||||
var employee = new Employee('Bob', 1000);
|
||||
var salesEmployee = new SalesEmployee('Jim', 800, 400);
|
||||
salesEmployee.calclatePay(); // error: No member 'calclatePay' on SalesEmployee
|
||||
})(Workforce || (Workforce = {}));
|
||||
extern;
|
||||
var $;
|
||||
var s = Workforce.salesEmployee.calculatePay();
|
||||
$('#results').text(s);
|
|
@ -0,0 +1,24 @@
|
|||
'use strict';
|
||||
var M;
|
||||
(function (M) {
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
})();
|
||||
(function (x, property, number) {
|
||||
if (property === void 0) { property = w; }
|
||||
var local = 1;
|
||||
// unresolved symbol because x is local
|
||||
//self.x++;
|
||||
self.w--; // ok because w is a property
|
||||
property;
|
||||
f = function (y) {
|
||||
return y + x + local + w + self.w;
|
||||
};
|
||||
function sum(z) {
|
||||
return z + f(z) + w + self.w;
|
||||
}
|
||||
});
|
||||
})(M || (M = {}));
|
||||
var c = new M.C(12, 5);
|
|
@ -0,0 +1,40 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------
|
||||
The base color for this template is #5c87b2. If you'd like
|
||||
to use a different color start by replacing all instances of
|
||||
#5c87b2 with your new color.
|
||||
----------------------------------------------------------*/
|
||||
body
|
||||
{
|
||||
background-color: #5c87b2;
|
||||
font-size: .75em;
|
||||
font-family: Segoe UI, Verdana, Helvetica, Sans-Serif;
|
||||
margin: 8px;
|
||||
padding: 0;
|
||||
color: #696969;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4, h5, h6
|
||||
{
|
||||
color: #000;
|
||||
font-size: 40px;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
textarea
|
||||
{
|
||||
font-family: Consolas
|
||||
}
|
||||
|
||||
#results
|
||||
{
|
||||
margin-top: 2em;
|
||||
margin-left: 2em;
|
||||
color: black;
|
||||
font-size: medium;
|
||||
}
|
||||
|
Loading…
Reference in a new issue