Skip to content

Commit

Permalink
Drop razor support. Fix #66242
Browse files Browse the repository at this point in the history
  • Loading branch information
octref committed Feb 25, 2019
1 parent 56ecc5b commit 393b48d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 21 deletions.
19 changes: 2 additions & 17 deletions extensions/html-language-features/client/src/htmlMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -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 => {
Expand Down Expand Up @@ -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) {
Expand Down
3 changes: 1 addition & 2 deletions extensions/html-language-features/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
"icon": "icons/html.png",
"activationEvents": [
"onLanguage:html",
"onLanguage:handlebars",
"onLanguage:razor"
"onLanguage:handlebars"
],
"main": "./client/out/htmlMain",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion extensions/html-language-features/package.nls.json
Original file line number Diff line number Diff line change
@@ -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.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 393b48d

Please sign in to comment.