Skip to content

Commit

Permalink
change wrap down indent
Browse files Browse the repository at this point in the history
update CHANGELOG
  • Loading branch information
midnightsyntax committed Sep 11, 2017
1 parent c026a5a commit 19dffd0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
16 changes: 14 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,29 @@

# CHANGELOG

## 1.3.3
##### 2017-09-11

### Changed

- `Wrap down` will now, if next line exists:
- Keep same indent as **current line** if next line indent is shorter.
- Use the same indent as **next line** if next line indent is longer.

---


## 1.3.2
##### 2017-09-10

### Changed

- `Wrap down` will now, if next line is empty, insert without creating a new line
- `Wrap down` will now, if next line exists but is empty, insert without creating a new line

### Fixed

- Indent break on wrap down
- Wrap down fail to execute if no line exist below
- `Wrap down` fail to execute if no line exist below
- Unhandled promise rejections

---
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type": "git",
"url": "https://github.com/midnightsyntax/vscode-wrap-console-log"
},
"version": "1.3.2",
"version": "1.3.3",
"publisher": "midnightsyntax",
"icon": "images/icon.png",
"engines": {
Expand Down
5 changes: 4 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,12 @@ function handle(target: Wrap, prefix?: boolean, input?: boolean) {

let nxtLine;
let nxtLineEmpty;
let nxtLineInd;

if (!wrap.lastLine) {
nxtLine = wrap.doc.lineAt(wrap.line+1);
nxtLineEmpty = nxtLine.text.trim() == '' ? true : false;
nxtLineInd = nxtLine.text.substring(0, nxtLine.firstNonWhitespaceCharacterIndex);
}

wrap.ind = vscode.workspace.getConfiguration("wrap-console-log")["autoFormat"] == true ? "" : wrap.ind;
Expand All @@ -101,7 +103,8 @@ function handle(target: Wrap, prefix?: boolean, input?: boolean) {
if (nxtLineEmpty) {
e.replace(new vscode.Position(nxtLine.lineNumber, 0), wrap.ind.concat(wrap.txt));
} else {
e.insert(new vscode.Position(wrap.line, wrap.doc.lineAt(wrap.line).range.end.character), "\n".concat(wrap.ind, wrap.txt));
e.insert(new vscode.Position(wrap.line, wrap.doc.lineAt(wrap.line).range.end.character),
"\n".concat((nxtLineInd.length > wrap.ind ? nxtLineInd : wrap.ind), wrap.txt));
}
})
}).then(() => {
Expand Down

0 comments on commit 19dffd0

Please sign in to comment.