-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathextension.js
More file actions
24 lines (21 loc) · 911 Bytes
/
extension.js
File metadata and controls
24 lines (21 loc) · 911 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const vscode = require('vscode')
function activate(context) {
console.log('Congratulations, your extension "inline-html-indent" is now active!')
const disposable = vscode.commands.registerCommand('inline-html-indent.htmlInlineIndent', async () => {
const editor = vscode.window.activeTextEditor
const cursorPosition = editor.selection.start
const cursorPositione = editor.selection.end
const wordRange = new vscode.Range(cursorPosition, cursorPositione)
const langId = editor.document.languageId
await vscode.languages.setTextDocumentLanguage(editor.document, 'html')
await vscode.commands.executeCommand('editor.action.reindentselectedlines')
await vscode.languages.setTextDocumentLanguage(editor.document, langId)
})
context.subscriptions.push(disposable)
}
// this method is called when your extension is deactivated
function deactivate() {}
module.exports = {
activate,
deactivate
}