mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 10:38:59 +01:00
[html] add razor
This commit is contained in:
39
extensions/html/server/src/service/parser/razorTags.ts
Normal file
39
extensions/html/server/src/service/parser/razorTags.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import {IHTMLTagProvider} from './htmlTags';
|
||||
|
||||
|
||||
export function getRazorTagProvider() : IHTMLTagProvider {
|
||||
var customTags : { [tag:string]: string[]} = {
|
||||
a: ['asp-action', 'asp-controller', 'asp-fragment', 'asp-host', 'asp-protocol', 'asp-route'],
|
||||
div: ['asp-validation-summary'],
|
||||
form: ['asp-action', 'asp-controller', 'asp-anti-forgery'],
|
||||
input: ['asp-for', 'asp-format'],
|
||||
label: ['asp-for'],
|
||||
select: ['asp-for', 'asp-items'],
|
||||
span: ['asp-validation-for']
|
||||
};
|
||||
|
||||
return {
|
||||
getId: () => 'razor',
|
||||
isApplicable: (languageId) => languageId === 'razor',
|
||||
collectTags: (collector: (tag: string) => void) => {
|
||||
// no extra tags
|
||||
},
|
||||
collectAttributes: (tag: string, collector: (attribute: string, type: string) => void) => {
|
||||
if (tag) {
|
||||
var attributes = customTags[tag];
|
||||
if (attributes) {
|
||||
attributes.forEach(a => collector(a, null));
|
||||
}
|
||||
}
|
||||
},
|
||||
collectValues: (tag: string, attribute: string, collector: (value: string) => void) => {
|
||||
// no values
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -8,12 +8,14 @@ import { TextDocument, Position, CompletionList, CompletionItemKind, Range } fro
|
||||
import { HTMLDocument } from '../parser/htmlParser';
|
||||
import { TokenType, createScanner, ScannerState } from '../parser/htmlScanner';
|
||||
import { getHTML5TagProvider, getAngularTagProvider, getIonicTagProvider } from '../parser/htmlTags';
|
||||
import { getRazorTagProvider } from '../parser/razorTags';
|
||||
import { CompletionConfiguration } from '../htmlLanguageService';
|
||||
|
||||
let allTagProviders = [
|
||||
getHTML5TagProvider(),
|
||||
getAngularTagProvider(),
|
||||
getIonicTagProvider()
|
||||
getIonicTagProvider(),
|
||||
getRazorTagProvider()
|
||||
];
|
||||
|
||||
export function doComplete(document: TextDocument, position: Position, doc: HTMLDocument, settings?: CompletionConfiguration): CompletionList {
|
||||
|
||||
Reference in New Issue
Block a user