diff --git a/README.md b/README.md
index b8f15cd..55449a7 100644
--- a/README.md
+++ b/README.md
@@ -15,6 +15,17 @@ Select a block of text or a string of text. Press Alt + W
This extension works best in files that either use tabs or spaces for indentation. It may not work as well with mixed tabs/spaces.
+## Settings
+
+add htmltagwrap.tag to your settings.json file( File-->Preferences-->Settings )
+
+setting.json
+ ```
+ {
+ "htmltagwrap.tag": "p"
+ }
+ ```
+
## Report Issues
I welcome pull requests. Please report an issue on GitHub if you have trouble.
diff --git a/src/extension.ts b/src/extension.ts
index d9a413c..a10c8ec 100644
--- a/src/extension.ts
+++ b/src/extension.ts
@@ -29,11 +29,17 @@ export function activate() {
var editor = vscode.window.activeTextEditor;
if (editor != undefined) {
+ let tag = vscode.workspace.getConfiguration().get
\n' + selectionStart_spaces + tabSizeSpace); + // Modify first line of selection + editBuilder.insert(new vscode.Position(selectionStart.line, selectionStart.character), '<' + tag + '>\n' + selectionStart_spaces + tabSizeSpace); console.log('Start Line done. Line #: ' + selectionStart.line); }).then(() => { console.log('Edit applied!'); var bottomTagLine = lineBelow + 1; - var firstTagSelectionSelection: vscode.Selection = new vscode.Selection(selectionStart.line, selectionStart.character + 1, selectionStart.line, selectionStart.character + 2); - var lastTagSelectionSelection: vscode.Selection = new vscode.Selection(bottomTagLine, selectionStart.character + 2, bottomTagLine, selectionStart.character + 3); + var firstTagSelectionSelection: vscode.Selection = new vscode.Selection(selectionStart.line, selectionStart.character + 1, selectionStart.line, selectionStart.character + 1 + tag.length); + var lastTagSelectionSelection: vscode.Selection = new vscode.Selection(bottomTagLine, selectionStart.character + 2, bottomTagLine, selectionStart.character + 2 + tag.length); var tagSelections: vscode.Selection[] = [firstTagSelectionSelection, lastTagSelectionSelection]; editor.selections = tagSelections; @@ -85,13 +91,13 @@ export function activate() { else { //Wrap it inline editor.edit((editBuilder) => { - editBuilder.insert(new vscode.Position(selectionEnd.line, selectionEnd.character), '
'); - editBuilder.insert(new vscode.Position(selectionEnd.line, selectionStart.character), ''); + editBuilder.insert(new vscode.Position(selectionEnd.line, selectionEnd.character), '' + tag + '>'); + editBuilder.insert(new vscode.Position(selectionEnd.line, selectionStart.character), '<' + tag + '>'); }).then(() => { console.log('Edit applied!'); - var firstTagSelectionSelection: vscode.Selection = new vscode.Selection(selectionStart.line, selectionStart.character + 1, selectionStart.line, selectionStart.character + 2); - var lastTagSelectionSelection: vscode.Selection = new vscode.Selection(selectionEnd.line, selectionEnd.character + 3 + 2, selectionEnd.line, selectionEnd.character + 3 + 3); + var firstTagSelectionSelection: vscode.Selection = new vscode.Selection(selectionStart.line, selectionStart.character + 1, selectionStart.line, selectionStart.character + 1 + tag.length); + var lastTagSelectionSelection: vscode.Selection = new vscode.Selection(selectionEnd.line, selectionEnd.character + 3 + 1 + tag.length, selectionEnd.line, selectionEnd.character + 2 + 2 + 2*tag.length); var tagSelections: vscode.Selection[] = [firstTagSelectionSelection, lastTagSelectionSelection]; editor.selections = tagSelections; diff --git a/test/debug.log b/test/debug.log new file mode 100644 index 0000000..c70d52e --- /dev/null +++ b/test/debug.log @@ -0,0 +1,2 @@ +[0727/213252.494:ERROR:tcp_listen_socket.cc(76)] Could not bind socket to 127.0.0.1:6004 +[0727/213252.498:ERROR:node_debugger.cc(87)] Cannot start debugger server