mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-13 17:22:15 -05:00
Adds xml-langauge-features extension back (#24271)
This commit is contained in:
@@ -56,6 +56,7 @@ const dirs = [
|
|||||||
'extensions/sql-database-projects',
|
'extensions/sql-database-projects',
|
||||||
'extensions/sql-migration',
|
'extensions/sql-migration',
|
||||||
'extensions/vscode-test-resolver',
|
'extensions/vscode-test-resolver',
|
||||||
|
'extensions/xml-language-features',
|
||||||
// {{SQL CARBON EDIT}} - End
|
// {{SQL CARBON EDIT}} - End
|
||||||
'remote',
|
'remote',
|
||||||
'remote/web',
|
'remote/web',
|
||||||
|
|||||||
6
extensions/xml-language-features/.eslintrc.json
Normal file
6
extensions/xml-language-features/.eslintrc.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"rules": {
|
||||||
|
"@typescript-eslint/explicit-function-return-type": ["off"],
|
||||||
|
"@typescript-eslint/await-thenable": ["off"]
|
||||||
|
}
|
||||||
|
}
|
||||||
11
extensions/xml-language-features/.vscodeignore
Normal file
11
extensions/xml-language-features/.vscodeignore
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
test/**
|
||||||
|
src/**
|
||||||
|
tsconfig.json
|
||||||
|
out/test/**
|
||||||
|
out/**
|
||||||
|
extension.webpack.config.js
|
||||||
|
cgmanifest.json
|
||||||
|
yarn.lock
|
||||||
|
preview-src/**
|
||||||
|
webpack.config.js
|
||||||
|
.vscode
|
||||||
20
extensions/xml-language-features/extension.webpack.config.js
Normal file
20
extensions/xml-language-features/extension.webpack.config.js
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
//@ts-check
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
const withDefaults = require('../shared.webpack.config');
|
||||||
|
|
||||||
|
module.exports = withDefaults({
|
||||||
|
context: __dirname,
|
||||||
|
resolve: {
|
||||||
|
mainFields: ['module', 'main']
|
||||||
|
},
|
||||||
|
entry: {
|
||||||
|
extension: './src/extension.ts',
|
||||||
|
}
|
||||||
|
});
|
||||||
28
extensions/xml-language-features/package.json
Normal file
28
extensions/xml-language-features/package.json
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"name": "xml-language-features",
|
||||||
|
"displayName": "%displayName%",
|
||||||
|
"description": "%description%",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"publisher": "Microsoft",
|
||||||
|
"engines": {
|
||||||
|
"vscode": "^1.20.0"
|
||||||
|
},
|
||||||
|
"main": "./out/extension",
|
||||||
|
"categories": [
|
||||||
|
"Programming Languages"
|
||||||
|
],
|
||||||
|
"activationEvents": [
|
||||||
|
"onLanguage:sql",
|
||||||
|
"onLanguage:xml"
|
||||||
|
],
|
||||||
|
"scripts": {
|
||||||
|
"compile": "gulp compile-extension:markdown-language-features && npm run build-preview",
|
||||||
|
"watch": "npm run build-preview && gulp watch-extension:markdown-language-features",
|
||||||
|
"vscode:prepublish": "npm run build-ext && npm run build-preview",
|
||||||
|
"build-ext": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../build/gulpfile.extensions.js compile-extension:markdown-language-features ./tsconfig.json",
|
||||||
|
"build-preview": "webpack --mode development"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"tsxml": "^0.1.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
4
extensions/xml-language-features/package.nls.json
Normal file
4
extensions/xml-language-features/package.nls.json
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"displayName": "XML Language Features",
|
||||||
|
"description": "Provides rich language support for XML."
|
||||||
|
}
|
||||||
18
extensions/xml-language-features/src/extension.ts
Normal file
18
extensions/xml-language-features/src/extension.ts
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
import * as vscode from 'vscode';
|
||||||
|
import * as xml from 'tsxml';
|
||||||
|
|
||||||
|
export function activate(context: vscode.ExtensionContext) {
|
||||||
|
context.subscriptions.push(vscode.languages.registerDocumentFormattingEditProvider({ language: 'xml' }, {
|
||||||
|
provideDocumentFormattingEdits: document => format(document)
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
function format(document: vscode.TextDocument): vscode.ProviderResult<vscode.TextEdit[]> {
|
||||||
|
const range = new vscode.Range(0, 0, document.lineCount, document.lineAt(document.lineCount - 1).range.end.character);
|
||||||
|
return xml.Compiler.formatXmlString(document.getText()).then(formatted => [new vscode.TextEdit(range, formatted)], () => [new vscode.TextEdit(range, document.getText())]);
|
||||||
|
}
|
||||||
15
extensions/xml-language-features/tsconfig.json
Normal file
15
extensions/xml-language-features/tsconfig.json
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"extends": "../tsconfig.base.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "./out",
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"typeRoots": [
|
||||||
|
"./node_modules/@types"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"src/**/*",
|
||||||
|
"../../src/vscode-dts/vscode.d.ts",
|
||||||
|
"../../src/vscode-dts/vscode.proposed.notebookWorkspaceEdit.d.ts"
|
||||||
|
]
|
||||||
|
}
|
||||||
8
extensions/xml-language-features/yarn.lock
Normal file
8
extensions/xml-language-features/yarn.lock
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||||
|
# yarn lockfile v1
|
||||||
|
|
||||||
|
|
||||||
|
tsxml@^0.1.0:
|
||||||
|
version "0.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/tsxml/-/tsxml-0.1.0.tgz#d73f14a0d844af51edc0b98bdb52634a41b9b0d4"
|
||||||
|
integrity sha1-1z8UoNhEr1HtwLmL21JjSkG5sNQ=
|
||||||
Reference in New Issue
Block a user