Drop razor support. Fix #66242

This commit is contained in:
Pine Wu
2019-02-24 17:03:15 -08:00
parent 56ecc5b559
commit 393b48d4a5
4 changed files with 5 additions and 21 deletions

View File

@@ -47,7 +47,7 @@ export function activate(context: ExtensionContext) {
debug: { module: serverModule, transport: TransportKind.ipc, options: debugOptions }
};
let documentSelector = ['html', 'handlebars', 'razor'];
let documentSelector = ['html', 'handlebars'];
let embeddedLanguages = { css: true, javascript: true };
let dataPaths = [
@@ -78,7 +78,7 @@ export function activate(context: ExtensionContext) {
let param = client.code2ProtocolConverter.asTextDocumentPositionParams(document, position);
return client.sendRequest(TagCloseRequest.type, param);
};
disposable = activateTagClosing(tagRequestor, { html: true, handlebars: true, razor: true }, 'html.autoClosingTags');
disposable = activateTagClosing(tagRequestor, { html: true, handlebars: true }, 'html.autoClosingTags');
toDispose.push(disposable);
disposable = client.onTelemetry(e => {
@@ -143,21 +143,6 @@ export function activate(context: ExtensionContext) {
],
});
languages.setLanguageConfiguration('razor', {
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\$\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\s]+)/g,
onEnterRules: [
{
beforeText: new RegExp(`<(?!(?:${EMPTY_ELEMENTS.join('|')}))([_:\\w][_:\\w-.\\d]*)([^/>]*(?!/)>)[^<]*$`, 'i'),
afterText: /^<\/([_:\w][_:\w-.\d]*)\s*>/i,
action: { indentAction: IndentAction.IndentOutdent }
},
{
beforeText: new RegExp(`<(?!(?:${EMPTY_ELEMENTS.join('|')}))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`, 'i'),
action: { indentAction: IndentAction.Indent }
}
],
});
const regionCompletionRegExpr = /^(\s*)(<(!(-(-\s*(#\w*)?)?)?)?)?$/;
languages.registerCompletionItemProvider(documentSelector, {
provideCompletionItems(doc, pos) {

View File

@@ -12,8 +12,7 @@
"icon": "icons/html.png",
"activationEvents": [
"onLanguage:html",
"onLanguage:handlebars",
"onLanguage:razor"
"onLanguage:handlebars"
],
"main": "./client/out/htmlMain",
"scripts": {

View File

@@ -1,6 +1,6 @@
{
"displayName": "HTML Language Features",
"description": "Provides rich language support for HTML, Razor, and Handlebar files",
"description": "Provides rich language support for HTML and Handlebar files",
"html.format.enable.desc": "Enable/disable default HTML formatter.",
"html.format.wrapLineLength.desc": "Maximum amount of characters per line (0 = disable).",
"html.format.unformatted.desc": "List of tags, comma separated, that shouldn't be reformatted. `null` defaults to all tags listed at https://www.w3.org/TR/html5/dom.html#phrasing-content.",

View File

@@ -175,7 +175,7 @@ connection.onDidChangeConfiguration((change) => {
const enableFormatter = globalSettings && globalSettings.html && globalSettings.html.format && globalSettings.html.format.enable;
if (enableFormatter) {
if (!formatterRegistration) {
const documentSelector: DocumentSelector = [{ language: 'html' }, { language: 'handlebars' }]; // don't register razor, the formatter does more harm than good
const documentSelector: DocumentSelector = [{ language: 'html' }, { language: 'handlebars' }];
formatterRegistration = connection.client.register(DocumentRangeFormattingRequest.type, { documentSelector });
}
} else if (formatterRegistration) {