Skip to content

Commit

Permalink
Fix: isort does not work on full document
Browse files Browse the repository at this point in the history
  • Loading branch information
millerdev committed Jan 31, 2021
1 parent 225b183 commit 1fec37d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
0.3.2 - tbd

- Fix isort entire document (not selection).
- Improve error handling on get command completions.
- Execute all selections with "python" command.

Expand Down
6 changes: 5 additions & 1 deletion client/jsproxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ function selection(editor, pyxtrange) {
return new vscode.Selection(doc.positionAt(anchor), doc.positionAt(active))
}

function allTextRange(doc) {
return doc.validateRange(new vscode.Range(0, 0, doc.lineCount, 0))
}

/**
* Interface for text manipulation on the active text editor
*/
Expand Down Expand Up @@ -64,7 +68,7 @@ const editor = {
set_text: withEditor((editor, text, range, select=true) => {
editor.edit(async builder => {
const doc = editor.document
const rng = range ? selection(editor, range) : undefined
const rng = range ? selection(editor, range) : allTextRange(doc)
await builder.replace(rng, text)
let start = rng ? rng.start : doc.positionAt(0)
let end = doc.positionAt(doc.offsetAt(start) + text.length)
Expand Down

0 comments on commit 1fec37d

Please sign in to comment.