forked from microsoft/azuredatastudio
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add xml formatter extenstion * remove unused imports
- Loading branch information
Anthony Dresser
authored
Jun 27, 2019
1 parent
20bbaa3
commit 7b6181d
Showing
16 changed files
with
109 additions
and
196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
test/** | ||
src/** | ||
tsconfig.json | ||
out/test/** | ||
out/** | ||
extension.webpack.config.js | ||
cgmanifest.json | ||
yarn.lock | ||
preview-src/** | ||
webpack.config.js |
20 changes: 20 additions & 0 deletions
20
extensions/xml-language-features/extension.webpack.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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', | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"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: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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"displayName": "XML Language Features", | ||
"description": "Provides rich language support for XML." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"extends": "../shared.tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "./out", | ||
"experimentalDecorators": true, | ||
"typeRoots": [ | ||
"./node_modules/@types" | ||
] | ||
}, | ||
"include": [ | ||
"src/**/*" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.