Merge commit 'be3e8236086165e5e45a5a10783823874b3f3ebd' as 'lib/vscode'
This commit is contained in:
2
lib/vscode/extensions/razor/.vscodeignore
Normal file
2
lib/vscode/extensions/razor/.vscodeignore
Normal file
@ -0,0 +1,2 @@
|
||||
test/**
|
||||
cgmanifest.json
|
17
lib/vscode/extensions/razor/cgmanifest.json
Normal file
17
lib/vscode/extensions/razor/cgmanifest.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"registrations": [
|
||||
{
|
||||
"component": {
|
||||
"type": "git",
|
||||
"git": {
|
||||
"name": "demyte/language-cshtml",
|
||||
"repositoryUrl": "https://github.com/demyte/language-cshtml",
|
||||
"commitHash": "e6e54d5a86a28cc1e44609a32aaa10a244cd3f81"
|
||||
}
|
||||
},
|
||||
"license": "MIT",
|
||||
"version": "0.3.0"
|
||||
}
|
||||
],
|
||||
"version": 1
|
||||
}
|
22
lib/vscode/extensions/razor/language-configuration.json
Normal file
22
lib/vscode/extensions/razor/language-configuration.json
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"comments": {
|
||||
"blockComment": [ "<!--", "-->" ]
|
||||
},
|
||||
"brackets": [
|
||||
["<!--", "-->"],
|
||||
["{", "}"],
|
||||
["(", ")"]
|
||||
],
|
||||
"autoClosingPairs": [
|
||||
{ "open": "{", "close": "}"},
|
||||
{ "open": "[", "close": "]"},
|
||||
{ "open": "(", "close": ")" },
|
||||
{ "open": "'", "close": "'" },
|
||||
{ "open": "\"", "close": "\"" }
|
||||
],
|
||||
"surroundingPairs": [
|
||||
{ "open": "'", "close": "'" },
|
||||
{ "open": "\"", "close": "\"" },
|
||||
{ "open": "<", "close": ">" }
|
||||
]
|
||||
}
|
33
lib/vscode/extensions/razor/package.json
Normal file
33
lib/vscode/extensions/razor/package.json
Normal file
@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "razor",
|
||||
"displayName": "%displayName%",
|
||||
"description": "%description%",
|
||||
"version": "1.0.0",
|
||||
"publisher": "vscode",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"vscode": "0.10.x"
|
||||
},
|
||||
"scripts": {
|
||||
"update-grammar": "node ../../build/npm/update-grammar.js demyte/language-cshtml grammars/cshtml.json ./syntaxes/cshtml.tmLanguage.json"
|
||||
},
|
||||
"contributes": {
|
||||
"languages": [{
|
||||
"id": "razor",
|
||||
"extensions": [ ".cshtml"],
|
||||
"aliases": [ "Razor", "razor" ],
|
||||
"mimetypes": ["text/x-cshtml"],
|
||||
"configuration": "./language-configuration.json"
|
||||
}],
|
||||
"grammars": [{
|
||||
"language": "razor",
|
||||
"scopeName": "text.html.cshtml",
|
||||
"path": "./syntaxes/cshtml.tmLanguage.json",
|
||||
"embeddedLanguages": {
|
||||
"section.embedded.source.cshtml": "csharp",
|
||||
"source.css": "css",
|
||||
"source.js": "javascript"
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
4
lib/vscode/extensions/razor/package.nls.json
Normal file
4
lib/vscode/extensions/razor/package.nls.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"displayName": "Razor Language Basics",
|
||||
"description": "Provides syntax highlighting, bracket matching and folding in Razor files."
|
||||
}
|
341
lib/vscode/extensions/razor/syntaxes/cshtml.tmLanguage.json
Normal file
341
lib/vscode/extensions/razor/syntaxes/cshtml.tmLanguage.json
Normal file
@ -0,0 +1,341 @@
|
||||
{
|
||||
"information_for_contributors": [
|
||||
"This file has been converted from https://github.com/demyte/language-cshtml/blob/master/grammars/cshtml.json",
|
||||
"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/demyte/language-cshtml/commit/e6e54d5a86a28cc1e44609a32aaa10a244cd3f81",
|
||||
"name": "ASP.NET Razor",
|
||||
"scopeName": "text.html.cshtml",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#razor-directives"
|
||||
},
|
||||
{
|
||||
"include": "#razor-code-block"
|
||||
},
|
||||
{
|
||||
"include": "#razor-else-if"
|
||||
},
|
||||
{
|
||||
"include": "#razor-if"
|
||||
},
|
||||
{
|
||||
"include": "#razor-else"
|
||||
},
|
||||
{
|
||||
"include": "#razor-foreach"
|
||||
},
|
||||
{
|
||||
"include": "#explicit-razor-expression"
|
||||
},
|
||||
{
|
||||
"include": "#implicit-razor-expression"
|
||||
},
|
||||
{
|
||||
"include": "text.html.basic"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
"comments": {
|
||||
"begin": "@\\*",
|
||||
"captures": {
|
||||
"0": {
|
||||
"name": "punctuation.definition.comment.source.cshtml"
|
||||
}
|
||||
},
|
||||
"end": "\\*@",
|
||||
"name": "comment.block.cshtml"
|
||||
},
|
||||
"razor-directives": {
|
||||
"name": "meta.directive.cshtml",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#using-directive"
|
||||
},
|
||||
{
|
||||
"include": "#model-directive"
|
||||
},
|
||||
{
|
||||
"include": "#inherits-directive"
|
||||
},
|
||||
{
|
||||
"include": "#inject-directive"
|
||||
},
|
||||
{
|
||||
"include": "#implements-directive"
|
||||
},
|
||||
{
|
||||
"include": "#layout-directive"
|
||||
},
|
||||
{
|
||||
"include": "#page-directive"
|
||||
},
|
||||
{
|
||||
"include": "#functions-directive"
|
||||
}
|
||||
]
|
||||
},
|
||||
"explicit-razor-expression": {
|
||||
"name": "meta.expression.explicit.cshtml",
|
||||
"begin": "(@)\\(",
|
||||
"captures": {
|
||||
"0": {
|
||||
"name": "keyword.control.cshtml"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"include": "source.cs"
|
||||
}
|
||||
],
|
||||
"end": "\\)"
|
||||
},
|
||||
"implicit-razor-expression": {
|
||||
"name": "meta.expression.implicit.cshtml",
|
||||
"begin": "(@)([a-zA-Z0-9\\.\\_\\(\\)]+)",
|
||||
"captures": {
|
||||
"0": {
|
||||
"name": "keyword.control.cshtml"
|
||||
}
|
||||
},
|
||||
"end": "$"
|
||||
},
|
||||
"using-directive": {
|
||||
"name": "meta.directive.using.cshtml",
|
||||
"begin": "(@using)\\s+",
|
||||
"captures": {
|
||||
"0": {
|
||||
"name": "keyword.control.cshtml"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#csharp-namespace-identifier"
|
||||
}
|
||||
],
|
||||
"end": "$"
|
||||
},
|
||||
"model-directive": {
|
||||
"name": "meta.directive.model.cshtml",
|
||||
"begin": "(@model)\\s+",
|
||||
"captures": {
|
||||
"0": {
|
||||
"name": "keyword.control.cshtml"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#csharp-type-name"
|
||||
}
|
||||
],
|
||||
"end": "$"
|
||||
},
|
||||
"inherits-directive": {
|
||||
"name": "meta.directive.inherits.cshtml",
|
||||
"begin": "(@inherits)\\s+",
|
||||
"captures": {
|
||||
"0": {
|
||||
"name": "keyword.control.cshtml"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#csharp-type-name"
|
||||
}
|
||||
],
|
||||
"end": "$"
|
||||
},
|
||||
"inject-directive": {
|
||||
"name": "meta.directive.inject.cshtml",
|
||||
"begin": "(@inject)\\s+",
|
||||
"captures": {
|
||||
"0": {
|
||||
"name": "keyword.control.cshtml"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#csharp-type-name"
|
||||
}
|
||||
],
|
||||
"end": "$"
|
||||
},
|
||||
"implements-directive": {
|
||||
"name": "meta.directive.implements.cshtml",
|
||||
"begin": "(@implements)\\s+",
|
||||
"captures": {
|
||||
"0": {
|
||||
"name": "keyword.control.cshtml"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#csharp-type-name"
|
||||
}
|
||||
],
|
||||
"end": "$"
|
||||
},
|
||||
"layout-directive": {
|
||||
"name": "meta.directive.layout.cshtml",
|
||||
"begin": "(@layout)\\s+",
|
||||
"captures": {
|
||||
"0": {
|
||||
"name": "keyword.control.cshtml"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#csharp-type-name"
|
||||
}
|
||||
],
|
||||
"end": "$"
|
||||
},
|
||||
"page-directive": {
|
||||
"name": "meta.directive.page.cshtml",
|
||||
"begin": "(@page)\\s+",
|
||||
"captures": {
|
||||
"0": {
|
||||
"name": "keyword.control.cshtml"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"include": "source.cs"
|
||||
}
|
||||
],
|
||||
"end": "$"
|
||||
},
|
||||
"functions-directive": {
|
||||
"name": "meta.directive.functions.cshtml",
|
||||
"match": "(@functions)",
|
||||
"captures": {
|
||||
"0": {
|
||||
"name": "keyword.control.cshtml"
|
||||
}
|
||||
}
|
||||
},
|
||||
"razor-if": {
|
||||
"begin": "(@if)",
|
||||
"captures": {
|
||||
"0": {
|
||||
"name": "keyword.control.cshtml"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"include": "source.cs"
|
||||
}
|
||||
],
|
||||
"end": "$"
|
||||
},
|
||||
"razor-else": {
|
||||
"begin": "(else)",
|
||||
"captures": {
|
||||
"0": {
|
||||
"name": "keyword.control.cshtml"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"include": "source.cs"
|
||||
}
|
||||
],
|
||||
"end": "$"
|
||||
},
|
||||
"razor-else-if": {
|
||||
"begin": "(else\\s+if)",
|
||||
"captures": {
|
||||
"0": {
|
||||
"name": "keyword.control.cshtml"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"include": "source.cs"
|
||||
}
|
||||
],
|
||||
"end": "$"
|
||||
},
|
||||
"razor-foreach": {
|
||||
"begin": "(@foreach)\\s+\\(",
|
||||
"captures": {
|
||||
"0": {
|
||||
"name": "keyword.control.cshtml"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"include": "source.cs"
|
||||
}
|
||||
],
|
||||
"end": "\\)"
|
||||
},
|
||||
"razor-code-block": {
|
||||
"begin": "@?\\{",
|
||||
"captures": {
|
||||
"0": {
|
||||
"name": "keyword.control.cshtml"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"include": "text.html.cshtml"
|
||||
},
|
||||
{
|
||||
"include": "source.cs"
|
||||
}
|
||||
],
|
||||
"end": "\\}"
|
||||
},
|
||||
"csharp-namespace-identifier": {
|
||||
"patterns": [
|
||||
{
|
||||
"name": "entity.name.type.namespace.cs",
|
||||
"match": "[_[:alpha:]][_[:alnum:]]*"
|
||||
}
|
||||
]
|
||||
},
|
||||
"csharp-type-name": {
|
||||
"patterns": [
|
||||
{
|
||||
"match": "([_[:alpha:]][_[:alnum:]]*)\\s*(\\:\\:)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "entity.name.type.alias.cs"
|
||||
},
|
||||
"2": {
|
||||
"name": "punctuation.separator.coloncolon.cs"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"match": "([_[:alpha:]][_[:alnum:]]*)\\s*(\\.)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "storage.type.cs"
|
||||
},
|
||||
"2": {
|
||||
"name": "punctuation.accessor.cs"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"match": "(\\.)\\s*([_[:alpha:]][_[:alnum:]]*)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "punctuation.accessor.cs"
|
||||
},
|
||||
"2": {
|
||||
"name": "storage.type.cs"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "storage.type.cs",
|
||||
"match": "[_[:alpha:]][_[:alnum:]]*"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
@{
|
||||
var total = 0;
|
||||
var totalMessage = "";
|
||||
@* a multiline
|
||||
razor comment embedded in csharp *@
|
||||
if (IsPost) {
|
||||
|
||||
// Retrieve the numbers that the user entered.
|
||||
var num1 = Request["text1"];
|
||||
var num2 = Request["text2"];
|
||||
|
||||
// Convert the entered strings into integers numbers and add.
|
||||
total = num1.AsInt() + num2.AsInt();
|
||||
<italic><bold>totalMessage = "Total = " + total;</bold></italic>
|
||||
}
|
||||
}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Add Numbers</title>
|
||||
<meta charset="utf-8" />
|
||||
</head>
|
||||
<body>
|
||||
<p>Enter two whole numbers and then click <strong>Add</strong>.</p>
|
||||
<form action="" method="post">
|
||||
<p><label for="text1">First Number:</label>
|
||||
<input type="text" name="text1" />
|
||||
</p>
|
||||
<p><label for="text2">Second Number:</label>
|
||||
<input type="text" name="text2" />
|
||||
</p>
|
||||
<p><input type="submit" value="Add" /></p>
|
||||
</form>
|
||||
|
||||
@* now we call the totalMessage method
|
||||
(a multi line razor comment outside code) *@
|
||||
|
||||
<p>@totalMessage</p>
|
||||
|
||||
<p>@(totalMessage+"!")</p>
|
||||
|
||||
An email address (with escaped at character): name@@domain.com
|
||||
|
||||
</body>
|
||||
</html>
|
3698
lib/vscode/extensions/razor/test/colorize-results/test_cshtml.json
Normal file
3698
lib/vscode/extensions/razor/test/colorize-results/test_cshtml.json
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user